diff --git a/app/src/main/java/org/mosad/teapod/PlayerActivity.kt b/app/src/main/java/org/mosad/teapod/PlayerActivity.kt
index fbd6aae..ba0919a 100644
--- a/app/src/main/java/org/mosad/teapod/PlayerActivity.kt
+++ b/app/src/main/java/org/mosad/teapod/PlayerActivity.kt
@@ -212,8 +212,8 @@ class PlayerActivity : AppCompatActivity() {
private fun initActions() {
exo_close_player.setOnClickListener { this.finish() }
- exo_rew_10.setOnClickListener { rewind() }
- exo_ffwd_10.setOnClickListener { forward() }
+ rwd_10.setOnButtonClickListener { rewind() }
+ ffwd_10.setOnButtonClickListener { forward() }
button_next_ep.setOnClickListener { playNextEpisode() }
}
diff --git a/app/src/main/java/org/mosad/teapod/ui/components/FastForwardButton.kt b/app/src/main/java/org/mosad/teapod/ui/components/FastForwardButton.kt
new file mode 100644
index 0000000..b1ae6cd
--- /dev/null
+++ b/app/src/main/java/org/mosad/teapod/ui/components/FastForwardButton.kt
@@ -0,0 +1,64 @@
+package org.mosad.teapod.ui.components
+
+import android.animation.Animator
+import android.animation.AnimatorListenerAdapter
+import android.animation.ObjectAnimator
+import android.content.Context
+import android.util.AttributeSet
+import android.view.View
+import android.widget.FrameLayout
+import kotlinx.android.synthetic.main.button_fast_forward.view.*
+import org.mosad.teapod.R
+
+class FastForwardButton(context: Context, attrs: AttributeSet): FrameLayout(context, attrs) {
+
+ private val animationDuration: Long = 800
+
+ init {
+ inflate(context, R.layout.button_fast_forward, this)
+ }
+
+ fun setOnButtonClickListener(func: FastForwardButton.() -> Unit) {
+ imageButton.setOnClickListener {
+ func()
+ runOnClickAnimation()
+ }
+ }
+
+ fun runOnClickAnimation() {
+ // run button animation
+ ObjectAnimator.ofFloat(imageButton, View.ROTATION, 0f, 50f).apply {
+ duration = animationDuration / 4
+ repeatCount = 1
+ repeatMode = ObjectAnimator.REVERSE
+ addListener(object : AnimatorListenerAdapter() {
+ override fun onAnimationStart(animation: Animator?) {
+ imageButton.isEnabled = false // disable button
+ imageButton.setImageResource(R.drawable.ic_baseline_forward_24)
+ }
+ override fun onAnimationEnd(animation: Animator?) {
+ imageButton.isEnabled = true // enable button
+ }
+ })
+ start()
+ }
+
+ // run lbl animation
+ textView.visibility = View.VISIBLE
+ ObjectAnimator.ofFloat(textView, View.TRANSLATION_X, 35f).apply {
+ duration = animationDuration
+ addListener(object : AnimatorListenerAdapter() {
+ override fun onAnimationEnd(animation: Animator?) {
+ imageButton.isEnabled = true // enable button
+ imageButton.setImageResource(R.drawable.ic_baseline_forward_10_24)
+
+ textView.visibility = View.GONE
+ textView.animate().translationX(0f)
+ }
+ })
+ start()
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/mosad/teapod/ui/components/RewindButton.kt b/app/src/main/java/org/mosad/teapod/ui/components/RewindButton.kt
new file mode 100644
index 0000000..6bc2fd8
--- /dev/null
+++ b/app/src/main/java/org/mosad/teapod/ui/components/RewindButton.kt
@@ -0,0 +1,64 @@
+package org.mosad.teapod.ui.components
+
+import android.animation.Animator
+import android.animation.AnimatorListenerAdapter
+import android.animation.ObjectAnimator
+import android.content.Context
+import android.util.AttributeSet
+import android.view.View
+import android.widget.FrameLayout
+import kotlinx.android.synthetic.main.button_rewind.view.*
+import org.mosad.teapod.R
+
+class RewindButton(context: Context, attrs: AttributeSet): FrameLayout(context, attrs) {
+
+ private val animationDuration: Long = 800
+
+ init {
+ inflate(context, R.layout.button_rewind, this)
+ }
+
+ fun setOnButtonClickListener(func: RewindButton.() -> Unit) {
+ imageButton.setOnClickListener {
+ func()
+ runOnClickAnimation()
+ }
+ }
+
+ fun runOnClickAnimation() {
+ // run button animation
+ ObjectAnimator.ofFloat(imageButton, View.ROTATION, 0f, -50f).apply {
+ duration = animationDuration / 4
+ repeatCount = 1
+ repeatMode = ObjectAnimator.REVERSE
+ addListener(object : AnimatorListenerAdapter() {
+ override fun onAnimationStart(animation: Animator?) {
+ imageButton.isEnabled = false // disable button
+ imageButton.setImageResource(R.drawable.ic_baseline_rewind_24)
+ }
+ override fun onAnimationEnd(animation: Animator?) {
+ imageButton.isEnabled = true // enable button
+ }
+ })
+ start()
+ }
+
+ // run lbl animation
+ textView.visibility = View.VISIBLE
+ ObjectAnimator.ofFloat(textView, View.TRANSLATION_X, -35f).apply {
+ duration = animationDuration
+ addListener(object : AnimatorListenerAdapter() {
+ override fun onAnimationEnd(animation: Animator?) {
+ imageButton.isEnabled = true // enable button
+ imageButton.setImageResource(R.drawable.ic_baseline_rewind_10_24)
+
+ textView.visibility = View.GONE
+ textView.animate().translationX(0f)
+ }
+ })
+ start()
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/exo_styled_controls_fastforward.xml b/app/src/main/res/drawable/ic_baseline_forward_10_24.xml
similarity index 100%
rename from app/src/main/res/drawable/exo_styled_controls_fastforward.xml
rename to app/src/main/res/drawable/ic_baseline_forward_10_24.xml
diff --git a/app/src/main/res/drawable/ic_baseline_forward_24.xml b/app/src/main/res/drawable/ic_baseline_forward_24.xml
new file mode 100644
index 0000000..8d1835c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_forward_24.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/exo_styled_controls_rewind.xml b/app/src/main/res/drawable/ic_baseline_rewind_10_24.xml
similarity index 100%
rename from app/src/main/res/drawable/exo_styled_controls_rewind.xml
rename to app/src/main/res/drawable/ic_baseline_rewind_10_24.xml
diff --git a/app/src/main/res/drawable/ic_baseline_rewind_24.xml b/app/src/main/res/drawable/ic_baseline_rewind_24.xml
new file mode 100644
index 0000000..96e77ec
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_rewind_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/layout/button_fast_forward.xml b/app/src/main/res/layout/button_fast_forward.xml
new file mode 100644
index 0000000..40cc527
--- /dev/null
+++ b/app/src/main/res/layout/button_fast_forward.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/button_rewind.xml b/app/src/main/res/layout/button_rewind.xml
new file mode 100644
index 0000000..14f8130
--- /dev/null
+++ b/app/src/main/res/layout/button_rewind.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
index ad882ca..2bc8bd8 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -2,6 +2,7 @@
+ android:orientation="vertical">
-
-
+
-
+
rewind 10 seconds
play/pause
forward 10 seconds
+ - 10 s
+ + 10 s
%1$02d:%2$02d
%1$d:%2$02d:%3$02d
Next Episode