Hotkey configuration issues (#282)
* the 'show settings' hotkey can now be nulled out * fixed hotkey status becoming indeterminate and sometimes impossible to change after unsetting all, then resetting all to default * user manual update
This commit is contained in:
parent
d1cf456996
commit
ea1cc663d4
6 changed files with 19 additions and 17 deletions
|
|
@ -88,7 +88,7 @@ public class TraditionalT9 extends KeyPadHandler {
|
|||
|
||||
|
||||
private void validateFunctionKeys() {
|
||||
if (settings.isSettingsKeyMissing()) {
|
||||
if (settings.areHotkeysInitialized()) {
|
||||
Hotkeys.setDefault(settings);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ public class PreferencesActivity extends AppCompatActivity implements Preference
|
|||
|
||||
|
||||
private void validateFunctionKeys() {
|
||||
if (settings.isSettingsKeyMissing()) {
|
||||
if (settings.areHotkeysInitialized()) {
|
||||
Hotkeys.setDefault(settings);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue