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
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -50,18 +49,6 @@ class PlayingQueueSheet : ExpandedBottomSheet() {
|
||||
val currentPlayingIndex = PlayingQueue.currentIndex()
|
||||
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 {
|
||||
val streams = PlayingQueue.getStreams().toMutableList()
|
||||
val currentIndex = PlayingQueue.currentIndex()
|
||||
|
@ -5,6 +5,7 @@ import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.text.format.DateUtils
|
||||
@ -127,13 +128,11 @@ open class CustomExoPlayerView(
|
||||
// locking the player
|
||||
binding.lockPlayer.setOnClickListener {
|
||||
// change the locked/unlocked icon
|
||||
binding.lockPlayer.setImageResource(
|
||||
if (!isPlayerLocked) {
|
||||
R.drawable.ic_locked
|
||||
} else {
|
||||
R.drawable.ic_unlocked
|
||||
}
|
||||
)
|
||||
val icon = if (!isPlayerLocked) R.drawable.ic_locked else R.drawable.ic_unlocked;
|
||||
val tooltip = if (!isPlayerLocked) R.string.tooltip_unlocked else R.string.tooltip_locked;
|
||||
binding.lockPlayer.setImageResource(icon)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
binding.lockPlayer.tooltipText = context.getString(tooltip)
|
||||
|
||||
// show/hide all the controls
|
||||
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
|
||||
android:id="@+id/close_imageButton"
|
||||
android:tooltipText="@string/tooltip_minimize"
|
||||
style="@style/PlayerControlTop"
|
||||
android:layout_marginEnd="-10dp"
|
||||
android:src="@drawable/ic_close"
|
||||
@ -68,6 +69,7 @@
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/autoPlay"
|
||||
android:tooltipText="@string/player_autoplayyy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="2dp"
|
||||
@ -81,6 +83,7 @@
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/sb_toggle"
|
||||
android:tooltipText="@string/tooltip_sponsorblock"
|
||||
style="@style/PlayerControlTop"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:src="@drawable/ic_sb_enabled"
|
||||
@ -89,6 +92,7 @@
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/queue_toggle"
|
||||
android:tooltipText="@string/queue"
|
||||
style="@style/PlayerControlTop"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:src="@drawable/ic_queue"
|
||||
@ -97,6 +101,7 @@
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/toggle_options"
|
||||
android:tooltipText="@string/tooltip_options"
|
||||
style="@style/PlayerControlTop"
|
||||
android:src="@drawable/ic_player_settings"
|
||||
app:tint="@android:color/white" />
|
||||
@ -311,6 +316,7 @@
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/fullscreen"
|
||||
android:tooltipText="@string/tooltip_fullscreen"
|
||||
style="@style/PlayerControlBottom"
|
||||
android:src="@drawable/ic_fullscreen"
|
||||
app:tint="@android:color/white" />
|
||||
|
@ -367,6 +367,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close_imageView"
|
||||
android:tooltipText="@string/tooltip_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0"
|
||||
@ -380,6 +381,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/play_imageView"
|
||||
android:tooltipText="@string/tooltip_play"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0"
|
||||
|
@ -39,41 +39,49 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/repeat"
|
||||
android:tooltipText="@string/tooltip_repeat"
|
||||
style="@style/QueueSheetOption"
|
||||
android:src="@drawable/ic_repeat" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/shuffle"
|
||||
android:tooltipText="@string/shuffle"
|
||||
style="@style/QueueSheetOption"
|
||||
android:src="@drawable/ic_shuffle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/reverse"
|
||||
android:tooltipText="@string/tooltip_reverse"
|
||||
style="@style/QueueSheetOption"
|
||||
android:src="@drawable/ic_reverse" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_to_playlist"
|
||||
android:tooltipText="@string/addToPlaylist"
|
||||
style="@style/QueueSheetOption"
|
||||
android:src="@drawable/ic_playlist_add" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sort"
|
||||
android:tooltipText="@string/tooltip_sort"
|
||||
style="@style/QueueSheetOption"
|
||||
android:src="@drawable/ic_sort" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/watch_positions_options"
|
||||
android:tooltipText="@string/tooltip_watch_position"
|
||||
style="@style/QueueSheetOption"
|
||||
android:src="@drawable/ic_eye" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/clear_queue"
|
||||
android:tooltipText="@string/tooltip_clear_queue"
|
||||
style="@style/QueueSheetOption"
|
||||
android:src="@drawable/ic_close" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dismiss"
|
||||
android:tooltipText="@string/tooltip_dismiss"
|
||||
style="@style/QueueSheetOption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
|
@ -488,10 +488,20 @@
|
||||
</plurals>
|
||||
|
||||
<!--Tooltips for queue options-->
|
||||
<string name="repeat">Repeat</string>
|
||||
<string name="reverse">Reverse</string>
|
||||
<string name="sort">Sort</string>
|
||||
<string name="watch_position">Watch position</string>
|
||||
<string name="clear_queue">Clear queue</string>
|
||||
<string name="dismiss">Dismiss</string>
|
||||
<string name="tooltip_repeat">Repeat</string>
|
||||
<string name="tooltip_reverse">Reverse</string>
|
||||
<string name="tooltip_sort">Sort</string>
|
||||
<string name="tooltip_watch_position">Watch position</string>
|
||||
<string name="tooltip_clear_queue">Clear queue</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>
|
Loading…
Reference in New Issue
Block a user