diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index fb2bf47..62d0e0a 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -3,6 +3,8 @@
Klávesnice Unexpected (pro ladění)
Klávesnice Unexpected
Nastavení Klávesnice Unexpected
+
+
Rozvržení
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index d8a472a..ef9c6a9 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -3,6 +3,8 @@
Unexpected Keyboard (Debug)
Unexpected Keyboard
Unexpected Keyboard - Einstellungen
+
+
Layout
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index 198c59f..5fb0427 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -3,6 +3,8 @@
Ajustes de Unexpected Keyboard
+
+
Formato
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index 52b8bc8..8248fbd 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -3,6 +3,8 @@
Unexpected Keyboard Paramètres
+ En mode portrait
+ En mode landscape
Disposition
Luminosité des symboles
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 1a250a0..34fe69f 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -3,6 +3,8 @@
Unexpected Keyboard (debug)
Unexpected Keyboard
Impostazioni di Unexpected Keyboard
+
+
Layout
diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml
index 4674279..61df5e6 100644
--- a/res/values-ko/strings.xml
+++ b/res/values-ko/strings.xml
@@ -3,6 +3,8 @@
Unexpected Keyboard 설정
+
+
레이아웃
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index dc7f653..7cdc3b5 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -1,5 +1,5 @@
+ 28dp
48dp
- 25dp
diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml
index 14cfc73..18f1293 100644
--- a/res/values-lv/strings.xml
+++ b/res/values-lv/strings.xml
@@ -3,6 +3,8 @@
Unexpected Keyboard (atkļūdošana)
Unexpected Keyboard
Unexpected Keyboard iestatījumi
+
+
Izkārtojums
diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml
index 54c18c8..d861391 100644
--- a/res/values-pl/strings.xml
+++ b/res/values-pl/strings.xml
@@ -3,6 +3,8 @@
Unexpected Keyboard (debug)
Unexpected Keyboard
Ustawienia Unexpected Keyboard
+
+
Układ
Dostosuj jasność znaków
Nieprzezroczystość tła klawiatury
diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
index b10d86b..382346a 100644
--- a/res/values-pt/strings.xml
+++ b/res/values-pt/strings.xml
@@ -3,6 +3,8 @@
Teclado Unexpected
Teclado Unexpected
Configurar Teclado Unexpected
+
+
Layout
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index ebe6e42..d4346b4 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -3,6 +3,8 @@
Unexpected Keyboard (отладка)
Unexpected Keyboard Настройки
+
+
Расположение
Изменить яркость клавиатуры
Изменить прозрачность фона
diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
index e1cce6b..aa3798e 100644
--- a/res/values-tr/strings.xml
+++ b/res/values-tr/strings.xml
@@ -3,6 +3,8 @@
Unexpected Keyboard (debug)
Unexpected Keyboard
Unexpected Keyboard Ayarları
+
+
Düzen
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index a160041..e03ddfb 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -3,6 +3,8 @@
Unexpected Keyboard (debug)
Unexpected Keyboard
Unexpected Keyboard 设置
+
+
布局
调整字母亮度
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 35ebbaa..8f7168a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3,6 +3,8 @@
Unexpected Keyboard (debug)
Unexpected Keyboard
Unexpected Keyboard Settings
+ In portrait mode
+ In landscape mode
Layout
Adjust label brightness
Adjust keyboard background opacity
diff --git a/res/values/values.xml b/res/values/values.xml
index 05e10c1..3cf31e9 100644
--- a/res/values/values.xml
+++ b/res/values/values.xml
@@ -9,7 +9,6 @@
56dp
250dp
28dp
- 0dp
true
false
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index 9ddebb9..5554b8f 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -60,7 +60,10 @@
-
+
+
+
+
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index 6f5ca74..24a396d 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -34,7 +34,7 @@ final class Config
public long longPressInterval;
public float marginBottom;
public float keyHeight;
- public float horizontalMargin;
+ public float horizontal_margin;
public float keyVerticalInterval;
public float keyHorizontalInterval;
public int labelBrightness; // 0 - 255
@@ -58,6 +58,7 @@ final class Config
public Set extra_keys_param;
public final IKeyEventHandler handler;
+ public boolean orientation_landscape = false;
private Config(SharedPreferences prefs, Resources res, IKeyEventHandler h)
{
@@ -85,6 +86,7 @@ final class Config
public void refresh(Resources res)
{
DisplayMetrics dm = res.getDisplayMetrics();
+ orientation_landscape = res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
// The height of the keyboard is relative to the height of the screen.
// This is the height of the keyboard if it have 4 rows.
int keyboardHeightPercent;
@@ -93,7 +95,7 @@ final class Config
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 (orientation_landscape)
{
if ("landscape".equals(show_numpad_s))
show_numpad = true;
@@ -120,12 +122,12 @@ final class Config
vibrateEnabled = _prefs.getBoolean("vibrate_enabled", true);
longPressTimeout = _prefs.getInt("longpress_timeout", 600);
longPressInterval = _prefs.getInt("longpress_interval", 65);
- marginBottom = getDipPref(dm, _prefs, "margin_bottom",
+ marginBottom = get_dip_pref(dm, "margin_bottom",
res.getDimension(R.dimen.margin_bottom));
- keyVerticalInterval = getDipPref(dm, _prefs, "key_vertical_space",
+ keyVerticalInterval = get_dip_pref(dm, "key_vertical_space",
res.getDimension(R.dimen.key_vertical_interval));
keyHorizontalInterval =
- getDipPref(dm, _prefs, "key_horizontal_space",
+ get_dip_pref(dm, "key_horizontal_space",
res.getDimension(R.dimen.key_horizontal_interval))
* horizontalIntervalScale;
// Label brightness is used as the alpha channel
@@ -137,10 +139,9 @@ final class Config
// Do not substract keyVerticalInterval from keyHeight because this is done
// during rendered.
keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4;
- horizontalMargin =
- getDipPref(dm, _prefs, "horizontal_margin",
- res.getDimension(R.dimen.horizontal_margin))
- + res.getDimension(R.dimen.extra_horizontal_margin);
+ horizontal_margin =
+ get_dip_pref(dm, oriented_pref("horizontal_margin"),
+ res.getDimension(R.dimen.horizontal_margin));
preciseRepeat = _prefs.getBoolean("precise_repeat", true);
double_tap_lock_shift = _prefs.getBoolean("lock_double_tap", false);
characterSize =
@@ -236,16 +237,23 @@ final class Config
return kw;
}
- private float getDipPref(DisplayMetrics dm, SharedPreferences prefs, String pref_name, float def)
+ private float get_dip_pref(DisplayMetrics dm, String pref_name, float def)
{
float value;
- try { value = prefs.getInt(pref_name, -1); }
- catch (Exception e) { value = prefs.getFloat(pref_name, -1f); }
+ try { value = _prefs.getInt(pref_name, -1); }
+ catch (Exception e) { value = _prefs.getFloat(pref_name, -1f); }
if (value < 0f)
return (def);
return (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, dm));
}
+ /** Returns preference name from a prefix depending on orientation. */
+ private String oriented_pref(String base_name)
+ {
+ String suffix = orientation_landscape ? "_landscape" : "_portrait";
+ return base_name + suffix;
+ }
+
private int getThemeId(Resources res, String theme_name)
{
switch (theme_name)
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index c3271b9..835d595 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -195,7 +195,7 @@ public class Keyboard2View extends View
private KeyboardData.Key getKeyAtPosition(float tx, float ty)
{
KeyboardData.Row row = getRowAtPosition(ty);
- float x = _config.horizontalMargin;
+ float x = _config.horizontal_margin;
if (row == null || tx < x)
return null;
for (KeyboardData.Key key : row.keys)
@@ -232,7 +232,7 @@ public class Keyboard2View extends View
+ _keyboard.rows.size()
+ _config.marginTop + _config.marginBottom);
setMeasuredDimension(width, height);
- _keyWidth = (width - (_config.horizontalMargin * 2)) / _keyboard.keysWidth;
+ _keyWidth = (width - (_config.horizontal_margin * 2)) / _keyboard.keysWidth;
}
@Override
@@ -244,9 +244,9 @@ public class Keyboard2View extends View
{
// Disable the back-gesture on the keyboard area
Rect keyboard_area = new Rect(
- left + (int)_config.horizontalMargin,
+ left + (int)_config.horizontal_margin,
top + (int)_config.marginTop,
- right - (int)_config.horizontalMargin,
+ right - (int)_config.horizontal_margin,
bottom - (int)_config.marginBottom);
setSystemGestureExclusionRects(Arrays.asList(keyboard_area));
}
@@ -266,7 +266,7 @@ public class Keyboard2View extends View
for (KeyboardData.Row row : _keyboard.rows)
{
y += row.shift * _config.keyHeight;
- float x = _config.horizontalMargin + _config.keyHorizontalInterval / 2;
+ float x = _config.horizontal_margin + _config.keyHorizontalInterval / 2;
float keyH = row.height * _config.keyHeight - _config.keyVerticalInterval;
for (KeyboardData.Key k : row.keys)
{