From 9e0c6b1741d1bafc60779ac6ed516f98d612bff9 Mon Sep 17 00:00:00 2001 From: Gregor Santner Date: Fri, 16 Dec 2016 04:45:53 +0100 Subject: [PATCH] Fix Rotation, Remove legacy code, Remove PunkBeer Pod * Fix #92 Rotation * Fix #111 Legacy * Remove punkbeer --- .../ui/theme/ThemedActivity.java | 17 +++++++++------- .../diaspora_android/util/AppSettings.java | 20 +++++-------------- app/src/main/res/raw/podlist.json | 7 ------- .../res/values-de/strings-preferences.xml | 5 +++-- .../res/values-es/strings-preferences.xml | 3 +-- .../res/values-fr/strings-preferences.xml | 3 +-- .../res/values-it/strings-preferences.xml | 3 +-- .../res/values-ja/strings-preferences.xml | 3 +-- .../res/values-kn/strings-preferences.xml | 2 +- .../res/values-ml/strings-preferences.xml | 2 +- .../res/values-nl/strings-preferences.xml | 2 +- .../res/values-pl/strings-preferences.xml | 3 +-- .../res/values-pt-rBR/strings-preferences.xml | 2 +- .../res/values-ru/strings-preferences.xml | 3 +-- .../main/res/values/strings-preferences.xml | 15 +++++++++----- app/src/main/res/xml/preferences__master.xml | 2 +- 16 files changed, 39 insertions(+), 53 deletions(-) diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/theme/ThemedActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/theme/ThemedActivity.java index 118f0604..33b60e61 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/ui/theme/ThemedActivity.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/theme/ThemedActivity.java @@ -79,13 +79,16 @@ public abstract class ThemedActivity extends AppCompatActivity { } protected void updateScreenRotation() { - String rotation = getAppSettings().getScreenRotation(); - if (rotation.equals(getString(R.string.rotation_val_auto))) { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); - } else if (rotation.equals(getString(R.string.rotation_val_portrait))) { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); - } else { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); + String setting = getAppSettings().getScreenRotation(); + int rotation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; // Default (system settings) + + if (setting.equals(getString(R.string.rotation_val_sensor))) { + rotation = ActivityInfo.SCREEN_ORIENTATION_SENSOR; + } else if (setting.equals(getString(R.string.rotation_val_portrait))) { + rotation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; + } else if (setting.equals(getString(R.string.rotation_val_landscape))) { + rotation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; } + setRequestedOrientation(rotation); } } diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java b/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java index f4734e63..002e0a6d 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java @@ -112,6 +112,10 @@ public class AppSettings { return pref.getString(context.getString(ressourceId), defaultValue); } + private String getString(SharedPreferences pref, int ressourceId, int ressourceIdDefaultValue) { + return pref.getString(context.getString(ressourceId), context.getString(ressourceIdDefaultValue)); + } + private boolean getBoolean(SharedPreferences pref, int ressourceId, boolean defaultValue) { return pref.getBoolean(context.getString(ressourceId), defaultValue); } @@ -170,20 +174,7 @@ public class AppSettings { setString(prefPod, R.string.pref_key__podprofile_name, name); } - - // TODO: Remove legacy at some time ;) - private void upgradeLegacyPoddomain() { - String legacy = getString(prefPod, R.string.pref_key__poddomain_legacy, ""); - if (!legacy.equals("")) { - DiasporaPod pod = new DiasporaPod(); - pod.setName(legacy); - pod.getPodUrls().add(new DiasporaPodUrl().setHost(legacy)); - setPod(pod); - } - } - public DiasporaPod getPod() { - upgradeLegacyPoddomain(); if (currentPod0Cached == null) { String pref = getString(prefPod, R.string.pref_key__current_pod_0, ""); @@ -206,7 +197,6 @@ public class AppSettings { } public boolean hasPod() { - upgradeLegacyPoddomain(); return !getString(prefPod, R.string.pref_key__current_pod_0, "").equals(""); } @@ -403,7 +393,7 @@ public class AppSettings { } public String getScreenRotation() { - return getString(prefApp, R.string.pref_key__screen_rotation, "auto"); + return getString(prefApp, R.string.pref_key__screen_rotation, R.string.rotation_val_system); } public void setPrimaryColorSettings(int base, int shade) { diff --git a/app/src/main/res/raw/podlist.json b/app/src/main/res/raw/podlist.json index b3191d4d..c260700f 100644 --- a/app/src/main/res/raw/podlist.json +++ b/app/src/main/res/raw/podlist.json @@ -329,13 +329,6 @@ "mainLangs": ["fr"], "id": 31397 }, - { - "score": 20, - "podUrls": [{"host": "diaspora.punkbeer.me"}], - "name": "punkbeer.me", - "mainLangs": [], - "id": 44751 - }, { "score": 20, "podUrls": [{"host": "diaspora.raven-ip.com"}], diff --git a/app/src/main/res/values-de/strings-preferences.xml b/app/src/main/res/values-de/strings-preferences.xml index b1cfcda2..d1662b44 100644 --- a/app/src/main/res/values-de/strings-preferences.xml +++ b/app/src/main/res/values-de/strings-preferences.xml @@ -40,10 +40,11 @@ Lade Bilder Deaktiviere das Laden von Bildern, um den Datenverbrauch zu verringern - + Bildschirmrotation Kontrolliere die automatische Bildschirmrotation - Automatisch + Standard + Sensor\n(System-Einstellungen ignorieren) Hochformat Querformat diff --git a/app/src/main/res/values-es/strings-preferences.xml b/app/src/main/res/values-es/strings-preferences.xml index acdd0aaa..75b8f09d 100644 --- a/app/src/main/res/values-es/strings-preferences.xml +++ b/app/src/main/res/values-es/strings-preferences.xml @@ -40,10 +40,9 @@ Cargar imágenes Desactivar la carga de de imágenes a datos móviles seguros - + Rotación de la pantalla Controlar la rotación automática de la pantalla - Automático Vertical Apaisado diff --git a/app/src/main/res/values-fr/strings-preferences.xml b/app/src/main/res/values-fr/strings-preferences.xml index 326e68dd..57dd4a7f 100644 --- a/app/src/main/res/values-fr/strings-preferences.xml +++ b/app/src/main/res/values-fr/strings-preferences.xml @@ -40,10 +40,9 @@ Charger les images Désactiver le chargements des images pour préserver la data mobile - + Rotation de l\'écran Rotation automatique de l\'écran - Automatique Portrait Paysage diff --git a/app/src/main/res/values-it/strings-preferences.xml b/app/src/main/res/values-it/strings-preferences.xml index a0711ed3..e0b13625 100644 --- a/app/src/main/res/values-it/strings-preferences.xml +++ b/app/src/main/res/values-it/strings-preferences.xml @@ -40,10 +40,9 @@ Carica immagini Disabilita il caricamento delle immagini per risparmiare la rete dati - + Rotazione dello schermo Controlla la rotazione automatica dello schermo - Automatica Verticale Orizzontale diff --git a/app/src/main/res/values-ja/strings-preferences.xml b/app/src/main/res/values-ja/strings-preferences.xml index 7b667f4d..008d44ef 100644 --- a/app/src/main/res/values-ja/strings-preferences.xml +++ b/app/src/main/res/values-ja/strings-preferences.xml @@ -40,10 +40,9 @@ 画像の読み込み 安全なモバイルデータのため、画像の読み込みを無効にします - + 画面の回転 画面の回転を自動でコントロール - 自動 顔写真 風景 diff --git a/app/src/main/res/values-kn/strings-preferences.xml b/app/src/main/res/values-kn/strings-preferences.xml index f8a035d1..fd7f2a36 100644 --- a/app/src/main/res/values-kn/strings-preferences.xml +++ b/app/src/main/res/values-kn/strings-preferences.xml @@ -15,7 +15,7 @@ - + diff --git a/app/src/main/res/values-ml/strings-preferences.xml b/app/src/main/res/values-ml/strings-preferences.xml index 6adc4aa0..17b34ae9 100644 --- a/app/src/main/res/values-ml/strings-preferences.xml +++ b/app/src/main/res/values-ml/strings-preferences.xml @@ -23,7 +23,7 @@ ചിത്രങ്ങൾ കാണിക്കണമോ മൊബൈൽ ഡാറ്റ ഉപഭോഗം കുറയ്ക്കാനായി ചിത്രങ്ങൾ ലോഡ് ചെയ്യാതിരിക്കുക - + പ്രോക്സി അനുവദിക്കൂ diff --git a/app/src/main/res/values-nl/strings-preferences.xml b/app/src/main/res/values-nl/strings-preferences.xml index 834466b0..fdeeb7e3 100644 --- a/app/src/main/res/values-nl/strings-preferences.xml +++ b/app/src/main/res/values-nl/strings-preferences.xml @@ -37,7 +37,7 @@ Afbeeldingen laden Afbeelding laden uitschakelen om mobiele data te besparen - + Tor Voorinstelling laden Laden van de proxy-instellingen voor HTTP-Proxy Tor (Orbot) diff --git a/app/src/main/res/values-pl/strings-preferences.xml b/app/src/main/res/values-pl/strings-preferences.xml index 33584d73..93f51f0c 100644 --- a/app/src/main/res/values-pl/strings-preferences.xml +++ b/app/src/main/res/values-pl/strings-preferences.xml @@ -40,10 +40,9 @@ Wczytuj obrazy Odznacz by wyłączyć wczytywanie obrazów, np. w celu oszczędzania transferu - + Orientacja ekranu Wybierz pożądaną orientację ekranu - Automatyczna Pionowa Pozioma diff --git a/app/src/main/res/values-pt-rBR/strings-preferences.xml b/app/src/main/res/values-pt-rBR/strings-preferences.xml index 47941dc5..c3de413e 100644 --- a/app/src/main/res/values-pt-rBR/strings-preferences.xml +++ b/app/src/main/res/values-pt-rBR/strings-preferences.xml @@ -23,7 +23,7 @@ Carregar imagens Desabilitar o carregamento de imagens para economizar seus créditos - + Habilitar o Proxy diff --git a/app/src/main/res/values-ru/strings-preferences.xml b/app/src/main/res/values-ru/strings-preferences.xml index 133bbbc0..71c9e24d 100644 --- a/app/src/main/res/values-ru/strings-preferences.xml +++ b/app/src/main/res/values-ru/strings-preferences.xml @@ -40,10 +40,9 @@ Загрузка изображений Отключить загрузку изображений для экономии трафика - + Поворот экрана Контролировать автоматический поворот экрана - Автоматический поворот Вертикальная ориентация Горизонтальная ориентация diff --git a/app/src/main/res/values/strings-preferences.xml b/app/src/main/res/values/strings-preferences.xml index c7f15ef0..5062d966 100644 --- a/app/src/main/res/values/strings-preferences.xml +++ b/app/src/main/res/values/strings-preferences.xml @@ -113,25 +113,30 @@ Load images Toggle image loading to eg. safe mobile data - + Screen rotation Control automatic screen rotation - auto + auto + sensor portrait landscape - Automatic + Default + Sensor\n(ignore system settings) Portrait Landscape - @string/rotation_val_auto + @string/rotation_val_system + @string/rotation_val_sensor @string/rotation_val_portrait @string/rotation_val_landscape - @string/rotation_auto + @string/rotation_system + @string/rotation_sensor @string/rotation_portrait @string/rotation_landscape + Load Tor Preset Load proxy settings for Tor (Orbot) HTTP Proxy diff --git a/app/src/main/res/xml/preferences__master.xml b/app/src/main/res/xml/preferences__master.xml index 70e9ec76..a1d8ce27 100644 --- a/app/src/main/res/xml/preferences__master.xml +++ b/app/src/main/res/xml/preferences__master.xml @@ -68,7 +68,7 @@ android:icon="@drawable/ic_touch_app_black_24px"/>