mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Moyoung: Implement language setting
This commit is contained in:
parent
fa070579be
commit
0bb1db06df
@ -212,12 +212,28 @@ public abstract class AbstractMoyoungDeviceCoordinator extends AbstractBLEDevice
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getSupportedLanguageSettings(GBDevice device) {
|
public String[] getSupportedLanguageSettings(final GBDevice device) {
|
||||||
|
// TODO: use settings customizer to display the languages
|
||||||
|
// retrieved from the watch instead of this fixed list
|
||||||
return new String[]{
|
return new String[]{
|
||||||
|
"ar_SA",
|
||||||
|
"cs_CZ",
|
||||||
|
"de_DE",
|
||||||
"en_US",
|
"en_US",
|
||||||
|
"es_ES",
|
||||||
|
"fr_FR",
|
||||||
|
"it_IT",
|
||||||
|
"ja_JP",
|
||||||
|
"ko_KO",
|
||||||
"nl_NL",
|
"nl_NL",
|
||||||
|
"pl_PL",
|
||||||
|
"pt_PT",
|
||||||
|
"ro_RO",
|
||||||
|
"ru_RU",
|
||||||
|
"uk_UA",
|
||||||
|
"zh_CN",
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HeartRateCapability.MeasurementInterval> getHeartRateMeasurementIntervals() {
|
public List<HeartRateCapability.MeasurementInterval> getHeartRateMeasurementIntervals() {
|
||||||
|
@ -1235,12 +1235,63 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
sendSetting(getSetting("DISPLAY_WATCH_FACE"), watchFace);
|
sendSetting(getSetting("DISPLAY_WATCH_FACE"), watchFace);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoyoungConstants.PREF_LANGUAGE:
|
case DeviceSettingsPreferenceConst.PREF_LANGUAGE:
|
||||||
String languagePref = prefs.getString(MoyoungConstants.PREF_LANGUAGE,
|
String languagePref = prefs.getString(DeviceSettingsPreferenceConst.PREF_LANGUAGE, "en_US");
|
||||||
String.valueOf(MoyoungEnumLanguage.LANGUAGE_ENGLISH.value()));
|
byte languageCode;
|
||||||
byte languageNum = Byte.valueOf(languagePref);
|
switch (languagePref.substring(0, 2)) {
|
||||||
|
case "zh":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_CHINESE.value();
|
||||||
|
break;
|
||||||
|
case "it":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_ITALIAN.value();
|
||||||
|
break;
|
||||||
|
case "cs":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_CZECH.value();
|
||||||
|
break;
|
||||||
|
case "ru":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_RUSSIAN.value();
|
||||||
|
break;
|
||||||
|
case "pl":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_POLISH.value();
|
||||||
|
break;
|
||||||
|
case "nl":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_DUTCH.value();
|
||||||
|
break;
|
||||||
|
case "fr":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_FRENCH.value();
|
||||||
|
break;
|
||||||
|
case "es":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_SPANISH.value();
|
||||||
|
break;
|
||||||
|
case "de":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_GERMAN.value();
|
||||||
|
break;
|
||||||
|
case "pt":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_PORTUGUESE.value();
|
||||||
|
break;
|
||||||
|
case "jp":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_JAPANESE.value();
|
||||||
|
break;
|
||||||
|
case "ko":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_KOREAN.value();
|
||||||
|
break;
|
||||||
|
case "ar":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_ARABIC.value();
|
||||||
|
break;
|
||||||
|
case "uk":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_UKRAINIAN.value();
|
||||||
|
break;
|
||||||
|
case "hu":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_HUNGARIAN.value();
|
||||||
|
break;
|
||||||
|
case "ro":
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_ROMANIAN.value();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
languageCode = MoyoungEnumLanguage.LANGUAGE_ENGLISH.value();
|
||||||
|
}
|
||||||
MoyoungSettingEnum<MoyoungEnumLanguage> languageSetting = getSetting("DEVICE_LANGUAGE");
|
MoyoungSettingEnum<MoyoungEnumLanguage> languageSetting = getSetting("DEVICE_LANGUAGE");
|
||||||
sendSetting(languageSetting, languageSetting.findByValue(languageNum));
|
sendSetting(languageSetting, languageSetting.findByValue(languageCode));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoyoungConstants.PREF_DEVICE_VERSION:
|
case MoyoungConstants.PREF_DEVICE_VERSION:
|
||||||
|
Loading…
Reference in New Issue
Block a user