forked from extern/Unexpected-Keyboard
Add option 'numpad_layout'
Allow choosing whether to show the high or the low digits first. The numeric pane and the numpad are affected by the option.
This commit is contained in:
parent
940fc81193
commit
c17b53ce7f
@ -16,6 +16,9 @@
|
||||
<!-- <string name="pref_show_numpad_never">Never</string> -->
|
||||
<!-- <string name="pref_show_numpad_landscape">Only in landscape mode</string> -->
|
||||
<!-- <string name="pref_show_numpad_always">Always</string> -->
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<string name="pref_autocapitalisation_title">Automatická kapitalizace</string>
|
||||
<string name="pref_autocapitalisation_summary">Stiskne Shift na začátku věty</string>
|
||||
<!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> -->
|
||||
|
@ -16,6 +16,9 @@
|
||||
<string name="pref_show_numpad_never">Nie</string>
|
||||
<string name="pref_show_numpad_landscape">Nur im Querformat</string>
|
||||
<string name="pref_show_numpad_always">Immer</string>
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<string name="pref_autocapitalisation_title">Automatische Großschreibung</string>
|
||||
<string name="pref_autocapitalisation_summary">Shift-Taste am Satzanfang aktivieren</string>
|
||||
<string name="pref_extra_keys_title">Zusätzliche Zeichen zur Tastatur hinzufügen</string>
|
||||
|
@ -16,6 +16,9 @@
|
||||
<!-- <string name="pref_show_numpad_never">Never</string> -->
|
||||
<!-- <string name="pref_show_numpad_landscape">Only in landscape mode</string> -->
|
||||
<!-- <string name="pref_show_numpad_always">Always</string> -->
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<!-- <string name="pref_autocapitalisation_title">Automatic capitalisation</string> -->
|
||||
<!-- <string name="pref_autocapitalisation_summary">Press Shift at the beginning of a sentence</string> -->
|
||||
<!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> -->
|
||||
|
@ -16,6 +16,9 @@
|
||||
<string name="pref_show_numpad_never">Jamais</string>
|
||||
<string name="pref_show_numpad_landscape">Seulement en mode paysage</string>
|
||||
<string name="pref_show_numpad_always">Toujour</string>
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<string name="pref_autocapitalisation_title">Majuscule automatique</string>
|
||||
<string name="pref_autocapitalisation_summary">Activer Shift au début des phrases</string>
|
||||
<string name="pref_extra_keys_title">Ajouter des touches au clavier</string>
|
||||
|
@ -16,6 +16,9 @@
|
||||
<!-- <string name="pref_show_numpad_never">Never</string> -->
|
||||
<!-- <string name="pref_show_numpad_landscape">Only in landscape mode</string> -->
|
||||
<!-- <string name="pref_show_numpad_always">Always</string> -->
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<string name="pref_autocapitalisation_title">Maiuscole Automatiche</string>
|
||||
<string name="pref_autocapitalisation_summary">Premi Shift all\'inizio di una frase</string>
|
||||
<!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> -->
|
||||
|
@ -16,6 +16,9 @@
|
||||
<!-- <string name="pref_show_numpad_never">Never</string> -->
|
||||
<!-- <string name="pref_show_numpad_landscape">Only in landscape mode</string> -->
|
||||
<!-- <string name="pref_show_numpad_always">Always</string> -->
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<!-- <string name="pref_autocapitalisation_title">Automatic capitalisation</string> -->
|
||||
<!-- <string name="pref_autocapitalisation_summary">Press Shift at the beginning of a sentence</string> -->
|
||||
<!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> -->
|
||||
|
@ -16,6 +16,9 @@
|
||||
<string name="pref_show_numpad_never">Nekad</string>
|
||||
<string name="pref_show_numpad_landscape">Tikai guleniskajā skatā</string>
|
||||
<string name="pref_show_numpad_always">Vienmēr</string>
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<string name="pref_autocapitalisation_title">Automātiski lielie burti</string>
|
||||
<string name="pref_autocapitalisation_summary">Piespiest Shift teikuma sākumā</string>
|
||||
<string name="pref_extra_keys_title">Pievienot tastatūrai taustiņus</string>
|
||||
|
@ -16,6 +16,9 @@
|
||||
<string name="pref_show_numpad_never">Nigdy</string>
|
||||
<string name="pref_show_numpad_landscape">Tylko w orientacji poziomej</string>
|
||||
<string name="pref_show_numpad_always">Zawsze</string>
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<string name="pref_autocapitalisation_title">Automatyczne wielkie litery</string>
|
||||
<string name="pref_autocapitalisation_summary">Naciśnij Shift na początku zdania</string>
|
||||
<string name="pref_extra_keys_title">Dodaj klawisze do klawiatury</string>
|
||||
|
@ -16,6 +16,9 @@
|
||||
<!-- <string name="pref_show_numpad_never">Never</string> -->
|
||||
<!-- <string name="pref_show_numpad_landscape">Only in landscape mode</string> -->
|
||||
<!-- <string name="pref_show_numpad_always">Always</string> -->
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<string name="pref_autocapitalisation_title">Maiusculização automática</string>
|
||||
<string name="pref_autocapitalisation_summary">Aciona o shift no início de cada frase</string>
|
||||
<!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> -->
|
||||
|
@ -16,6 +16,9 @@
|
||||
<!-- <string name="pref_show_numpad_never">Never</string> -->
|
||||
<!-- <string name="pref_show_numpad_landscape">Only in landscape mode</string> -->
|
||||
<!-- <string name="pref_show_numpad_always">Always</string> -->
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<!-- <string name="pref_autocapitalisation_title">Automatic capitalisation</string> -->
|
||||
<!-- <string name="pref_autocapitalisation_summary">Press Shift at the beginning of a sentence</string> -->
|
||||
<!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> -->
|
||||
|
@ -16,6 +16,9 @@
|
||||
<!-- <string name="pref_show_numpad_never">Never</string> -->
|
||||
<!-- <string name="pref_show_numpad_landscape">Only in landscape mode</string> -->
|
||||
<!-- <string name="pref_show_numpad_always">Always</string> -->
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<!-- <string name="pref_autocapitalisation_title">Automatic capitalisation</string> -->
|
||||
<!-- <string name="pref_autocapitalisation_summary">Press Shift at the beginning of a sentence</string> -->
|
||||
<!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> -->
|
||||
|
@ -16,6 +16,9 @@
|
||||
<string name="pref_show_numpad_never">从不</string>
|
||||
<string name="pref_show_numpad_landscape">只在横屏显示</string>
|
||||
<string name="pref_show_numpad_always">一直显示</string>
|
||||
<!-- <string name="pref_numpad_layout">NumPad layout</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> -->
|
||||
<!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> -->
|
||||
<string name="pref_autocapitalisation_title">句首自动大写</string>
|
||||
<string name="pref_autocapitalisation_summary">在句子的开头自动按下Shift</string>
|
||||
<string name="pref_extra_keys_title">选择要显示的按键</string>
|
||||
|
@ -71,6 +71,14 @@
|
||||
<item>@string/pref_show_numpad_landscape</item>
|
||||
<item>@string/pref_show_numpad_always</item>
|
||||
</string-array>
|
||||
<string-array name="pref_numpad_layout_values">
|
||||
<item>high_first</item>
|
||||
<item>low_first</item>
|
||||
</string-array>
|
||||
<string-array name="pref_numpad_layout_entries">
|
||||
<item>@string/pref_numpad_layout_e_high_first</item>
|
||||
<item>@string/pref_numpad_layout_e_low_first</item>
|
||||
</string-array>
|
||||
<string-array name="pref_accents_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
|
@ -16,6 +16,9 @@
|
||||
<string name="pref_show_numpad_never">Never</string>
|
||||
<string name="pref_show_numpad_landscape">Only in landscape mode</string>
|
||||
<string name="pref_show_numpad_always">Always</string>
|
||||
<string name="pref_numpad_layout">NumPad layout</string>
|
||||
<string name="pref_numpad_layout_e_high_first">High digits first</string>
|
||||
<string name="pref_numpad_layout_e_low_first">Low digits first</string>
|
||||
<string name="pref_autocapitalisation_title">Automatic capitalisation</string>
|
||||
<string name="pref_autocapitalisation_summary">Press Shift at the beginning of a sentence</string>
|
||||
<string name="pref_extra_keys_title">Add keys to the keyboard</string>
|
||||
|
@ -33,6 +33,7 @@
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="24"/>
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="25"/>
|
||||
</PreferenceScreen>
|
||||
<ListPreference android:key="numpad_layout" android:title="@string/pref_numpad_layout" android:summary="%s" android:defaultValue="high_first" android:entries="@array/pref_numpad_layout_entries" android:entryValues="@array/pref_numpad_layout_values"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/pref_category_typing">
|
||||
<CheckBoxPreference android:key="autocapitalisation" android:title="@string/pref_autocapitalisation_title" android:summary="@string/pref_autocapitalisation_summary" android:defaultValue="true"/>
|
||||
|
@ -28,6 +28,8 @@ final class Config
|
||||
public KeyboardData second_layout; // Or 'null' for none
|
||||
public KeyboardData custom_layout; // Might be 'null'
|
||||
public boolean show_numpad = false;
|
||||
// From the 'numpad_layout' option, also apply to the numeric pane.
|
||||
public boolean inverse_numpad = false;
|
||||
public float swipe_dist_px;
|
||||
public boolean vibrateEnabled;
|
||||
public long longPressTimeout;
|
||||
@ -120,6 +122,7 @@ final class Config
|
||||
layout = layout_of_string(res, _prefs.getString("layout", "none"));
|
||||
second_layout = layout_of_string(res, _prefs.getString("second_layout", "none"));
|
||||
custom_layout = KeyboardData.load_string(_prefs.getString("custom_layout", ""));
|
||||
inverse_numpad = _prefs.getString("numpad_layout", "default").equals("low_first");
|
||||
// The baseline for the swipe distance correspond to approximately the
|
||||
// width of a key in portrait mode, as most layouts have 10 columns.
|
||||
// Multipled by the DPI ratio because most swipes are made in the diagonals.
|
||||
@ -161,7 +164,7 @@ final class Config
|
||||
* - Replace the action key to show the right label
|
||||
* - Swap the enter and action keys
|
||||
*/
|
||||
public KeyboardData modify_layout(KeyboardData original_kw)
|
||||
public KeyboardData modify_layout(KeyboardData kw)
|
||||
{
|
||||
// Update the name to avoid caching in KeyModifier
|
||||
final KeyValue action_key = (actionLabel == null) ? null :
|
||||
@ -171,7 +174,28 @@ final class Config
|
||||
final Set<KeyValue> extra_keys = new HashSet<KeyValue>();
|
||||
extra_keys.addAll(extra_keys_subtype);
|
||||
extra_keys.addAll(extra_keys_param);
|
||||
KeyboardData kw = original_kw.mapKeys(new KeyboardData.MapKeyValues() {
|
||||
if (kw.num_pad && show_numpad)
|
||||
kw = kw.addNumPad();
|
||||
kw = kw.mapKeys(new KeyboardData.MapKeyValues() {
|
||||
/** Apply to the center value only. Partial match, fallback to [apply]. */
|
||||
public KeyboardData.Corner apply_key0(KeyboardData.Corner corner)
|
||||
{
|
||||
if (corner == null)
|
||||
return null;
|
||||
KeyValue kv = corner.kv;
|
||||
switch (kv.getKind())
|
||||
{
|
||||
case Char:
|
||||
char c = kv.getChar();
|
||||
if (inverse_numpad)
|
||||
c = inverse_numpad_char(c);
|
||||
if (c != kv.getChar())
|
||||
return KeyboardData.Corner.of_kv(kv.withChar(c));
|
||||
break;
|
||||
}
|
||||
return super.apply(corner);
|
||||
}
|
||||
|
||||
public KeyValue apply(KeyValue key, boolean localized)
|
||||
{
|
||||
boolean is_extra_key = extra_keys.contains(key);
|
||||
@ -214,8 +238,6 @@ final class Config
|
||||
});
|
||||
if (extra_keys.size() > 0)
|
||||
kw = kw.addExtraKeys(extra_keys.iterator());
|
||||
if (original_kw.num_pad && show_numpad)
|
||||
kw = kw.addNumPad();
|
||||
return kw;
|
||||
}
|
||||
|
||||
@ -284,6 +306,20 @@ final class Config
|
||||
return KeyboardData.load(res, id);
|
||||
}
|
||||
|
||||
char inverse_numpad_char(char c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '7': return '1';
|
||||
case '8': return '2';
|
||||
case '9': return '3';
|
||||
case '1': return '7';
|
||||
case '2': return '8';
|
||||
case '3': return '9';
|
||||
default: return c;
|
||||
}
|
||||
}
|
||||
|
||||
private static Config _globalConfig = null;
|
||||
|
||||
public static void initGlobalConfig(SharedPreferences prefs, Resources res,
|
||||
|
@ -462,12 +462,17 @@ class KeyboardData
|
||||
|
||||
public Key apply(Key k)
|
||||
{
|
||||
return new Key(apply(k.key0), apply(k.key1), apply(k.key2),
|
||||
return new Key(apply_key0(k.key0), apply(k.key1), apply(k.key2),
|
||||
apply(k.key3), apply(k.key4), k.width, k.shift, k.edgekeys,
|
||||
k.indication);
|
||||
}
|
||||
|
||||
private Corner apply(Corner c)
|
||||
protected Corner apply_key0(Corner c)
|
||||
{
|
||||
return apply(c);
|
||||
}
|
||||
|
||||
protected Corner apply(Corner c)
|
||||
{
|
||||
if (c == null)
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user