mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-28 17:19:00 +03:00
Remove no-longer-needed FloatListPreference
This commit is contained in:
parent
5b9f362925
commit
19993199db
3 changed files with 1 additions and 32 deletions
|
@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.setting
|
|||
import android.support.graphics.drawable.VectorDrawableCompat
|
||||
import android.support.v4.graphics.drawable.DrawableCompat
|
||||
import android.support.v7.preference.*
|
||||
import eu.kanade.tachiyomi.widget.preference.FloatListPreference
|
||||
import eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
|
||||
@DslMarker
|
||||
|
@ -38,10 +37,6 @@ inline fun PreferenceGroup.intListPreference(block: (@DSL IntListPreference).()
|
|||
return initThenAdd(IntListPreference(context), block).also(::initDialog)
|
||||
}
|
||||
|
||||
inline fun PreferenceGroup.floatListPreference(block: (@DSL FloatListPreference).() -> Unit): FloatListPreference {
|
||||
return initThenAdd(FloatListPreference(context), block).also(::initDialog)
|
||||
}
|
||||
|
||||
inline fun PreferenceGroup.multiSelectListPreference(block: (@DSL MultiSelectListPreference).() -> Unit): MultiSelectListPreference {
|
||||
return initThenAdd(MultiSelectListPreference(context), block).also(::initDialog)
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class SettingsReaderController : SettingsController() {
|
|||
defaultValue = false
|
||||
}
|
||||
|
||||
floatListPreference {
|
||||
intListPreference {
|
||||
key = Keys.webtoonMarginRatio
|
||||
titleRes = R.string.pref_reader_theme
|
||||
entriesRes = arrayOf(R.string.webtoon_margin_ratio_0,
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package eu.kanade.tachiyomi.widget.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v7.preference.ListPreference
|
||||
import android.util.AttributeSet
|
||||
|
||||
class FloatListPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
ListPreference(context, attrs) {
|
||||
|
||||
override fun persistString(value: String?): Boolean {
|
||||
return value != null && persistFloat(value.toFloat())
|
||||
}
|
||||
|
||||
override fun getPersistedString(defaultReturnValue: String?): String? {
|
||||
// When the underlying preference is using a PreferenceDataStore, there's no way (for now)
|
||||
// to check if a value is in the store, so we use a most likely unused value as workaround
|
||||
val defaultIntValue = Float.NEGATIVE_INFINITY
|
||||
|
||||
val value = getPersistedFloat(defaultIntValue)
|
||||
return if (value != defaultIntValue) {
|
||||
value.toString()
|
||||
} else {
|
||||
defaultReturnValue
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue