mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-11-22 15:23:11 +01:00
Clicking twice on CTRL or ALT will lock them in 'ON' state (#72)
* Clicking twice on CTRL or ALT will lock them in 'ON' state * Make Locking behaviour optional, configurable in preferences * Nest the new settings into a different page To avoid spamming the settings page and repetition in the summaries. Cannot be a popup unfortunately because that would require API >= 11. * Add Fn and Meta Co-authored-by: Jules Aguillon <jules@j3s.fr>
This commit is contained in:
parent
e92504ae92
commit
5404e7432d
@ -21,6 +21,8 @@
|
|||||||
<string name="pref_vibrate_duration_title">Duration</string>
|
<string name="pref_vibrate_duration_title">Duration</string>
|
||||||
<string name="pref_precise_repeat_title">Precise cursor movements</string>
|
<string name="pref_precise_repeat_title">Precise cursor movements</string>
|
||||||
<string name="pref_precise_repeat_summary">Modulate key repeat speed by swiping more or less</string>
|
<string name="pref_precise_repeat_summary">Modulate key repeat speed by swiping more or less</string>
|
||||||
|
<string name="pref_lockable_keys_title">Lockable modifiers</string>
|
||||||
|
<string name="pref_lockable_keys_summary">Modifier that can be locked by typing them twice</string>
|
||||||
<string name="pref_category_style">Style</string>
|
<string name="pref_category_style">Style</string>
|
||||||
<string name="pref_margin_bottom_title">Margin bottom</string>
|
<string name="pref_margin_bottom_title">Margin bottom</string>
|
||||||
<string name="pref_keyboard_height_title">Keyboard height</string>
|
<string name="pref_keyboard_height_title">Keyboard height</string>
|
||||||
|
@ -9,6 +9,13 @@
|
|||||||
<juloo.common.IntSlideBarPreference android:key="longpress_timeout" android:title="@string/pref_long_timeout_title" android:summary="%sms" android:defaultValue="600" min="50" max="2000"/>
|
<juloo.common.IntSlideBarPreference android:key="longpress_timeout" android:title="@string/pref_long_timeout_title" android:summary="%sms" android:defaultValue="600" min="50" max="2000"/>
|
||||||
<juloo.common.IntSlideBarPreference android:key="longpress_interval" android:title="@string/pref_long_interval_title" android:summary="%sms" android:defaultValue="25" min="5" max="100"/>
|
<juloo.common.IntSlideBarPreference android:key="longpress_interval" android:title="@string/pref_long_interval_title" android:summary="%sms" android:defaultValue="25" min="5" max="100"/>
|
||||||
<CheckBoxPreference android:key="precise_repeat" android:title="@string/pref_precise_repeat_title" android:summary="@string/pref_precise_repeat_summary" android:defaultValue="true"/>
|
<CheckBoxPreference android:key="precise_repeat" android:title="@string/pref_precise_repeat_title" android:summary="@string/pref_precise_repeat_summary" android:defaultValue="true"/>
|
||||||
|
<PreferenceScreen android:title="@string/pref_lockable_keys_title" android:summary="@string/pref_lockable_keys_summary">
|
||||||
|
<CheckBoxPreference android:key="lockable_shift" android:title="Shift" android:defaultValue="true"/>
|
||||||
|
<CheckBoxPreference android:key="lockable_ctrl" android:title="Ctrl" android:defaultValue="false"/>
|
||||||
|
<CheckBoxPreference android:key="lockable_alt" android:title="Alt" android:defaultValue="false"/>
|
||||||
|
<CheckBoxPreference android:key="lockable_fn" android:title="Fn" android:defaultValue="false"/>
|
||||||
|
<CheckBoxPreference android:key="lockable_meta" android:title="Meta" android:defaultValue="false"/>
|
||||||
|
</PreferenceScreen>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/pref_category_vibrate">
|
<PreferenceCategory android:title="@string/pref_category_vibrate">
|
||||||
<CheckBoxPreference android:key="vibrate_enabled" android:title="@string/pref_vibrate_title" android:summary="@string/pref_vibrate_summary" android:defaultValue="true"/>
|
<CheckBoxPreference android:key="vibrate_enabled" android:title="@string/pref_vibrate_title" android:summary="@string/pref_vibrate_summary" android:defaultValue="true"/>
|
||||||
|
@ -33,6 +33,7 @@ final class Config
|
|||||||
public float keyVerticalInterval;
|
public float keyVerticalInterval;
|
||||||
public float keyHorizontalInterval;
|
public float keyHorizontalInterval;
|
||||||
public boolean preciseRepeat;
|
public boolean preciseRepeat;
|
||||||
|
public int lockable_modifiers;
|
||||||
public float characterSize; // Ratio
|
public float characterSize; // Ratio
|
||||||
public int accents; // Values are R.values.pref_accents_v_*
|
public int accents; // Values are R.values.pref_accents_v_*
|
||||||
public int theme; // Values are R.style.*
|
public int theme; // Values are R.style.*
|
||||||
@ -114,6 +115,12 @@ final class Config
|
|||||||
keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4;
|
keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4;
|
||||||
horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin) + res.getDimension(R.dimen.extra_horizontal_margin);
|
horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin) + res.getDimension(R.dimen.extra_horizontal_margin);
|
||||||
preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat);
|
preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat);
|
||||||
|
lockable_modifiers =
|
||||||
|
(prefs.getBoolean("lockable_shift", true) ? KeyValue.FLAG_SHIFT : 0)
|
||||||
|
| (prefs.getBoolean("lockable_ctrl", false) ? KeyValue.FLAG_CTRL : 0)
|
||||||
|
| (prefs.getBoolean("lockable_alt", false) ? KeyValue.FLAG_ALT : 0)
|
||||||
|
| (prefs.getBoolean("lockable_fn", false) ? KeyValue.FLAG_FN : 0)
|
||||||
|
| (prefs.getBoolean("lockable_meta", false) ? KeyValue.FLAG_META : 0);
|
||||||
characterSize = prefs.getFloat("character_size", characterSize);
|
characterSize = prefs.getFloat("character_size", characterSize);
|
||||||
accents = Integer.valueOf(prefs.getString("accents", "1"));
|
accents = Integer.valueOf(prefs.getString("accents", "1"));
|
||||||
theme = getThemeId(res, prefs.getString("theme", ""));
|
theme = getThemeId(res, prefs.getString("theme", ""));
|
||||||
@ -143,8 +150,13 @@ final class Config
|
|||||||
return (swapEnterActionKey && action_key != null) ?
|
return (swapEnterActionKey && action_key != null) ?
|
||||||
KeyValue.getKeyByName("enter") : action_key;
|
KeyValue.getKeyByName("enter") : action_key;
|
||||||
default:
|
default:
|
||||||
|
if (key.flags != 0)
|
||||||
|
{
|
||||||
if ((key.flags & key_flags_to_remove) != 0)
|
if ((key.flags & key_flags_to_remove) != 0)
|
||||||
return null;
|
return null;
|
||||||
|
if ((key.flags & lockable_modifiers) != 0)
|
||||||
|
return key.withFlags(key.flags | KeyValue.FLAG_LOCK);
|
||||||
|
}
|
||||||
return key;
|
return key;
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,11 @@ class KeyValue
|
|||||||
return new KeyValue(name, s, c, eventCode, flags);
|
return new KeyValue(name, s, c, eventCode, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public KeyValue withFlags(int f)
|
||||||
|
{
|
||||||
|
return new KeyValue(name, symbol, char_, eventCode, f);
|
||||||
|
}
|
||||||
|
|
||||||
private static HashMap<String, KeyValue> keys = new HashMap<String, KeyValue>();
|
private static HashMap<String, KeyValue> keys = new HashMap<String, KeyValue>();
|
||||||
|
|
||||||
public KeyValue(String n, String s, char c, int e, int f)
|
public KeyValue(String n, String s, char c, int e, int f)
|
||||||
@ -154,7 +159,7 @@ class KeyValue
|
|||||||
static
|
static
|
||||||
{
|
{
|
||||||
addModifierKey("shift", "\uE808",
|
addModifierKey("shift", "\uE808",
|
||||||
FLAG_LOCK | FLAG_SHIFT | FLAG_KEY_FONT | FLAG_SMALLER_FONT);
|
FLAG_SHIFT | FLAG_KEY_FONT | FLAG_SMALLER_FONT);
|
||||||
addModifierKey("ctrl", "Ctrl", FLAG_CTRL | FLAG_SMALLER_FONT);
|
addModifierKey("ctrl", "Ctrl", FLAG_CTRL | FLAG_SMALLER_FONT);
|
||||||
addModifierKey("alt", "Alt", FLAG_ALT | FLAG_SMALLER_FONT);
|
addModifierKey("alt", "Alt", FLAG_ALT | FLAG_SMALLER_FONT);
|
||||||
addModifierKey("accent_aigu", "◌́", FLAG_ACCENT2);
|
addModifierKey("accent_aigu", "◌́", FLAG_ACCENT2);
|
||||||
|
Loading…
Reference in New Issue
Block a user