From b807939652f4195eeca3e4f7ef66a69147aa54ae Mon Sep 17 00:00:00 2001 From: vanitasvitae Date: Fri, 17 Jun 2016 19:43:28 +0200 Subject: [PATCH] Moved desktop/mobile toggle from settingsactivity to bottom bar, updated german translations, removed unused settings methods --- .../diaspora_android/activity/MainActivity.java | 7 ++++++- .../dfa/diaspora_android/data/AppSettings.java | 14 ++++++++------ app/src/main/res/menu/main__menu_bottom.xml | 5 +++++ app/src/main/res/values-de/strings.xml | 10 +++++++++- app/src/main/res/values/strings-preferences.xml | 9 +++------ app/src/main/res/values/strings.xml | 3 ++- app/src/main/res/xml/preferences.xml | 5 ----- 7 files changed, 33 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java index ff2c7012..24af417c 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java @@ -531,6 +531,11 @@ public class MainActivity extends AppCompatActivity return true; } + case R.id.action_toggle_desktop_page: { + webView.loadUrl("https://" + podDomain + "/mobile/toggle"); + return true; + } + case R.id.action_compose: { if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/status_messages/new"); @@ -706,7 +711,7 @@ public class MainActivity extends AppCompatActivity sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); Uri bmpUri = Uri.fromFile(new File(fileSaveDirectory, fileSaveName)); sharingIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); - startActivity(Intent.createChooser(sharingIntent, getString(R.string.share_dotdodot))); + startActivity(Intent.createChooser(sharingIntent, getString(R.string.share_dotdotdot))); } else { // Broadcast that this file is indexable diff --git a/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java b/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java index e49b7ae0..764666db 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java @@ -1,5 +1,6 @@ package com.github.dfa.diaspora_android.data; +import android.annotation.SuppressLint; import android.content.Context; import android.content.SharedPreferences; import android.util.Log; @@ -73,7 +74,6 @@ public class AppSettings { public static final String PODUSERPROFILE_ID = "podUserProfile_guid"; public static final String PODDOMAIN = "podDomain"; public static final String PODUSERPROFILE_ASPECTS = "podUserProfile_aspects"; - public static final String IS_LOAD_DESKTOP_PAGE = "pref_key_desktop_mode"; public static final String PROXY_ENABLED = "pref_key_proxy_enabled"; public static final String PROXY_WAS_ENABLED = "wasProxyEnabled"; public static final String PROXY_HOST = "pref_key_proxy_host"; @@ -92,15 +92,10 @@ public class AppSettings { setString(prefPod, PREF.PODUSERPROFILE_ID, profileId); } - public boolean isLoadImages() { return prefApp.getBoolean(PREF.IS_LOAD_IMAGES, true); } - public boolean isLoadDesktopPage() { - return prefApp.getBoolean(PREF.IS_LOAD_DESKTOP_PAGE, false); - } - public int getMinimumFontSize() { switch (prefApp.getString(PREF.MINIMUM_FONT_SIZE, "")) { case "huge": @@ -164,6 +159,7 @@ public class AppSettings { return aspects; } + @SuppressLint("CommitPrefEdits") public void setProxyEnabled(boolean enabled) { //commit instead of apply because the app is likely to be killed before apply is called. prefApp.edit().putBoolean(PREF.PROXY_ENABLED, enabled).commit(); @@ -181,6 +177,12 @@ public class AppSettings { return prefApp.getBoolean(PREF.PROXY_WAS_ENABLED, false); } + /** + * Needed in order to determine, whether the proxy has just been disabled (trigger app restart) + * or if proxy was disabled before (do not restart app) + * @param b new value + */ + @SuppressLint("CommitPrefEdits") public void setProxyWasEnabled(boolean b) { prefApp.edit().putBoolean(PREF.PROXY_WAS_ENABLED, b).commit(); } diff --git a/app/src/main/res/menu/main__menu_bottom.xml b/app/src/main/res/menu/main__menu_bottom.xml index 41600a60..a7eb0213 100644 --- a/app/src/main/res/menu/main__menu_bottom.xml +++ b/app/src/main/res/menu/main__menu_bottom.xml @@ -37,6 +37,11 @@ + <br In externem Browser öffnen… Speichere Bild als Linkadresse kopiert … - Teilen… + Teilen… Aktiviert Host Proxy Port Warnung: Proxy konnte nicht aktiviert werden… + Netzwerk + Erscheinungsbild + Deaktiviere das Laden von Bildern, um den Datenverbrauch zu verringern + Nutze einen Proxyserver um Firewalls zu umgehen + Schriftgröße + Lade Bilder + Aktiviere Proxy + Mobil-/Desktopansicht umschalten diff --git a/app/src/main/res/values/strings-preferences.xml b/app/src/main/res/values/strings-preferences.xml index 15f2706c..ebb0c14e 100644 --- a/app/src/main/res/values/strings-preferences.xml +++ b/app/src/main/res/values/strings-preferences.xml @@ -1,7 +1,7 @@ - Look and Feel + Appearance Network @@ -18,9 +18,6 @@ large huge - - Desktop mode - Load full desktop site instead of mobile view Load images @@ -29,7 +26,7 @@ Enable Proxy Proxy Diaspora\'s traffic to circumvent firewalls.\nMay require restart - Host - Port + Host + Port \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9567f116..91cb52f0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -211,6 +211,7 @@ Profile Exit app + Toggle mobile/desktop view Diaspora *[shared by #DiasporaForAndroid]* Link address copied … @@ -221,7 +222,7 @@ Copy link address to clipboard Saving image to https:// - Share… + Share… #DiasporaForAndroid Warning: Could not set network proxy… diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index c891b6c7..e6cf2a8d 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -10,11 +10,6 @@ android:summary="%s" android:entries="@array/pref_entries_font_size" android:entryValues="@array/pref_entry_values_font_size" /> -