mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
优化
This commit is contained in:
parent
75ddba2730
commit
e0d146b8ba
@ -67,6 +67,9 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config) {
|
||||
putPrefBoolean(PreferKey.webService, WebService.isRun)
|
||||
addPreferencesFromResource(R.xml.pref_main)
|
||||
findPreference<SwitchPreference>("webService")?.onLongClick {
|
||||
if (!WebService.isRun) {
|
||||
return@onLongClick false
|
||||
}
|
||||
context?.selector(arrayListOf("复制地址", "浏览器打开")) { _, i ->
|
||||
when (i) {
|
||||
0 -> context?.sendToClip(it.summary.toString())
|
||||
|
@ -116,8 +116,10 @@ class Preference(context: Context, attrs: AttributeSet) :
|
||||
isBottomBackground = isBottomBackground
|
||||
)
|
||||
super.onBindViewHolder(holder)
|
||||
holder.itemView.onLongClick {
|
||||
onLongClick?.invoke(this)
|
||||
onLongClick?.let { listener ->
|
||||
holder.itemView.onLongClick {
|
||||
listener.invoke(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,10 @@ class SwitchPreference(context: Context, attrs: AttributeSet) :
|
||||
v.applyTint(context.accentColor)
|
||||
}
|
||||
super.onBindViewHolder(holder)
|
||||
holder.itemView.setOnLongClickListener {
|
||||
onLongClick?.invoke(this) ?: false
|
||||
onLongClick?.let { listener ->
|
||||
holder.itemView.setOnLongClickListener {
|
||||
listener.invoke(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user