|
|
|
@ -12,32 +12,32 @@ import org.jetbrains.anko.defaultSharedPreferences |
|
|
|
|
|
|
|
|
|
fun Context.isOnline() = connectivityManager.activeNetworkInfo?.isConnected == true |
|
|
|
|
|
|
|
|
|
fun Context.getPrefBoolean(key: String, defValue: Boolean) = |
|
|
|
|
fun Context.getPrefBoolean(key: String, defValue: Boolean = false) = |
|
|
|
|
defaultSharedPreferences.getBoolean(key, defValue) |
|
|
|
|
|
|
|
|
|
fun Context.putPrefBoolean(key: String, value: Boolean) = |
|
|
|
|
fun Context.putPrefBoolean(key: String, value: Boolean = false) = |
|
|
|
|
defaultSharedPreferences.edit { putBoolean(key, value) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun Context.getPrefInt(key: String, defValue: Int) = |
|
|
|
|
fun Context.getPrefInt(key: String, defValue: Int = 0) = |
|
|
|
|
defaultSharedPreferences.getInt(key, defValue) |
|
|
|
|
|
|
|
|
|
fun Context.putPrefInt(key: String, value: Int) = |
|
|
|
|
defaultSharedPreferences.edit { putInt(key, value) } |
|
|
|
|
|
|
|
|
|
fun Context.getPrefLong(key: String, defValue: Long) = |
|
|
|
|
fun Context.getPrefLong(key: String, defValue: Long = 0L) = |
|
|
|
|
defaultSharedPreferences.getLong(key, defValue) |
|
|
|
|
|
|
|
|
|
fun Context.putPrefLong(key: String, value: Long) = |
|
|
|
|
defaultSharedPreferences.edit { putLong(key, value) } |
|
|
|
|
|
|
|
|
|
fun Context.getPrefString(key: String, defValue: String) = |
|
|
|
|
fun Context.getPrefString(key: String, defValue: String? = null) = |
|
|
|
|
defaultSharedPreferences.getString(key, defValue) |
|
|
|
|
|
|
|
|
|
fun Context.putPrefString(key: String, value: String) = |
|
|
|
|
defaultSharedPreferences.edit { putString(key, value) } |
|
|
|
|
|
|
|
|
|
fun Context.getPrefStringSet(key: String, defValue: MutableSet<String>) = |
|
|
|
|
fun Context.getPrefStringSet(key: String, defValue: MutableSet<String>? = null) = |
|
|
|
|
defaultSharedPreferences.getStringSet(key, defValue) |
|
|
|
|
|
|
|
|
|
fun Context.putPrefStringSet(key: String, value: MutableSet<String>) = |
|
|
|
|