diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 3f3470d..caa597d 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -10,12 +10,16 @@
Akzente für alle installierten Sprachen anzeigen
Akzente nur für die gewählte Sprache anzeigen
Akzente verbergen
- Automatische Großschreibung
- Umschalttaste am Satzanfang aktivieren
- Tasten hinzufügen
+ Ziffernblock anzeigen
+ Nie
+ Nur im Querformat
+ Immer
Tastaturlayout zum Programmieren
+ Zusätzliche Zeichen zur Tastatur hinzufügen
Keines
Tippen
+ Automatische Großschreibung
+ Shift-Taste am Satzanfang aktivieren
Länge der Wischgeste
Abstand der Zeichen in den Ecken der Tasten (%s)
Zeitüberschreitung bei Tastenwiederholung
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index 7d501e6..05c0d83 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -8,6 +8,10 @@
Afficher les accents pour les langues installées
Afficher les accents pour la langue sélectionnée
Cacher les accents
+ Afficher le pavé numérique
+ Jamais
+ Seulement en mode paysage
+ Toujour
Majuscule automatique
Active Shift au début des phrases
Saisie
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 74ad18f..7dc5a96 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -67,6 +67,16 @@
- @string/pref_accents_e_selected
- @string/pref_accents_e_none
+
+ - never
+ - landscape
+ - always
+
+
+ - @string/pref_show_numpad_never
+ - @string/pref_show_numpad_landscape
+ - @string/pref_show_numpad_always
+
- 1
- 2
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 501aefc..9195670 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -10,6 +10,10 @@
Show accents for all installed languages
Only show accents for the selected language
Hide accents
+ Show NumPad
+ Never
+ Only in landscape mode
+ Always
Automatic capitalisation
Press Shift at the beginning of a sentence
Add keys to the keyboard
diff --git a/res/xml/numeric.xml b/res/xml/numeric.xml
index ba1081f..9e6bc69 100644
--- a/res/xml/numeric.xml
+++ b/res/xml/numeric.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/res/xml/numpad.xml b/res/xml/numpad.xml
new file mode 100644
index 0000000..3ddb830
--- /dev/null
+++ b/res/xml/numpad.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index e91c460..93badef 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -3,6 +3,7 @@
+
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index 324562d..ad79920 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -25,6 +25,7 @@ final class Config
// From preferences
public int layout; // Or '-1' for the system defaults
public int programming_layout; // Or '-1' for none
+ public boolean show_numpad = false;
public float swipe_dist_px;
public boolean vibrateEnabled;
public long longPressTimeout;
@@ -100,8 +101,12 @@ final class Config
// Scale some dimensions depending on orientation
float horizontalIntervalScale = 1.f;
float characterSizeScale = 1.f;
+ String show_numpad_s = prefs.getString("show_numpad", "never");
+ show_numpad = "always".equals(show_numpad_s);
if (res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) // Landscape mode
{
+ if ("landscape".equals(show_numpad_s))
+ show_numpad = true;
keyboardHeightPercent = prefs.getInt("keyboard_height_landscape", 50);
horizontalIntervalScale = 2.f;
characterSizeScale = 1.25f;
@@ -208,6 +213,8 @@ 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;
}
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index 4742235..7955aca 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -199,9 +199,13 @@ public class Keyboard2View extends View
return null;
for (KeyboardData.Key key : row.keys)
{
- x += (key.shift + key.width) * _keyWidth;
- if (tx < x)
+ float xLeft = x + key.shift * _keyWidth;
+ float xRight = xLeft + key.width * _keyWidth;
+ if (tx < xLeft)
+ return null;
+ if (tx < xRight)
return key;
+ x = xRight;
}
return null;
}
diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java
index 5bbbac1..21acde7 100644
--- a/srcs/juloo.keyboard2/KeyboardData.java
+++ b/srcs/juloo.keyboard2/KeyboardData.java
@@ -18,13 +18,15 @@ class KeyboardData
public final float keysHeight;
/** Whether to add extra keys. */
public final boolean extra_keys;
+ /** Whether to possibly add NumPad. */
+ public final boolean num_pad;
public KeyboardData mapKeys(MapKey f)
{
ArrayList rows_ = new ArrayList();
for (Row r : rows)
rows_.add(r.mapKeys(f));
- return new KeyboardData(rows_, keysWidth, extra_keys);
+ return new KeyboardData(rows_, keysWidth, extra_keys, num_pad);
}
/** Add keys from the given iterator into the keyboard. Extra keys are added
@@ -46,7 +48,32 @@ class KeyboardData
for (int c = 1; c <= 4; c++)
addExtraKeys_to_row(rows, k, r, c);
}
- return new KeyboardData(rows, keysWidth, extra_keys);
+ return new KeyboardData(rows, keysWidth, extra_keys, num_pad);
+ }
+
+ public KeyboardData addNumPad()
+ {
+ if (!num_pad || _numPadKeyboardData == null)
+ return this;
+ ArrayList extendedRows = new ArrayList();
+ Iterator iterNumPadRows = _numPadKeyboardData.rows.iterator();
+ for (Row row : rows)
+ {
+ ArrayList keys = new ArrayList(row.keys);
+ if (iterNumPadRows.hasNext())
+ {
+ Row numPadRow = iterNumPadRows.next();
+ List nps = numPadRow.keys;
+ if (nps.size() > 0) {
+ float firstNumPadShift = 0.5f + keysWidth - row.keysWidth;
+ keys.add(nps.get(0).withShift(firstNumPadShift));
+ for (int i = 1; i < nps.size(); i++)
+ keys.add(nps.get(i));
+ }
+ }
+ extendedRows.add(new Row(keys, row.height, row.shift));
+ }
+ return new KeyboardData(extendedRows, compute_max_width(extendedRows), extra_keys, num_pad);
}
public Key findKeyWithValue(KeyValue kv)
@@ -75,6 +102,7 @@ class KeyboardData
}
private static Row _bottomRow = null;
+ private static KeyboardData _numPadKeyboardData = null;
private static Map _layoutCache = new HashMap();
public static KeyboardData load(Resources res, int id)
@@ -86,6 +114,10 @@ class KeyboardData
{
if (_bottomRow == null)
_bottomRow = parse_bottom_row(res.getXml(R.xml.bottom_row));
+ if (_numPadKeyboardData == null)
+ {
+ _numPadKeyboardData = parse_keyboard(res.getXml(R.xml.numpad));
+ }
l = parse_keyboard(res.getXml(id));
_layoutCache.put(id, l);
}
@@ -103,13 +135,14 @@ class KeyboardData
throw new Exception("Empty layout file");
boolean bottom_row = parser.getAttributeBooleanValue(null, "bottom_row", true);
boolean extra_keys = parser.getAttributeBooleanValue(null, "extra_keys", true);
+ boolean num_pad = parser.getAttributeBooleanValue(null, "num_pad", true);
ArrayList rows = new ArrayList();
while (expect_tag(parser, "row"))
rows.add(Row.parse(parser));
float kw = compute_max_width(rows);
if (bottom_row)
rows.add(_bottomRow.updateWidth(kw));
- return new KeyboardData(rows, kw, extra_keys);
+ return new KeyboardData(rows, kw, extra_keys, num_pad);
}
private static float compute_max_width(List rows)
@@ -127,7 +160,7 @@ class KeyboardData
return Row.parse(parser);
}
- protected KeyboardData(List rows_, float kw, boolean xk)
+ protected KeyboardData(List rows_, float kw, boolean xk, boolean np)
{
float kh = 0.f;
for (Row r : rows_)
@@ -136,6 +169,7 @@ class KeyboardData
keysWidth = kw;
keysHeight = kh;
extra_keys = xk;
+ num_pad = np;
}
public static class Row
@@ -146,7 +180,7 @@ class KeyboardData
/** Extra empty space on the top. */
public final float shift;
/** Total width of the row. */
- private final float keysWidth;
+ public final float keysWidth;
protected Row(List keys_, float h, float s)
{
@@ -278,6 +312,11 @@ class KeyboardData
return new Key(k0, k1, k2, k3, k4, width, shift, edgekeys);
}
+ public Key withShift(float s)
+ {
+ return new Key(key0, key1, key2, key3, key4, width, s, edgekeys);
+ }
+
/**
* See Pointers.onTouchMove() for the represented direction.
*/