diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt
index 487c12a4b..376cf6393 100644
--- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt
+++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt
@@ -250,7 +250,7 @@ class PlayerFragment : Fragment() {
playbackSpeed = PreferenceHelper.getString(
PreferenceKeys.PLAYBACK_SPEED,
"1"
- )!!
+ )!!.replace("F", "") // due to old way to handle it (with float)
fullscreenOrientationPref = PreferenceHelper.getString(
PreferenceKeys.FULLSCREEN_ORIENTATION,
@@ -1061,21 +1061,17 @@ class PlayerFragment : Fragment() {
}
private fun enableDoubleTapToSeek() {
- val hideDoubleTapOverlayDelay = 700L
+ // set seek increment text
+ val seekIncrementText = (seekIncrement / 1000).toString()
+ binding.rewindTV.text = seekIncrementText
+ binding.forwardTV.text = seekIncrementText
// enable rewind button
val rewindGestureDetector = GestureDetector(
context,
object : SimpleOnGestureListener() {
override fun onDoubleTap(e: MotionEvent): Boolean {
- exoPlayer.seekTo(exoPlayer.currentPosition - seekIncrement)
-
- // show the rewind button
- binding.rewindBTN.apply {
- visibility = View.VISIBLE
- removeCallbacks(hideRewindButtonRunnable)
- postDelayed(hideRewindButtonRunnable, hideDoubleTapOverlayDelay)
- }
+ rewind()
return super.onDoubleTap(e)
}
@@ -1097,14 +1093,7 @@ class PlayerFragment : Fragment() {
context,
object : SimpleOnGestureListener() {
override fun onDoubleTap(e: MotionEvent): Boolean {
- exoPlayer.seekTo(exoPlayer.currentPosition + seekIncrement)
-
- // show the forward button
- binding.forwardBTN.apply {
- visibility = View.VISIBLE
- removeCallbacks(hideForwardButtonRunnable)
- postDelayed(hideForwardButtonRunnable, hideDoubleTapOverlayDelay)
- }
+ forward()
return super.onDoubleTap(e)
}
@@ -1122,8 +1111,64 @@ class PlayerFragment : Fragment() {
}
}
- private val hideForwardButtonRunnable = Runnable { binding.forwardBTN.visibility = View.GONE }
- private val hideRewindButtonRunnable = Runnable { binding.rewindBTN.visibility = View.GONE }
+ private fun rewind() {
+ exoPlayer.seekTo(exoPlayer.currentPosition - seekIncrement)
+
+ // show the rewind button
+ binding.rewindBTN.apply {
+ visibility = View.VISIBLE
+ // clear previous animation
+ animate().rotation(0F).setDuration(0).start()
+ // start new animation
+ animate()
+ .rotation(-30F)
+ .setDuration(100)
+ .withEndAction {
+ // reset the animation when finished
+ animate().rotation(0F).setDuration(100).start()
+ }
+ .start()
+
+ removeCallbacks(hideRewindButtonRunnable)
+ // start callback to hide the button
+ postDelayed(hideRewindButtonRunnable, 700)
+ }
+ }
+
+ private fun forward() {
+ exoPlayer.seekTo(exoPlayer.currentPosition + seekIncrement)
+
+ // show the forward button
+ binding.forwardBTN.apply {
+ visibility = View.VISIBLE
+ // clear previous animation
+ animate().rotation(0F).setDuration(0).start()
+ // start new animation
+ animate()
+ .rotation(30F)
+ .setDuration(100)
+ .withEndAction {
+ // reset the animation when finished
+ animate().rotation(0F).setDuration(100).start()
+ }
+ .start()
+
+ // start callback to hide the button
+ removeCallbacks(hideForwardButtonRunnable)
+ postDelayed(hideForwardButtonRunnable, 700)
+ }
+ }
+
+ private val hideForwardButtonRunnable = Runnable {
+ binding.forwardBTN.apply {
+ visibility = View.GONE
+ }
+ }
+ private val hideRewindButtonRunnable = Runnable {
+ binding.rewindBTN.apply {
+ visibility = View.GONE
+ }
+ }
// enable seek bar preview
private fun enableSeekbarPreview() {
diff --git a/app/src/main/java/com/github/libretube/update/UpdateInfo.kt b/app/src/main/java/com/github/libretube/update/UpdateInfo.kt
index a3e239ea4..dd0c4bb59 100644
--- a/app/src/main/java/com/github/libretube/update/UpdateInfo.kt
+++ b/app/src/main/java/com/github/libretube/update/UpdateInfo.kt
@@ -21,4 +21,4 @@ data class UpdateInfo(
val upload_url: String,
val url: String,
val zipball_url: String
-)
\ No newline at end of file
+)
diff --git a/app/src/main/res/drawable/ic_forward.xml b/app/src/main/res/drawable/ic_forward.xml
index 8108f0bc6..6a52e6b10 100644
--- a/app/src/main/res/drawable/ic_forward.xml
+++ b/app/src/main/res/drawable/ic_forward.xml
@@ -1,10 +1,10 @@
+ android:pathData="M18,13c0,3.31 -2.69,6 -6,6s-6,-2.69 -6,-6s2.69,-6 6,-6v4l5,-5l-5,-5v4c-4.42,0 -8,3.58 -8,8c0,4.42 3.58,8 8,8c4.42,0 8,-3.58 8,-8H18z" />
diff --git a/app/src/main/res/drawable/ic_rewind.xml b/app/src/main/res/drawable/ic_rewind.xml
index 54921898a..a34fc6a9c 100644
--- a/app/src/main/res/drawable/ic_rewind.xml
+++ b/app/src/main/res/drawable/ic_rewind.xml
@@ -1,10 +1,10 @@
-
+
diff --git a/app/src/main/res/layout/fragment_player.xml b/app/src/main/res/layout/fragment_player.xml
index 9999c6d05..068b8315d 100644
--- a/app/src/main/res/layout/fragment_player.xml
+++ b/app/src/main/res/layout/fragment_player.xml
@@ -379,25 +379,39 @@
android:id="@+id/doubleTapOverlayLL"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="70dp"
- android:layout_marginBottom="60dp">
+ android:layout_marginVertical="65dp">
+ android:layout_weight=".40">
-
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginStart="30dp"
+ android:visibility="invisible">
+
+
+
+
+
+
@@ -405,24 +419,39 @@
+ android:layout_weight=".20" />
+ android:layout_weight=".40">
-
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginEnd="30dp"
+ android:visibility="invisible">
+
+
+
+
+
+
@@ -469,4 +498,4 @@
app:layout_constraintStart_toEndOf="@+id/player"
app:layout_constraintTop_toTopOf="@+id/play_imageView" />
-
+
\ No newline at end of file