mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-19 21:59:11 +00:00
add more compose previews, and make them work better
This commit is contained in:
parent
1b5a793690
commit
e55b375f90
43 changed files with 425 additions and 193 deletions
|
@ -16,11 +16,13 @@ import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
|
import helium314.keyboard.compat.ConfigurationCompatKt;
|
||||||
import helium314.keyboard.keyboard.KeyboardActionListener;
|
import helium314.keyboard.keyboard.KeyboardActionListener;
|
||||||
import helium314.keyboard.latin.AudioAndHapticFeedbackManager;
|
import helium314.keyboard.latin.AudioAndHapticFeedbackManager;
|
||||||
import helium314.keyboard.latin.InputAttributes;
|
import helium314.keyboard.latin.InputAttributes;
|
||||||
|
@ -239,6 +241,14 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** convenience function for the rare situations where we need to load settings but may not have a keyboard */
|
||||||
|
public void loadSettings(final Context context) {
|
||||||
|
if (mSettingsValues != null) return;
|
||||||
|
final Locale locale = ConfigurationCompatKt.locale(context.getResources().getConfiguration());
|
||||||
|
final InputAttributes inputAttributes = new InputAttributes(new EditorInfo(), false, context.getPackageName());
|
||||||
|
loadSettings(context, locale, inputAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
public void loadSettings(final Context context, final Locale locale,
|
public void loadSettings(final Context context, final Locale locale,
|
||||||
@NonNull final InputAttributes inputAttributes) {
|
@NonNull final InputAttributes inputAttributes) {
|
||||||
mSettingsValuesLock.lock();
|
mSettingsValuesLock.lock();
|
||||||
|
|
|
@ -26,12 +26,10 @@ public final class DeviceProtectedUtils {
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
return prefs;
|
return prefs;
|
||||||
}
|
}
|
||||||
Context deviceProtectedContext = getDeviceProtectedContext(context);
|
final Context deviceProtectedContext = getDeviceProtectedContext(context);
|
||||||
if (deviceProtectedContext == null) { // not relevant in practice, but happens when compose previews access shared preferences
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
return prefs;
|
|
||||||
}
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(deviceProtectedContext);
|
prefs = PreferenceManager.getDefaultSharedPreferences(deviceProtectedContext);
|
||||||
|
if (prefs.getAll() == null)
|
||||||
|
return prefs; // happens for compose previews
|
||||||
if (prefs.getAll().isEmpty()) {
|
if (prefs.getAll().isEmpty()) {
|
||||||
Log.i(TAG, "Device encrypted storage is empty, copying values from credential encrypted storage");
|
Log.i(TAG, "Device encrypted storage is empty, copying values from credential encrypted storage");
|
||||||
deviceProtectedContext.moveSharedPreferencesFrom(context, android.preference.PreferenceManager.getDefaultSharedPreferencesName(context));
|
deviceProtectedContext.moveSharedPreferencesFrom(context, android.preference.PreferenceManager.getDefaultSharedPreferencesName(context));
|
||||||
|
@ -42,7 +40,9 @@ public final class DeviceProtectedUtils {
|
||||||
// keep this private to avoid accidental use of device protected context anywhere in the app
|
// keep this private to avoid accidental use of device protected context anywhere in the app
|
||||||
private static Context getDeviceProtectedContext(final Context context) {
|
private static Context getDeviceProtectedContext(final Context context) {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) return context;
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) return context;
|
||||||
return context.isDeviceProtectedStorage() ? context : context.createDeviceProtectedStorageContext();
|
final Context ctx = context.isDeviceProtectedStorage() ? context : context.createDeviceProtectedStorageContext();
|
||||||
|
if (ctx == null) return context; // happens for compose previews
|
||||||
|
else return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getFilesDir(final Context context) {
|
public static File getFilesDir(final Context context) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.common.FileUtils
|
import helium314.keyboard.latin.common.FileUtils
|
||||||
import helium314.keyboard.latin.common.decodeBase36
|
import helium314.keyboard.latin.common.decodeBase36
|
||||||
import helium314.keyboard.latin.common.encodeBase36
|
import helium314.keyboard.latin.common.encodeBase36
|
||||||
|
import helium314.keyboard.latin.settings.Settings
|
||||||
import helium314.keyboard.latin.utils.LayoutType.Companion.folder
|
import helium314.keyboard.latin.utils.LayoutType.Companion.folder
|
||||||
import helium314.keyboard.latin.utils.ScriptUtils.script
|
import helium314.keyboard.latin.utils.ScriptUtils.script
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
|
@ -84,6 +85,8 @@ object LayoutUtilsCustom {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkLayout(layoutContent: String, context: Context): Boolean {
|
fun checkLayout(layoutContent: String, context: Context): Boolean {
|
||||||
|
if (Settings.getValues() == null)
|
||||||
|
Settings.getInstance().loadSettings(context)
|
||||||
val params = KeyboardParams()
|
val params = KeyboardParams()
|
||||||
params.mId = KeyboardLayoutSet.getFakeKeyboardId(KeyboardId.ELEMENT_ALPHABET)
|
params.mId = KeyboardLayoutSet.getFakeKeyboardId(KeyboardId.ELEMENT_ALPHABET)
|
||||||
params.mPopupKeyTypes.add(POPUP_KEYS_LAYOUT)
|
params.mPopupKeyTypes.add(POPUP_KEYS_LAYOUT)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.Locale
|
||||||
fun <T> runInLocale(context: Context, locale: Locale, run: (Context) -> T): T {
|
fun <T> runInLocale(context: Context, locale: Locale, run: (Context) -> T): T {
|
||||||
val config = Configuration(context.resources.configuration)
|
val config = Configuration(context.resources.configuration)
|
||||||
config.setLocale(locale)
|
config.setLocale(locale)
|
||||||
val localeContext = context.createConfigurationContext(config)
|
val localeContext = context.createConfigurationContext(config) ?: context
|
||||||
return run(localeContext)
|
return run(localeContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.view.inputmethod.InputMethodSubtype
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.app.LocaleManagerCompat
|
import androidx.core.app.LocaleManagerCompat
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
|
import helium314.keyboard.compat.locale
|
||||||
import helium314.keyboard.keyboard.KeyboardSwitcher
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.latin.RichInputMethodManager
|
import helium314.keyboard.latin.RichInputMethodManager
|
||||||
import helium314.keyboard.latin.common.Constants.Separators
|
import helium314.keyboard.latin.common.Constants.Separators
|
||||||
|
@ -104,11 +105,15 @@ object SubtypeSettings {
|
||||||
|
|
||||||
fun reloadSystemLocales(context: Context) {
|
fun reloadSystemLocales(context: Context) {
|
||||||
systemLocales.clear()
|
systemLocales.clear()
|
||||||
|
try {
|
||||||
val localeList = LocaleManagerCompat.getSystemLocales(context)
|
val localeList = LocaleManagerCompat.getSystemLocales(context)
|
||||||
(0 until localeList.size()).forEach {
|
(0 until localeList.size()).forEach {
|
||||||
val locale = localeList[it]
|
val locale = localeList[it]
|
||||||
if (locale != null) systemLocales.add(locale)
|
if (locale != null) systemLocales.add(locale)
|
||||||
}
|
}
|
||||||
|
} catch (_: Throwable) {
|
||||||
|
systemLocales.add(context.resources.configuration.locale())
|
||||||
|
}
|
||||||
systemSubtypes.clear()
|
systemSubtypes.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ fun layoutFilePicker(
|
||||||
@Composable
|
@Composable
|
||||||
fun dictionaryFilePicker(mainLocale: Locale?): ManagedActivityResultLauncher<Intent, ActivityResult> {
|
fun dictionaryFilePicker(mainLocale: Locale?): ManagedActivityResultLauncher<Intent, ActivityResult> {
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
val cachedDictionaryFile = File(ctx.cacheDir.path + File.separator + "temp_dict")
|
val cachedDictionaryFile = File(ctx.cacheDir?.path + File.separator + "temp_dict")
|
||||||
var done by remember { mutableStateOf(false) }
|
var done by remember { mutableStateOf(false) }
|
||||||
val picker = filePicker { uri ->
|
val picker = filePicker { uri ->
|
||||||
cachedDictionaryFile.delete()
|
cachedDictionaryFile.delete()
|
||||||
|
|
|
@ -5,6 +5,7 @@ import androidx.annotation.StringRes
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
@ -49,6 +50,8 @@ fun DefaultButton(isDefault: Boolean, onClick: () -> Unit) {
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
|
Theme(previewDark) {
|
||||||
|
Surface {
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
NextScreenIcon()
|
NextScreenIcon()
|
||||||
SearchIcon()
|
SearchIcon()
|
||||||
|
@ -57,4 +60,6 @@ private fun Preview() {
|
||||||
DeleteButton { }
|
DeleteButton { }
|
||||||
DefaultButton(false) { }
|
DefaultButton(false) { }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
18
app/src/main/java/helium314/keyboard/settings/Preview.kt
Normal file
18
app/src/main/java/helium314/keyboard/settings/Preview.kt
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
package helium314.keyboard.settings
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
||||||
|
import helium314.keyboard.latin.settings.Settings
|
||||||
|
import helium314.keyboard.latin.utils.SubtypeSettings
|
||||||
|
|
||||||
|
// file is meant for making compose previews work
|
||||||
|
|
||||||
|
fun initPreview(context: Context) {
|
||||||
|
Settings.init(context)
|
||||||
|
SubtypeSettings.init(context)
|
||||||
|
SettingsActivity.settingsContainer = SettingsContainer(context)
|
||||||
|
KeyboardIconsSet.instance.loadIcons(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
const val previewDark = true
|
|
@ -1,3 +1,4 @@
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
package helium314.keyboard.settings
|
package helium314.keyboard.settings
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
@ -202,13 +203,23 @@ fun WelcomeWizard(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview(
|
@Preview
|
||||||
// content cut off on real device, but not here... great?
|
|
||||||
device = "spec:orientation=landscape,width=400dp,height=780dp"
|
|
||||||
)
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
Theme(true) {
|
Theme(previewDark) {
|
||||||
|
Surface {
|
||||||
|
WelcomeWizard({}) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview(
|
||||||
|
// content cut off on real device, but not here... great?
|
||||||
|
device = "spec:orientation=landscape,width=400dp,height=780dp"
|
||||||
|
)
|
||||||
|
@Composable
|
||||||
|
private fun WidePreview() {
|
||||||
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
WelcomeWizard({}) { }
|
WelcomeWizard({}) { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@ import com.github.skydoves.colorpicker.compose.AlphaSlider
|
||||||
import com.github.skydoves.colorpicker.compose.BrightnessSlider
|
import com.github.skydoves.colorpicker.compose.BrightnessSlider
|
||||||
import com.github.skydoves.colorpicker.compose.HsvColorPicker
|
import com.github.skydoves.colorpicker.compose.HsvColorPicker
|
||||||
import com.github.skydoves.colorpicker.compose.rememberColorPickerController
|
import com.github.skydoves.colorpicker.compose.rememberColorPickerController
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ColorPickerDialog(
|
fun ColorPickerDialog(
|
||||||
|
@ -144,5 +146,16 @@ fun ColorPickerDialog(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
|
Theme(previewDark) {
|
||||||
ColorPickerDialog({}, -0x0f4488aa, "color name", {})
|
ColorPickerDialog({}, -0x0f4488aa, "color name", {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// for some reason this is cut of while both previews are shown
|
||||||
|
@Preview(device = "spec:orientation=landscape,width=400dp,height=780dp")
|
||||||
|
@Composable
|
||||||
|
private fun WidePreview() {
|
||||||
|
Theme(previewDark) {
|
||||||
|
ColorPickerDialog({}, -0x0f4488aa, "color name", {})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,10 @@ import helium314.keyboard.settings.EditButton
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.SettingsDestination
|
import helium314.keyboard.settings.SettingsDestination
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.filePicker
|
import helium314.keyboard.settings.filePicker
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import helium314.keyboard.settings.screens.SaveThoseColors
|
import helium314.keyboard.settings.screens.SaveThoseColors
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.serialization.SerializationException
|
import kotlinx.serialization.SerializationException
|
||||||
|
@ -277,10 +279,12 @@ private fun loadColorString(colorString: String, prefs: SharedPreferences): Bool
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
|
Theme(previewDark) {
|
||||||
ColorThemePickerDialog(
|
ColorThemePickerDialog(
|
||||||
onDismissRequest = {},
|
onDismissRequest = {},
|
||||||
setting = Setting(LocalContext.current, "", R.string.settings) {},
|
setting = Setting(LocalContext.current, "", R.string.settings) {},
|
||||||
default = "dark",
|
default = "dark",
|
||||||
isNight = true
|
isNight = true
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
// taken from StreetComplete
|
// taken from StreetComplete
|
||||||
/** Slight specialization of an alert dialog: AlertDialog with OK and Cancel button. Both buttons
|
/** Slight specialization of an alert dialog: AlertDialog with OK and Cancel button. Both buttons
|
||||||
|
@ -39,6 +41,7 @@ fun ConfirmationDialog(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewConfirmDialog() {
|
private fun PreviewConfirmDialog() {
|
||||||
|
Theme(previewDark) {
|
||||||
ConfirmationDialog(
|
ConfirmationDialog(
|
||||||
onDismissRequest = { },
|
onDismissRequest = { },
|
||||||
onConfirmed = {},
|
onConfirmed = {},
|
||||||
|
@ -46,4 +49,5 @@ private fun PreviewConfirmDialog() {
|
||||||
confirmButtonText = "I don't care",
|
confirmButtonText = "I don't care",
|
||||||
content = { Text(stringResource(R.string.disable_personalized_dicts_message)) }
|
content = { Text(stringResource(R.string.disable_personalized_dicts_message)) }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,9 @@ import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.customIconNames
|
import helium314.keyboard.latin.customIconNames
|
||||||
import helium314.keyboard.latin.utils.getStringResourceOrName
|
import helium314.keyboard.latin.utils.getStringResourceOrName
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import helium314.keyboard.settings.screens.GetIcon
|
import helium314.keyboard.settings.screens.GetIcon
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
|
@ -178,9 +181,11 @@ fun CustomizeIconsDialog(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
KeyboardIconsSet.instance.loadIcons(LocalContext.current)
|
initPreview(LocalContext.current)
|
||||||
|
Theme(previewDark) {
|
||||||
CustomizeIconsDialog(
|
CustomizeIconsDialog(
|
||||||
prefKey = "",
|
prefKey = "",
|
||||||
onDismissRequest = { },
|
onDismissRequest = { },
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.em
|
import androidx.compose.ui.unit.em
|
||||||
import helium314.keyboard.compat.locale
|
import helium314.keyboard.compat.locale
|
||||||
|
@ -31,7 +32,9 @@ import helium314.keyboard.latin.common.LocaleUtils.localizedDisplayName
|
||||||
import helium314.keyboard.latin.utils.DictionaryInfoUtils
|
import helium314.keyboard.latin.utils.DictionaryInfoUtils
|
||||||
import helium314.keyboard.latin.utils.createDictionaryTextAnnotated
|
import helium314.keyboard.latin.utils.createDictionaryTextAnnotated
|
||||||
import helium314.keyboard.settings.DeleteButton
|
import helium314.keyboard.settings.DeleteButton
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dictionaryFilePicker
|
import helium314.keyboard.settings.dictionaryFilePicker
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import helium314.keyboard.settings.screens.getUserAndInternalDictionaries
|
import helium314.keyboard.settings.screens.getUserAndInternalDictionaries
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
@ -97,3 +100,11 @@ fun DictionaryDialog(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
Theme(previewDark) {
|
||||||
|
DictionaryDialog({}, Locale.ENGLISH)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ package helium314.keyboard.settings.dialogs
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun InfoDialog(
|
fun InfoDialog(
|
||||||
|
@ -18,3 +21,11 @@ fun InfoDialog(
|
||||||
confirmButtonText = null
|
confirmButtonText = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
Theme(previewDark) {
|
||||||
|
InfoDialog("message") { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -17,16 +17,21 @@ import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.LocalDensity
|
import androidx.compose.ui.platform.LocalDensity
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.input.TextFieldValue
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.utils.LayoutType
|
import helium314.keyboard.latin.utils.LayoutType
|
||||||
import helium314.keyboard.latin.utils.LayoutUtilsCustom
|
import helium314.keyboard.latin.utils.LayoutUtilsCustom
|
||||||
import helium314.keyboard.latin.utils.Log
|
import helium314.keyboard.latin.utils.Log
|
||||||
|
import helium314.keyboard.latin.utils.SettingsSubtype
|
||||||
import helium314.keyboard.latin.utils.SubtypeSettings
|
import helium314.keyboard.latin.utils.SubtypeSettings
|
||||||
import helium314.keyboard.latin.utils.getActivity
|
import helium314.keyboard.latin.utils.getActivity
|
||||||
import helium314.keyboard.latin.utils.getStringResourceOrName
|
import helium314.keyboard.latin.utils.getStringResourceOrName
|
||||||
import helium314.keyboard.settings.CloseIcon
|
import helium314.keyboard.settings.CloseIcon
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -114,3 +119,13 @@ fun LayoutEditDialog(
|
||||||
|
|
||||||
// the job is here (outside the composable to make sure old jobs are canceled
|
// the job is here (outside the composable to make sure old jobs are canceled
|
||||||
private var errorJob: Job? = null
|
private var errorJob: Job? = null
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
val content = LocalContext.current.assets.open("layouts/main/dvorak.json").reader().readText()
|
||||||
|
initPreview(LocalContext.current)
|
||||||
|
Theme(previewDark) {
|
||||||
|
LayoutEditDialog({}, LayoutType.MAIN, "qwerty", locale = Locale.ENGLISH, startContent = content) { true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -48,9 +48,11 @@ import helium314.keyboard.settings.DeleteButton
|
||||||
import helium314.keyboard.settings.EditButton
|
import helium314.keyboard.settings.EditButton
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
import helium314.keyboard.settings.layoutFilePicker
|
import helium314.keyboard.settings.layoutFilePicker
|
||||||
import helium314.keyboard.settings.layoutIntent
|
import helium314.keyboard.settings.layoutIntent
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LayoutPickerDialog(
|
fun LayoutPickerDialog(
|
||||||
|
@ -211,9 +213,11 @@ private fun LayoutItemRow(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
|
Theme(previewDark) {
|
||||||
LayoutPickerDialog(
|
LayoutPickerDialog(
|
||||||
onDismissRequest = {},
|
onDismissRequest = {},
|
||||||
setting = Setting(LocalContext.current, "", R.string.settings) {},
|
setting = Setting(LocalContext.current, "", R.string.settings) {},
|
||||||
layoutType = LayoutType.SYMBOLS
|
layoutType = LayoutType.SYMBOLS
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
// taken from StreetComplete
|
// taken from StreetComplete
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -100,6 +102,7 @@ fun <T: Any> ListPickerDialog(
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewListPickerDialog() {
|
private fun PreviewListPickerDialog() {
|
||||||
val items = remember { (0..<5).toList() }
|
val items = remember { (0..<5).toList() }
|
||||||
|
Theme(previewDark) {
|
||||||
ListPickerDialog(
|
ListPickerDialog(
|
||||||
onDismissRequest = {},
|
onDismissRequest = {},
|
||||||
items = items,
|
items = items,
|
||||||
|
@ -108,4 +111,5 @@ private fun PreviewListPickerDialog() {
|
||||||
selectedItem = 2,
|
selectedItem = 2,
|
||||||
getItemName = { "Item $it" },
|
getItemName = { "Item $it" },
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
// modified version of ListPickerDialog for selecting multiple items
|
// modified version of ListPickerDialog for selecting multiple items
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -83,6 +85,7 @@ fun <T: Any> MultiListPickerDialog(
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
val items = remember { (0..<5).toList() }
|
val items = remember { (0..<5).toList() }
|
||||||
|
Theme(previewDark) {
|
||||||
MultiListPickerDialog(
|
MultiListPickerDialog(
|
||||||
onDismissRequest = {},
|
onDismissRequest = {},
|
||||||
items = items,
|
items = items,
|
||||||
|
@ -91,4 +94,5 @@ private fun Preview() {
|
||||||
initialSelection = listOf(2, 4),
|
initialSelection = listOf(2, 4),
|
||||||
getItemName = { "Item $it" },
|
getItemName = { "Item $it" },
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import helium314.keyboard.latin.utils.DictionaryInfoUtils
|
||||||
import helium314.keyboard.latin.utils.ScriptUtils.script
|
import helium314.keyboard.latin.utils.ScriptUtils.script
|
||||||
import helium314.keyboard.latin.utils.SubtypeSettings
|
import helium314.keyboard.latin.utils.SubtypeSettings
|
||||||
import helium314.keyboard.latin.utils.locale
|
import helium314.keyboard.latin.utils.locale
|
||||||
import helium314.keyboard.latin.utils.prefs
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import sh.calvin.reorderable.ReorderableItem
|
import sh.calvin.reorderable.ReorderableItem
|
||||||
import sh.calvin.reorderable.rememberReorderableLazyListState
|
import sh.calvin.reorderable.rememberReorderableLazyListState
|
||||||
|
|
||||||
|
@ -93,6 +95,7 @@ fun <T: Any> ReorderDialog(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
|
Theme(previewDark) {
|
||||||
ReorderDialog(
|
ReorderDialog(
|
||||||
onConfirmed = {},
|
onConfirmed = {},
|
||||||
onDismissRequest = {},
|
onDismissRequest = {},
|
||||||
|
@ -100,4 +103,5 @@ private fun Preview() {
|
||||||
displayItem = { Text(it.toString(), Modifier.fillMaxWidth(), textAlign = TextAlign.Center) },
|
displayItem = { Text(it.toString(), Modifier.fillMaxWidth(), textAlign = TextAlign.Center) },
|
||||||
getKey = { it.toString() }
|
getKey = { it.toString() }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SliderDialog(
|
fun SliderDialog(
|
||||||
|
@ -70,6 +72,7 @@ fun SliderDialog(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewSliderDialog() {
|
private fun PreviewSliderDialog() {
|
||||||
|
Theme(previewDark) {
|
||||||
SliderDialog(
|
SliderDialog(
|
||||||
onDismissRequest = { },
|
onDismissRequest = { },
|
||||||
onDone = { },
|
onDone = { },
|
||||||
|
@ -78,4 +81,5 @@ private fun PreviewSliderDialog() {
|
||||||
title = { Text("move it") },
|
title = { Text("move it") },
|
||||||
showDefault = true
|
showDefault = true
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.buildAnnotatedString
|
import androidx.compose.ui.text.buildAnnotatedString
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
||||||
import helium314.keyboard.keyboard.internal.keyboard_parser.POPUP_KEYS_ALL
|
import helium314.keyboard.keyboard.internal.keyboard_parser.POPUP_KEYS_ALL
|
||||||
|
@ -72,8 +73,11 @@ import helium314.keyboard.latin.utils.mainLayoutName
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.DefaultButton
|
import helium314.keyboard.settings.DefaultButton
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.layoutFilePicker
|
import helium314.keyboard.settings.layoutFilePicker
|
||||||
import helium314.keyboard.settings.layoutIntent
|
import helium314.keyboard.settings.layoutIntent
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import helium314.keyboard.settings.screens.GetIcon
|
import helium314.keyboard.settings.screens.GetIcon
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
@ -496,3 +500,12 @@ fun <T>DropDownField(
|
||||||
|
|
||||||
private fun getAvailableSecondaryLocales(context: Context, mainLocale: Locale): List<Locale> =
|
private fun getAvailableSecondaryLocales(context: Context, mainLocale: Locale): List<Locale> =
|
||||||
getDictionaryLocales(context).filter { it != mainLocale && it.script() == mainLocale.script() }
|
getDictionaryLocales(context).filter { it != mainLocale && it.script() == mainLocale.script() }
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
initPreview(LocalContext.current)
|
||||||
|
Theme(previewDark) {
|
||||||
|
SubtypeDialog({}, SettingsSubtype(Locale.ENGLISH, "")) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.text.input.TextFieldValue
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.window.DialogProperties
|
import androidx.compose.ui.window.DialogProperties
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
// mostly taken from StreetComplete / SCEE
|
// mostly taken from StreetComplete / SCEE
|
||||||
/** Dialog with which to input text. OK button is only clickable if [checkTextValid] returns true. */
|
/** Dialog with which to input text. OK button is only clickable if [checkTextValid] returns true. */
|
||||||
|
@ -85,6 +87,7 @@ fun TextInputDialog(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
|
Theme(previewDark) {
|
||||||
TextInputDialog(
|
TextInputDialog(
|
||||||
onDismissRequest = {},
|
onDismissRequest = {},
|
||||||
onConfirmed = {},
|
onConfirmed = {},
|
||||||
|
@ -93,4 +96,5 @@ private fun Preview() {
|
||||||
singleLine = false,
|
singleLine = false,
|
||||||
textInputLabel = { Text("fill it") }
|
textInputLabel = { Text("fill it") }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
import androidx.compose.ui.window.DialogProperties
|
import androidx.compose.ui.window.DialogProperties
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ThreeButtonAlertDialog(
|
fun ThreeButtonAlertDialog(
|
||||||
|
@ -98,7 +99,7 @@ fun ThreeButtonAlertDialog(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
Theme {
|
Theme(previewDark) {
|
||||||
ThreeButtonAlertDialog(
|
ThreeButtonAlertDialog(
|
||||||
onDismissRequest = {},
|
onDismissRequest = {},
|
||||||
onConfirmed = { },
|
onConfirmed = { },
|
||||||
|
|
|
@ -26,7 +26,6 @@ import androidx.compose.ui.unit.dp
|
||||||
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
||||||
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode.checkAndConvertCode
|
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode.checkAndConvertCode
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.settings.Settings
|
|
||||||
import helium314.keyboard.latin.utils.ToolbarKey
|
import helium314.keyboard.latin.utils.ToolbarKey
|
||||||
import helium314.keyboard.latin.utils.getCodeForToolbarKey
|
import helium314.keyboard.latin.utils.getCodeForToolbarKey
|
||||||
import helium314.keyboard.latin.utils.getCodeForToolbarKeyLongClick
|
import helium314.keyboard.latin.utils.getCodeForToolbarKeyLongClick
|
||||||
|
@ -34,6 +33,9 @@ import helium314.keyboard.latin.utils.getStringResourceOrName
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.latin.utils.readCustomKeyCodes
|
import helium314.keyboard.latin.utils.readCustomKeyCodes
|
||||||
import helium314.keyboard.latin.utils.writeCustomKeyCodes
|
import helium314.keyboard.latin.utils.writeCustomKeyCodes
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import helium314.keyboard.settings.screens.GetIcon
|
import helium314.keyboard.settings.screens.GetIcon
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -138,21 +140,22 @@ private fun ToolbarKeyCustomizer(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun checkCode(code: TextFieldValue) = runCatching {
|
||||||
|
code.text.toIntOrNull()?.takeIf { it.checkAndConvertCode() <= Char.MAX_VALUE.code }
|
||||||
|
}.getOrNull()
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
fun PreviewToolbarKeyCustomizer() {
|
private fun PreviewToolbarKeyCustomizer() {
|
||||||
Settings.init(LocalContext.current)
|
initPreview(LocalContext.current)
|
||||||
ToolbarKeyCustomizer(ToolbarKey.CUT) { }
|
ToolbarKeyCustomizer(ToolbarKey.CUT) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
fun PreviewToolbarKeysCustomizer() {
|
private fun PreviewToolbarKeysCustomizer() {
|
||||||
Settings.init(LocalContext.current)
|
initPreview(LocalContext.current)
|
||||||
KeyboardIconsSet.instance.loadIcons(LocalContext.current)
|
Theme(previewDark) {
|
||||||
ToolbarKeysCustomizer("") { }
|
ToolbarKeysCustomizer("") { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkCode(code: TextFieldValue) = runCatching {
|
|
||||||
code.text.toIntOrNull()?.takeIf { it.checkAndConvertCode() <= Char.MAX_VALUE.code }
|
|
||||||
}.getOrNull()
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ fun LoadGestureLibPreference(setting: Setting) {
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
val prefs = ctx.protectedPrefs()
|
val prefs = ctx.protectedPrefs()
|
||||||
val abi = Build.SUPPORTED_ABIS[0]
|
val abi = Build.SUPPORTED_ABIS[0]
|
||||||
val libFile = File(ctx.filesDir.absolutePath + File.separator + JniUtils.JNI_LIB_IMPORT_FILE_NAME)
|
val libFile = File(ctx.filesDir?.absolutePath + File.separator + JniUtils.JNI_LIB_IMPORT_FILE_NAME)
|
||||||
fun renameToLibFileAndRestart(file: File, checksum: String) {
|
fun renameToLibFileAndRestart(file: File, checksum: String) {
|
||||||
libFile.delete()
|
libFile.delete()
|
||||||
// store checksum in default preferences (soo JniUtils)
|
// store checksum in default preferences (soo JniUtils)
|
||||||
|
|
|
@ -29,6 +29,8 @@ import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
// partially taken from StreetComplete / SCEE
|
// partially taken from StreetComplete / SCEE
|
||||||
|
|
||||||
|
@ -105,6 +107,7 @@ fun Preference(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreferencePreview() {
|
private fun PreferencePreview() {
|
||||||
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
Column {
|
Column {
|
||||||
PreferenceCategory("Preference Category")
|
PreferenceCategory("Preference Category")
|
||||||
|
@ -163,4 +166,5 @@ private fun PreferencePreview() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import helium314.keyboard.settings.preferences.Preference
|
||||||
import helium314.keyboard.settings.SearchSettingsScreen
|
import helium314.keyboard.settings.SearchSettingsScreen
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
@ -177,7 +178,7 @@ fun createAboutSettings(context: Context) = listOf(
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
SettingsActivity.settingsContainer = SettingsContainer(LocalContext.current)
|
SettingsActivity.settingsContainer = SettingsContainer(LocalContext.current)
|
||||||
Theme(true) {
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
AboutScreen { }
|
AboutScreen { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ import helium314.keyboard.settings.dialogs.TextInputDialog
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
import helium314.keyboard.settings.preferences.BackupRestorePreference
|
import helium314.keyboard.settings.preferences.BackupRestorePreference
|
||||||
import helium314.keyboard.settings.preferences.LoadGestureLibPreference
|
import helium314.keyboard.settings.preferences.LoadGestureLibPreference
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AdvancedSettingsScreen(
|
fun AdvancedSettingsScreen(
|
||||||
|
@ -235,7 +236,7 @@ fun createAdvancedSettings(context: Context) = listOf(
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
SettingsActivity.settingsContainer = SettingsContainer(LocalContext.current)
|
SettingsActivity.settingsContainer = SettingsContainer(LocalContext.current)
|
||||||
Theme(true) {
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
AdvancedSettingsScreen { }
|
AdvancedSettingsScreen { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import helium314.keyboard.latin.utils.Log
|
||||||
import helium314.keyboard.latin.utils.getActivity
|
import helium314.keyboard.latin.utils.getActivity
|
||||||
import helium314.keyboard.latin.utils.getStringResourceOrName
|
import helium314.keyboard.latin.utils.getStringResourceOrName
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.SettingsContainer
|
|
||||||
import helium314.keyboard.settings.preferences.ListPreference
|
import helium314.keyboard.settings.preferences.ListPreference
|
||||||
import helium314.keyboard.settings.SettingsWithoutKey
|
import helium314.keyboard.settings.SettingsWithoutKey
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
|
@ -36,9 +35,11 @@ import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.ColorThemePickerDialog
|
import helium314.keyboard.settings.dialogs.ColorThemePickerDialog
|
||||||
import helium314.keyboard.settings.dialogs.CustomizeIconsDialog
|
import helium314.keyboard.settings.dialogs.CustomizeIconsDialog
|
||||||
import helium314.keyboard.settings.dialogs.TextInputDialog
|
import helium314.keyboard.settings.dialogs.TextInputDialog
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
import helium314.keyboard.settings.preferences.BackgroundImagePref
|
import helium314.keyboard.settings.preferences.BackgroundImagePref
|
||||||
import helium314.keyboard.settings.preferences.CustomFontPreference
|
import helium314.keyboard.settings.preferences.CustomFontPreference
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppearanceScreen(
|
fun AppearanceScreen(
|
||||||
|
@ -307,8 +308,8 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
SettingsActivity.settingsContainer = SettingsContainer(LocalContext.current)
|
initPreview(LocalContext.current)
|
||||||
Theme(true) {
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
AppearanceScreen { }
|
AppearanceScreen { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ import helium314.keyboard.settings.SearchScreen
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.ColorPickerDialog
|
import helium314.keyboard.settings.dialogs.ColorPickerDialog
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
|
@ -239,7 +240,7 @@ data class SaveThoseColors(val name: String? = null, val moreColors: Int, val co
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
Theme(true) {
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
ColorsScreen(false, null) { }
|
ColorsScreen(false, null) { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,15 +18,15 @@ import helium314.keyboard.latin.settings.DebugSettings
|
||||||
import helium314.keyboard.latin.settings.DebugSettingsFragment
|
import helium314.keyboard.latin.settings.DebugSettingsFragment
|
||||||
import helium314.keyboard.latin.settings.Defaults
|
import helium314.keyboard.latin.settings.Defaults
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.SettingsContainer
|
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.preferences.Preference
|
import helium314.keyboard.settings.preferences.Preference
|
||||||
import helium314.keyboard.settings.SearchSettingsScreen
|
import helium314.keyboard.settings.SearchSettingsScreen
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
|
||||||
import helium314.keyboard.settings.preferences.SwitchPreference
|
import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
import helium314.keyboard.settings.preferences.PreferenceCategory
|
import helium314.keyboard.settings.preferences.PreferenceCategory
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DebugScreen(
|
fun DebugScreen(
|
||||||
|
@ -111,8 +111,8 @@ private fun createDebugSettings(context: Context) = listOf(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
SettingsActivity.settingsContainer = SettingsContainer(LocalContext.current)
|
initPreview(LocalContext.current)
|
||||||
Theme(true) {
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
DebugScreen { }
|
DebugScreen { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
@ -18,6 +19,7 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.buildAnnotatedString
|
import androidx.compose.ui.text.buildAnnotatedString
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import helium314.keyboard.latin.Dictionary
|
import helium314.keyboard.latin.Dictionary
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
|
@ -34,9 +36,12 @@ import helium314.keyboard.latin.utils.appendLink
|
||||||
import helium314.keyboard.latin.utils.getDictionaryLocales
|
import helium314.keyboard.latin.utils.getDictionaryLocales
|
||||||
import helium314.keyboard.latin.utils.locale
|
import helium314.keyboard.latin.utils.locale
|
||||||
import helium314.keyboard.settings.SearchScreen
|
import helium314.keyboard.settings.SearchScreen
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
||||||
import helium314.keyboard.settings.dialogs.DictionaryDialog
|
import helium314.keyboard.settings.dialogs.DictionaryDialog
|
||||||
import helium314.keyboard.settings.dictionaryFilePicker
|
import helium314.keyboard.settings.dictionaryFilePicker
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
@ -138,3 +143,14 @@ fun getUserAndInternalDictionaries(context: Context, locale: Locale): Pair<List<
|
||||||
}
|
}
|
||||||
return userDicts to (best != null)
|
return userDicts to (best != null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
initPreview(LocalContext.current)
|
||||||
|
Theme(previewDark) {
|
||||||
|
Surface {
|
||||||
|
DictionaryScreen { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -11,17 +11,19 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.settings.Defaults
|
import helium314.keyboard.latin.settings.Defaults
|
||||||
import helium314.keyboard.latin.settings.Settings
|
import helium314.keyboard.latin.settings.Settings
|
||||||
|
import helium314.keyboard.latin.utils.JniUtils
|
||||||
import helium314.keyboard.latin.utils.Log
|
import helium314.keyboard.latin.utils.Log
|
||||||
import helium314.keyboard.latin.utils.getActivity
|
import helium314.keyboard.latin.utils.getActivity
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.SettingsContainer
|
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.SearchSettingsScreen
|
import helium314.keyboard.settings.SearchSettingsScreen
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.preferences.SliderPreference
|
import helium314.keyboard.settings.preferences.SliderPreference
|
||||||
import helium314.keyboard.settings.preferences.SwitchPreference
|
import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun GestureTypingScreen(
|
fun GestureTypingScreen(
|
||||||
|
@ -112,8 +114,9 @@ fun createGestureTypingSettings(context: Context) = listOf(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
SettingsActivity.settingsContainer = SettingsContainer(LocalContext.current)
|
JniUtils.sHaveGestureLib = true
|
||||||
Theme(true) {
|
initPreview(LocalContext.current)
|
||||||
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
GestureTypingScreen { }
|
GestureTypingScreen { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
@ -23,6 +24,7 @@ import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.common.Constants.Separators
|
import helium314.keyboard.latin.common.Constants.Separators
|
||||||
|
@ -45,7 +47,10 @@ import helium314.keyboard.latin.utils.locale
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.SearchScreen
|
import helium314.keyboard.settings.SearchScreen
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.SubtypeDialog
|
import helium314.keyboard.settings.dialogs.SubtypeDialog
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -167,3 +172,14 @@ private fun getSortedSubtypes(context: Context): List<InputMethodSubtype> {
|
||||||
)
|
)
|
||||||
return SubtypeSettings.getAllAvailableSubtypes().sortedWith(subtypeSortComparator)
|
return SubtypeSettings.getAllAvailableSubtypes().sortedWith(subtypeSortComparator)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
initPreview(LocalContext.current)
|
||||||
|
Theme(previewDark) {
|
||||||
|
Surface {
|
||||||
|
LanguageScreen { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -23,13 +23,14 @@ import helium314.keyboard.latin.utils.JniUtils
|
||||||
import helium314.keyboard.latin.utils.SubtypeSettings
|
import helium314.keyboard.latin.utils.SubtypeSettings
|
||||||
import helium314.keyboard.latin.utils.displayName
|
import helium314.keyboard.latin.utils.displayName
|
||||||
import helium314.keyboard.latin.utils.getActivity
|
import helium314.keyboard.latin.utils.getActivity
|
||||||
import helium314.keyboard.latin.utils.prefs
|
|
||||||
import helium314.keyboard.latin.utils.switchTo
|
import helium314.keyboard.latin.utils.switchTo
|
||||||
import helium314.keyboard.settings.NextScreenIcon
|
import helium314.keyboard.settings.NextScreenIcon
|
||||||
import helium314.keyboard.settings.preferences.Preference
|
import helium314.keyboard.settings.preferences.Preference
|
||||||
import helium314.keyboard.settings.preferences.PreferenceCategory
|
import helium314.keyboard.settings.preferences.PreferenceCategory
|
||||||
import helium314.keyboard.settings.SearchSettingsScreen
|
import helium314.keyboard.settings.SearchSettingsScreen
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MainSettingsScreen(
|
fun MainSettingsScreen(
|
||||||
|
@ -146,7 +147,8 @@ fun MainSettingsScreen(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewScreen() {
|
private fun PreviewScreen() {
|
||||||
Theme(true) {
|
initPreview(LocalContext.current)
|
||||||
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
MainSettingsScreen({}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {})
|
MainSettingsScreen({}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {})
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,14 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.common.splitOnWhitespace
|
import helium314.keyboard.latin.common.splitOnWhitespace
|
||||||
|
@ -25,6 +27,9 @@ import helium314.keyboard.latin.utils.locale
|
||||||
import helium314.keyboard.settings.NextScreenIcon
|
import helium314.keyboard.settings.NextScreenIcon
|
||||||
import helium314.keyboard.settings.SearchScreen
|
import helium314.keyboard.settings.SearchScreen
|
||||||
import helium314.keyboard.settings.SettingsDestination
|
import helium314.keyboard.settings.SettingsDestination
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.TreeSet
|
import java.util.TreeSet
|
||||||
|
|
||||||
|
@ -83,3 +88,14 @@ fun getSortedDictionaryLocales(): TreeSet<Locale> {
|
||||||
sortedLocales.addAll(getSystemLocales())
|
sortedLocales.addAll(getSystemLocales())
|
||||||
return sortedLocales
|
return sortedLocales
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
initPreview(LocalContext.current)
|
||||||
|
Theme(previewDark) {
|
||||||
|
Surface {
|
||||||
|
PersonalDictionariesScreen { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import helium314.keyboard.latin.utils.SubtypeSettings
|
||||||
import helium314.keyboard.latin.utils.getActivity
|
import helium314.keyboard.latin.utils.getActivity
|
||||||
import helium314.keyboard.latin.utils.locale
|
import helium314.keyboard.latin.utils.locale
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.SettingsContainer
|
|
||||||
import helium314.keyboard.settings.preferences.ListPreference
|
import helium314.keyboard.settings.preferences.ListPreference
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.preferences.ReorderSwitchPreference
|
import helium314.keyboard.settings.preferences.ReorderSwitchPreference
|
||||||
|
@ -28,7 +27,9 @@ import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.preferences.SliderPreference
|
import helium314.keyboard.settings.preferences.SliderPreference
|
||||||
import helium314.keyboard.settings.preferences.SwitchPreference
|
import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PreferencesScreen(
|
fun PreferencesScreen(
|
||||||
|
@ -186,8 +187,8 @@ private val localesWithLocalizedNumberRow = listOf("ar", "bn", "fa", "gu", "hi",
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun Preview() {
|
private fun Preview() {
|
||||||
SettingsActivity.settingsContainer = SettingsContainer(LocalContext.current)
|
initPreview(LocalContext.current)
|
||||||
Theme(true) {
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
PreferencesScreen { }
|
PreferencesScreen { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
package helium314.keyboard.settings.screens
|
package helium314.keyboard.settings.screens
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
@ -10,6 +11,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.settings.Settings
|
import helium314.keyboard.latin.settings.Settings
|
||||||
import helium314.keyboard.latin.utils.LayoutType
|
import helium314.keyboard.latin.utils.LayoutType
|
||||||
|
@ -22,8 +24,11 @@ import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.SearchSettingsScreen
|
import helium314.keyboard.settings.SearchSettingsScreen
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.LayoutPickerDialog
|
import helium314.keyboard.settings.dialogs.LayoutPickerDialog
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.preferences.Preference
|
import helium314.keyboard.settings.preferences.Preference
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SecondaryLayoutScreen(
|
fun SecondaryLayoutScreen(
|
||||||
|
@ -62,3 +67,14 @@ fun createLayoutSettings(context: Context) = LayoutType.entries.filter { it != L
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
initPreview(LocalContext.current)
|
||||||
|
Theme(previewDark) {
|
||||||
|
Surface {
|
||||||
|
SecondaryLayoutScreen { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ import helium314.keyboard.latin.utils.Log
|
||||||
import helium314.keyboard.latin.utils.getActivity
|
import helium314.keyboard.latin.utils.getActivity
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.NextScreenIcon
|
import helium314.keyboard.settings.NextScreenIcon
|
||||||
import helium314.keyboard.settings.SettingsContainer
|
|
||||||
import helium314.keyboard.settings.preferences.ListPreference
|
import helium314.keyboard.settings.preferences.ListPreference
|
||||||
import helium314.keyboard.settings.SettingsWithoutKey
|
import helium314.keyboard.settings.SettingsWithoutKey
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
|
@ -36,7 +35,9 @@ import helium314.keyboard.settings.SettingsDestination
|
||||||
import helium314.keyboard.settings.preferences.SwitchPreference
|
import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TextCorrectionScreen(
|
fun TextCorrectionScreen(
|
||||||
|
@ -203,8 +204,8 @@ fun createCorrectionSettings(context: Context) = listOf(
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreferencePreview() {
|
private fun PreferencePreview() {
|
||||||
SettingsActivity.settingsContainer = SettingsContainer(LocalContext.current)
|
initPreview(LocalContext.current)
|
||||||
Theme(true) {
|
Theme(previewDark) {
|
||||||
Surface {
|
Surface {
|
||||||
TextCorrectionScreen { }
|
TextCorrectionScreen { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,17 +27,16 @@ import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.settings.Defaults
|
import helium314.keyboard.latin.settings.Defaults
|
||||||
import helium314.keyboard.latin.settings.Settings
|
import helium314.keyboard.latin.settings.Settings
|
||||||
import helium314.keyboard.settings.SettingsContainer
|
|
||||||
import helium314.keyboard.settings.SettingsWithoutKey
|
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.preferences.Preference
|
import helium314.keyboard.settings.preferences.Preference
|
||||||
import helium314.keyboard.settings.preferences.ReorderSwitchPreference
|
import helium314.keyboard.settings.preferences.ReorderSwitchPreference
|
||||||
import helium314.keyboard.settings.SearchSettingsScreen
|
import helium314.keyboard.settings.SearchSettingsScreen
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
|
||||||
import helium314.keyboard.settings.preferences.SwitchPreference
|
import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.ToolbarKeysCustomizer
|
import helium314.keyboard.settings.dialogs.ToolbarKeysCustomizer
|
||||||
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
import helium314.keyboard.settings.keyboardNeedsReload
|
||||||
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ToolbarScreen(
|
fun ToolbarScreen(
|
||||||
|
@ -102,18 +101,6 @@ fun createToolbarSettings(context: Context) = listOf(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@Preview
|
|
||||||
@Composable
|
|
||||||
private fun Preview() {
|
|
||||||
SettingsActivity.settingsContainer = SettingsContainer(LocalContext.current)
|
|
||||||
KeyboardIconsSet.instance.loadIcons(LocalContext.current)
|
|
||||||
Theme(true) {
|
|
||||||
Surface {
|
|
||||||
ToolbarScreen { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun KeyboardIconsSet.GetIcon(name: String?) {
|
fun KeyboardIconsSet.GetIcon(name: String?) {
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
|
@ -127,3 +114,14 @@ fun KeyboardIconsSet.GetIcon(name: String?) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
initPreview(LocalContext.current)
|
||||||
|
Theme(previewDark) {
|
||||||
|
Surface {
|
||||||
|
ToolbarScreen { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue