From e93e60b6a0006df0fa03936c02bd2446f5413fef Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Tue, 21 Jan 2020 17:52:16 +0100 Subject: [PATCH] Fixes voice language issue when reset. Also force save the display one (#2692) --- .../ui/widgets/settings/DisplayLanguageOptionsView.java | 1 + .../ui/widgets/settings/VoiceSearchLanguageOptionsView.java | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/DisplayLanguageOptionsView.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/DisplayLanguageOptionsView.java index 7e98119e7..d8d6670ec 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/DisplayLanguageOptionsView.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/DisplayLanguageOptionsView.java @@ -62,6 +62,7 @@ protected boolean reset() { String currentLocale = LocaleUtils.getCurrentLocale(); if (currentLocale.equalsIgnoreCase(systemLocale)) { setLanguage(LocaleUtils.getIndexForSupportedLocale(systemLocale), false); + SettingsStore.getInstance(getContext()).setDisplayLocale(currentLocale); return false; } else { diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/VoiceSearchLanguageOptionsView.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/VoiceSearchLanguageOptionsView.java index e45159c19..52ab1542c 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/VoiceSearchLanguageOptionsView.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/VoiceSearchLanguageOptionsView.java @@ -59,16 +59,16 @@ private void initialize(Context aContext) { @Override protected boolean reset() { String systemLocale = LocaleUtils.getClosestSupportedLocale(getContext(), LocaleUtils.getDeviceLanguage().getId()); - String currentLocale = LocaleUtils.getCurrentLocale(); + String currentLocale = LocaleUtils.getVoiceSearchLanguage(getContext()).getId(); if (currentLocale.equalsIgnoreCase(systemLocale)) { setLanguage(LocaleUtils.getIndexForSupportedLocale(systemLocale), false); - return false; } else { setLanguage(LocaleUtils.getIndexForSupportedLocale(systemLocale), true); SettingsStore.getInstance(getContext()).setVoiceSearchLocale(null); - return true; } + + return false; } private RadioGroupSetting.OnCheckedChangeListener mLanguageListener = (radioGroup, checkedId, doApply) -> {