diff options
Diffstat (limited to 'android')
7 files changed, 1 insertions, 113 deletions
diff --git a/android/source/res/values/arrays.xml b/android/source/res/values/arrays.xml deleted file mode 100644 index 832bca781572..000000000000 --- a/android/source/res/values/arrays.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string-array name="SupportedLanguagesValues"> - <item>SYSTEM_DEFAULT_LANGUAGE</item> - <item >de</item> - <item >en</item> - <item >tr</item> - </string-array> - <string-array name="SupportedLanguages"> - <item>(System Default)</item> - <item>Deutsch</item> - <item>English</item> - <item>Turkçe</item> - </string-array> -</resources> diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml index 3766db146098..36b3cef75a25 100644 --- a/android/source/res/values/strings.xml +++ b/android/source/res/values/strings.xml @@ -140,8 +140,6 @@ <string name="alert_ok">OK</string> <string name="alert_cancel">Cancel</string> <string name="current_uno_command">Current UNO command</string> - <string name="display_language">Display Language</string> - <string name="display_language_summary">Set the default display language</string> <string name="pdf_export_finished">PDF export finished</string> <string name="unable_to_export_pdf">Unable to export to pdf</string> <string name="unable_to_save">Unable to save file</string> diff --git a/android/source/res/xml/libreoffice_preferences.xml b/android/source/res/xml/libreoffice_preferences.xml index 052efacb2e3e..d8ca4dc8c7a7 100644 --- a/android/source/res/xml/libreoffice_preferences.xml +++ b/android/source/res/xml/libreoffice_preferences.xml @@ -4,15 +4,6 @@ android:title="@string/pref_category_general" android:key="PREF_CATEGORY_GENERAL"> - <ListPreference - android:title="@string/display_language" - android:summary="@string/display_language_summary" - android:entries="@array/SupportedLanguages" - android:entryValues="@array/SupportedLanguagesValues" - android:defaultValue="SYSTEM_DEFAULT_LANGUAGE" - android:key="DISPLAY_LANGUAGE" - /> - <CheckBoxPreference android:title="@string/pref_experimental_editing" android:key="ENABLE_EXPERIMENTAL" diff --git a/android/source/src/java/org/libreoffice/LibreOfficeApplication.java b/android/source/src/java/org/libreoffice/LibreOfficeApplication.java index ebe54cf27c64..3b03c83adda9 100644 --- a/android/source/src/java/org/libreoffice/LibreOfficeApplication.java +++ b/android/source/src/java/org/libreoffice/LibreOfficeApplication.java @@ -25,9 +25,4 @@ public class LibreOfficeApplication extends MultiDexApplication { public static Handler getMainHandler() { return mainHandler; } - - @Override - protected void attachBaseContext(Context base) { - super.attachBaseContext(LocaleHelper.onAttach(base)); - } } diff --git a/android/source/src/java/org/libreoffice/LocaleHelper.java b/android/source/src/java/org/libreoffice/LocaleHelper.java deleted file mode 100644 index e3997f913a32..000000000000 --- a/android/source/src/java/org/libreoffice/LocaleHelper.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.libreoffice; - -import android.content.Context; -import android.content.SharedPreferences; -import android.content.res.Configuration; -import android.content.res.Resources; -import androidx.preference.PreferenceManager; - -import java.util.Locale; - -public class LocaleHelper { - - private static final String SELECTED_LANG = "org.libreoffice.selected.lang"; - // value for language that indicates that system's default language should be used - public static final String SYSTEM_DEFAULT_LANGUAGE = "SYSTEM_DEFAULT_LANGUAGE"; - - public static Context onAttach(Context context){ - String lang = getPersistedData(context, Locale.getDefault().getLanguage()); - return setLocale(context, lang); - } - - public static Context setLocale(Context context, String lang) { - persist(context, lang); - return updateResources(context, lang); - } - - @SuppressWarnings("deprecation") - private static Context updateResources(Context context, String lang) { - Locale locale; - if (lang.equals(SYSTEM_DEFAULT_LANGUAGE)) { - locale = Locale.getDefault(); - } else { - locale = new Locale(lang); - } - Locale.setDefault(locale); - - Resources res = context.getResources(); - Configuration cfg = res.getConfiguration(); - cfg.locale = locale; - cfg.setLayoutDirection(locale); - - res.updateConfiguration(cfg, res.getDisplayMetrics()); - return context; - } - - private static void persist(Context context, String lang) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); - preferences.edit().putString(SELECTED_LANG, lang); - preferences.edit().apply(); - } - - private static String getPersistedData(Context context, String lang) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); - return preferences.getString(SELECTED_LANG, lang); - } -} diff --git a/android/source/src/java/org/libreoffice/SettingsActivity.java b/android/source/src/java/org/libreoffice/SettingsActivity.java index e9cb403be459..90d3f95459e4 100644 --- a/android/source/src/java/org/libreoffice/SettingsActivity.java +++ b/android/source/src/java/org/libreoffice/SettingsActivity.java @@ -59,9 +59,6 @@ public class SettingsActivity extends FragmentActivity { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { SettingsListenerModel.getInstance().changePreferenceState(sharedPreferences, key); - if(key.equals("DISPLAY_LANGUAGE")){ - getActivity().recreate(); - } } } } diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index e87779df0eae..63eed9d37069 100644 --- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -46,16 +46,14 @@ import android.widget.TextView; import org.libreoffice.AboutDialogFragment; import org.libreoffice.BuildConfig; import org.libreoffice.LibreOfficeMainActivity; -import org.libreoffice.LocaleHelper; import org.libreoffice.R; import org.libreoffice.SettingsActivity; -import org.libreoffice.SettingsListenerModel; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class LibreOfficeUIActivity extends AppCompatActivity implements SettingsListenerModel.OnSettingsPreferenceChangedListener, View.OnClickListener{ +public class LibreOfficeUIActivity extends AppCompatActivity implements View.OnClickListener{ public enum DocumentType { WRITER, CALC, @@ -70,7 +68,6 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings private static final String RECENT_DOCUMENTS_KEY = "RECENT_DOCUMENT_URIS"; // delimiter used for storing multiple URIs in a string private static final String RECENT_DOCUMENTS_DELIMITER = " "; - private static final String DISPLAY_LANGUAGE = "DISPLAY_LANGUAGE"; public static final String NEW_DOC_TYPE_KEY = "NEW_DOC_TYPE_KEY"; public static final String NEW_WRITER_STRING_KEY = "private:factory/swriter"; @@ -140,9 +137,6 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - readPreferences(); - SettingsListenerModel.getInstance().setListener(this); - // init UI createUI(); fabOpenAnimation = AnimationUtils.loadAnimation(this, R.anim.fab_open); @@ -160,11 +154,6 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings } } - @Override - protected void attachBaseContext(Context newBase) { - super.attachBaseContext(LocaleHelper.onAttach(newBase)); - } - public void createUI() { setContentView(R.layout.activity_document_browser); @@ -332,17 +321,6 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings return super.onOptionsItemSelected(item); } - public void readPreferences(){ - SharedPreferences defaultPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); - final String displayLanguage = defaultPrefs.getString(DISPLAY_LANGUAGE, LocaleHelper.SYSTEM_DEFAULT_LANGUAGE); - LocaleHelper.setLocale(this, displayLanguage); - } - - @Override - public void settingsPreferenceChanged(SharedPreferences sharedPreferences, String key) { - readPreferences(); - } - @Override protected void onResume() { super.onResume(); |