mirror of
https://github.com/gsantner/dandelion
synced 2025-09-10 10:49:42 +02: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:
parent
19ac40c5b3
commit
9e0c6b1741
16 changed files with 39 additions and 53 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue