hide watch progress by default

This commit is contained in:
Bnyro 2022-07-29 11:40:36 +02:00
parent 46acb3bda2
commit 07a9418570
6 changed files with 19 additions and 17 deletions

View File

@ -2,6 +2,7 @@ package com.github.libretube.util
import android.view.View
import android.view.ViewTreeObserver
import android.widget.LinearLayout
import com.github.libretube.preferences.PreferenceHelper
/**
@ -17,7 +18,8 @@ fun View?.setWatchProgressLength(videoId: String, duration: Long) {
this@setWatchProgressLength.getViewTreeObserver().removeOnGlobalLayoutListener(this)
positions.forEach {
if (it.videoId == videoId) {
newWidth = (width * (it.position / (duration))) / 1000
val fullWidth = (parent as LinearLayout).width
newWidth = (fullWidth * (it.position / (duration))) / 1000
return@forEach
}
}
@ -27,6 +29,7 @@ fun View?.setWatchProgressLength(videoId: String, duration: Long) {
width = newWidth!!.toInt()
}
view.layoutParams = lp
view.visibility = View.VISIBLE
} else {
view.visibility = View.GONE
}

View File

@ -66,10 +66,7 @@
<View
android:id="@+id/watch_progress"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_gravity="bottom"
android:background="@android:color/holo_red_dark" />
style="@style/WatchProgress" />
</LinearLayout>

View File

@ -54,10 +54,8 @@
<View
android:id="@+id/watch_progress"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_gravity="bottom"
android:background="@android:color/holo_red_dark" />
style="@style/WatchProgress"
android:layout_height="5dp" />
</LinearLayout>

View File

@ -65,10 +65,7 @@
<View
android:id="@+id/watch_progress"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_gravity="bottom"
android:background="@android:color/holo_red_dark" />
style="@style/WatchProgress" />
</LinearLayout>

View File

@ -65,10 +65,7 @@
<View
android:id="@+id/watch_progress"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_gravity="bottom"
android:background="@android:color/holo_red_dark" />
style="@style/WatchProgress" />
</LinearLayout>

View File

@ -125,5 +125,15 @@
</style>
<style name="WatchProgress">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">4dp</item>
<item name="android:layout_gravity">bottom</item>
<item name="android:background">@android:color/holo_red_dark</item>
<item name="android:visibility">gone</item>
</style>
</resources>