2021-11-06 04:00:29 +01:00
|
|
|
package jp.juggler.subwaytooter.pref
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.SharedPreferences
|
|
|
|
import jp.juggler.subwaytooter.pref.impl.*
|
|
|
|
|
|
|
|
fun SharedPreferences.Editor.remove(item: BasePref<*>): SharedPreferences.Editor {
|
|
|
|
item.remove(this)
|
|
|
|
return this
|
|
|
|
}
|
|
|
|
|
2023-01-16 06:58:23 +01:00
|
|
|
// 戻り値はEditor
|
2021-11-06 04:00:29 +01:00
|
|
|
fun SharedPreferences.Editor.put(item: BooleanPref, v: Boolean) =
|
|
|
|
this.apply { item.put(this, v) }
|
|
|
|
|
|
|
|
fun SharedPreferences.Editor.put(item: StringPref, v: String) =
|
|
|
|
this.apply { item.put(this, v) }
|
|
|
|
|
|
|
|
fun SharedPreferences.Editor.put(item: IntPref, v: Int) =
|
|
|
|
this.apply { item.put(this, v) }
|
|
|
|
|
|
|
|
fun SharedPreferences.Editor.put(item: LongPref, v: Long) =
|
|
|
|
this.apply { item.put(this, v) }
|
|
|
|
|
|
|
|
fun SharedPreferences.Editor.put(item: FloatPref, v: Float) =
|
|
|
|
this.apply { item.put(this, v) }
|