mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-16 15:02:48 +00:00
use the context.prefs shortcut
This commit is contained in:
parent
52e0e891fe
commit
07cac44861
4 changed files with 9 additions and 11 deletions
|
@ -35,7 +35,6 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import helium314.keyboard.latin.R
|
||||
import helium314.keyboard.latin.utils.DeviceProtectedUtils
|
||||
import helium314.keyboard.latin.utils.Log
|
||||
import helium314.keyboard.settings.dialogs.SliderDialog
|
||||
|
||||
|
@ -140,7 +139,7 @@ fun SwitchPreference(
|
|||
onCheckedChange: (Boolean) -> Unit = { },
|
||||
) {
|
||||
val ctx = LocalContext.current
|
||||
val prefs = DeviceProtectedUtils.getSharedPreferences(ctx)
|
||||
val prefs = ctx.prefs()
|
||||
val b = (ctx.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
||||
if (b?.value ?: 0 < 0)
|
||||
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||
|
@ -198,7 +197,7 @@ fun <T: Number> SliderPreference(
|
|||
onValueChanged: (Float) -> Unit = { },
|
||||
) {
|
||||
val ctx = LocalContext.current
|
||||
val prefs = DeviceProtectedUtils.getSharedPreferences(ctx)
|
||||
val prefs = ctx.prefs()
|
||||
val b = (ctx.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
||||
if (b?.value ?: 0 < 0)
|
||||
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue