abouttreesummaryrefslogcommitdiff
path: root/srcs
diff options
context:
space:
mode:
Diffstat (limited to 'srcs')
-rw-r--r--srcs/juloo.keyboard2/Config.java10
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java21
2 files changed, 20 insertions, 11 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index e24f339..b6eb4b9 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -66,6 +66,7 @@ final class Config
public final IKeyEventHandler handler;
public boolean orientation_landscape = false;
+ public int current_layout; // Index in 'layouts' of the currently used layout
private Config(SharedPreferences prefs, Resources res, IKeyEventHandler h)
{
@@ -154,6 +155,15 @@ final class Config
extra_keys_param = ExtraKeysPreference.get_extra_keys(_prefs);
extra_keys_custom = CustomExtraKeysPreference.get(_prefs);
pin_entry_enabled = _prefs.getBoolean("pin_entry_enabled", true);
+ current_layout = _prefs.getInt("current_layout", 0);
+ }
+
+ public void set_current_layout(int l)
+ {
+ current_layout = l;
+ SharedPreferences.Editor e = _prefs.edit();
+ e.putInt("current_layout", l);
+ e.apply();
}
KeyValue action_key()
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index 5720f64..a0766ab 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -29,11 +29,9 @@ public class Keyboard2 extends InputMethodService
{
private Keyboard2View _keyboardView;
private KeyEventHandler _keyeventhandler;
- // If not 'null', the layout to use instead of [_currentTextLayout].
+ /** If not 'null', the layout to use instead of [_config.current_layout]. */
private KeyboardData _currentSpecialLayout;
- /** Current layout index in [Config.layouts]. */
- private int _currentTextLayout;
- // Layout associated with the currently selected locale. Not 'null'.
+ /** Layout associated with the currently selected locale. Not 'null'. */
private KeyboardData _localeTextLayout;
private ViewGroup _emojiPane = null;
public int actionId; // Action performed by the Action key.
@@ -46,10 +44,11 @@ public class Keyboard2 extends InputMethodService
if (_currentSpecialLayout != null)
return _currentSpecialLayout;
KeyboardData layout = null;
- if (_currentTextLayout >= _config.layouts.size())
- _currentTextLayout = 0;
- if (_currentTextLayout < _config.layouts.size())
- layout = _config.layouts.get(_currentTextLayout);
+ int layout_i = _config.current_layout;
+ if (layout_i >= _config.layouts.size())
+ layout_i = 0;
+ if (layout_i < _config.layouts.size())
+ layout = _config.layouts.get(layout_i);
if (layout == null)
layout = _localeTextLayout;
return layout;
@@ -63,9 +62,9 @@ public class Keyboard2 extends InputMethodService
void setTextLayout(int l)
{
- if (l == _currentTextLayout)
+ if (l == _config.current_layout)
return;
- _currentTextLayout = l;
+ _config.set_current_layout(l);
_currentSpecialLayout = null;
_keyboardView.setKeyboard(current_layout());
}
@@ -73,7 +72,7 @@ public class Keyboard2 extends InputMethodService
void incrTextLayout(int delta)
{
int s = _config.layouts.size();
- setTextLayout((_currentTextLayout + delta + s) % s);
+ setTextLayout((_config.current_layout + delta + s) % s);
}
void setSpecialLayout(KeyboardData l)