优化
This commit is contained in:
@@ -72,7 +72,7 @@ class MoreConfigDialog : DialogFragment() {
|
||||
class ReadPreferenceFragment : PreferenceFragment(),
|
||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
private val slopSquare by lazy { ViewConfiguration.get(context).scaledTouchSlop }
|
||||
private val slopSquare by lazy { ViewConfiguration.get(requireContext()).scaledTouchSlop }
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
|
||||
@@ -65,10 +65,17 @@ fun Menu.applyOpenTint(context: Context) {
|
||||
fun Menu.iconItemOnLongClick(id: Int, function: (view: View) -> Unit) {
|
||||
findItem(id)?.let { item ->
|
||||
item.setActionView(R.layout.view_action_button)
|
||||
item.actionView.contentDescription = item.title
|
||||
item.actionView.findViewById<ImageButton>(R.id.item).setImageDrawable(item.icon)
|
||||
item.actionView.setOnLongClickListener { function.invoke(item.actionView); true }
|
||||
item.actionView.setOnClickListener { performIdentifierAction(id, 0) }
|
||||
item.actionView?.run {
|
||||
contentDescription = item.title
|
||||
findViewById<ImageButton>(R.id.item).setImageDrawable(item.icon)
|
||||
setOnLongClickListener {
|
||||
function.invoke(this)
|
||||
true
|
||||
}
|
||||
setOnClickListener {
|
||||
performIdentifierAction(id, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user