From abc6785b7c41ffb7049046b36f7240b9f09e7f84 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Rasquin Date: Sun, 25 Nov 2018 21:15:50 +0100 Subject: [PATCH 1/8] Popup: speedup popup / exclude some more keycodes First show popup before handling keypress (so popup is always shown, even typing super fast) Exclude more keys (cursor keys, del, backspace) from showing a popup. Signed-off-by: Jean-Pierre Rasquin --- .../pckeyboard/PointerTracker.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/PointerTracker.java b/app/src/main/java/org/pocketworkstation/pckeyboard/PointerTracker.java index 021976cf7..d5b862601 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/PointerTracker.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/PointerTracker.java @@ -222,11 +222,17 @@ private boolean isModifierInternal(int keyIndex) { return false; int primaryCode = key.codes[0]; return primaryCode == Keyboard.KEYCODE_SHIFT + || primaryCode == Keyboard.KEYCODE_DELETE || primaryCode == Keyboard.KEYCODE_MODE_CHANGE + || primaryCode == LatinKeyboardView.KEYCODE_FORWARD_DEL || primaryCode == LatinKeyboardView.KEYCODE_CTRL_LEFT || primaryCode == LatinKeyboardView.KEYCODE_ALT_LEFT || primaryCode == LatinKeyboardView.KEYCODE_META_LEFT - || primaryCode == LatinKeyboardView.KEYCODE_FN; + || primaryCode == LatinKeyboardView.KEYCODE_FN + || primaryCode == LatinKeyboardView.KEYCODE_DPAD_DOWN + || primaryCode == LatinKeyboardView.KEYCODE_DPAD_LEFT + || primaryCode == LatinKeyboardView.KEYCODE_DPAD_RIGHT + || primaryCode == LatinKeyboardView.KEYCODE_DPAD_UP; } public boolean isModifier() { @@ -513,15 +519,15 @@ private static int getSquareDistanceToKeyEdge(int x, int y, Key key) { } private void showKeyPreviewAndUpdateKey(int keyIndex) { - updateKey(keyIndex); - // The modifier key, such as shift key, should not be shown as preview when multi-touch is - // supported. On the other hand, if multi-touch is not supported, the modifier key should - // be shown as preview. if (mHasDistinctMultitouch && isModifier()) { mProxy.showPreview(NOT_A_KEY, this); } else { mProxy.showPreview(keyIndex, this); } + updateKey(keyIndex); + // The modifier key, such as shift key, should not be shown as preview when multi-touch is + // supported. On the other hand, if multi-touch is not supported, the modifier key should + // be shown as preview. } private void startLongPressTimer(int keyIndex) { From ca699d842fccc0e72064ced0f87843eb937eeb42 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Rasquin Date: Sun, 25 Nov 2018 21:16:53 +0100 Subject: [PATCH 2/8] Popup: add setting for popup duration Let user chose for how long the key popup is to be shown (10-500ms). Signed-off-by: Jean-Pierre Rasquin --- .../org/pocketworkstation/pckeyboard/LatinIME.java | 7 +++++++ .../pckeyboard/LatinKeyboardBaseView.java | 12 +++++++++--- app/src/main/res/values/config.xml | 1 - app/src/main/res/values/durations.xml | 3 +++ app/src/main/res/values/strings.xml | 4 +++- app/src/main/res/xml/prefs_feedback.xml | 13 ++++++++++++- 6 files changed, 34 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java index b2b30c927..5898926c8 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java @@ -106,6 +106,7 @@ public class LatinIME extends InputMethodService implements static final String PREF_VIBRATE_LEN = "vibrate_len"; private static final String PREF_SOUND_ON = "sound_on"; private static final String PREF_POPUP_ON = "popup_on"; + private static final String PREF_POPUP_DURATION = "pref_popup_duration"; private static final String PREF_AUTO_CAP = "auto_cap"; private static final String PREF_QUICK_FIXES = "quick_fixes"; private static final String PREF_SHOW_SUGGESTIONS = "show_suggestions"; @@ -209,6 +210,7 @@ public class LatinIME extends InputMethodService implements private boolean mPasswordText; private boolean mVibrateOn; private int mVibrateLen; + private int mPopupDuration; private boolean mSoundOn; private boolean mPopupOn; private boolean mAutoCapPref; @@ -933,6 +935,7 @@ public void onStartInputView(EditorInfo attribute, boolean restarting) { updateCorrectionMode(); inputView.setPreviewEnabled(mPopupOn); + inputView.setPreviewDuration(mPopupDuration); inputView.setProximityCorrectionEnabled(true); // If we just entered a text field, maybe it has some old text that // requires correction @@ -3108,6 +3111,8 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, mVolDownAction = sharedPreferences.getString(PREF_VOL_DOWN, res.getString(R.string.default_vol_down)); } else if (PREF_VIBRATE_LEN.equals(key)) { mVibrateLen = getPrefInt(sharedPreferences, PREF_VIBRATE_LEN, getResources().getString(R.string.vibrate_duration_ms)); + } else if (PREF_POPUP_DURATION.equals(key)) { + mPopupDuration = getPrefInt(sharedPreferences, PREF_POPUP_DURATION, getResources().getString(R.string.popup_duration_ms)); } updateKeyboardOptions(); @@ -3494,6 +3499,7 @@ private void loadSettings() { mSoundOn = sp.getBoolean(PREF_SOUND_ON, false); mPopupOn = sp.getBoolean(PREF_POPUP_ON, mResources .getBoolean(R.bool.default_popup_preview)); + mPopupDuration = getPrefInt(sp, PREF_POPUP_DURATION, getResources().getString(R.string.popup_duration_ms)); mAutoCapPref = sp.getBoolean(PREF_AUTO_CAP, getResources().getBoolean( R.bool.default_auto_cap)); mQuickFixes = sp.getBoolean(PREF_QUICK_FIXES, true); @@ -3620,6 +3626,7 @@ protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) { p.println(" mSoundOn=" + mSoundOn); p.println(" mVibrateOn=" + mVibrateOn); p.println(" mPopupOn=" + mPopupOn); + p.println(" mPopupDuration=" + mPopupDuration); } // Characters per second measurement diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java index 7e520ef4d..46cb52793 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java @@ -207,6 +207,7 @@ public interface OnKeyboardActionListener { protected int mPreviewTextSizeLarge; protected int[] mOffsetInWindow; protected int mOldPreviewKeyIndex = NOT_A_KEY; + protected int mPopupDuration; protected boolean mShowPreview = true; protected boolean mShowTouchPoints = true; protected int mPopupPreviewOffsetX; @@ -215,7 +216,6 @@ public interface OnKeyboardActionListener { protected int mPopupPreviewDisplayedY; protected final int mDelayBeforePreview; protected final int mDelayBeforeSpacePreview; - protected final int mDelayAfterPreview; // Popup mini keyboard protected PopupWindow mMiniKeyboardPopup; @@ -553,7 +553,6 @@ public LatinKeyboardBaseView(Context context, AttributeSet attrs, int defStyle) mShowPreview = false; mDelayBeforePreview = res.getInteger(R.integer.config_delay_before_preview); mDelayBeforeSpacePreview = res.getInteger(R.integer.config_delay_before_space_preview); - mDelayAfterPreview = res.getInteger(R.integer.config_delay_after_preview); mPopupLayout = 0; @@ -773,6 +772,13 @@ public void setPreviewEnabled(boolean previewEnabled) { mShowPreview = previewEnabled; } + /** + * Sets for how long the key feedback popup is shown. + * By default the preview lasts 10ms. + * @param popupDuration the duration in ms to show the key feedback popup + */ + public void setPreviewDuration(int popupDuration) { mPopupDuration = popupDuration; } + /** * Returns the enabled state of the key feedback popup. * @return whether or not the key feedback popup is enabled @@ -1169,7 +1175,7 @@ public void showPreview(int keyIndex, PointerTracker tracker) { || (hidePreviewOrShowSpaceKeyPreview && isLanguageSwitchEnabled))) { if (keyIndex == NOT_A_KEY) { mHandler.cancelPopupPreview(); - mHandler.dismissPreview(mDelayAfterPreview); + mHandler.dismissPreview(mPopupDuration); } else if (tracker != null) { int delay = mShowPreview ? mDelayBeforePreview : mDelayBeforeSpacePreview; mHandler.popupPreview(delay, keyIndex, tracker); diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml index 6ee4511a5..b3c7aec5c 100644 --- a/app/src/main/res/values/config.xml +++ b/app/src/main/res/values/config.xml @@ -21,7 +21,6 @@ 0 200 - 10 0 70 0 diff --git a/app/src/main/res/values/durations.xml b/app/src/main/res/values/durations.xml index 7242f847a..7e7748200 100644 --- a/app/src/main/res/values/durations.xml +++ b/app/src/main/res/values/durations.xml @@ -22,4 +22,7 @@ 40 ms + + 10 ms diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 60fd5c45c..f535494df 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -564,7 +564,9 @@ 2 3 - + + Popup duration + Long-press duration Drawing method diff --git a/app/src/main/res/xml/prefs_feedback.xml b/app/src/main/res/xml/prefs_feedback.xml index 2a3d4e6c8..60f20768a 100644 --- a/app/src/main/res/xml/prefs_feedback.xml +++ b/app/src/main/res/xml/prefs_feedback.xml @@ -50,7 +50,7 @@ android:defaultValue="@string/default_click_method" android:persistent="true" /> - + + + From 1f87ecac5843464a09451e16a2c9dbb87dca3069 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Rasquin Date: Wed, 28 Nov 2018 17:51:48 +0100 Subject: [PATCH 3/8] AutoCaps: Fix AutoCaps broken on backspace Signed-off-by: Jean-Pierre Rasquin --- app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java index 5898926c8..bc8af66f1 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java @@ -2244,6 +2244,7 @@ && sameAsTextBeforeCursor(ic, mEnteredText)) { } mJustRevertedSeparator = null; ic.endBatchEdit(); + updateShiftKeyState(getCurrentInputEditorInfo()); } private void setModCtrl(boolean val) { From e5e7a1b0ef640439e390e9cfa06a28f6e483f25d Mon Sep 17 00:00:00 2001 From: Jean-Pierre Rasquin Date: Wed, 28 Nov 2018 23:21:34 +0100 Subject: [PATCH 4/8] Add swiss-french layout Signed-off-by: Jean-Pierre Rasquin --- .../pckeyboard/InputLanguageSelection.java | 16 +- .../values-fr-rCH/donottranslate-altchars.xml | 25 ++ .../values-fr-rCH/donottranslate-keymap.xml | 215 ++++++++++++++++++ app/src/main/res/values-fr-rCH/strings.xml | 19 ++ 4 files changed, 267 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/values-fr-rCH/donottranslate-altchars.xml create mode 100644 app/src/main/res/values-fr-rCH/donottranslate-keymap.xml create mode 100644 app/src/main/res/values-fr-rCH/strings.xml diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/InputLanguageSelection.java b/app/src/main/java/org/pocketworkstation/pckeyboard/InputLanguageSelection.java index dfa361090..224be1399 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/InputLanguageSelection.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/InputLanguageSelection.java @@ -70,25 +70,25 @@ public class InputLanguageSelection extends PreferenceActivity { private static final String[] KBD_LOCALIZATIONS = { "ar", "bg", "bg_ST", "ca", "cs", "cs_QY", "da", "de", "de_NE", "el", "en", "en_CX", "en_DV", "en_GB", "es", "es_LA", "es_US", - "fa", "fi", "fr", "fr_CA", "he", "hr", "hu", "hu_QY", "hy", "in", - "it", "iw", "ja", "ka", "ko", "lo", "lt", "lv", "nb", "nl", "pl", - "pt", "pt_PT", "rm", "ro", "ru", "ru_PH", "si", "sk", "sk_QY", "sl", - "sr", "sv", "ta", "th", "tl", "tr", "uk", "vi", "zh_CN", "zh_TW" + "fa", "fi", "fr", "fr_CA", "fr_CH", "he", "hr", "hu", "hu_QY", "hy", + "in", "it", "iw", "ja", "ka", "ko", "lo", "lt", "lv", "nb", "nl", + "pl", "pt", "pt_PT", "rm", "ro", "ru", "ru_PH", "si", "sk", "sk_QY", + "sl", "sr", "sv", "ta", "th", "tl", "tr", "uk", "vi", "zh_CN", "zh_TW" }; private static final String[] KBD_5_ROW = { "ar", "bg", "bg_ST", "cs", "cs_QY", "da", "de", "de_NE", "el", "en", "en_CX", "en_DV", "en_GB", "es", "es_LA", "fa", "fi", "fr", - "fr_CA", "he", "hr", "hu", "hu_QY", "hy", "it", "iw", "lo", "lt", - "nb", "pt_PT", "ro", "ru", "ru_PH", "si", "sk", "sk_QY", "sl", + "fr_CA", "fr_CH", "he", "hr", "hu", "hu_QY", "hy", "it", "iw", "lo", + "lt", "nb", "pt_PT", "ro", "ru", "ru_PH", "si", "sk", "sk_QY", "sl", "sr", "sv", "ta", "th", "tr", "uk" }; private static final String[] KBD_4_ROW = { "ar", "bg", "bg_ST", "cs", "cs_QY", "da", "de", "de_NE", "el", "en", "en_CX", "en_DV", "es", "es_LA", "es_US", "fa", "fr", "fr_CA", - "he", "hr", "hu", "hu_QY", "iw", "nb", "ru", "ru_PH", "sk", "sk_QY", - "sl", "sr", "sv", "tr", "uk" + "fr_CH", "he", "hr", "hu", "hu_QY", "iw", "nb", "ru", "ru_PH", "sk", + "sk_QY", "sl", "sr", "sv", "tr", "uk" }; private static String getLocaleName(Locale l) { diff --git a/app/src/main/res/values-fr-rCH/donottranslate-altchars.xml b/app/src/main/res/values-fr-rCH/donottranslate-altchars.xml new file mode 100644 index 000000000..f34ab9c85 --- /dev/null +++ b/app/src/main/res/values-fr-rCH/donottranslate-altchars.xml @@ -0,0 +1,25 @@ + + + + 3éèêë€ + + + 6ýÿŷ¥ + diff --git a/app/src/main/res/values-fr-rCH/donottranslate-keymap.xml b/app/src/main/res/values-fr-rCH/donottranslate-keymap.xml new file mode 100644 index 000000000..fa34f3259 --- /dev/null +++ b/app/src/main/res/values-fr-rCH/donottranslate-keymap.xml @@ -0,0 +1,215 @@ + + + + § + ° + §°ⁿ + + 1 + + + 1+†‡¦¹ + + 2 + \" + 2\"@‚’‘„”“² + + 3 + * + 3*#★•♥♠♦♣³ + + 4 + ç + 4çčć¢⁴ + + 5 + % + 5%‰ + + 6 + & + 6\&♪ + + 7 + / + 7/| + + 8 + ( + 8(∞ + + 9 + ) + 9) + + 0 + = + 0=≈≠±+-×÷ + + \' + \? + \'\?¿´‘’ + + ^ + ` + ^`~↑↓←→ + + + q + Q + @string/alternates_for_q + + w + W + @string/alternates_for_w + + e + E + @string/alternates_for_e + + r + R + @string/alternates_for_r + + t + T + @string/alternates_for_t + + z + Z + @string/alternates_for_z + + u + U + @string/alternates_for_u + + i + I + @string/alternates_for_i + + o + O + @string/alternates_for_o + + p + P + @string/alternates_for_p + + è + ü + èü[ + + ¨ + ! + ¨!¡] + + $ + £ + $£₤λ¢€¥} + + + a + A + @string/alternates_for_a + + s + S + @string/alternates_for_s + + d + D + @string/alternates_for_d + + f + F + @string/alternates_for_f + + g + G + @string/alternates_for_g + + h + H + @string/alternates_for_h + + j + J + @string/alternates_for_j + + k + K + @string/alternates_for_k + + l + L + @string/alternates_for_l + + é + ö + éö + + à + ä + àä{ + + + < + > + <>\\≤«‹›»≥ + + y + Y + @string/alternates_for_y + + x + X + @string/alternates_for_x + + c + C + @string/alternates_for_c + + v + V + @string/alternates_for_v + + b + B + @string/alternates_for_b + + n + N + @string/alternates_for_n + + m + M + @string/alternates_for_m + + , + ; + ,; + + . + : + .:… + + - + _ + -_– + diff --git a/app/src/main/res/values-fr-rCH/strings.xml b/app/src/main/res/values-fr-rCH/strings.xml new file mode 100644 index 000000000..02d320512 --- /dev/null +++ b/app/src/main/res/values-fr-rCH/strings.xml @@ -0,0 +1,19 @@ + + + + + From a3e6702bc9874bd4e528260598cc9a764ab4ae99 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Rasquin Date: Sun, 2 Dec 2018 16:24:40 +0100 Subject: [PATCH 5/8] Add luxembourgish layout Signed-off-by: Jean-Pierre Rasquin --- .../pckeyboard/InputLanguageSelection.java | 12 +- .../res/values-lb/donottranslate-altchars.xml | 34 +++ .../res/values-lb/donottranslate-keymap.xml | 215 ++++++++++++++++++ app/src/main/res/values-lb/strings.xml | 19 ++ 4 files changed, 274 insertions(+), 6 deletions(-) create mode 100644 app/src/main/res/values-lb/donottranslate-altchars.xml create mode 100644 app/src/main/res/values-lb/donottranslate-keymap.xml create mode 100644 app/src/main/res/values-lb/strings.xml diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/InputLanguageSelection.java b/app/src/main/java/org/pocketworkstation/pckeyboard/InputLanguageSelection.java index 224be1399..3ea3ba192 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/InputLanguageSelection.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/InputLanguageSelection.java @@ -71,7 +71,7 @@ public class InputLanguageSelection extends PreferenceActivity { "ar", "bg", "bg_ST", "ca", "cs", "cs_QY", "da", "de", "de_NE", "el", "en", "en_CX", "en_DV", "en_GB", "es", "es_LA", "es_US", "fa", "fi", "fr", "fr_CA", "fr_CH", "he", "hr", "hu", "hu_QY", "hy", - "in", "it", "iw", "ja", "ka", "ko", "lo", "lt", "lv", "nb", "nl", + "in", "it", "iw", "ja", "ka", "ko", "lb", "lo", "lt", "lv", "nb", "nl", "pl", "pt", "pt_PT", "rm", "ro", "ru", "ru_PH", "si", "sk", "sk_QY", "sl", "sr", "sv", "ta", "th", "tl", "tr", "uk", "vi", "zh_CN", "zh_TW" }; @@ -79,16 +79,16 @@ public class InputLanguageSelection extends PreferenceActivity { private static final String[] KBD_5_ROW = { "ar", "bg", "bg_ST", "cs", "cs_QY", "da", "de", "de_NE", "el", "en", "en_CX", "en_DV", "en_GB", "es", "es_LA", "fa", "fi", "fr", - "fr_CA", "fr_CH", "he", "hr", "hu", "hu_QY", "hy", "it", "iw", "lo", - "lt", "nb", "pt_PT", "ro", "ru", "ru_PH", "si", "sk", "sk_QY", "sl", - "sr", "sv", "ta", "th", "tr", "uk" + "fr_CA", "fr_CH", "he", "hr", "hu", "hu_QY", "hy", "it", "iw", "lb", + "lo", "lt", "nb", "pt_PT", "ro", "ru", "ru_PH", "si", "sk", "sk_QY", + "sl", "sr", "sv", "ta", "th", "tr", "uk" }; private static final String[] KBD_4_ROW = { "ar", "bg", "bg_ST", "cs", "cs_QY", "da", "de", "de_NE", "el", "en", "en_CX", "en_DV", "es", "es_LA", "es_US", "fa", "fr", "fr_CA", - "fr_CH", "he", "hr", "hu", "hu_QY", "iw", "nb", "ru", "ru_PH", "sk", - "sk_QY", "sl", "sr", "sv", "tr", "uk" + "fr_CH", "he", "hr", "hu", "hu_QY", "iw", "lb", "nb", "ru", "ru_PH", + "sk", "sk_QY", "sl", "sr", "sv", "tr", "uk" }; private static String getLocaleName(Locale l) { diff --git a/app/src/main/res/values-lb/donottranslate-altchars.xml b/app/src/main/res/values-lb/donottranslate-altchars.xml new file mode 100644 index 000000000..8b9a6147b --- /dev/null +++ b/app/src/main/res/values-lb/donottranslate-altchars.xml @@ -0,0 +1,34 @@ + + + + 1àáâãäåæ + ç + 3éèêë€ + 8ïîíì + ñ + 9øœöõôóò + + §ß + 7üûúù + + + 6ýÿŷ¥ + 2 + diff --git a/app/src/main/res/values-lb/donottranslate-keymap.xml b/app/src/main/res/values-lb/donottranslate-keymap.xml new file mode 100644 index 000000000..a9b0fec1e --- /dev/null +++ b/app/src/main/res/values-lb/donottranslate-keymap.xml @@ -0,0 +1,215 @@ + + + + § + ° + §°ⁿ + + 1 + + + 1+†‡¦¹ + + 2 + \" + 2\"@‚’‘„”“² + + 3 + * + 3*#★•♥♠♦♣³ + + 4 + ç + 4çčć¢⁴ + + 5 + % + 5%‰ + + 6 + & + 6\&♪ + + 7 + / + 7/| + + 8 + ( + 8(∞ + + 9 + ) + 9) + + 0 + = + 0=≈≠±+-×÷ + + \' + \? + \'\?¿´‘’ + + ^ + ` + ^`~↑↓←→ + + + q + Q + @string/alternates_for_q + + w + W + @string/alternates_for_w + + e + E + @string/alternates_for_e + + r + R + @string/alternates_for_r + + t + T + @string/alternates_for_t + + z + Z + @string/alternates_for_z + + u + U + @string/alternates_for_u + + i + I + @string/alternates_for_i + + o + O + @string/alternates_for_o + + p + P + @string/alternates_for_p + + è + ü + èü[ + + ¨ + ! + ¨!]¡ + + $ + £ + $£}₤λ¢€¥ + + + a + A + @string/alternates_for_a + + s + S + @string/alternates_for_s + + d + D + @string/alternates_for_d + + f + F + @string/alternates_for_f + + g + G + @string/alternates_for_g + + h + H + @string/alternates_for_h + + j + J + @string/alternates_for_j + + k + K + @string/alternates_for_k + + l + L + @string/alternates_for_l + + é + ö + éö + + à + ä + àä{ + + + < + > + <>\\≤«‹›»≥ + + y + Y + @string/alternates_for_y + + x + X + @string/alternates_for_x + + c + C + @string/alternates_for_c + + v + V + @string/alternates_for_v + + b + B + @string/alternates_for_b + + n + N + @string/alternates_for_n + + m + M + @string/alternates_for_m + + , + ; + ,; + + . + : + .:… + + - + _ + -_– + diff --git a/app/src/main/res/values-lb/strings.xml b/app/src/main/res/values-lb/strings.xml new file mode 100644 index 000000000..02d320512 --- /dev/null +++ b/app/src/main/res/values-lb/strings.xml @@ -0,0 +1,19 @@ + + + + + From 674c51b6d74f3a5e59964a6a0b1b7b9c9a7cfa38 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Rasquin Date: Fri, 7 Dec 2018 21:19:12 +0100 Subject: [PATCH 6/8] Hint: always show except lettres (a-z/A-Z) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some locales have shifted chars likel ç ° ä ö ü which are helpful to be visible Signed-off-by: Jean-Pierre Rasquin --- .../java/org/pocketworkstation/pckeyboard/Keyboard.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/Keyboard.java b/app/src/main/java/org/pocketworkstation/pckeyboard/Keyboard.java index b4e59ecd9..e07298c05 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/Keyboard.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/Keyboard.java @@ -638,7 +638,7 @@ public String getHintLabel(boolean wantAscii, boolean wantAll) { hint = ""; if (shiftLabel != null && !isSimpleUppercase) { char c = shiftLabel.charAt(0); - if (wantAll || wantAscii && is7BitAscii(c)) { + if (wantAll || wantAscii && isNotAlpha(c)) { hint = Character.toString(c); } } @@ -664,6 +664,11 @@ private static boolean is7BitAscii(char c) { if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) return false; return c >= 32 && c < 127; } + + private static boolean isNotAlpha(char c) { + if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) return false; + return true; + } /** * Informs the key that it has been pressed, in case it needs to change its appearance or From 751f0f1d9369b62dc0026c36a3a083f18d047438 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Rasquin Date: Sun, 6 Jan 2019 01:39:32 +0100 Subject: [PATCH 7/8] Main key label: Move it to the left when alt hint is available This avoids caracters colliding on certain fonts. Signed-off-by: Jean-Pierre Rasquin --- .../pocketworkstation/pckeyboard/LatinKeyboardBaseView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java index 46cb52793..aa0824473 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java @@ -274,6 +274,7 @@ public interface OnKeyboardActionListener { private final HashMap mTextHeightCache = new HashMap(); // Distance from horizontal center of the key, proportional to key label text height. private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR = 0.55f; + private final float KEY_LABEL_ALTHINT_HORIZONTAL_ADJUSTMENT_FACTOR = 0.70f; private final String KEY_LABEL_HEIGHT_REFERENCE_CHAR = "H"; /* package */ static Method sSetRenderMode; private static int sPrevRenderMode = -1; @@ -1059,7 +1060,9 @@ private void onBufferDraw(Canvas canvas) { } // Draw main key label - final int centerX = (key.width + padding.left - padding.right) / 2; + final int centerX = Math.round( + (key.width + padding.left - padding.right) / 2 + * (altHint.equals("") ? 1f : KEY_LABEL_ALTHINT_HORIZONTAL_ADJUSTMENT_FACTOR)); final int centerY = (key.height + padding.top - padding.bottom) / 2; final float baseline = centerY + labelHeight * KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR; From ce7593e3b4520ca789417e0fbd067dd209ceb930 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Rasquin Date: Sun, 6 Jan 2019 01:54:07 +0100 Subject: [PATCH 8/8] Alt hint label: Do not show when shifted Signed-off-by: Jean-Pierre Rasquin --- .../pocketworkstation/pckeyboard/LatinKeyboardBaseView.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java index aa0824473..3fb1ce527 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinKeyboardBaseView.java @@ -1045,7 +1045,7 @@ private void onBufferDraw(Canvas canvas) { // Draw alternate hint label (if present) behind the main key String altHint = key.getAltHintLabel(showHints7Bit(), showHintsAll()); - if (!altHint.equals("")) { + if (!altHint.equals("") && !key.isShifted()) { int hintTextSize = (int)(mKeyTextSize * 0.6 * mLabelScale); paintHint.setTextSize(hintTextSize); @@ -1062,7 +1062,8 @@ private void onBufferDraw(Canvas canvas) { // Draw main key label final int centerX = Math.round( (key.width + padding.left - padding.right) / 2 - * (altHint.equals("") ? 1f : KEY_LABEL_ALTHINT_HORIZONTAL_ADJUSTMENT_FACTOR)); + * (!altHint.equals("") && !key.isShifted() + ? KEY_LABEL_ALTHINT_HORIZONTAL_ADJUSTMENT_FACTOR : 1f)); final int centerY = (key.height + padding.top - padding.bottom) / 2; final float baseline = centerY + labelHeight * KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR;