pull/2410/head
kunfei 2 years ago
parent 83e62668eb
commit 6256e78f5f
  1. 3
      app/src/main/java/io/legado/app/lib/prefs/ColorPreference.kt
  2. 18
      app/src/main/java/io/legado/app/lib/prefs/Preference.kt

@ -116,8 +116,7 @@ class ColorPreference(context: Context, attrs: AttributeSet) : Preference(contex
} }
} }
override fun onBindViewHolder(holder: PreferenceViewHolder) { override fun onBindView(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
val v = bindView<ColorPanelView>( val v = bindView<ColorPanelView>(
context, holder, icon, title, summary, widgetLayoutResource, context, holder, icon, title, summary, widgetLayoutResource,
R.id.cpv_preference_preview_color_panel, 30, 30 R.id.cpv_preference_preview_color_panel, 30, 30

@ -108,16 +108,9 @@ open class Preference(context: Context, attrs: AttributeSet) :
} }
override fun onBindViewHolder(holder: PreferenceViewHolder) { final override fun onBindViewHolder(holder: PreferenceViewHolder) {
bindView<View>(
context,
holder,
icon,
title,
summary,
isBottomBackground = isBottomBackground
)
super.onBindViewHolder(holder) super.onBindViewHolder(holder)
onBindView(holder)
onLongClick?.let { listener -> onLongClick?.let { listener ->
holder.itemView.onLongClick { holder.itemView.onLongClick {
listener.invoke(this) listener.invoke(this)
@ -125,6 +118,13 @@ open class Preference(context: Context, attrs: AttributeSet) :
} }
} }
open fun onBindView(holder: PreferenceViewHolder) {
bindView<View>(
context, holder, icon, title, summary,
isBottomBackground = isBottomBackground
)
}
fun onLongClick(listener: (preference: Preference) -> Boolean) { fun onLongClick(listener: (preference: Preference) -> Boolean) {
onLongClick = listener onLongClick = listener
} }

Loading…
Cancel
Save