Update bottom sheets
This commit is contained in:
@@ -56,6 +56,7 @@ class FastScroller @JvmOverloads constructor(
|
|||||||
private var bubbleHeight = 0
|
private var bubbleHeight = 0
|
||||||
private var handleHeight = 0
|
private var handleHeight = 0
|
||||||
private var viewHeight = 0
|
private var viewHeight = 0
|
||||||
|
private var offset = 0
|
||||||
private var hideScrollbar = true
|
private var hideScrollbar = true
|
||||||
private var showBubble = true
|
private var showBubble = true
|
||||||
private var showBubbleAlways = false
|
private var showBubbleAlways = false
|
||||||
@@ -137,6 +138,7 @@ class FastScroller @JvmOverloads constructor(
|
|||||||
bubbleSize = getBubbleSize(R.styleable.FastScroller_bubbleSize, BubbleSize.NORMAL)
|
bubbleSize = getBubbleSize(R.styleable.FastScroller_bubbleSize, BubbleSize.NORMAL)
|
||||||
val textSize = getDimension(R.styleable.FastScroller_bubbleTextSize, bubbleSize.textSize)
|
val textSize = getDimension(R.styleable.FastScroller_bubbleTextSize, bubbleSize.textSize)
|
||||||
binding.bubble.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
binding.bubble.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
||||||
|
offset = getDimensionPixelOffset(R.styleable.FastScroller_scrollerOffset, offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
setTrackColor(trackColor)
|
setTrackColor(trackColor)
|
||||||
@@ -248,7 +250,7 @@ class FastScroller @JvmOverloads constructor(
|
|||||||
|
|
||||||
layoutParams = (layoutParams as ConstraintLayout.LayoutParams).apply {
|
layoutParams = (layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||||
height = 0
|
height = 0
|
||||||
setMargins(0, marginTop, 0, marginBottom)
|
setMargins(offset, marginTop, offset, marginBottom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,13 +258,13 @@ class FastScroller @JvmOverloads constructor(
|
|||||||
height = LayoutParams.MATCH_PARENT
|
height = LayoutParams.MATCH_PARENT
|
||||||
anchorGravity = GravityCompat.END
|
anchorGravity = GravityCompat.END
|
||||||
anchorId = recyclerViewId
|
anchorId = recyclerViewId
|
||||||
setMargins(0, marginTop, 0, marginBottom)
|
setMargins(offset, marginTop, offset, marginBottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
is FrameLayout -> layoutParams = (layoutParams as FrameLayout.LayoutParams).apply {
|
is FrameLayout -> layoutParams = (layoutParams as FrameLayout.LayoutParams).apply {
|
||||||
height = LayoutParams.MATCH_PARENT
|
height = LayoutParams.MATCH_PARENT
|
||||||
gravity = GravityCompat.END
|
gravity = GravityCompat.END
|
||||||
setMargins(0, marginTop, 0, marginBottom)
|
setMargins(offset, marginTop, offset, marginBottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
is RelativeLayout -> layoutParams = (layoutParams as RelativeLayout.LayoutParams).apply {
|
is RelativeLayout -> layoutParams = (layoutParams as RelativeLayout.LayoutParams).apply {
|
||||||
@@ -270,7 +272,7 @@ class FastScroller @JvmOverloads constructor(
|
|||||||
addRule(RelativeLayout.ALIGN_TOP, recyclerViewId)
|
addRule(RelativeLayout.ALIGN_TOP, recyclerViewId)
|
||||||
addRule(RelativeLayout.ALIGN_BOTTOM, recyclerViewId)
|
addRule(RelativeLayout.ALIGN_BOTTOM, recyclerViewId)
|
||||||
addRule(RelativeLayout.ALIGN_END, recyclerViewId)
|
addRule(RelativeLayout.ALIGN_END, recyclerViewId)
|
||||||
setMargins(0, marginTop, 0, marginBottom)
|
setMargins(offset, marginTop, offset, marginBottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> throw IllegalArgumentException("Parent ViewGroup must be a ConstraintLayout, CoordinatorLayout, FrameLayout, or RelativeLayout")
|
else -> throw IllegalArgumentException("Parent ViewGroup must be a ConstraintLayout, CoordinatorLayout, FrameLayout, or RelativeLayout")
|
||||||
|
|||||||
@@ -4,14 +4,11 @@ import android.content.Context
|
|||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.WindowInsets
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.AttrRes
|
import androidx.annotation.AttrRes
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
import androidx.core.content.withStyledAttributes
|
import androidx.core.content.withStyledAttributes
|
||||||
import androidx.core.view.ViewCompat
|
|
||||||
import androidx.core.view.WindowInsetsCompat
|
|
||||||
import androidx.core.view.isGone
|
import androidx.core.view.isGone
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import org.koitharu.kotatsu.R
|
import org.koitharu.kotatsu.R
|
||||||
@@ -28,17 +25,17 @@ class AdaptiveSheetHeaderBar @JvmOverloads constructor(
|
|||||||
private var sheetBehavior: AdaptiveSheetBehavior? = null
|
private var sheetBehavior: AdaptiveSheetBehavior? = null
|
||||||
|
|
||||||
var title: CharSequence?
|
var title: CharSequence?
|
||||||
get() = binding.textViewTitle.text
|
get() = binding.shTextViewTitle.text
|
||||||
set(value) {
|
set(value) {
|
||||||
binding.textViewTitle.text = value
|
binding.shTextViewTitle.text = value
|
||||||
}
|
}
|
||||||
|
|
||||||
val isExpanded: Boolean
|
val isTitleVisible: Boolean
|
||||||
get() = binding.dragHandle.isGone
|
get() = binding.shLayoutSidesheet.isVisible
|
||||||
|
|
||||||
init {
|
init {
|
||||||
orientation = VERTICAL
|
orientation = VERTICAL
|
||||||
binding.buttonClose.setOnClickListener { dismissSheet() }
|
binding.shButtonClose.setOnClickListener { dismissSheet() }
|
||||||
context.withStyledAttributes(
|
context.withStyledAttributes(
|
||||||
attrs,
|
attrs,
|
||||||
R.styleable.AdaptiveSheetHeaderBar, defStyleAttr,
|
R.styleable.AdaptiveSheetHeaderBar, defStyleAttr,
|
||||||
@@ -49,8 +46,13 @@ class AdaptiveSheetHeaderBar @JvmOverloads constructor(
|
|||||||
|
|
||||||
override fun onAttachedToWindow() {
|
override fun onAttachedToWindow() {
|
||||||
super.onAttachedToWindow()
|
super.onAttachedToWindow()
|
||||||
dispatchInsets(ViewCompat.getRootWindowInsets(this))
|
if (isInEditMode) {
|
||||||
setBottomSheetBehavior(findParentSheetBehavior())
|
val isTabled = resources.getBoolean(R.bool.is_tablet)
|
||||||
|
binding.shDragHandle.isGone = isTabled
|
||||||
|
binding.shLayoutSidesheet.isVisible = isTabled
|
||||||
|
} else {
|
||||||
|
setBottomSheetBehavior(findParentSheetBehavior())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDetachedFromWindow() {
|
override fun onDetachedFromWindow() {
|
||||||
@@ -58,26 +60,17 @@ class AdaptiveSheetHeaderBar @JvmOverloads constructor(
|
|||||||
super.onDetachedFromWindow()
|
super.onDetachedFromWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onApplyWindowInsets(insets: WindowInsets?): WindowInsets {
|
|
||||||
dispatchInsets(if (insets != null) WindowInsetsCompat.toWindowInsetsCompat(insets) else null)
|
|
||||||
return super.onApplyWindowInsets(insets)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStateChanged(sheet: View, newState: Int) {
|
override fun onStateChanged(sheet: View, newState: Int) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setTitle(@StringRes resId: Int) {
|
fun setTitle(@StringRes resId: Int) {
|
||||||
binding.textViewTitle.setText(resId)
|
binding.shTextViewTitle.setText(resId)
|
||||||
}
|
|
||||||
|
|
||||||
private fun dispatchInsets(insets: WindowInsetsCompat?) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setBottomSheetBehavior(behavior: AdaptiveSheetBehavior?) {
|
private fun setBottomSheetBehavior(behavior: AdaptiveSheetBehavior?) {
|
||||||
binding.dragHandle.isVisible = behavior is AdaptiveSheetBehavior.Bottom
|
binding.shDragHandle.isVisible = behavior is AdaptiveSheetBehavior.Bottom
|
||||||
binding.layoutSidesheet.isVisible = behavior is AdaptiveSheetBehavior.Side
|
binding.shLayoutSidesheet.isVisible = behavior is AdaptiveSheetBehavior.Side
|
||||||
sheetBehavior?.removeCallback(this)
|
sheetBehavior?.removeCallback(this)
|
||||||
sheetBehavior = behavior
|
sheetBehavior = behavior
|
||||||
behavior?.addCallback(this)
|
behavior?.addCallback(this)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.google.android.material.R as materialR
|
|||||||
abstract class BaseAdaptiveSheet<B : ViewBinding> : AppCompatDialogFragment() {
|
abstract class BaseAdaptiveSheet<B : ViewBinding> : AppCompatDialogFragment() {
|
||||||
|
|
||||||
private var waitingForDismissAllowingStateLoss = false
|
private var waitingForDismissAllowingStateLoss = false
|
||||||
|
private var isFitToContentsDisabled = false
|
||||||
|
|
||||||
var viewBinding: B? = null
|
var viewBinding: B? = null
|
||||||
private set
|
private set
|
||||||
@@ -87,15 +88,28 @@ abstract class BaseAdaptiveSheet<B : ViewBinding> : AppCompatDialogFragment() {
|
|||||||
b.state = BottomSheetBehavior.STATE_EXPANDED
|
b.state = BottomSheetBehavior.STATE_EXPANDED
|
||||||
}
|
}
|
||||||
if (b is AdaptiveSheetBehavior.Bottom) {
|
if (b is AdaptiveSheetBehavior.Bottom) {
|
||||||
b.isFitToContents = !isExpanded
|
b.isFitToContents = !isFitToContentsDisabled && !isExpanded
|
||||||
val rootView = dialog?.findViewById<View>(materialR.id.design_bottom_sheet)
|
val rootView = dialog?.findViewById<View>(materialR.id.design_bottom_sheet)
|
||||||
rootView?.updateLayoutParams {
|
rootView?.updateLayoutParams {
|
||||||
height = if (isExpanded) LayoutParams.MATCH_PARENT else LayoutParams.WRAP_CONTENT
|
height = if (isFitToContentsDisabled || isExpanded) {
|
||||||
|
LayoutParams.MATCH_PARENT
|
||||||
|
} else {
|
||||||
|
LayoutParams.WRAP_CONTENT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b.isDraggable = !isLocked
|
b.isDraggable = !isLocked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun disableFitToContents() {
|
||||||
|
isFitToContentsDisabled = true
|
||||||
|
val b = behavior as? AdaptiveSheetBehavior.Bottom ?: return
|
||||||
|
b.isFitToContents = false
|
||||||
|
dialog?.findViewById<View>(materialR.id.design_bottom_sheet)?.updateLayoutParams {
|
||||||
|
height = LayoutParams.MATCH_PARENT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun requireViewBinding(): B = checkNotNull(viewBinding) {
|
fun requireViewBinding(): B = checkNotNull(viewBinding) {
|
||||||
"Fragment $this did not return a ViewBinding from onCreateView() or this was called before onCreateView()."
|
"Fragment $this did not return a ViewBinding from onCreateView() or this was called before onCreateView()."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.graphics.Color
|
|||||||
import androidx.annotation.AttrRes
|
import androidx.annotation.AttrRes
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.annotation.FloatRange
|
import androidx.annotation.FloatRange
|
||||||
|
import androidx.annotation.Px
|
||||||
import androidx.core.content.res.use
|
import androidx.core.content.res.use
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
|
|
||||||
@@ -22,6 +23,22 @@ fun Context.getThemeColor(
|
|||||||
it.getColor(0, fallback)
|
it.getColor(0, fallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Px
|
||||||
|
fun Context.getThemeDimensionPixelSize(
|
||||||
|
@AttrRes resId: Int,
|
||||||
|
@ColorInt fallback: Int = 0,
|
||||||
|
) = obtainStyledAttributes(intArrayOf(resId)).use {
|
||||||
|
it.getDimensionPixelSize(0, fallback)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Px
|
||||||
|
fun Context.getThemeDimensionPixelOffset(
|
||||||
|
@AttrRes resId: Int,
|
||||||
|
@ColorInt fallback: Int = 0,
|
||||||
|
) = obtainStyledAttributes(intArrayOf(resId)).use {
|
||||||
|
it.getDimensionPixelOffset(0, fallback)
|
||||||
|
}
|
||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
fun Context.getThemeColor(
|
fun Context.getThemeColor(
|
||||||
@AttrRes resId: Int,
|
@AttrRes resId: Int,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.koitharu.kotatsu.list.ui.adapter
|
|||||||
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
|
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
|
||||||
import org.koitharu.kotatsu.core.util.ext.setTextAndVisible
|
import org.koitharu.kotatsu.core.util.ext.setTextAndVisible
|
||||||
import org.koitharu.kotatsu.databinding.ItemHeaderButtonBinding
|
import org.koitharu.kotatsu.databinding.ItemHeaderButtonBinding
|
||||||
|
import org.koitharu.kotatsu.databinding.ItemHeaderSingleBinding
|
||||||
import org.koitharu.kotatsu.list.ui.model.ListHeader
|
import org.koitharu.kotatsu.list.ui.model.ListHeader
|
||||||
import org.koitharu.kotatsu.list.ui.model.ListModel
|
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||||
|
|
||||||
@@ -22,3 +23,12 @@ fun listHeaderAD(
|
|||||||
binding.buttonMore.setTextAndVisible(item.buttonTextRes)
|
binding.buttonMore.setTextAndVisible(item.buttonTextRes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun listSimpleHeaderAD() = adapterDelegateViewBinding<ListHeader, ListModel, ItemHeaderSingleBinding>(
|
||||||
|
{ inflater, parent -> ItemHeaderSingleBinding.inflate(inflater, parent, false) },
|
||||||
|
) {
|
||||||
|
|
||||||
|
bind {
|
||||||
|
binding.textViewTitle.text = item.getText(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,21 +1,45 @@
|
|||||||
package org.koitharu.kotatsu.list.ui.filter
|
package org.koitharu.kotatsu.list.ui.filter
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.recyclerview.widget.AsyncListDiffer.ListListener
|
import androidx.recyclerview.widget.AsyncListDiffer.ListListener
|
||||||
import com.hannesdorfmann.adapterdelegates4.AsyncListDifferDelegationAdapter
|
import com.hannesdorfmann.adapterdelegates4.AsyncListDifferDelegationAdapter
|
||||||
|
import org.koitharu.kotatsu.core.ui.list.fastscroll.FastScroller
|
||||||
|
import org.koitharu.kotatsu.list.ui.adapter.listSimpleHeaderAD
|
||||||
|
import org.koitharu.kotatsu.list.ui.adapter.loadingFooterAD
|
||||||
|
import org.koitharu.kotatsu.list.ui.adapter.loadingStateAD
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||||
|
|
||||||
class FilterAdapter(
|
class FilterAdapter(
|
||||||
listener: OnFilterChangedListener,
|
listener: OnFilterChangedListener,
|
||||||
listListener: ListListener<FilterItem>,
|
listListener: ListListener<ListModel>,
|
||||||
) : AsyncListDifferDelegationAdapter<FilterItem>(
|
) : AsyncListDifferDelegationAdapter<ListModel>(FilterDiffCallback()), FastScroller.SectionIndexer {
|
||||||
FilterDiffCallback(),
|
|
||||||
filterSortDelegate(listener),
|
|
||||||
filterTagDelegate(listener),
|
|
||||||
filterHeaderDelegate(),
|
|
||||||
filterLoadingDelegate(),
|
|
||||||
filterErrorDelegate(),
|
|
||||||
) {
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
delegatesManager
|
||||||
|
.addDelegate(filterSortDelegate(listener))
|
||||||
|
.addDelegate(filterTagDelegate(listener))
|
||||||
|
.addDelegate(listSimpleHeaderAD())
|
||||||
|
.addDelegate(loadingStateAD())
|
||||||
|
.addDelegate(loadingFooterAD())
|
||||||
|
.addDelegate(filterErrorDelegate())
|
||||||
differ.addListListener(listListener)
|
differ.addListListener(listListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getSectionText(context: Context, position: Int): CharSequence? {
|
||||||
|
val list = items
|
||||||
|
for (i in (0..position).reversed()) {
|
||||||
|
val item = list.getOrNull(i) ?: continue
|
||||||
|
if (item is FilterItem.Tag) {
|
||||||
|
return item.tag.title.firstOrNull()?.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
const val ITEM_TYPE_HEADER = 0
|
||||||
|
const val ITEM_TYPE_SORT = 1
|
||||||
|
const val ITEM_TYPE_TAG = 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,64 +1,48 @@
|
|||||||
package org.koitharu.kotatsu.list.ui.filter
|
package org.koitharu.kotatsu.list.ui.filter
|
||||||
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegate
|
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegate
|
||||||
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
|
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
|
||||||
import org.koitharu.kotatsu.R
|
import org.koitharu.kotatsu.R
|
||||||
import org.koitharu.kotatsu.core.ui.model.titleRes
|
import org.koitharu.kotatsu.core.ui.model.titleRes
|
||||||
import org.koitharu.kotatsu.databinding.ItemCheckableNewBinding
|
import org.koitharu.kotatsu.core.util.ext.setChecked
|
||||||
import org.koitharu.kotatsu.databinding.ItemFilterHeaderBinding
|
import org.koitharu.kotatsu.databinding.ItemCheckableMultipleBinding
|
||||||
|
import org.koitharu.kotatsu.databinding.ItemCheckableSingleBinding
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||||
|
|
||||||
fun filterSortDelegate(
|
fun filterSortDelegate(
|
||||||
listener: OnFilterChangedListener,
|
listener: OnFilterChangedListener,
|
||||||
) = adapterDelegateViewBinding<FilterItem.Sort, FilterItem, ItemCheckableNewBinding>(
|
) = adapterDelegateViewBinding<FilterItem.Sort, ListModel, ItemCheckableSingleBinding>(
|
||||||
{ layoutInflater, parent -> ItemCheckableNewBinding.inflate(layoutInflater, parent, false) },
|
{ layoutInflater, parent -> ItemCheckableSingleBinding.inflate(layoutInflater, parent, false) },
|
||||||
) {
|
) {
|
||||||
|
|
||||||
itemView.setOnClickListener {
|
itemView.setOnClickListener {
|
||||||
listener.onSortItemClick(item)
|
listener.onSortItemClick(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
bind {
|
bind { payloads ->
|
||||||
binding.root.setText(item.order.titleRes)
|
binding.root.setText(item.order.titleRes)
|
||||||
binding.root.isChecked = item.isSelected
|
binding.root.setChecked(item.isSelected, payloads.isNotEmpty())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun filterTagDelegate(
|
fun filterTagDelegate(
|
||||||
listener: OnFilterChangedListener,
|
listener: OnFilterChangedListener,
|
||||||
) = adapterDelegateViewBinding<FilterItem.Tag, FilterItem, ItemCheckableNewBinding>(
|
) = adapterDelegateViewBinding<FilterItem.Tag, ListModel, ItemCheckableMultipleBinding>(
|
||||||
{ layoutInflater, parent -> ItemCheckableNewBinding.inflate(layoutInflater, parent, false) },
|
{ layoutInflater, parent -> ItemCheckableMultipleBinding.inflate(layoutInflater, parent, false) },
|
||||||
) {
|
) {
|
||||||
|
|
||||||
itemView.setOnClickListener {
|
itemView.setOnClickListener {
|
||||||
listener.onTagItemClick(item)
|
listener.onTagItemClick(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
bind {
|
bind { payloads ->
|
||||||
binding.root.text = item.tag.title
|
binding.root.text = item.tag.title
|
||||||
binding.root.isChecked = item.isChecked
|
binding.root.setChecked(item.isChecked, payloads.isNotEmpty())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun filterHeaderDelegate() = adapterDelegateViewBinding<FilterItem.Header, FilterItem, ItemFilterHeaderBinding>(
|
fun filterErrorDelegate() = adapterDelegate<FilterItem.Error, ListModel>(R.layout.item_sources_empty) {
|
||||||
{ layoutInflater, parent -> ItemFilterHeaderBinding.inflate(layoutInflater, parent, false) },
|
|
||||||
) {
|
|
||||||
|
|
||||||
bind {
|
|
||||||
binding.textViewTitle.setText(item.titleResId)
|
|
||||||
binding.badge.isVisible = if (item.counter == 0) {
|
|
||||||
false
|
|
||||||
} else {
|
|
||||||
binding.badge.text = item.counter.toString()
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun filterLoadingDelegate() = adapterDelegate<FilterItem.Loading, FilterItem>(R.layout.item_loading_footer) {}
|
|
||||||
|
|
||||||
fun filterErrorDelegate() = adapterDelegate<FilterItem.Error, FilterItem>(R.layout.item_sources_empty) {
|
|
||||||
|
|
||||||
bind {
|
bind {
|
||||||
(itemView as TextView).setText(item.textResId)
|
(itemView as TextView).setText(item.textResId)
|
||||||
|
|||||||
@@ -1,91 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.list.ui.filter
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.MenuItem
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.widget.SearchView
|
|
||||||
import androidx.fragment.app.FragmentManager
|
|
||||||
import androidx.recyclerview.widget.AsyncListDiffer
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import org.koitharu.kotatsu.R
|
|
||||||
import org.koitharu.kotatsu.core.ui.BaseBottomSheet
|
|
||||||
import org.koitharu.kotatsu.core.ui.util.CollapseActionViewCallback
|
|
||||||
import org.koitharu.kotatsu.core.util.ext.observe
|
|
||||||
import org.koitharu.kotatsu.core.util.ext.parentFragmentViewModels
|
|
||||||
import org.koitharu.kotatsu.databinding.SheetFilterBinding
|
|
||||||
import org.koitharu.kotatsu.remotelist.ui.RemoteListViewModel
|
|
||||||
|
|
||||||
class FilterBottomSheet :
|
|
||||||
BaseBottomSheet<SheetFilterBinding>(),
|
|
||||||
MenuItem.OnActionExpandListener,
|
|
||||||
SearchView.OnQueryTextListener,
|
|
||||||
AsyncListDiffer.ListListener<FilterItem> {
|
|
||||||
|
|
||||||
private val viewModel by parentFragmentViewModels<RemoteListViewModel>()
|
|
||||||
private var collapsibleActionViewCallback: CollapseActionViewCallback? = null
|
|
||||||
|
|
||||||
override fun onCreateViewBinding(inflater: LayoutInflater, container: ViewGroup?): SheetFilterBinding {
|
|
||||||
return SheetFilterBinding.inflate(inflater, container, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewBindingCreated(binding: SheetFilterBinding, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewBindingCreated(binding, savedInstanceState)
|
|
||||||
val adapter = FilterAdapter(viewModel, this)
|
|
||||||
binding.recyclerView.adapter = adapter
|
|
||||||
viewModel.filterItems.observe(viewLifecycleOwner, adapter::setItems)
|
|
||||||
initOptionsMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroyView() {
|
|
||||||
super.onDestroyView()
|
|
||||||
collapsibleActionViewCallback = null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
|
|
||||||
setExpanded(isExpanded = true, isLocked = true)
|
|
||||||
collapsibleActionViewCallback?.onMenuItemActionExpand(item)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
|
|
||||||
val searchView = (item.actionView as? SearchView) ?: return false
|
|
||||||
searchView.setQuery("", false)
|
|
||||||
searchView.post { setExpanded(isExpanded = false, isLocked = false) }
|
|
||||||
collapsibleActionViewCallback?.onMenuItemActionCollapse(item)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onQueryTextSubmit(query: String?): Boolean = false
|
|
||||||
|
|
||||||
override fun onQueryTextChange(newText: String?): Boolean {
|
|
||||||
viewModel.filterSearch(newText?.trim().orEmpty())
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCurrentListChanged(previousList: MutableList<FilterItem>, currentList: MutableList<FilterItem>) {
|
|
||||||
if (currentList.size > previousList.size && view != null) {
|
|
||||||
(requireViewBinding().recyclerView.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(0, 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initOptionsMenu() {
|
|
||||||
requireViewBinding().headerBar.inflateMenu(R.menu.opt_filter)
|
|
||||||
val searchMenuItem = requireViewBinding().headerBar.menu.findItem(R.id.action_search)
|
|
||||||
searchMenuItem.setOnActionExpandListener(this)
|
|
||||||
val searchView = searchMenuItem.actionView as SearchView
|
|
||||||
searchView.setOnQueryTextListener(this)
|
|
||||||
searchView.setIconifiedByDefault(false)
|
|
||||||
searchView.queryHint = searchMenuItem.title
|
|
||||||
collapsibleActionViewCallback = CollapseActionViewCallback(searchMenuItem).also {
|
|
||||||
onBackPressedDispatcher.addCallback(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
private const val TAG = "FilterBottomSheet"
|
|
||||||
|
|
||||||
fun show(fm: FragmentManager) = FilterBottomSheet().show(fm, TAG)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,6 +18,10 @@ import kotlinx.coroutines.plus
|
|||||||
import org.koitharu.kotatsu.R
|
import org.koitharu.kotatsu.R
|
||||||
import org.koitharu.kotatsu.core.parser.MangaDataRepository
|
import org.koitharu.kotatsu.core.parser.MangaDataRepository
|
||||||
import org.koitharu.kotatsu.core.parser.RemoteMangaRepository
|
import org.koitharu.kotatsu.core.parser.RemoteMangaRepository
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.ListHeader
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.LoadingFooter
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.LoadingState
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaTag
|
import org.koitharu.kotatsu.parsers.model.MangaTag
|
||||||
import org.koitharu.kotatsu.parsers.util.SuspendLazy
|
import org.koitharu.kotatsu.parsers.util.SuspendLazy
|
||||||
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
|
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
|
||||||
@@ -39,8 +43,8 @@ class FilterCoordinator(
|
|||||||
}
|
}
|
||||||
private var availableTagsDeferred = loadTagsAsync()
|
private var availableTagsDeferred = loadTagsAsync()
|
||||||
|
|
||||||
val items: StateFlow<List<FilterItem>> = getItemsFlow()
|
val items: StateFlow<List<ListModel>> = getItemsFlow()
|
||||||
.stateIn(coroutineScope + Dispatchers.Default, SharingStarted.Eagerly, listOf(FilterItem.Loading))
|
.stateIn(coroutineScope + Dispatchers.Default, SharingStarted.Eagerly, listOf(LoadingState))
|
||||||
|
|
||||||
init {
|
init {
|
||||||
observeState()
|
observeState()
|
||||||
@@ -115,19 +119,19 @@ class FilterCoordinator(
|
|||||||
allTags: TagsWrapper,
|
allTags: TagsWrapper,
|
||||||
state: FilterState,
|
state: FilterState,
|
||||||
query: String,
|
query: String,
|
||||||
): List<FilterItem> {
|
): List<ListModel> {
|
||||||
val sortOrders = repository.sortOrders.sortedBy { it.ordinal }
|
val sortOrders = repository.sortOrders.sortedBy { it.ordinal }
|
||||||
val tags = mergeTags(state.tags, allTags.tags).toList()
|
val tags = mergeTags(state.tags, allTags.tags).toList()
|
||||||
val list = ArrayList<FilterItem>(tags.size + sortOrders.size + 3)
|
val list = ArrayList<ListModel>(tags.size + sortOrders.size + 3)
|
||||||
if (query.isEmpty()) {
|
if (query.isEmpty()) {
|
||||||
if (sortOrders.isNotEmpty()) {
|
if (sortOrders.isNotEmpty()) {
|
||||||
list.add(FilterItem.Header(R.string.sort_order, 0))
|
list.add(ListHeader(R.string.sort_order, 0, null))
|
||||||
sortOrders.mapTo(list) {
|
sortOrders.mapTo(list) {
|
||||||
FilterItem.Sort(it, isSelected = it == state.sortOrder)
|
FilterItem.Sort(it, isSelected = it == state.sortOrder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allTags.isLoading || allTags.isError || tags.isNotEmpty()) {
|
if (allTags.isLoading || allTags.isError || tags.isNotEmpty()) {
|
||||||
list.add(FilterItem.Header(R.string.genres, state.tags.size))
|
list.add(ListHeader(R.string.genres, 0, null))
|
||||||
tags.mapTo(list) {
|
tags.mapTo(list) {
|
||||||
FilterItem.Tag(it, isChecked = it in state.tags)
|
FilterItem.Tag(it, isChecked = it in state.tags)
|
||||||
}
|
}
|
||||||
@@ -135,7 +139,7 @@ class FilterCoordinator(
|
|||||||
if (allTags.isError) {
|
if (allTags.isError) {
|
||||||
list.add(FilterItem.Error(R.string.filter_load_error))
|
list.add(FilterItem.Error(R.string.filter_load_error))
|
||||||
} else if (allTags.isLoading) {
|
} else if (allTags.isLoading) {
|
||||||
list.add(FilterItem.Loading)
|
list.add(LoadingFooter())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tags.mapNotNullTo(list) {
|
tags.mapNotNullTo(list) {
|
||||||
|
|||||||
@@ -1,59 +1,51 @@
|
|||||||
package org.koitharu.kotatsu.list.ui.filter
|
package org.koitharu.kotatsu.list.ui.filter
|
||||||
|
|
||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.ListHeader
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||||
|
|
||||||
class FilterDiffCallback : DiffUtil.ItemCallback<FilterItem>() {
|
class FilterDiffCallback : DiffUtil.ItemCallback<ListModel>() {
|
||||||
|
|
||||||
override fun areItemsTheSame(oldItem: FilterItem, newItem: FilterItem): Boolean {
|
override fun areItemsTheSame(oldItem: ListModel, newItem: ListModel): Boolean {
|
||||||
return when {
|
return when {
|
||||||
oldItem === newItem -> true
|
oldItem === newItem -> true
|
||||||
oldItem.javaClass != newItem.javaClass -> false
|
oldItem.javaClass != newItem.javaClass -> false
|
||||||
oldItem is FilterItem.Header && newItem is FilterItem.Header -> {
|
oldItem is ListHeader && newItem is ListHeader -> {
|
||||||
oldItem.titleResId == newItem.titleResId
|
oldItem == newItem
|
||||||
}
|
}
|
||||||
|
|
||||||
oldItem is FilterItem.Tag && newItem is FilterItem.Tag -> {
|
oldItem is FilterItem.Tag && newItem is FilterItem.Tag -> {
|
||||||
oldItem.tag == newItem.tag
|
oldItem.tag == newItem.tag
|
||||||
}
|
}
|
||||||
|
|
||||||
oldItem is FilterItem.Sort && newItem is FilterItem.Sort -> {
|
oldItem is FilterItem.Sort && newItem is FilterItem.Sort -> {
|
||||||
oldItem.order == newItem.order
|
oldItem.order == newItem.order
|
||||||
}
|
}
|
||||||
|
|
||||||
oldItem is FilterItem.Error && newItem is FilterItem.Error -> {
|
oldItem is FilterItem.Error && newItem is FilterItem.Error -> {
|
||||||
oldItem.textResId == newItem.textResId
|
oldItem.textResId == newItem.textResId
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun areContentsTheSame(oldItem: FilterItem, newItem: FilterItem): Boolean {
|
override fun areContentsTheSame(oldItem: ListModel, newItem: ListModel): Boolean {
|
||||||
return when {
|
return oldItem == newItem
|
||||||
oldItem == FilterItem.Loading && newItem == FilterItem.Loading -> true
|
|
||||||
oldItem is FilterItem.Header && newItem is FilterItem.Header -> {
|
|
||||||
oldItem.counter == newItem.counter
|
|
||||||
}
|
|
||||||
oldItem is FilterItem.Error && newItem is FilterItem.Error -> true
|
|
||||||
oldItem is FilterItem.Tag && newItem is FilterItem.Tag -> {
|
|
||||||
oldItem.isChecked == newItem.isChecked
|
|
||||||
}
|
|
||||||
oldItem is FilterItem.Sort && newItem is FilterItem.Sort -> {
|
|
||||||
oldItem.isSelected == newItem.isSelected
|
|
||||||
}
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getChangePayload(oldItem: FilterItem, newItem: FilterItem): Any? {
|
override fun getChangePayload(oldItem: ListModel, newItem: ListModel): Any? {
|
||||||
val hasPayload = when {
|
val hasPayload = when {
|
||||||
oldItem is FilterItem.Tag && newItem is FilterItem.Tag -> {
|
oldItem is FilterItem.Tag && newItem is FilterItem.Tag -> {
|
||||||
oldItem.isChecked != newItem.isChecked
|
oldItem.isChecked != newItem.isChecked
|
||||||
}
|
}
|
||||||
|
|
||||||
oldItem is FilterItem.Sort && newItem is FilterItem.Sort -> {
|
oldItem is FilterItem.Sort && newItem is FilterItem.Sort -> {
|
||||||
oldItem.isSelected != newItem.isSelected
|
oldItem.isSelected != newItem.isSelected
|
||||||
}
|
}
|
||||||
oldItem is FilterItem.Header && newItem is FilterItem.Header -> {
|
|
||||||
oldItem.counter != newItem.counter
|
|
||||||
}
|
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
return if (hasPayload) Unit else super.getChangePayload(oldItem, newItem)
|
return if (hasPayload) Unit else super.getChangePayload(oldItem, newItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,71 @@
|
|||||||
package org.koitharu.kotatsu.list.ui.filter
|
package org.koitharu.kotatsu.list.ui.filter
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaTag
|
import org.koitharu.kotatsu.parsers.model.MangaTag
|
||||||
import org.koitharu.kotatsu.parsers.model.SortOrder
|
import org.koitharu.kotatsu.parsers.model.SortOrder
|
||||||
|
|
||||||
sealed interface FilterItem {
|
sealed interface FilterItem : ListModel {
|
||||||
|
|
||||||
class Header(
|
|
||||||
@StringRes val titleResId: Int,
|
|
||||||
val counter: Int,
|
|
||||||
) : FilterItem
|
|
||||||
|
|
||||||
class Sort(
|
class Sort(
|
||||||
val order: SortOrder,
|
val order: SortOrder,
|
||||||
val isSelected: Boolean,
|
val isSelected: Boolean,
|
||||||
) : FilterItem
|
) : FilterItem {
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as Sort
|
||||||
|
|
||||||
|
if (order != other.order) return false
|
||||||
|
return isSelected == other.isSelected
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = order.hashCode()
|
||||||
|
result = 31 * result + isSelected.hashCode()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Tag(
|
class Tag(
|
||||||
val tag: MangaTag,
|
val tag: MangaTag,
|
||||||
val isChecked: Boolean,
|
val isChecked: Boolean,
|
||||||
) : FilterItem
|
) : FilterItem {
|
||||||
|
|
||||||
object Loading : FilterItem
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as Tag
|
||||||
|
|
||||||
|
if (tag != other.tag) return false
|
||||||
|
return isChecked == other.isChecked
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = tag.hashCode()
|
||||||
|
result = 31 * result + isChecked.hashCode()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Error(
|
class Error(
|
||||||
@StringRes val textResId: Int,
|
@StringRes val textResId: Int,
|
||||||
) : FilterItem
|
) : FilterItem {
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as Error
|
||||||
|
|
||||||
|
return textResId == other.textResId
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return textResId
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package org.koitharu.kotatsu.list.ui.filter
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.fragment.app.FragmentManager
|
||||||
|
import androidx.recyclerview.widget.AsyncListDiffer
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetBehavior
|
||||||
|
import org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetCallback
|
||||||
|
import org.koitharu.kotatsu.core.ui.sheet.BaseAdaptiveSheet
|
||||||
|
import org.koitharu.kotatsu.core.ui.util.CollapseActionViewCallback
|
||||||
|
import org.koitharu.kotatsu.core.util.ext.observe
|
||||||
|
import org.koitharu.kotatsu.core.util.ext.parentFragmentViewModels
|
||||||
|
import org.koitharu.kotatsu.databinding.SheetFilterBinding
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||||
|
import org.koitharu.kotatsu.remotelist.ui.RemoteListViewModel
|
||||||
|
|
||||||
|
class FilterSheetFragment :
|
||||||
|
BaseAdaptiveSheet<SheetFilterBinding>(),
|
||||||
|
AdaptiveSheetCallback,
|
||||||
|
AsyncListDiffer.ListListener<ListModel> {
|
||||||
|
|
||||||
|
private val viewModel by parentFragmentViewModels<RemoteListViewModel>()
|
||||||
|
private var collapsibleActionViewCallback: CollapseActionViewCallback? = null
|
||||||
|
|
||||||
|
override fun onCreateViewBinding(inflater: LayoutInflater, container: ViewGroup?): SheetFilterBinding {
|
||||||
|
return SheetFilterBinding.inflate(inflater, container, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewBindingCreated(binding: SheetFilterBinding, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewBindingCreated(binding, savedInstanceState)
|
||||||
|
addSheetCallback(this)
|
||||||
|
val adapter = FilterAdapter(viewModel, this)
|
||||||
|
binding.recyclerView.adapter = adapter
|
||||||
|
viewModel.filterItems.observe(viewLifecycleOwner, adapter::setItems)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
collapsibleActionViewCallback = null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCurrentListChanged(previousList: MutableList<ListModel>, currentList: MutableList<ListModel>) {
|
||||||
|
if (currentList.size > previousList.size && view != null) {
|
||||||
|
(requireViewBinding().recyclerView.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(0, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStateChanged(sheet: View, newState: Int) {
|
||||||
|
viewBinding?.recyclerView?.isFastScrollerEnabled = newState == AdaptiveSheetBehavior.STATE_EXPANDED
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
private const val TAG = "FilterBottomSheet"
|
||||||
|
|
||||||
|
fun show(fm: FragmentManager) = FilterSheetFragment().show(fm, TAG)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,6 +63,7 @@ class PagesThumbnailsSheet :
|
|||||||
|
|
||||||
override fun onViewBindingCreated(binding: SheetPagesBinding, savedInstanceState: Bundle?) {
|
override fun onViewBindingCreated(binding: SheetPagesBinding, savedInstanceState: Bundle?) {
|
||||||
super.onViewBindingCreated(binding, savedInstanceState)
|
super.onViewBindingCreated(binding, savedInstanceState)
|
||||||
|
addSheetCallback(this)
|
||||||
spanResolver = MangaListSpanResolver(binding.root.resources)
|
spanResolver = MangaListSpanResolver(binding.root.resources)
|
||||||
thumbnailsAdapter = PageThumbnailAdapter(
|
thumbnailsAdapter = PageThumbnailAdapter(
|
||||||
coil = coil,
|
coil = coil,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import org.koitharu.kotatsu.core.util.ext.addMenuProvider
|
|||||||
import org.koitharu.kotatsu.core.util.ext.withArgs
|
import org.koitharu.kotatsu.core.util.ext.withArgs
|
||||||
import org.koitharu.kotatsu.databinding.FragmentListBinding
|
import org.koitharu.kotatsu.databinding.FragmentListBinding
|
||||||
import org.koitharu.kotatsu.list.ui.MangaListFragment
|
import org.koitharu.kotatsu.list.ui.MangaListFragment
|
||||||
import org.koitharu.kotatsu.list.ui.filter.FilterBottomSheet
|
import org.koitharu.kotatsu.list.ui.filter.FilterSheetFragment
|
||||||
import org.koitharu.kotatsu.main.ui.owners.AppBarOwner
|
import org.koitharu.kotatsu.main.ui.owners.AppBarOwner
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||||
import org.koitharu.kotatsu.search.ui.SearchActivity
|
import org.koitharu.kotatsu.search.ui.SearchActivity
|
||||||
@@ -42,7 +42,7 @@ class RemoteListFragment : MangaListFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onFilterClick(view: View?) {
|
override fun onFilterClick(view: View?) {
|
||||||
FilterBottomSheet.show(childFragmentManager)
|
FilterSheetFragment.show(childFragmentManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEmptyActionClick() {
|
override fun onEmptyActionClick() {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import org.koitharu.kotatsu.list.ui.filter.FilterState
|
|||||||
import org.koitharu.kotatsu.list.ui.filter.OnFilterChangedListener
|
import org.koitharu.kotatsu.list.ui.filter.OnFilterChangedListener
|
||||||
import org.koitharu.kotatsu.list.ui.model.EmptyState
|
import org.koitharu.kotatsu.list.ui.model.EmptyState
|
||||||
import org.koitharu.kotatsu.list.ui.model.ListHeader2
|
import org.koitharu.kotatsu.list.ui.model.ListHeader2
|
||||||
|
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||||
import org.koitharu.kotatsu.list.ui.model.LoadingFooter
|
import org.koitharu.kotatsu.list.ui.model.LoadingFooter
|
||||||
import org.koitharu.kotatsu.list.ui.model.LoadingState
|
import org.koitharu.kotatsu.list.ui.model.LoadingState
|
||||||
import org.koitharu.kotatsu.list.ui.model.toErrorFooter
|
import org.koitharu.kotatsu.list.ui.model.toErrorFooter
|
||||||
@@ -68,7 +69,7 @@ class RemoteListViewModel @Inject constructor(
|
|||||||
private val listError = MutableStateFlow<Throwable?>(null)
|
private val listError = MutableStateFlow<Throwable?>(null)
|
||||||
private var loadingJob: Job? = null
|
private var loadingJob: Job? = null
|
||||||
|
|
||||||
val filterItems: StateFlow<List<FilterItem>>
|
val filterItems: StateFlow<List<ListModel>>
|
||||||
get() = filter.items
|
get() = filter.items
|
||||||
|
|
||||||
override val content = combine(
|
override val content = combine(
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import android.os.Bundle
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.core.graphics.Insets
|
import androidx.core.graphics.Insets
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.updatePadding
|
||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
@@ -29,6 +28,7 @@ import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblingInfo
|
|||||||
import org.koitharu.kotatsu.scrobbling.common.ui.config.adapter.ScrobblingMangaAdapter
|
import org.koitharu.kotatsu.scrobbling.common.ui.config.adapter.ScrobblingMangaAdapter
|
||||||
import org.koitharu.kotatsu.tracker.ui.feed.adapter.FeedAdapter
|
import org.koitharu.kotatsu.tracker.ui.feed.adapter.FeedAdapter
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
import com.google.android.material.R as materialR
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class ScrobblerConfigActivity : BaseActivity<ActivityScrobblerConfigBinding>(),
|
class ScrobblerConfigActivity : BaseActivity<ActivityScrobblerConfigBinding>(),
|
||||||
@@ -115,11 +115,11 @@ class ScrobblerConfigActivity : BaseActivity<ActivityScrobblerConfigBinding>(),
|
|||||||
private fun onUserChanged(user: ScrobblerUser?) {
|
private fun onUserChanged(user: ScrobblerUser?) {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
viewBinding.imageViewAvatar.disposeImageRequest()
|
viewBinding.imageViewAvatar.disposeImageRequest()
|
||||||
viewBinding.imageViewAvatar.isVisible = false
|
viewBinding.imageViewAvatar.setImageResource(materialR.drawable.abc_ic_menu_overflow_material)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
viewBinding.imageViewAvatar.isVisible = true
|
|
||||||
viewBinding.imageViewAvatar.newImageRequest(this, user.avatar)
|
viewBinding.imageViewAvatar.newImageRequest(this, user.avatar)
|
||||||
|
?.placeholder(R.drawable.bg_badge_empty)
|
||||||
?.enqueueWith(coil)
|
?.enqueueWith(coil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
@@ -58,6 +57,7 @@ class ScrobblingSelectorSheet :
|
|||||||
|
|
||||||
override fun onViewBindingCreated(binding: SheetScrobblingSelectorBinding, savedInstanceState: Bundle?) {
|
override fun onViewBindingCreated(binding: SheetScrobblingSelectorBinding, savedInstanceState: Bundle?) {
|
||||||
super.onViewBindingCreated(binding, savedInstanceState)
|
super.onViewBindingCreated(binding, savedInstanceState)
|
||||||
|
disableFitToContents()
|
||||||
val listAdapter = ScrobblerSelectorAdapter(viewLifecycleOwner, coil, this, this)
|
val listAdapter = ScrobblerSelectorAdapter(viewLifecycleOwner, coil, this, this)
|
||||||
val decoration = ScrobblerMangaSelectionDecoration(binding.root.context)
|
val decoration = ScrobblerMangaSelectionDecoration(binding.root.context)
|
||||||
with(binding.recyclerView) {
|
with(binding.recyclerView) {
|
||||||
@@ -84,9 +84,7 @@ class ScrobblingSelectorSheet :
|
|||||||
tab.select()
|
tab.select()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewModel.searchQuery.observe(viewLifecycleOwner) {
|
viewModel.searchQuery.observe(viewLifecycleOwner, ::onSearchQueryChanged)
|
||||||
binding.headerBar.subtitle = it
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
@@ -135,7 +133,7 @@ class ScrobblingSelectorSheet :
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
viewModel.search(query)
|
viewModel.search(query)
|
||||||
requireViewBinding().headerBar.menu.findItem(R.id.action_search)?.collapseActionView()
|
requireViewBinding().toolbar.menu.findItem(R.id.action_search)?.collapseActionView()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,10 +153,14 @@ class ScrobblingSelectorSheet :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun openSearch() {
|
private fun openSearch() {
|
||||||
val menuItem = requireViewBinding().headerBar.menu.findItem(R.id.action_search) ?: return
|
val menuItem = requireViewBinding().toolbar.menu.findItem(R.id.action_search) ?: return
|
||||||
menuItem.expandActionView()
|
menuItem.expandActionView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun onSearchQueryChanged(query: String?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private fun onError(e: Throwable) {
|
private fun onError(e: Throwable) {
|
||||||
Toast.makeText(requireContext(), e.getDisplayMessage(resources), Toast.LENGTH_LONG).show()
|
Toast.makeText(requireContext(), e.getDisplayMessage(resources), Toast.LENGTH_LONG).show()
|
||||||
if (viewModel.isEmpty) {
|
if (viewModel.isEmpty) {
|
||||||
@@ -167,8 +169,8 @@ class ScrobblingSelectorSheet :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initOptionsMenu() {
|
private fun initOptionsMenu() {
|
||||||
requireViewBinding().headerBar.inflateMenu(R.menu.opt_shiki_selector)
|
requireViewBinding().toolbar.inflateMenu(R.menu.opt_shiki_selector)
|
||||||
val searchMenuItem = requireViewBinding().headerBar.menu.findItem(R.id.action_search)
|
val searchMenuItem = requireViewBinding().toolbar.menu.findItem(R.id.action_search)
|
||||||
searchMenuItem.setOnActionExpandListener(this)
|
searchMenuItem.setOnActionExpandListener(this)
|
||||||
val searchView = searchMenuItem.actionView as SearchView
|
val searchView = searchMenuItem.actionView as SearchView
|
||||||
searchView.setOnQueryTextListener(this)
|
searchView.setOnQueryTextListener(this)
|
||||||
@@ -182,10 +184,6 @@ class ScrobblingSelectorSheet :
|
|||||||
private fun initTabs() {
|
private fun initTabs() {
|
||||||
val entries = viewModel.availableScrobblers
|
val entries = viewModel.availableScrobblers
|
||||||
val tabs = requireViewBinding().tabs
|
val tabs = requireViewBinding().tabs
|
||||||
if (entries.size <= 1) {
|
|
||||||
tabs.isVisible = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val selectedId = arguments?.getInt(ARG_SCROBBLER, -1) ?: -1
|
val selectedId = arguments?.getInt(ARG_SCROBBLER, -1) ?: -1
|
||||||
tabs.removeAllTabs()
|
tabs.removeAllTabs()
|
||||||
tabs.clearOnTabSelectedListeners()
|
tabs.clearOnTabSelectedListeners()
|
||||||
@@ -200,7 +198,6 @@ class ScrobblingSelectorSheet :
|
|||||||
tab.select()
|
tab.select()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tabs.isVisible = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
14
app/src/main/res/layout/item_checkable_multiple.xml
Normal file
14
app/src/main/res/layout/item_checkable_multiple.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<CheckedTextView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?android:listPreferredItemHeightSmall"
|
||||||
|
android:drawablePadding="?android:listPreferredItemPaddingStart"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="?android:listPreferredItemPaddingStart"
|
||||||
|
android:paddingEnd="?android:listPreferredItemPaddingEnd"
|
||||||
|
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||||
|
app:drawableStartCompat="?android:listChoiceIndicatorMultiple"
|
||||||
|
tools:text="@tools:sample/full_names" />
|
||||||
14
app/src/main/res/layout/item_checkable_single.xml
Normal file
14
app/src/main/res/layout/item_checkable_single.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<CheckedTextView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?android:listPreferredItemHeightSmall"
|
||||||
|
android:drawablePadding="?android:listPreferredItemPaddingStart"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="?android:listPreferredItemPaddingStart"
|
||||||
|
android:paddingEnd="?android:listPreferredItemPaddingEnd"
|
||||||
|
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||||
|
app:drawableStartCompat="?android:listChoiceIndicatorSingle"
|
||||||
|
tools:text="@tools:sample/full_names" />
|
||||||
21
app/src/main/res/layout/item_header_single.xml
Normal file
21
app/src/main/res/layout/item_header_single.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="?listPreferredItemPaddingStart"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingEnd="?listPreferredItemPaddingEnd">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical|start"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.Kotatsu.SectionHeader"
|
||||||
|
tools:text="@tools:sample/lorem[2]" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -9,14 +9,14 @@
|
|||||||
tools:parentTag="android.widget.LinearLayout">
|
tools:parentTag="android.widget.LinearLayout">
|
||||||
|
|
||||||
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
|
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
|
||||||
android:id="@+id/dragHandle"
|
android:id="@+id/sh_dragHandle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/layout_sidesheet"
|
android:id="@+id/sh_layout_sidesheet"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView_title"
|
android:id="@+id/sh_textView_title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
tools:text="@string/filter" />
|
tools:text="@string/filter" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/button_close"
|
android:id="@+id/sh_button_close"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
|
|||||||
@@ -7,18 +7,28 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar
|
<org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetHeaderBar
|
||||||
android:id="@+id/headerBar"
|
android:id="@+id/headerBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:title="@string/filter" />
|
app:title="@string/filter" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<FrameLayout
|
||||||
android:id="@+id/recyclerView"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:clipToPadding="false"
|
|
||||||
android:orientation="vertical"
|
<org.koitharu.kotatsu.core.ui.list.fastscroll.FastScrollRecyclerView
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
android:id="@+id/recyclerView"
|
||||||
tools:listitem="@layout/item_checkable_new" />
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:scrollIndicators="top"
|
||||||
|
app:bubbleSize="normal"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
|
app:scrollerOffset="6dp"
|
||||||
|
app:trackColor="?attr/colorOutline"
|
||||||
|
tools:ignore="UnusedAttribute"
|
||||||
|
tools:listitem="@layout/item_checkable_new" />
|
||||||
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
style="?android:attr/actionOverflowButtonStyle"
|
style="?android:attr/actionOverflowButtonStyle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-6dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
android:contentDescription="@string/open_in_browser"
|
android:contentDescription="@string/open_in_browser"
|
||||||
|
|||||||
@@ -4,38 +4,53 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar
|
<org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetHeaderBar
|
||||||
android:id="@+id/headerBar"
|
android:id="@+id/headerBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:title="@string/tracking">
|
app:title="@string/tracking" />
|
||||||
|
|
||||||
<Button
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/button_done"
|
android:id="@+id/toolbar"
|
||||||
style="@style/Widget.Material3.Button.UnelevatedButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="end"
|
|
||||||
android:layout_marginHorizontal="@dimen/toolbar_button_margin"
|
|
||||||
android:text="@string/done" />
|
|
||||||
|
|
||||||
</org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar>
|
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
|
||||||
android:id="@+id/tabs"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:visibility="gone"
|
|
||||||
app:tabGravity="start"
|
<RelativeLayout
|
||||||
tools:visibility="visible" />
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/tabs"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_toStartOf="@id/button_done"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:scrollIndicators="start|end"
|
||||||
|
app:tabGravity="start"
|
||||||
|
app:tabMode="scrollable"
|
||||||
|
tools:ignore="UnusedAttribute" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_done"
|
||||||
|
style="@style/Widget.Material3.Button.UnelevatedButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginHorizontal="@dimen/toolbar_button_margin"
|
||||||
|
android:text="@string/done" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.MaterialToolbar>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:padding="@dimen/grid_spacing"
|
android:padding="@dimen/grid_spacing"
|
||||||
android:scrollbars="vertical"
|
android:scrollbars="vertical"
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_search"
|
|
||||||
android:icon="?actionModeWebSearchDrawable"
|
|
||||||
android:title="@string/find_genre"
|
|
||||||
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
|
||||||
app:showAsAction="ifRoom|collapseActionView" />
|
|
||||||
|
|
||||||
</menu>
|
|
||||||
@@ -81,6 +81,7 @@
|
|||||||
<attr name="thumbColor" format="color" />
|
<attr name="thumbColor" format="color" />
|
||||||
<attr name="trackColor" format="color" />
|
<attr name="trackColor" format="color" />
|
||||||
<attr name="bubbleTextSize" format="dimension" />
|
<attr name="bubbleTextSize" format="dimension" />
|
||||||
|
<attr name="scrollerOffset" format="dimension" />
|
||||||
<attr name="bubbleSize" format="enum">
|
<attr name="bubbleSize" format="enum">
|
||||||
<enum name="normal" value="0" />
|
<enum name="normal" value="0" />
|
||||||
<enum name="small" value="1" />
|
<enum name="small" value="1" />
|
||||||
|
|||||||
Reference in New Issue
Block a user