mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 05:25:08 +01:00
Adding a default popup for selectedPosition in spinner view
For cases where neither bind no listener is implmented, you can just get the selected position
This commit is contained in:
parent
f0fbab56af
commit
d584aa56b9
@ -25,7 +25,8 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
FrameLayout(context, attrs) {
|
FrameLayout(context, attrs) {
|
||||||
|
|
||||||
private var entries = emptyList<String>()
|
private var entries = emptyList<String>()
|
||||||
private var selectedPosition = 0
|
var selectedPosition = 0
|
||||||
|
private set
|
||||||
private var pref: Preference<Int>? = null
|
private var pref: Preference<Int>? = null
|
||||||
private var prefOffset = 0
|
private var prefOffset = 0
|
||||||
private var popup: PopupMenu? = null
|
private var popup: PopupMenu? = null
|
||||||
@ -63,6 +64,12 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
|
|
||||||
binding.detailView.text = entries.firstOrNull().orEmpty()
|
binding.detailView.text = entries.firstOrNull().orEmpty()
|
||||||
|
|
||||||
|
popup = makeSettingsPopup()
|
||||||
|
setOnTouchListener(popup?.dragToOpenListener)
|
||||||
|
setOnClickListener {
|
||||||
|
popup?.show()
|
||||||
|
}
|
||||||
|
|
||||||
a.recycle()
|
a.recycle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user