Option to disable app updates
parent
64e17d4086
commit
402c66ae87
@ -0,0 +1,20 @@
|
|||||||
|
package org.koitharu.kotatsu.utils.delegates.prefs
|
||||||
|
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import androidx.core.content.edit
|
||||||
|
import kotlin.properties.ReadWriteProperty
|
||||||
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
|
class LongPreferenceDelegate(private val key: String, private val defValue: Long) :
|
||||||
|
ReadWriteProperty<SharedPreferences, Long> {
|
||||||
|
|
||||||
|
override fun getValue(thisRef: SharedPreferences, property: KProperty<*>): Long {
|
||||||
|
return thisRef.getLong(key, defValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setValue(thisRef: SharedPreferences, property: KProperty<*>, value: Long) {
|
||||||
|
thisRef.edit {
|
||||||
|
putLong(key, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/key_app_update_auto"
|
||||||
|
android:summary="@string/show_notification_app_update"
|
||||||
|
android:title="@string/application_update"
|
||||||
|
app:allowDividerBelow="true"
|
||||||
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
Loading…
Reference in New Issue