1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-25 05:42:10 +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() {
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);
}
}

View file

@ -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) {

View file

@ -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"}],

View file

@ -40,10 +40,11 @@
<!-- Load images -->
<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>
<!-- Rotate Screen -->
<!-- Screen rotation -->
<string name="pref_title__screen_rotation">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_landscape">Querformat</string>
<!-- Proxy -->

View file

@ -40,10 +40,9 @@
<!-- Load images -->
<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>
<!-- Rotate Screen -->
<!-- Screen rotation -->
<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="rotation_auto">Automático</string>
<string name="rotation_portrait">Vertical</string>
<string name="rotation_landscape">Apaisado</string>
<!-- Proxy -->

View file

@ -40,10 +40,9 @@
<!-- Load images -->
<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>
<!-- Rotate Screen -->
<!-- Screen rotation -->
<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="rotation_auto">Automatique</string>
<string name="rotation_portrait">Portrait</string>
<string name="rotation_landscape">Paysage</string>
<!-- Proxy -->

View file

@ -40,10 +40,9 @@
<!-- Load images -->
<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>
<!-- Rotate Screen -->
<!-- Screen rotation -->
<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="rotation_auto">Automatica</string>
<string name="rotation_portrait">Verticale</string>
<string name="rotation_landscape">Orizzontale</string>
<!-- Proxy -->

View file

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

View file

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

View file

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

View file

@ -37,7 +37,7 @@
<!-- Load images -->
<string name="pref_title__load_images">Afbeeldingen laden</string>
<string name="pref_desc__load_images">Afbeelding laden uitschakelen om mobiele data te besparen</string>
<!-- Rotate Screen -->
<!-- Screen rotation -->
<!-- Proxy -->
<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>

View file

@ -40,10 +40,9 @@
<!-- Load images -->
<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>
<!-- Rotate Screen -->
<!-- Screen rotation -->
<string name="pref_title__screen_rotation">Orientacja 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_landscape">Pozioma</string>
<!-- Proxy -->

View file

@ -23,7 +23,7 @@
<!-- Load images -->
<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>
<!-- Rotate Screen -->
<!-- Screen rotation -->
<!-- Proxy -->
<string name="pref_title__proxy_enabled">Habilitar o Proxy</string>
<!-- Chrome custom tabs -->

View file

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

View file

@ -113,25 +113,30 @@
<string name="pref_title__load_images">Load images</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_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_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_landscape">Landscape</string>
<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_landscape</item>
</array>
<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_landscape</item>
</array>
<!-- Proxy -->
<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>

View file

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