Fix action key not being set by default

This commit is contained in:
Aleksandras Kostarevas 2024-07-23 11:55:00 +03:00
parent a3eae09dfd
commit 4ee33fb365
2 changed files with 10 additions and 1 deletions

View File

@ -29,6 +29,7 @@ import org.futo.inputmethod.compat.AppWorkaroundsUtils;
import org.futo.inputmethod.latin.InputAttributes; import org.futo.inputmethod.latin.InputAttributes;
import org.futo.inputmethod.latin.R; import org.futo.inputmethod.latin.R;
import org.futo.inputmethod.latin.uix.actions.ActionRegistry; import org.futo.inputmethod.latin.uix.actions.ActionRegistry;
import org.futo.inputmethod.latin.uix.actions.RegistryKt;
import org.futo.inputmethod.latin.utils.AsyncResultHolder; import org.futo.inputmethod.latin.utils.AsyncResultHolder;
import org.futo.inputmethod.latin.utils.ResourceUtils; import org.futo.inputmethod.latin.utils.ResourceUtils;
import org.futo.inputmethod.latin.utils.TargetPackageInfoGetterTask; import org.futo.inputmethod.latin.utils.TargetPackageInfoGetterTask;
@ -147,7 +148,11 @@ public class SettingsValues {
mIncludesOtherImesInLanguageSwitchList = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS mIncludesOtherImesInLanguageSwitchList = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS
? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false) ? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false)
: true /* forcibly */; : true /* forcibly */;
mActionKeyId = ActionRegistry.INSTANCE.actionStringIdToIdx(prefs.getString(Settings.PREF_ACTION_KEY_ID, "")); mActionKeyId = ActionRegistry.INSTANCE.actionStringIdToIdx(
prefs.getString(
Settings.PREF_ACTION_KEY_ID,
RegistryKt.getDefaultActionKey()
));
mShowsActionKey = mActionKeyId != -1; mShowsActionKey = mActionKeyId != -1;
mIsNumberRowEnabled = prefs.getBoolean(Settings.PREF_ENABLE_NUMBER_ROW, false); mIsNumberRowEnabled = prefs.getBoolean(Settings.PREF_ENABLE_NUMBER_ROW, false);
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true); mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);

View File

@ -235,6 +235,10 @@ val DefaultActionSettings = mapOf(
ActionCategory.Disabled to listOf(MemoryDebugAction, SystemVoiceInputAction) ActionCategory.Disabled to listOf(MemoryDebugAction, SystemVoiceInputAction)
) )
val DefaultActionKey = DefaultActionSettings[ActionCategory.ActionKey]!!.firstOrNull()?.let {
ActionRegistry.actionToStringId(it)
} ?: ""
val ActionsSettings = SettingsKey( val ActionsSettings = SettingsKey(
stringPreferencesKey("actions_settings_map"), stringPreferencesKey("actions_settings_map"),
DefaultActionSettings.flattenToActionEditorItems().ensureWellFormed().serializeActionEditorItemListToString() DefaultActionSettings.flattenToActionEditorItems().ensureWellFormed().serializeActionEditorItemListToString()