mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
* feat(launcher): apps page with search, sort, filter, folders, widgets and page swipes * feat(launcher): app shortcuts, pinned shortcuts, hidden apps and LauncherApps listing * fix(ui): let page content scroll to the bottom edge * feat(launcher): accept widgets other apps ask to pin * i18n(launcher): translate apps page strings * fix(launcher): keep disabled pins, serialize widget adds, add many plurals * fix(launcher): drop in-flight pin refreshes after unpinning * fix(launcher): skip unpin when pinned shortcuts can't be read * fix(launcher): drop in-flight app lists when home role is lost * fix(launcher): only migrate folder entries with one launcher activity
27 lines
844 B
Kotlin
27 lines
844 B
Kotlin
package com.droiddeck.launcher
|
|
|
|
import android.content.Context
|
|
import androidx.compose.runtime.getValue
|
|
import androidx.compose.runtime.mutableStateOf
|
|
import androidx.compose.runtime.setValue
|
|
|
|
object HomeHidden {
|
|
private const val PREFS = "home_launcher"
|
|
private const val KEY = "hidden"
|
|
|
|
var keys by mutableStateOf<Set<String>>(emptySet())
|
|
private set
|
|
private var loaded = false
|
|
|
|
fun load(context: Context) {
|
|
if (loaded) return
|
|
loaded = true
|
|
keys = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getStringSet(KEY, emptySet()).orEmpty().toSet()
|
|
}
|
|
|
|
fun set(context: Context, key: String, hidden: Boolean) {
|
|
keys = if (hidden) keys + key else keys - key
|
|
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putStringSet(KEY, keys).apply()
|
|
}
|
|
}
|