From bf7edf5c81144262ca72e02dd995a79e8770208a Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Wed, 16 Oct 2019 15:26:29 +0200 Subject: [PATCH] Dutch keyboard --- .../vrbrowser/ui/keyboards/DutchKeyboard.java | 68 +++++++++++++++++++ .../vrbrowser/ui/widgets/KeyboardWidget.java | 9 ++- app/src/main/res/values/non_L10n.xml | 9 +++ app/src/main/res/values/options_values.xml | 4 ++ app/src/main/res/values/strings.xml | 4 ++ .../main/res/xml/keyboard_qwerty_dutch.xml | 61 +++++++++++++++++ 6 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/DutchKeyboard.java create mode 100644 app/src/main/res/xml/keyboard_qwerty_dutch.xml diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/DutchKeyboard.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/DutchKeyboard.java new file mode 100644 index 000000000..a92124457 --- /dev/null +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/DutchKeyboard.java @@ -0,0 +1,68 @@ +package org.mozilla.vrbrowser.ui.keyboards; + +import android.content.Context; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import org.mozilla.vrbrowser.R; +import org.mozilla.vrbrowser.input.CustomKeyboard; +import org.mozilla.vrbrowser.ui.widgets.WidgetPlacement; +import org.mozilla.vrbrowser.utils.StringUtils; + +import java.util.Locale; + +public class DutchKeyboard extends BaseKeyboard { + private CustomKeyboard mKeyboard; + private CustomKeyboard mSymbolsKeyboard; + private Locale mLocale; + + public DutchKeyboard(Context aContext) { + super(aContext); + mLocale = new Locale("nl", "NL"); + } + + @NonNull + @Override + public CustomKeyboard getAlphabeticKeyboard() { + if (mKeyboard == null) { + mKeyboard = new CustomKeyboard(mContext.getApplicationContext(), R.xml.keyboard_qwerty_dutch); + } + return mKeyboard; + } + + @Nullable + @Override + public CustomKeyboard getSymbolsKeyboard() { + if (mSymbolsKeyboard == null) { + mSymbolsKeyboard = new CustomKeyboard(mContext.getApplicationContext(), R.xml.keyboard_symbols); + } + return mSymbolsKeyboard; + } + + @Override + public float getAlphabeticKeyboardWidth() { + return WidgetPlacement.dpDimension(mContext, R.dimen.keyboard_alphabetic_width); + } + + @Nullable + @Override + public CandidatesResult getCandidates(String aText) { + return null; + } + + @Override + public String getKeyboardTitle() { + return StringUtils.getStringByLocale(mContext, R.string.settings_language_dutch, getLocale()); + } + + @Override + public Locale getLocale() { + return mLocale; + } + + @Override + public String getSpaceKeyText(String aComposingText) { + return StringUtils.getStringByLocale(mContext, R.string.settings_language_dutch, getLocale()); + } +} diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/KeyboardWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/KeyboardWidget.java index f5ad5bc5f..81dab0dd9 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/KeyboardWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/KeyboardWidget.java @@ -38,6 +38,7 @@ import org.mozilla.vrbrowser.input.CustomKeyboard; import org.mozilla.vrbrowser.telemetry.TelemetryWrapper; import org.mozilla.vrbrowser.ui.keyboards.DanishKeyboard; +import org.mozilla.vrbrowser.ui.keyboards.DutchKeyboard; import org.mozilla.vrbrowser.ui.keyboards.ItalianKeyboard; import org.mozilla.vrbrowser.ui.keyboards.FrenchKeyboard; import org.mozilla.vrbrowser.ui.keyboards.GermanKeyboard; @@ -187,6 +188,7 @@ private void initialize(Context aContext) { mKeyboards.add(new JapaneseKeyboard(aContext)); mKeyboards.add(new PolishKeyboard(aContext)); mKeyboards.add(new DanishKeyboard(aContext)); + mKeyboards.add(new DutchKeyboard(aContext)); mDefaultKeyboardSymbols = new CustomKeyboard(aContext.getApplicationContext(), R.xml.keyboard_symbols); mKeyboardNumeric = new CustomKeyboard(aContext.getApplicationContext(), R.xml.keyboard_numeric); @@ -715,6 +717,9 @@ private void handleLanguageChange(KeyboardInterface aKeyboard) { handleShift(false); hideOverlays(); updateCandidates(); + + String spaceText = mCurrentKeyboard.getSpaceKeyText(mComposingText).toUpperCase(); + mCurrentKeyboard.getAlphabeticKeyboard().setSpaceKeyLabel(spaceText); } private void disableShift(@NonNull CustomKeyboard keyboard) { @@ -902,11 +907,9 @@ private void updateCandidates() { } private void updateSpecialKeyLabels() { - String spaceText = mCurrentKeyboard.getSpaceKeyText(mComposingText).toUpperCase(); String enterText = mCurrentKeyboard.getEnterKeyText(mEditorInfo.imeOptions, mComposingText); String modeChangeText = mCurrentKeyboard.getModeChangeKeyText(); - boolean changed = mCurrentKeyboard.getAlphabeticKeyboard().setSpaceKeyLabel(spaceText); - changed |= mCurrentKeyboard.getAlphabeticKeyboard().setEnterKeyLabel(enterText); + boolean changed = mCurrentKeyboard.getAlphabeticKeyboard().setEnterKeyLabel(enterText); CustomKeyboard symbolsKeyboard = getSymbolsKeyboard(); changed |= symbolsKeyboard.setModeChangeKeyLabel(modeChangeText); symbolsKeyboard.setEnterKeyLabel(enterText); diff --git a/app/src/main/res/values/non_L10n.xml b/app/src/main/res/values/non_L10n.xml index 12b084491..82ec8c491 100644 --- a/app/src/main/res/values/non_L10n.xml +++ b/app/src/main/res/values/non_L10n.xml @@ -81,6 +81,7 @@ Italiano Polski Dansk + Nederlands 选定 空格 @@ -123,6 +124,7 @@ xẍẋ yýỳŷÿỹ zźẑžżẓ + . \.com \.net \.org eęèéêëẽėē @@ -148,6 +150,13 @@ øö nñń + + eéëêèęėēěĕə + aáäâàæãåāăą + oöôòõœøōóő + uúüûùūůų + ìíiïîįī + https://location.services.mozilla.com/v1/country diff --git a/app/src/main/res/values/options_values.xml b/app/src/main/res/values/options_values.xml index 2869f4a9c..1a909762c 100644 --- a/app/src/main/res/values/options_values.xml +++ b/app/src/main/res/values/options_values.xml @@ -98,6 +98,7 @@ @string/language_it_IT @string/language_da_DK @string/language_pl_PL + @string/language_nl_NL @@ -113,6 +114,7 @@ it-IT da-DK pl-PL + nl-NL @@ -130,6 +132,7 @@ @string/language_it_IT @string/language_da_DK @string/language_pl_PL + @string/language_nl_NL @@ -146,6 +149,7 @@ it-IT da-DK pl-PL + nl-NL diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 13e80b23a..8af9d2ffb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -216,6 +216,10 @@ changes the app and the language of the speech-recognition-based search to 'Danish'. --> Danish + + Dutch + Display diff --git a/app/src/main/res/xml/keyboard_qwerty_dutch.xml b/app/src/main/res/xml/keyboard_qwerty_dutch.xml new file mode 100644 index 000000000..85526a8a6 --- /dev/null +++ b/app/src/main/res/xml/keyboard_qwerty_dutch.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file