INNER CODE UNIT · Kotlin

allRemotePrefsNames

1812z/HyperIsland · android/app/src/main/kotlin/io/github/hyperisland/XposedPrefsSyncApp.kt:259

    private fun allRemotePrefsNames(): List<String> = buildList(SHARD_COUNT + 1) {
        add(REMOTE_PREFS_CORE)
        for (index in 0 until SHARD_COUNT) add("$REMOTE_PREFS_SHARD_PREFIX$index")
    }

    private fun writeValue(editor: SharedPreferences.Editor, key: String, value: Any?): Boolean {
        when (value) {
            is Boolean -> editor.putBoolean(key, value)
            is Int     -> editor.putInt(key, value)
            is Long    -> editor.putLong(key, value)
            is Float   -> editor.putFloat(key, value)
            is String  -> editor.putString(key, value)
            is Set<*>  -> {
                if (value.any { it !is String }) return false
                editor.putStringSet(key, value.filterIsInstance<String>().toSet())
            }
            null       -> editor.remove(key)
            else       -> return false

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…