pull/357/head
gedoor 4 years ago
parent d4db3109f5
commit 5036d15b84
  1. 10
      app/src/main/java/io/legado/app/utils/ContextExtensions.kt

@ -59,8 +59,10 @@ fun Context.getPrefString(@StringRes keyId: Int, defValue: String? = null) =
fun Context.putPrefString(key: String, value: String) =
defaultSharedPreferences.edit { putString(key, value) }
fun Context.getPrefStringSet(key: String, defValue: MutableSet<String>? = null) =
defaultSharedPreferences.getStringSet(key, defValue)
fun Context.getPrefStringSet(
key: String,
defValue: MutableSet<String>? = null
): MutableSet<String>? = defaultSharedPreferences.getStringSet(key, defValue)
fun Context.putPrefStringSet(key: String, value: MutableSet<String>) =
defaultSharedPreferences.edit { putStringSet(key, value) }
@ -194,10 +196,10 @@ val Context.channel: String
get() {
try {
val pm = packageManager
val appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
val appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
return appInfo.metaData.getString("channel") ?: ""
} catch (e: Exception) {
e.printStackTrace();
e.printStackTrace()
}
return ""
}

Loading…
Cancel
Save