mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-12-25 07:29:03 +01:00
Add an option to toggle accent keys
These keys are not useful at all in English. A new option allows to hide them, [false] by default.
This commit is contained in:
parent
0b1befcc88
commit
eac74d3f22
@ -34,4 +34,6 @@
|
|||||||
<string name="pref_key_height_summary">%sdp</string>
|
<string name="pref_key_height_summary">%sdp</string>
|
||||||
<string name="pref_horizontal_margin_title">Horizontal margin</string>
|
<string name="pref_horizontal_margin_title">Horizontal margin</string>
|
||||||
<string name="pref_horizontal_margin_summary">%sdp</string>
|
<string name="pref_horizontal_margin_summary">%sdp</string>
|
||||||
|
<string name="pref_disable_accent_keys_title">Toggle accent keys</string>
|
||||||
|
<string name="pref_disable_accent_keys_summary">Whether to remove the accent keys from the keyboard.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -9,6 +9,12 @@
|
|||||||
android:entries="@array/pref_layout_entries"
|
android:entries="@array/pref_layout_entries"
|
||||||
android:entryValues="@array/pref_layout_values"
|
android:entryValues="@array/pref_layout_values"
|
||||||
/>
|
/>
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="disable_accent_keys"
|
||||||
|
android:title="@string/pref_disable_accent_keys_title"
|
||||||
|
android:summary="@string/pref_disable_accent_keys_summary"
|
||||||
|
android:defaultValue="false"
|
||||||
|
/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/pref_category_typing">
|
<PreferenceCategory android:title="@string/pref_category_typing">
|
||||||
<juloo.common.SlideBarPreference
|
<juloo.common.SlideBarPreference
|
||||||
|
@ -9,7 +9,6 @@ class Config
|
|||||||
{
|
{
|
||||||
private Keyboard2 _context;
|
private Keyboard2 _context;
|
||||||
|
|
||||||
|
|
||||||
public final float marginTop;
|
public final float marginTop;
|
||||||
public final float keyPadding;
|
public final float keyPadding;
|
||||||
public final float keyBgPadding;
|
public final float keyBgPadding;
|
||||||
@ -23,6 +22,7 @@ class Config
|
|||||||
public float marginBottom;
|
public float marginBottom;
|
||||||
public float keyHeight;
|
public float keyHeight;
|
||||||
public float horizontalMargin;
|
public float horizontalMargin;
|
||||||
|
public boolean disableAccentKeys;
|
||||||
|
|
||||||
public Config(Keyboard2 context)
|
public Config(Keyboard2 context)
|
||||||
{
|
{
|
||||||
@ -43,6 +43,7 @@ class Config
|
|||||||
marginBottom = res.getDimension(R.dimen.margin_bottom);
|
marginBottom = res.getDimension(R.dimen.margin_bottom);
|
||||||
keyHeight = res.getDimension(R.dimen.key_height);
|
keyHeight = res.getDimension(R.dimen.key_height);
|
||||||
horizontalMargin = res.getDimension(R.dimen.horizontal_margin);
|
horizontalMargin = res.getDimension(R.dimen.horizontal_margin);
|
||||||
|
disableAccentKeys = false;
|
||||||
// from prefs
|
// from prefs
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
@ -62,6 +63,7 @@ class Config
|
|||||||
marginBottom = getDipPref(prefs, "margin_bottom", marginBottom);
|
marginBottom = getDipPref(prefs, "margin_bottom", marginBottom);
|
||||||
keyHeight = getDipPref(prefs, "key_height", keyHeight);
|
keyHeight = getDipPref(prefs, "key_height", keyHeight);
|
||||||
horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin);
|
horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin);
|
||||||
|
disableAccentKeys = prefs.getBoolean("disable_accent_keys", disableAccentKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getDipPref(SharedPreferences prefs, String pref_name, float def)
|
private float getDipPref(SharedPreferences prefs, String pref_name, float def)
|
||||||
|
@ -33,6 +33,9 @@ class KeyValue
|
|||||||
public static final int FLAG_ACCENT5 = (1 << 20);
|
public static final int FLAG_ACCENT5 = (1 << 20);
|
||||||
public static final int FLAG_ACCENT6 = (1 << 21);
|
public static final int FLAG_ACCENT6 = (1 << 21);
|
||||||
|
|
||||||
|
public static final int FLAGS_ACCENTS = FLAG_ACCENT1 | FLAG_ACCENT2 |
|
||||||
|
FLAG_ACCENT3 | FLAG_ACCENT4 | FLAG_ACCENT5 | FLAG_ACCENT6;
|
||||||
|
|
||||||
private String _name;
|
private String _name;
|
||||||
private String _symbol;
|
private String _symbol;
|
||||||
private char _char;
|
private char _char;
|
||||||
|
@ -43,6 +43,27 @@ class KeyboardData
|
|||||||
return (_rows);
|
return (_rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove every keys that has the given flags.
|
||||||
|
public void removeKeysByFlag(int flags)
|
||||||
|
{
|
||||||
|
for (Row r : _rows)
|
||||||
|
{
|
||||||
|
for (Key k : r)
|
||||||
|
{
|
||||||
|
k.key0 = _removeKeyValueFlag(k.key0, flags);
|
||||||
|
k.key1 = _removeKeyValueFlag(k.key1, flags);
|
||||||
|
k.key2 = _removeKeyValueFlag(k.key2, flags);
|
||||||
|
k.key3 = _removeKeyValueFlag(k.key3, flags);
|
||||||
|
k.key4 = _removeKeyValueFlag(k.key4, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private KeyValue _removeKeyValueFlag(KeyValue v, int flags)
|
||||||
|
{
|
||||||
|
return (v != null && (v.getFlags() & flags) != 0) ? null : v;
|
||||||
|
}
|
||||||
|
|
||||||
public class Row extends ArrayList<Key>
|
public class Row extends ArrayList<Key>
|
||||||
{
|
{
|
||||||
private float _keysWidth;
|
private float _keysWidth;
|
||||||
|
Loading…
Reference in New Issue
Block a user