mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
parent
2d65aefc76
commit
ecd529f73b
5 changed files with 28 additions and 20 deletions
|
@ -1273,7 +1273,18 @@ class GeneratorPlayer : FullScreenPlayer() {
|
|||
from, to
|
||||
).apply {
|
||||
addListener(onEnd = {
|
||||
if (!show) playerBinding?.skipChapterButton?.isVisible = false
|
||||
if (show) {
|
||||
if (!isShowing) {
|
||||
// Automatically request focus if the menu is not opened
|
||||
playerBinding?.skipChapterButton?.requestFocus()
|
||||
}
|
||||
} else {
|
||||
playerBinding?.skipChapterButton?.isVisible = false
|
||||
if (!isShowing) {
|
||||
// Automatically return focus to play pause
|
||||
playerBinding?.playerPausePlay?.requestFocus()
|
||||
}
|
||||
}
|
||||
})
|
||||
addUpdateListener { valueAnimator ->
|
||||
val value = valueAnimator.animatedValue as Int
|
||||
|
|
|
@ -45,19 +45,9 @@ class SelectAdaptor(val callback: (Any) -> Unit) : RecyclerView.Adapter<Recycler
|
|||
if(newIndex == selectedIndex) return
|
||||
val oldIndex = selectedIndex
|
||||
selectedIndex = newIndex
|
||||
recyclerView.apply {
|
||||
for (i in 0 until itemCount) {
|
||||
val viewHolder = getChildViewHolder( getChildAt(i) ?: continue) ?: continue
|
||||
val pos = viewHolder.absoluteAdapterPosition
|
||||
if (viewHolder is SelectViewHolder) {
|
||||
if (pos == oldIndex) {
|
||||
viewHolder.update(false)
|
||||
} else if (pos == newIndex) {
|
||||
viewHolder.update(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
notifyItemChanged(selectedIndex)
|
||||
notifyItemChanged(oldIndex)
|
||||
}
|
||||
|
||||
fun updateSelectionList(newList: List<SelectData>) {
|
||||
|
@ -79,10 +69,6 @@ class SelectAdaptor(val callback: (Any) -> Unit) : RecyclerView.Adapter<Recycler
|
|||
RecyclerView.ViewHolder(binding.root) {
|
||||
private val item: MaterialButton = binding.root
|
||||
|
||||
fun update(isSelected: Boolean) {
|
||||
item.isSelected = isSelected
|
||||
}
|
||||
|
||||
fun bind(
|
||||
data: SelectData, isSelected: Boolean, callback: (Any) -> Unit
|
||||
) {
|
||||
|
|
6
app/src/main/res/color/button_selector_color.xml
Normal file
6
app/src/main/res/color/button_selector_color.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:state_focused="true" android:color="@color/black"/>
|
||||
<item android:state_selected="true" android:state_focused="false" android:color="@color/white"/>
|
||||
<item android:color="@color/transparent"/>
|
||||
</selector>
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<com.google.android.material.button.MaterialButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/RegularButtonTV"
|
||||
style="@style/SelectableButtonTV"
|
||||
android:layout_gravity="start"
|
||||
android:layout_margin="2dp"
|
||||
android:minWidth="115dp"
|
||||
|
|
|
@ -737,6 +737,11 @@
|
|||
<item name="android:layout_marginEnd">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="SelectableButtonTV" parent="RegularButtonTV">
|
||||
<item name="icon">@drawable/ic_baseline_check_24_listview</item>
|
||||
<item name="iconTint">@color/button_selector_color</item>
|
||||
</style>
|
||||
|
||||
<style name="RegularButtonTV">
|
||||
<item name="android:tag">@string/tv_no_focus_tag</item>
|
||||
<item name="android:stateListAnimator">@null</item>
|
||||
|
|
Loading…
Reference in a new issue