abouttreesummaryrefslogcommitdiff
path: root/srcs
diff options
context:
space:
mode:
Diffstat (limited to 'srcs')
-rw-r--r--srcs/juloo.keyboard2/Autocapitalisation.java7
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java32
2 files changed, 22 insertions, 17 deletions
diff --git a/srcs/juloo.keyboard2/Autocapitalisation.java b/srcs/juloo.keyboard2/Autocapitalisation.java
index 1a339e0..2493771 100644
--- a/srcs/juloo.keyboard2/Autocapitalisation.java
+++ b/srcs/juloo.keyboard2/Autocapitalisation.java
@@ -108,6 +108,13 @@ final class Autocapitalisation
{
if (new_cursor == _cursor) // Just typing
return;
+ if (new_cursor == 0)
+ {
+ // Detect whether the input box has been cleared
+ CharSequence t = _ic.getTextAfterCursor(1, 0);
+ if (t != null && t.equals(""))
+ _should_update_caps_mode = true;
+ }
_cursor = new_cursor;
_should_enable_shift = false;
callback(true);
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index 422548a..e613925 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -19,6 +19,8 @@ public class Keyboard2View extends View
implements View.OnTouchListener, Pointers.IPointerEventHandler
{
private KeyboardData _keyboard;
+ private KeyValue _shift_kv;
+ private KeyboardData.Key _shift_key;
private Pointers _pointers;
@@ -79,6 +81,13 @@ public class Keyboard2View extends View
public void setKeyboard(KeyboardData kw)
{
_keyboard = _config.modify_layout(kw);
+ _shift_kv = KeyValue.getKeyByName("shift");
+ _shift_key = _keyboard.findKeyWithValue(_shift_kv);
+ if (_shift_key == null)
+ {
+ _shift_kv = _shift_kv.withFlags(_shift_kv.getFlags() | KeyValue.FLAG_LOCK);
+ _shift_key = _keyboard.findKeyWithValue(_shift_kv);
+ }
reset();
}
@@ -93,24 +102,13 @@ public class Keyboard2View extends View
/** Called by auto-capitalisation. */
public void set_shift_state(boolean state)
{
- if (_keyboard == null)
+ if (_keyboard == null || _shift_key == null)
return;
- KeyValue shift = KeyValue.getKeyByName("shift");
- KeyboardData.Key key = _keyboard.findKeyWithValue(shift);
- if (key == null)
- {
- // Lookup again for the lockable shift key, which is a different value.
- shift = shift.withFlags(shift.getFlags() | KeyValue.FLAG_LOCK);
- key = _keyboard.findKeyWithValue(shift);
- }
- if (key != null)
- {
- if (state)
- _pointers.add_fake_pointer(shift, key);
- else
- _pointers.remove_fake_pointer(shift, key);
- invalidate();
- }
+ if (state)
+ _pointers.add_fake_pointer(_shift_kv, _shift_key);
+ else
+ _pointers.remove_fake_pointer(_shift_kv, _shift_key);
+ invalidate();
}
public KeyValue modifyKey(KeyValue k, Pointers.Modifiers mods)