diff --git a/docs/user-manual.md b/docs/user-manual.md index 4d893f13..e70f417d 100644 --- a/docs/user-manual.md +++ b/docs/user-manual.md @@ -89,9 +89,13 @@ _**NB2:** In messaging applications, you need to enable their "Send with ENTER" #### Add Word Key (Default: Press ✱): Add a new word to the dictionary for the current language. -#### Backspace Key (Default: Press ↩ / Back): +#### Backspace Key: Just deletes text. +If your phone has a dedicated "Del" or "Clear" key, you do not need to set anything in the Settings, unless you want to have another Backspace. In this case, the blank option: "--" will be automatically preselected. + +On phones which have a combined "Delete"/"Back", that key will be selected automatically. However, you can assign "Backspace" function to another key, so "Back" will only navigate back. + _**NB:** Using "Back" as backspace does not work in all applications, most notably Firefox and Spotify. They are able to take full control of the key and redefine its function, meaning it will do whatever the app authors intended. Unfortunately, nothing can be done, because "Back" plays a special role in Android and its usage is restricted by the system._ _**NB 2:** Holding "Back" key will always trigger the default system action (i.e. show running applications list)._ diff --git a/src/io/github/sspanak/tt9/ime/TraditionalT9.java b/src/io/github/sspanak/tt9/ime/TraditionalT9.java index 44939b0f..beb23746 100644 --- a/src/io/github/sspanak/tt9/ime/TraditionalT9.java +++ b/src/io/github/sspanak/tt9/ime/TraditionalT9.java @@ -88,7 +88,7 @@ public class TraditionalT9 extends KeyPadHandler { private void validateFunctionKeys() { - if (settings.isSettingsKeyMissing()) { + if (settings.areHotkeysInitialized()) { Hotkeys.setDefault(settings); } } diff --git a/src/io/github/sspanak/tt9/preferences/PreferencesActivity.java b/src/io/github/sspanak/tt9/preferences/PreferencesActivity.java index b86b9940..cdb94337 100644 --- a/src/io/github/sspanak/tt9/preferences/PreferencesActivity.java +++ b/src/io/github/sspanak/tt9/preferences/PreferencesActivity.java @@ -143,7 +143,7 @@ public class PreferencesActivity extends AppCompatActivity implements Preference private void validateFunctionKeys() { - if (settings.isSettingsKeyMissing()) { + if (settings.areHotkeysInitialized()) { Hotkeys.setDefault(settings); } } diff --git a/src/io/github/sspanak/tt9/preferences/SettingsStore.java b/src/io/github/sspanak/tt9/preferences/SettingsStore.java index f65390c6..653aba4d 100644 --- a/src/io/github/sspanak/tt9/preferences/SettingsStore.java +++ b/src/io/github/sspanak/tt9/preferences/SettingsStore.java @@ -156,17 +156,19 @@ public class SettingsStore { /************* function key settings *************/ - public boolean isSettingsKeyMissing() { - return getKeyShowSettings() == 0; + public boolean areHotkeysInitialized() { + return !prefs.getBoolean("hotkeys_initialized", false); } public void setDefaultKeys(int addWord, int backspace, int nextInputMode, int nextLanguage, int showSettings) { - prefsEditor.putString(SectionKeymap.ITEM_ADD_WORD, String.valueOf(addWord)); - prefsEditor.putString(SectionKeymap.ITEM_BACKSPACE, String.valueOf(backspace)); - prefsEditor.putString(SectionKeymap.ITEM_NEXT_INPUT_MODE, String.valueOf(nextInputMode)); - prefsEditor.putString(SectionKeymap.ITEM_NEXT_LANGUAGE, String.valueOf(nextLanguage)); - prefsEditor.putString(SectionKeymap.ITEM_SHOW_SETTINGS, String.valueOf(showSettings)); - prefsEditor.apply(); + prefsEditor + .putString(SectionKeymap.ITEM_ADD_WORD, String.valueOf(addWord)) + .putString(SectionKeymap.ITEM_BACKSPACE, String.valueOf(backspace)) + .putString(SectionKeymap.ITEM_NEXT_INPUT_MODE, String.valueOf(nextInputMode)) + .putString(SectionKeymap.ITEM_NEXT_LANGUAGE, String.valueOf(nextLanguage)) + .putString(SectionKeymap.ITEM_SHOW_SETTINGS, String.valueOf(showSettings)) + .putBoolean("hotkeys_initialized", true) + .apply(); } public int getFunctionKey(String functionName) { diff --git a/src/io/github/sspanak/tt9/preferences/helpers/Hotkeys.java b/src/io/github/sspanak/tt9/preferences/helpers/Hotkeys.java index 232a2204..84346a3d 100644 --- a/src/io/github/sspanak/tt9/preferences/helpers/Hotkeys.java +++ b/src/io/github/sspanak/tt9/preferences/helpers/Hotkeys.java @@ -62,7 +62,7 @@ public class Hotkeys { KeyEvent.KEYCODE_STAR, backspaceKeyCode, KeyEvent.KEYCODE_POUND, - -KeyEvent.KEYCODE_POUND, + -KeyEvent.KEYCODE_POUND, // negative means "hold" -KeyEvent.KEYCODE_STAR ); } diff --git a/src/io/github/sspanak/tt9/preferences/items/SectionKeymap.java b/src/io/github/sspanak/tt9/preferences/items/SectionKeymap.java index 7592f53c..325e3b44 100644 --- a/src/io/github/sspanak/tt9/preferences/items/SectionKeymap.java +++ b/src/io/github/sspanak/tt9/preferences/items/SectionKeymap.java @@ -35,8 +35,8 @@ public class SectionKeymap { for (DropDownPreference dropDown : items) { int keypadKey = settings.getFunctionKey(dropDown.getKey()); dropDown.setValue(String.valueOf(keypadKey)); - previewCurrentKey(dropDown); } + populate(); } @@ -50,7 +50,6 @@ public class SectionKeymap { for (DropDownPreference item : items) { onItemClick(item); } - } @@ -78,9 +77,6 @@ public class SectionKeymap { // backspace works both when pressed short and long, // so separate "hold" and "not hold" options for it make no sense && !(dropDown.getKey().equals(ITEM_BACKSPACE) && Integer.parseInt(key) < 0) - // "show settings" must always be available for the users not to lose - // access to the Settings screen - && !(dropDown.getKey().equals(ITEM_SHOW_SETTINGS) && key.equals("0")) ) { keys.add(String.valueOf(key)); }