abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Keyboard2.java
diff options
context:
space:
mode:
authorJules Aguillon2023-07-29 17:29:45 +0200
committerJules Aguillon2023-07-29 17:29:45 +0200
commitfce8ff7ce2920861804ccfd3e3e7cb0ff3165a33 (patch)
tree0f870b212d01b51906e2d0c44af50b3ecbe7f531 /srcs/juloo.keyboard2/Keyboard2.java
parentd1f0d5a7bf99e36bb7c7aa082d208bb54e73c118 (diff)
downloadunexpected-keyboard-fce8ff7ce2920861804ccfd3e3e7cb0ff3165a33.tar.gz
unexpected-keyboard-fce8ff7ce2920861804ccfd3e3e7cb0ff3165a33.zip
Add option to disable pin entry layout
The pin entry layout might be inferior for some usecases and people might be more used to the numeric layout.
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2.java')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index 48e60db..3606213 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -71,6 +71,12 @@ public class Keyboard2 extends InputMethodService
return KeyboardData.load(getResources(), layout_id);
}
+ /** Load a layout that contains a numpad (eg. the pin entry). */
+ KeyboardData loadNumpad(int layout_id)
+ {
+ return _config.modify_numpad(KeyboardData.load(getResources(), layout_id));
+ }
+
@Override
public void onCreate()
{
@@ -154,7 +160,7 @@ public class Keyboard2 extends InputMethodService
}
}
if (default_layout == null)
- default_layout = KeyboardData.load(getResources(), R.xml.latn_qwerty_us);
+ default_layout = loadLayout(R.xml.latn_qwerty_us);
_localeTextLayout = default_layout;
if (_config.second_layout == null)
{
@@ -235,20 +241,21 @@ public class Keyboard2 extends InputMethodService
return null;
}
- private void refresh_special_layout(EditorInfo info)
+ private KeyboardData refresh_special_layout(EditorInfo info)
{
switch (info.inputType & InputType.TYPE_MASK_CLASS)
{
case InputType.TYPE_CLASS_NUMBER:
case InputType.TYPE_CLASS_PHONE:
case InputType.TYPE_CLASS_DATETIME:
- _currentSpecialLayout =
- _config.modify_numpad(KeyboardData.load(getResources(), R.xml.pin));
- break;
+ if (_config.pin_entry_enabled)
+ return loadNumpad(R.xml.pin);
+ else
+ return loadNumpad(R.xml.numeric);
default:
- _currentSpecialLayout = null;
break;
}
+ return null;
}
@Override
@@ -256,7 +263,7 @@ public class Keyboard2 extends InputMethodService
{
refresh_config();
refresh_action_label(info);
- refresh_special_layout(info);
+ _currentSpecialLayout = refresh_special_layout(info);
_keyboardView.setKeyboard(current_layout());
_keyeventhandler.started(info);
setInputView(_keyboardView);
@@ -382,7 +389,7 @@ public class Keyboard2 extends InputMethodService
break;
case SWITCH_NUMERIC:
- setSpecialLayout(_config.modify_numpad(loadLayout(R.xml.numeric)));
+ setSpecialLayout(loadNumpad(R.xml.numeric));
break;
case SWITCH_EMOJI:
@@ -422,7 +429,7 @@ public class Keyboard2 extends InputMethodService
break;
case SWITCH_GREEKMATH:
- setSpecialLayout(_config.modify_numpad(loadLayout(R.xml.greekmath)));
+ setSpecialLayout(loadNumpad(R.xml.greekmath));
break;
case CAPS_LOCK: