1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-10 14:36:01 +01:00

Fix Rotation, Remove legacy code, Remove PunkBeer Pod

* Fix #92 Rotation
* Fix #111 Legacy
* Remove punkbeer
<https://diasp.org/posts/6449363>
This commit is contained in:
Gregor Santner 2016-12-16 04:45:53 +01:00
parent 19ac40c5b3
commit 9e0c6b1741
No known key found for this signature in database
GPG key ID: 2AEB822A5CF48C9F
16 changed files with 39 additions and 53 deletions

View file

@ -79,13 +79,16 @@ public abstract class ThemedActivity extends AppCompatActivity {
} }
protected void updateScreenRotation() { protected void updateScreenRotation() {
String rotation = getAppSettings().getScreenRotation(); String setting = getAppSettings().getScreenRotation();
if (rotation.equals(getString(R.string.rotation_val_auto))) { int rotation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; // Default (system settings)
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
} else if (rotation.equals(getString(R.string.rotation_val_portrait))) { if (setting.equals(getString(R.string.rotation_val_sensor))) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); rotation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
} else { } else if (setting.equals(getString(R.string.rotation_val_portrait))) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); rotation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
} else if (setting.equals(getString(R.string.rotation_val_landscape))) {
rotation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
} }
setRequestedOrientation(rotation);
} }
} }

View file

@ -112,6 +112,10 @@ public class AppSettings {
return pref.getString(context.getString(ressourceId), defaultValue); 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) { private boolean getBoolean(SharedPreferences pref, int ressourceId, boolean defaultValue) {
return pref.getBoolean(context.getString(ressourceId), defaultValue); return pref.getBoolean(context.getString(ressourceId), defaultValue);
} }
@ -170,20 +174,7 @@ public class AppSettings {
setString(prefPod, R.string.pref_key__podprofile_name, name); 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() { public DiasporaPod getPod() {
upgradeLegacyPoddomain();
if (currentPod0Cached == null) { if (currentPod0Cached == null) {
String pref = getString(prefPod, R.string.pref_key__current_pod_0, ""); String pref = getString(prefPod, R.string.pref_key__current_pod_0, "");
@ -206,7 +197,6 @@ public class AppSettings {
} }
public boolean hasPod() { public boolean hasPod() {
upgradeLegacyPoddomain();
return !getString(prefPod, R.string.pref_key__current_pod_0, "").equals(""); return !getString(prefPod, R.string.pref_key__current_pod_0, "").equals("");
} }
@ -403,7 +393,7 @@ public class AppSettings {
} }
public String getScreenRotation() { 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) { public void setPrimaryColorSettings(int base, int shade) {

View file

@ -329,13 +329,6 @@
"mainLangs": ["fr"], "mainLangs": ["fr"],
"id": 31397 "id": 31397
}, },
{
"score": 20,
"podUrls": [{"host": "diaspora.punkbeer.me"}],
"name": "punkbeer.me",
"mainLangs": [],
"id": 44751
},
{ {
"score": 20, "score": 20,
"podUrls": [{"host": "diaspora.raven-ip.com"}], "podUrls": [{"host": "diaspora.raven-ip.com"}],

View file

@ -40,10 +40,11 @@
<!-- Load images --> <!-- Load images -->
<string name="pref_title__load_images">Lade Bilder</string> <string name="pref_title__load_images">Lade Bilder</string>
<string name="pref_desc__load_images">Deaktiviere das Laden von Bildern, um den Datenverbrauch zu verringern</string> <string name="pref_desc__load_images">Deaktiviere das Laden von Bildern, um den Datenverbrauch zu verringern</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<string name="pref_title__screen_rotation">Bildschirmrotation</string> <string name="pref_title__screen_rotation">Bildschirmrotation</string>
<string name="pref_desc__screen_rotation">Kontrolliere die automatische Bildschirmrotation</string> <string name="pref_desc__screen_rotation">Kontrolliere die automatische Bildschirmrotation</string>
<string name="rotation_auto">Automatisch</string> <string name="rotation_system">Standard</string>
<string name="rotation_sensor">Sensor\n(System-Einstellungen ignorieren)</string>
<string name="rotation_portrait">Hochformat</string> <string name="rotation_portrait">Hochformat</string>
<string name="rotation_landscape">Querformat</string> <string name="rotation_landscape">Querformat</string>
<!-- Proxy --> <!-- Proxy -->

View file

@ -40,10 +40,9 @@
<!-- Load images --> <!-- Load images -->
<string name="pref_title__load_images">Cargar imágenes</string> <string name="pref_title__load_images">Cargar imágenes</string>
<string name="pref_desc__load_images">Desactivar la carga de de imágenes a datos móviles seguros</string> <string name="pref_desc__load_images">Desactivar la carga de de imágenes a datos móviles seguros</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<string name="pref_title__screen_rotation">Rotación de la pantalla</string> <string name="pref_title__screen_rotation">Rotación de la pantalla</string>
<string name="pref_desc__screen_rotation">Controlar la rotación automática de la pantalla</string> <string name="pref_desc__screen_rotation">Controlar la rotación automática de la pantalla</string>
<string name="rotation_auto">Automático</string>
<string name="rotation_portrait">Vertical</string> <string name="rotation_portrait">Vertical</string>
<string name="rotation_landscape">Apaisado</string> <string name="rotation_landscape">Apaisado</string>
<!-- Proxy --> <!-- Proxy -->

View file

@ -40,10 +40,9 @@
<!-- Load images --> <!-- Load images -->
<string name="pref_title__load_images">Charger les images</string> <string name="pref_title__load_images">Charger les images</string>
<string name="pref_desc__load_images">Désactiver le chargements des images pour préserver la data mobile</string> <string name="pref_desc__load_images">Désactiver le chargements des images pour préserver la data mobile</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<string name="pref_title__screen_rotation">Rotation de l\'écran</string> <string name="pref_title__screen_rotation">Rotation de l\'écran</string>
<string name="pref_desc__screen_rotation">Rotation automatique de l\'écran</string> <string name="pref_desc__screen_rotation">Rotation automatique de l\'écran</string>
<string name="rotation_auto">Automatique</string>
<string name="rotation_portrait">Portrait</string> <string name="rotation_portrait">Portrait</string>
<string name="rotation_landscape">Paysage</string> <string name="rotation_landscape">Paysage</string>
<!-- Proxy --> <!-- Proxy -->

View file

@ -40,10 +40,9 @@
<!-- Load images --> <!-- Load images -->
<string name="pref_title__load_images">Carica immagini</string> <string name="pref_title__load_images">Carica immagini</string>
<string name="pref_desc__load_images">Disabilita il caricamento delle immagini per risparmiare la rete dati</string> <string name="pref_desc__load_images">Disabilita il caricamento delle immagini per risparmiare la rete dati</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<string name="pref_title__screen_rotation">Rotazione dello schermo</string> <string name="pref_title__screen_rotation">Rotazione dello schermo</string>
<string name="pref_desc__screen_rotation">Controlla la rotazione automatica dello schermo</string> <string name="pref_desc__screen_rotation">Controlla la rotazione automatica dello schermo</string>
<string name="rotation_auto">Automatica</string>
<string name="rotation_portrait">Verticale</string> <string name="rotation_portrait">Verticale</string>
<string name="rotation_landscape">Orizzontale</string> <string name="rotation_landscape">Orizzontale</string>
<!-- Proxy --> <!-- Proxy -->

View file

@ -40,10 +40,9 @@
<!-- Load images --> <!-- Load images -->
<string name="pref_title__load_images">画像の読み込み</string> <string name="pref_title__load_images">画像の読み込み</string>
<string name="pref_desc__load_images">安全なモバイルデータのため、画像の読み込みを無効にします</string> <string name="pref_desc__load_images">安全なモバイルデータのため、画像の読み込みを無効にします</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<string name="pref_title__screen_rotation">画面の回転</string> <string name="pref_title__screen_rotation">画面の回転</string>
<string name="pref_desc__screen_rotation">画面の回転を自動でコントロール</string> <string name="pref_desc__screen_rotation">画面の回転を自動でコントロール</string>
<string name="rotation_auto">自動</string>
<string name="rotation_portrait">顔写真</string> <string name="rotation_portrait">顔写真</string>
<string name="rotation_landscape">風景</string> <string name="rotation_landscape">風景</string>
<!-- Proxy --> <!-- Proxy -->

View file

@ -15,7 +15,7 @@
<!-- Font size --> <!-- Font size -->
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
<!-- Load images --> <!-- Load images -->
<!-- Rotate Screen --> <!-- Screen rotation -->
<!-- Proxy --> <!-- Proxy -->
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->
<!-- Diaspora Settings --> <!-- Diaspora Settings -->

View file

@ -23,7 +23,7 @@
<!-- Load images --> <!-- Load images -->
<string name="pref_title__load_images">ചിത്രങ്ങൾ കാണിക്കണമോ</string> <string name="pref_title__load_images">ചിത്രങ്ങൾ കാണിക്കണമോ</string>
<string name="pref_desc__load_images">മൊബൈൽ ഡാറ്റ ഉപഭോഗം കുറയ്ക്കാനായി ചിത്രങ്ങൾ ലോഡ് ചെയ്യാതിരിക്കുക</string> <string name="pref_desc__load_images">മൊബൈൽ ഡാറ്റ ഉപഭോഗം കുറയ്ക്കാനായി ചിത്രങ്ങൾ ലോഡ് ചെയ്യാതിരിക്കുക</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__proxy_enabled">പ്രോക്സി അനുവദിക്കൂ</string> <string name="pref_title__proxy_enabled">പ്രോക്സി അനുവദിക്കൂ</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->

View file

@ -37,7 +37,7 @@
<!-- Load images --> <!-- Load images -->
<string name="pref_title__load_images">Afbeeldingen laden</string> <string name="pref_title__load_images">Afbeeldingen laden</string>
<string name="pref_desc__load_images">Afbeelding laden uitschakelen om mobiele data te besparen</string> <string name="pref_desc__load_images">Afbeelding laden uitschakelen om mobiele data te besparen</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__http_proxy_load_tor_preset">Tor Voorinstelling laden</string> <string name="pref_title__http_proxy_load_tor_preset">Tor Voorinstelling laden</string>
<string name="pref_desc__http_proxy_load_tor_preset">Laden van de proxy-instellingen voor HTTP-Proxy Tor (Orbot)</string> <string name="pref_desc__http_proxy_load_tor_preset">Laden van de proxy-instellingen voor HTTP-Proxy Tor (Orbot)</string>

View file

@ -40,10 +40,9 @@
<!-- Load images --> <!-- Load images -->
<string name="pref_title__load_images">Wczytuj obrazy</string> <string name="pref_title__load_images">Wczytuj obrazy</string>
<string name="pref_desc__load_images">Odznacz by wyłączyć wczytywanie obrazów, np. w celu oszczędzania transferu</string> <string name="pref_desc__load_images">Odznacz by wyłączyć wczytywanie obrazów, np. w celu oszczędzania transferu</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<string name="pref_title__screen_rotation">Orientacja ekranu</string> <string name="pref_title__screen_rotation">Orientacja ekranu</string>
<string name="pref_desc__screen_rotation">Wybierz pożądaną orientację ekranu</string> <string name="pref_desc__screen_rotation">Wybierz pożądaną orientację ekranu</string>
<string name="rotation_auto">Automatyczna</string>
<string name="rotation_portrait">Pionowa</string> <string name="rotation_portrait">Pionowa</string>
<string name="rotation_landscape">Pozioma</string> <string name="rotation_landscape">Pozioma</string>
<!-- Proxy --> <!-- Proxy -->

View file

@ -23,7 +23,7 @@
<!-- Load images --> <!-- Load images -->
<string name="pref_title__load_images">Carregar imagens</string> <string name="pref_title__load_images">Carregar imagens</string>
<string name="pref_desc__load_images">Desabilitar o carregamento de imagens para economizar seus créditos</string> <string name="pref_desc__load_images">Desabilitar o carregamento de imagens para economizar seus créditos</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__proxy_enabled">Habilitar o Proxy</string> <string name="pref_title__proxy_enabled">Habilitar o Proxy</string>
<!-- Chrome custom tabs --> <!-- Chrome custom tabs -->

View file

@ -40,10 +40,9 @@
<!-- Load images --> <!-- Load images -->
<string name="pref_title__load_images">Загрузка изображений</string> <string name="pref_title__load_images">Загрузка изображений</string>
<string name="pref_desc__load_images">Отключить загрузку изображений для экономии трафика</string> <string name="pref_desc__load_images">Отключить загрузку изображений для экономии трафика</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<string name="pref_title__screen_rotation">Поворот экрана</string> <string name="pref_title__screen_rotation">Поворот экрана</string>
<string name="pref_desc__screen_rotation">Контролировать автоматический поворот экрана</string> <string name="pref_desc__screen_rotation">Контролировать автоматический поворот экрана</string>
<string name="rotation_auto">Автоматический поворот</string>
<string name="rotation_portrait">Вертикальная ориентация</string> <string name="rotation_portrait">Вертикальная ориентация</string>
<string name="rotation_landscape">Горизонтальная ориентация</string> <string name="rotation_landscape">Горизонтальная ориентация</string>
<!-- Proxy --> <!-- Proxy -->

View file

@ -113,25 +113,30 @@
<string name="pref_title__load_images">Load images</string> <string name="pref_title__load_images">Load images</string>
<string name="pref_desc__load_images">Toggle image loading to eg. safe mobile data</string> <string name="pref_desc__load_images">Toggle image loading to eg. safe mobile data</string>
<!-- Rotate Screen --> <!-- Screen rotation -->
<string name="pref_title__screen_rotation">Screen rotation</string> <string name="pref_title__screen_rotation">Screen rotation</string>
<string name="pref_desc__screen_rotation">Control automatic screen rotation</string> <string name="pref_desc__screen_rotation">Control automatic screen rotation</string>
<string name="rotation_val_auto" translatable="false">auto</string> <string name="rotation_val_system" translatable="false">auto</string>
<string name="rotation_val_sensor" translatable="false">sensor</string>
<string name="rotation_val_portrait" translatable="false">portrait</string> <string name="rotation_val_portrait" translatable="false">portrait</string>
<string name="rotation_val_landscape" translatable="false">landscape</string> <string name="rotation_val_landscape" translatable="false">landscape</string>
<string name="rotation_auto">Automatic</string> <string name="rotation_system">Default</string>
<string name="rotation_sensor">Sensor\n(ignore system settings)</string>
<string name="rotation_portrait">Portrait</string> <string name="rotation_portrait">Portrait</string>
<string name="rotation_landscape">Landscape</string> <string name="rotation_landscape">Landscape</string>
<array name="pref_entries_values__screen_rotation" translatable="false"> <array name="pref_entries_values__screen_rotation" translatable="false">
<item>@string/rotation_val_auto</item> <item>@string/rotation_val_system</item>
<item>@string/rotation_val_sensor</item>
<item>@string/rotation_val_portrait</item> <item>@string/rotation_val_portrait</item>
<item>@string/rotation_val_landscape</item> <item>@string/rotation_val_landscape</item>
</array> </array>
<array name="pref_entries__screen_rotation" translatable="false"> <array name="pref_entries__screen_rotation" translatable="false">
<item>@string/rotation_auto</item> <item>@string/rotation_system</item>
<item>@string/rotation_sensor</item>
<item>@string/rotation_portrait</item> <item>@string/rotation_portrait</item>
<item>@string/rotation_landscape</item> <item>@string/rotation_landscape</item>
</array> </array>
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title__http_proxy_load_tor_preset">Load Tor Preset</string> <string name="pref_title__http_proxy_load_tor_preset">Load Tor Preset</string>
<string name="pref_desc__http_proxy_load_tor_preset">Load proxy settings for Tor (Orbot) HTTP Proxy</string> <string name="pref_desc__http_proxy_load_tor_preset">Load proxy settings for Tor (Orbot) HTTP Proxy</string>

View file

@ -68,7 +68,7 @@
android:icon="@drawable/ic_touch_app_black_24px"/> android:icon="@drawable/ic_touch_app_black_24px"/>
<ListPreference <ListPreference
android:defaultValue="@string/rotation_val_auto" android:defaultValue="@string/rotation_val_system"
android:key="@string/pref_key__screen_rotation" android:key="@string/pref_key__screen_rotation"
android:title="@string/pref_title__screen_rotation" android:title="@string/pref_title__screen_rotation"
android:summary="@string/pref_desc__screen_rotation" android:summary="@string/pref_desc__screen_rotation"