Merge pull request #5425 from RafaelsRamos/feat/5418

feat: Support setting sleep timer on Audio player
This commit is contained in:
Bnyro 2024-01-06 14:00:24 +01:00 committed by GitHub
commit c4da395b58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 6 deletions

View File

@ -45,6 +45,7 @@ import com.github.libretube.ui.models.PlayerViewModel
import com.github.libretube.ui.sheets.ChaptersBottomSheet
import com.github.libretube.ui.sheets.PlaybackOptionsSheet
import com.github.libretube.ui.sheets.PlayingQueueSheet
import com.github.libretube.ui.sheets.SleepTimerSheet
import com.github.libretube.ui.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.DataSaverMode
import com.github.libretube.util.PlayingQueue
@ -153,6 +154,10 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
}
}
binding.sleepTimer.setOnClickListener {
SleepTimerSheet().show(childFragmentManager)
}
binding.openVideo.setOnClickListener {
BackgroundHelper.stopBackgroundPlay(requireContext())
killFragment()

View File

@ -279,15 +279,32 @@
android:layout_gravity="center"
android:padding="15dp">
<ImageView
android:id="@+id/playback_options"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleX="0.9"
android:scaleY="0.9"
android:src="@drawable/ic_speed" />
android:orientation="horizontal">
<ImageView
android:id="@+id/playback_options"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleX="0.9"
android:scaleY="0.9"
android:src="@drawable/ic_speed" />
<ImageView
android:id="@+id/sleep_timer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleX="0.9"
android:scaleY="0.9"
android:src="@drawable/ic_sleep" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"