Remove no-longer-needed FloatListPreference

This commit is contained in:
John Leehey
2019-11-30 18:41:52 -08:00
parent 5b9f362925
commit 19993199db
3 changed files with 1 additions and 32 deletions

View File

@@ -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
}
}
}