mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 05:25:08 +01:00
Fixed #697
This commit is contained in:
parent
bb26e3cc92
commit
2551024b20
@ -12,6 +12,7 @@ import androidx.core.view.get
|
||||
import com.tfcporciuncula.flow.Preference
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.databinding.MaterialSpinnerViewBinding
|
||||
import kotlin.math.max
|
||||
|
||||
class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: AttributeSet?) :
|
||||
FrameLayout(context, attrs) {
|
||||
@ -82,10 +83,10 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
}
|
||||
|
||||
fun bindToIntPreference(pref: Preference<Int>, @ArrayRes intValuesResource: Int, block: ((Int) -> Unit)? = null) {
|
||||
setSelection(pref.get())
|
||||
this.pref = pref
|
||||
prefOffset = 0
|
||||
val intValues = resources.getStringArray(intValuesResource).map { it.toIntOrNull() }
|
||||
setSelection(max(0,intValues.indexOf(pref.get())))
|
||||
popup = makeSettingsPopup(pref, intValues, block)
|
||||
setOnTouchListener(popup?.dragToOpenListener)
|
||||
setOnClickListener {
|
||||
|
Loading…
Reference in New Issue
Block a user