mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
feat(player): add tooltips player buttons
This commit is contained in:
parent
4ef4cf33d5
commit
7052c621bc
@ -1,7 +1,6 @@
|
|||||||
package com.github.libretube.ui.sheets
|
package com.github.libretube.ui.sheets
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@ -50,18 +49,6 @@ class PlayingQueueSheet : ExpandedBottomSheet() {
|
|||||||
val currentPlayingIndex = PlayingQueue.currentIndex()
|
val currentPlayingIndex = PlayingQueue.currentIndex()
|
||||||
if (currentPlayingIndex != -1) binding.optionsRecycler.scrollToPosition(currentPlayingIndex)
|
if (currentPlayingIndex != -1) binding.optionsRecycler.scrollToPosition(currentPlayingIndex)
|
||||||
|
|
||||||
// tooltips are only supported since API 26
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
binding.repeat.tooltipText = getString(R.string.repeat)
|
|
||||||
binding.shuffle.tooltipText = getString(R.string.shuffle)
|
|
||||||
binding.reverse.tooltipText = getString(R.string.reverse)
|
|
||||||
binding.addToPlaylist.tooltipText = getString(R.string.addToPlaylist)
|
|
||||||
binding.sort.tooltipText = getString(R.string.sort)
|
|
||||||
binding.watchPositionsOptions.tooltipText = getString(R.string.watch_position)
|
|
||||||
binding.clearQueue.tooltipText = getString(R.string.clear_queue)
|
|
||||||
binding.dismiss?.tooltipText = getString(R.string.dismiss)
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.shuffle.setOnClickListener {
|
binding.shuffle.setOnClickListener {
|
||||||
val streams = PlayingQueue.getStreams().toMutableList()
|
val streams = PlayingQueue.getStreams().toMutableList()
|
||||||
val currentIndex = PlayingQueue.currentIndex()
|
val currentIndex = PlayingQueue.currentIndex()
|
||||||
|
@ -5,6 +5,7 @@ import android.app.Activity
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
import android.os.Build
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
@ -127,13 +128,11 @@ open class CustomExoPlayerView(
|
|||||||
// locking the player
|
// locking the player
|
||||||
binding.lockPlayer.setOnClickListener {
|
binding.lockPlayer.setOnClickListener {
|
||||||
// change the locked/unlocked icon
|
// change the locked/unlocked icon
|
||||||
binding.lockPlayer.setImageResource(
|
val icon = if (!isPlayerLocked) R.drawable.ic_locked else R.drawable.ic_unlocked;
|
||||||
if (!isPlayerLocked) {
|
val tooltip = if (!isPlayerLocked) R.string.tooltip_unlocked else R.string.tooltip_locked;
|
||||||
R.drawable.ic_locked
|
binding.lockPlayer.setImageResource(icon)
|
||||||
} else {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||||
R.drawable.ic_unlocked
|
binding.lockPlayer.tooltipText = context.getString(tooltip)
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// show/hide all the controls
|
// show/hide all the controls
|
||||||
lockPlayer(isPlayerLocked)
|
lockPlayer(isPlayerLocked)
|
||||||
|
88
app/src/main/res/layout-v26/queue_bottom_sheet.xml
Normal file
88
app/src/main/res/layout-v26/queue_bottom_sheet.xml
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/standard_bottom_sheet"
|
||||||
|
style="@style/Widget.Material3.BottomSheet"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<!-- Drag handle for accessibility -->
|
||||||
|
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
|
||||||
|
android:id="@+id/drag_handle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/options_recycler"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/bottom_controls"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:background="@drawable/rounded_ripple"
|
||||||
|
android:padding="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/repeat"
|
||||||
|
style="@style/QueueSheetOption"
|
||||||
|
android:src="@drawable/ic_repeat" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/shuffle"
|
||||||
|
style="@style/QueueSheetOption"
|
||||||
|
android:src="@drawable/ic_shuffle" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/reverse"
|
||||||
|
style="@style/QueueSheetOption"
|
||||||
|
android:src="@drawable/ic_reverse" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/add_to_playlist"
|
||||||
|
style="@style/QueueSheetOption"
|
||||||
|
android:src="@drawable/ic_playlist_add" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sort"
|
||||||
|
style="@style/QueueSheetOption"
|
||||||
|
android:src="@drawable/ic_sort" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/watch_positions_options"
|
||||||
|
style="@style/QueueSheetOption"
|
||||||
|
android:src="@drawable/ic_eye" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/clear_queue"
|
||||||
|
style="@style/QueueSheetOption"
|
||||||
|
android:src="@drawable/ic_close" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
style="@style/QueueSheetOption"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:tooltipText="Dismiss"
|
||||||
|
android:src="@drawable/ic_arrow_down" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/close_imageButton"
|
android:id="@+id/close_imageButton"
|
||||||
|
android:tooltipText="@string/tooltip_minimize"
|
||||||
style="@style/PlayerControlTop"
|
style="@style/PlayerControlTop"
|
||||||
android:layout_marginEnd="-10dp"
|
android:layout_marginEnd="-10dp"
|
||||||
android:src="@drawable/ic_close"
|
android:src="@drawable/ic_close"
|
||||||
@ -68,6 +69,7 @@
|
|||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/autoPlay"
|
android:id="@+id/autoPlay"
|
||||||
|
android:tooltipText="@string/player_autoplayyy"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="2dp"
|
android:layout_marginEnd="2dp"
|
||||||
@ -81,6 +83,7 @@
|
|||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/sb_toggle"
|
android:id="@+id/sb_toggle"
|
||||||
|
android:tooltipText="@string/tooltip_sponsorblock"
|
||||||
style="@style/PlayerControlTop"
|
style="@style/PlayerControlTop"
|
||||||
android:layout_marginEnd="2dp"
|
android:layout_marginEnd="2dp"
|
||||||
android:src="@drawable/ic_sb_enabled"
|
android:src="@drawable/ic_sb_enabled"
|
||||||
@ -89,6 +92,7 @@
|
|||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/queue_toggle"
|
android:id="@+id/queue_toggle"
|
||||||
|
android:tooltipText="@string/queue"
|
||||||
style="@style/PlayerControlTop"
|
style="@style/PlayerControlTop"
|
||||||
android:layout_marginEnd="2dp"
|
android:layout_marginEnd="2dp"
|
||||||
android:src="@drawable/ic_queue"
|
android:src="@drawable/ic_queue"
|
||||||
@ -97,6 +101,7 @@
|
|||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/toggle_options"
|
android:id="@+id/toggle_options"
|
||||||
|
android:tooltipText="@string/tooltip_options"
|
||||||
style="@style/PlayerControlTop"
|
style="@style/PlayerControlTop"
|
||||||
android:src="@drawable/ic_player_settings"
|
android:src="@drawable/ic_player_settings"
|
||||||
app:tint="@android:color/white" />
|
app:tint="@android:color/white" />
|
||||||
@ -311,6 +316,7 @@
|
|||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/fullscreen"
|
android:id="@+id/fullscreen"
|
||||||
|
android:tooltipText="@string/tooltip_fullscreen"
|
||||||
style="@style/PlayerControlBottom"
|
style="@style/PlayerControlBottom"
|
||||||
android:src="@drawable/ic_fullscreen"
|
android:src="@drawable/ic_fullscreen"
|
||||||
app:tint="@android:color/white" />
|
app:tint="@android:color/white" />
|
||||||
|
@ -367,6 +367,7 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/close_imageView"
|
android:id="@+id/close_imageView"
|
||||||
|
android:tooltipText="@string/tooltip_close"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:alpha="0"
|
android:alpha="0"
|
||||||
@ -380,6 +381,7 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/play_imageView"
|
android:id="@+id/play_imageView"
|
||||||
|
android:tooltipText="@string/tooltip_play"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:alpha="0"
|
android:alpha="0"
|
||||||
|
@ -39,41 +39,49 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/repeat"
|
android:id="@+id/repeat"
|
||||||
|
android:tooltipText="@string/tooltip_repeat"
|
||||||
style="@style/QueueSheetOption"
|
style="@style/QueueSheetOption"
|
||||||
android:src="@drawable/ic_repeat" />
|
android:src="@drawable/ic_repeat" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/shuffle"
|
android:id="@+id/shuffle"
|
||||||
|
android:tooltipText="@string/shuffle"
|
||||||
style="@style/QueueSheetOption"
|
style="@style/QueueSheetOption"
|
||||||
android:src="@drawable/ic_shuffle" />
|
android:src="@drawable/ic_shuffle" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/reverse"
|
android:id="@+id/reverse"
|
||||||
|
android:tooltipText="@string/tooltip_reverse"
|
||||||
style="@style/QueueSheetOption"
|
style="@style/QueueSheetOption"
|
||||||
android:src="@drawable/ic_reverse" />
|
android:src="@drawable/ic_reverse" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/add_to_playlist"
|
android:id="@+id/add_to_playlist"
|
||||||
|
android:tooltipText="@string/addToPlaylist"
|
||||||
style="@style/QueueSheetOption"
|
style="@style/QueueSheetOption"
|
||||||
android:src="@drawable/ic_playlist_add" />
|
android:src="@drawable/ic_playlist_add" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/sort"
|
android:id="@+id/sort"
|
||||||
|
android:tooltipText="@string/tooltip_sort"
|
||||||
style="@style/QueueSheetOption"
|
style="@style/QueueSheetOption"
|
||||||
android:src="@drawable/ic_sort" />
|
android:src="@drawable/ic_sort" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/watch_positions_options"
|
android:id="@+id/watch_positions_options"
|
||||||
|
android:tooltipText="@string/tooltip_watch_position"
|
||||||
style="@style/QueueSheetOption"
|
style="@style/QueueSheetOption"
|
||||||
android:src="@drawable/ic_eye" />
|
android:src="@drawable/ic_eye" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/clear_queue"
|
android:id="@+id/clear_queue"
|
||||||
|
android:tooltipText="@string/tooltip_clear_queue"
|
||||||
style="@style/QueueSheetOption"
|
style="@style/QueueSheetOption"
|
||||||
android:src="@drawable/ic_close" />
|
android:src="@drawable/ic_close" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/dismiss"
|
android:id="@+id/dismiss"
|
||||||
|
android:tooltipText="@string/tooltip_dismiss"
|
||||||
style="@style/QueueSheetOption"
|
style="@style/QueueSheetOption"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -488,10 +488,20 @@
|
|||||||
</plurals>
|
</plurals>
|
||||||
|
|
||||||
<!--Tooltips for queue options-->
|
<!--Tooltips for queue options-->
|
||||||
<string name="repeat">Repeat</string>
|
<string name="tooltip_repeat">Repeat</string>
|
||||||
<string name="reverse">Reverse</string>
|
<string name="tooltip_reverse">Reverse</string>
|
||||||
<string name="sort">Sort</string>
|
<string name="tooltip_sort">Sort</string>
|
||||||
<string name="watch_position">Watch position</string>
|
<string name="tooltip_watch_position">Watch position</string>
|
||||||
<string name="clear_queue">Clear queue</string>
|
<string name="tooltip_clear_queue">Clear queue</string>
|
||||||
<string name="dismiss">Dismiss</string>
|
<string name="tooltip_dismiss">Dismiss</string>
|
||||||
|
|
||||||
|
<!--Tooltips for player-->
|
||||||
|
<string name="tooltip_locked">Lock player</string>
|
||||||
|
<string name="tooltip_unlocked">Unlock player</string>
|
||||||
|
<string name="tooltip_sponsorblock">Toggle Sponsorblock</string>
|
||||||
|
<string name="tooltip_options">Options</string>
|
||||||
|
<string name="tooltip_minimize">Minimze</string>
|
||||||
|
<string name="tooltip_fullscreen">Fullscreen</string>
|
||||||
|
<string name="tooltip_close">Close</string>
|
||||||
|
<string name="tooltip_play">Play</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user