diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/SpanishKeyboard.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/SpanishKeyboard.java new file mode 100644 index 000000000..31c1a7c74 --- /dev/null +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/SpanishKeyboard.java @@ -0,0 +1,46 @@ +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.utils.StringUtils; + +import java.util.Locale; + +public class SpanishKeyboard extends BaseKeyboard { + private CustomKeyboard mKeyboard; + private final Locale mSpanishLocale = new Locale("es", ""); + + public SpanishKeyboard(Context aContext) { + super(aContext); + } + + @NonNull + @Override + public CustomKeyboard getAlphabeticKeyboard() { + if (mKeyboard == null) { + mKeyboard = new CustomKeyboard(mContext.getApplicationContext(), R.xml.keyboard_qwerty_spanish); + } + return mKeyboard; + } + + @Nullable + @Override + public CandidatesResult getCandidates(String aText) { + return null; + } + + @Override + public String getKeyboardTitle() { + return StringUtils.getStringByLocale(mContext, R.string.settings_language_spanish, getLocale()); + } + + @Override + public Locale getLocale() { + return mSpanishLocale; + } +} 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 567020a7b..98c0eb0ac 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 @@ -34,6 +34,7 @@ import org.mozilla.vrbrowser.input.CustomKeyboard; import org.mozilla.vrbrowser.telemetry.TelemetryWrapper; import org.mozilla.vrbrowser.ui.keyboards.KeyboardInterface; +import org.mozilla.vrbrowser.ui.keyboards.SpanishKeyboard; import org.mozilla.vrbrowser.ui.views.AutoCompletionView; import org.mozilla.vrbrowser.ui.views.CustomKeyboardView; import org.mozilla.vrbrowser.ui.views.LanguageSelectorView; @@ -118,6 +119,7 @@ private void initialize(Context aContext) { mKeyboards = new ArrayList<>(); mKeyboards.add(new EnglishKeyboard(aContext)); + mKeyboards.add(new SpanishKeyboard(aContext)); mKeyboards.add(new ChinesePinyinKeyboard(aContext)); setDefaultKeyboard(); @@ -432,7 +434,7 @@ public void onNoKey() { @Override public void onText(CharSequence text) { - + handleText(text.toString()); } @Override diff --git a/app/src/main/res/xml/keyboard_qwerty_spanish.xml b/app/src/main/res/xml/keyboard_qwerty_spanish.xml new file mode 100644 index 000000000..71891d9a7 --- /dev/null +++ b/app/src/main/res/xml/keyboard_qwerty_spanish.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file