pull/2092/head
821938089 2 years ago
parent e2ec305839
commit 1b94de3956
  1. 8
      app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt
  2. 8
      app/src/main/java/io/legado/app/ui/widget/PopupAction.kt

@ -31,7 +31,9 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac
TextToSpeech.OnInitListener {
private val binding = PopupActionMenuBinding.inflate(LayoutInflater.from(context))
private val adapter = Adapter(context)
private val adapter = Adapter(context).apply {
setHasStableIds(true)
}
private val menuItems: List<MenuItemImpl>
private val visibleMenuItems = arrayListOf<MenuItemImpl>()
private val moreMenuItems = arrayListOf<MenuItemImpl>()
@ -157,6 +159,10 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac
inner class Adapter(context: Context) :
RecyclerAdapter<MenuItemImpl, ItemTextBinding>(context) {
override fun getItemId(position: Int): Long {
return position.toLong()
}
override fun getViewBinding(parent: ViewGroup): ItemTextBinding {
return ItemTextBinding.inflate(inflater, parent, false)
}

@ -15,7 +15,9 @@ class PopupAction(private val context: Context) :
val binding = PopupActionBinding.inflate(context.layoutInflater)
val adapter by lazy {
Adapter(context)
Adapter(context).apply {
setHasStableIds(true)
}
}
var onActionClick: ((action: String) -> Unit)? = null
@ -36,6 +38,10 @@ class PopupAction(private val context: Context) :
inner class Adapter(context: Context) :
RecyclerAdapter<SelectItem<String>, ItemTextBinding>(context) {
override fun getItemId(position: Int): Long {
return position.toLong()
}
override fun getViewBinding(parent: ViewGroup): ItemTextBinding {
return ItemTextBinding.inflate(inflater, parent, false)
}

Loading…
Cancel
Save