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

Moved desktop/mobile toggle from settingsactivity to bottom bar, updated german translations, removed unused settings methods

This commit is contained in:
vanitasvitae 2016-06-17 19:43:28 +02:00
parent 85e54f03e9
commit b807939652
7 changed files with 33 additions and 20 deletions

View file

@ -531,6 +531,11 @@ public class MainActivity extends AppCompatActivity
return true; return true;
} }
case R.id.action_toggle_desktop_page: {
webView.loadUrl("https://" + podDomain + "/mobile/toggle");
return true;
}
case R.id.action_compose: { case R.id.action_compose: {
if (Helpers.isOnline(MainActivity.this)) { if (Helpers.isOnline(MainActivity.this)) {
webView.loadUrl("https://" + podDomain + "/status_messages/new"); webView.loadUrl("https://" + podDomain + "/status_messages/new");
@ -706,7 +711,7 @@ public class MainActivity extends AppCompatActivity
sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl());
Uri bmpUri = Uri.fromFile(new File(fileSaveDirectory, fileSaveName)); Uri bmpUri = Uri.fromFile(new File(fileSaveDirectory, fileSaveName));
sharingIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); 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 { else {
// Broadcast that this file is indexable // Broadcast that this file is indexable

View file

@ -1,5 +1,6 @@
package com.github.dfa.diaspora_android.data; package com.github.dfa.diaspora_android.data;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.util.Log; import android.util.Log;
@ -73,7 +74,6 @@ public class AppSettings {
public static final String PODUSERPROFILE_ID = "podUserProfile_guid"; public static final String PODUSERPROFILE_ID = "podUserProfile_guid";
public static final String PODDOMAIN = "podDomain"; public static final String PODDOMAIN = "podDomain";
public static final String PODUSERPROFILE_ASPECTS = "podUserProfile_aspects"; 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_ENABLED = "pref_key_proxy_enabled";
public static final String PROXY_WAS_ENABLED = "wasProxyEnabled"; public static final String PROXY_WAS_ENABLED = "wasProxyEnabled";
public static final String PROXY_HOST = "pref_key_proxy_host"; public static final String PROXY_HOST = "pref_key_proxy_host";
@ -92,15 +92,10 @@ public class AppSettings {
setString(prefPod, PREF.PODUSERPROFILE_ID, profileId); setString(prefPod, PREF.PODUSERPROFILE_ID, profileId);
} }
public boolean isLoadImages() { public boolean isLoadImages() {
return prefApp.getBoolean(PREF.IS_LOAD_IMAGES, true); return prefApp.getBoolean(PREF.IS_LOAD_IMAGES, true);
} }
public boolean isLoadDesktopPage() {
return prefApp.getBoolean(PREF.IS_LOAD_DESKTOP_PAGE, false);
}
public int getMinimumFontSize() { public int getMinimumFontSize() {
switch (prefApp.getString(PREF.MINIMUM_FONT_SIZE, "")) { switch (prefApp.getString(PREF.MINIMUM_FONT_SIZE, "")) {
case "huge": case "huge":
@ -164,6 +159,7 @@ public class AppSettings {
return aspects; return aspects;
} }
@SuppressLint("CommitPrefEdits")
public void setProxyEnabled(boolean enabled) { public void setProxyEnabled(boolean enabled) {
//commit instead of apply because the app is likely to be killed before apply is called. //commit instead of apply because the app is likely to be killed before apply is called.
prefApp.edit().putBoolean(PREF.PROXY_ENABLED, enabled).commit(); prefApp.edit().putBoolean(PREF.PROXY_ENABLED, enabled).commit();
@ -181,6 +177,12 @@ public class AppSettings {
return prefApp.getBoolean(PREF.PROXY_WAS_ENABLED, false); 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) { public void setProxyWasEnabled(boolean b) {
prefApp.edit().putBoolean(PREF.PROXY_WAS_ENABLED, b).commit(); prefApp.edit().putBoolean(PREF.PROXY_WAS_ENABLED, b).commit();
} }

View file

@ -37,6 +37,11 @@
<!-- overflow menu --> <!-- overflow menu -->
<item
android:id="@+id/action_toggle_desktop_page"
android:icon="@drawable/ic_sync_white_24dp"
android:title="@string/toggle_desktop_page"
/>
<item <item
android:id="@+id/action_exit" android:id="@+id/action_exit"
android:icon="@drawable/ic_sync_white_24dp" android:icon="@drawable/ic_sync_white_24dp"

View file

@ -171,11 +171,19 @@ along with this program. If not, see http://www.gnu.org/licenses.&lt;br> &lt;br
<string name="context_menu_open_external_browser">In externem Browser öffnen…</string> <string name="context_menu_open_external_browser">In externem Browser öffnen…</string>
<string name="toast_saved_image_to_location">Speichere Bild als</string> <string name="toast_saved_image_to_location">Speichere Bild als</string>
<string name="toast_link_address_copied">Linkadresse kopiert …</string> <string name="toast_link_address_copied">Linkadresse kopiert …</string>
<string name="share_dotdodot">Teilen…</string> <string name="share_dotdotdot">Teilen…</string>
<string name="proxy_enabled">Aktiviert</string> <string name="proxy_enabled">Aktiviert</string>
<string name="proxy_host">Host</string> <string name="proxy_host">Host</string>
<string name="settings_proxy">Proxy</string> <string name="settings_proxy">Proxy</string>
<string name="proxy_port">Port</string> <string name="proxy_port">Port</string>
<string name="toast_set_proxy_failed">Warnung: Proxy konnte nicht aktiviert werden…</string> <string name="toast_set_proxy_failed">Warnung: Proxy konnte nicht aktiviert werden…</string>
<string name="pref_category_network">Netzwerk</string>
<string name="pref_category_visuals">Erscheinungsbild</string>
<string name="pref_desc_load_images">Deaktiviere das Laden von Bildern, um den Datenverbrauch zu verringern</string>
<string name="pref_desc_proxy_enabled">Nutze einen Proxyserver um Firewalls zu umgehen</string>
<string name="pref_title_font_size">Schriftgröße</string>
<string name="pref_title_load_images">Lade Bilder</string>
<string name="pref_title_proxy_enabled">Aktiviere Proxy</string>
<string name="toggle_desktop_page">Mobil-/Desktopansicht umschalten</string>
</resources> </resources>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Categories --> <!-- Categories -->
<string name="pref_category_visuals">Look and Feel</string> <string name="pref_category_visuals">Appearance</string>
<string name="pref_category_network">Network</string> <string name="pref_category_network">Network</string>
<!-- Visuals --> <!-- Visuals -->
@ -18,9 +18,6 @@
<item>large</item> <item>large</item>
<item>huge</item> <item>huge</item>
</array> </array>
<!-- Mobile/Desktop view -->
<string name="pref_title_desktop_view">Desktop mode</string>
<string name="pref_desc_desktop_view">Load full desktop site instead of mobile view</string>
<!-- Load images --> <!-- Load images -->
<string name="pref_title_load_images">Load images</string> <string name="pref_title_load_images">Load images</string>
@ -29,7 +26,7 @@
<!-- Proxy --> <!-- Proxy -->
<string name="pref_title_proxy_enabled">Enable Proxy</string> <string name="pref_title_proxy_enabled">Enable Proxy</string>
<string name="pref_desc_proxy_enabled">Proxy Diaspora\'s traffic to circumvent firewalls.\nMay require restart</string> <string name="pref_desc_proxy_enabled">Proxy Diaspora\'s traffic to circumvent firewalls.\nMay require restart</string>
<string name="pref_title_proxy_host">Host</string> <string name="pref_title_proxy_host" translatable="false">Host</string>
<string name="pref_title_proxy_port">Port</string> <string name="pref_title_proxy_port" translatable="false">Port</string>
</resources> </resources>

View file

@ -211,6 +211,7 @@
<string name="jb_profile">Profile</string> <string name="jb_profile">Profile</string>
<string name="exit_app">Exit app</string> <string name="exit_app">Exit app</string>
<string name="toggle_desktop_page">Toggle mobile/desktop view</string>
<string name="diaspora" translatable="false">Diaspora</string> <string name="diaspora" translatable="false">Diaspora</string>
<string name="shared_by_diaspora_android">*[shared by #DiasporaForAndroid]*</string> <string name="shared_by_diaspora_android">*[shared by #DiasporaForAndroid]*</string>
<string name="toast_link_address_copied">Link address copied …</string> <string name="toast_link_address_copied">Link address copied …</string>
@ -221,7 +222,7 @@
<string name="context_menu_copy_link">Copy link address to clipboard</string> <string name="context_menu_copy_link">Copy link address to clipboard</string>
<string name="toast_saved_image_to_location">Saving image to</string> <string name="toast_saved_image_to_location">Saving image to</string>
<string name="prefix_https" translatable="false">https://</string> <string name="prefix_https" translatable="false">https://</string>
<string name="share_dotdodot">Share…</string> <string name="share_dotdotdot">Share…</string>
<string name="app_hashtag" translatable="false">#DiasporaForAndroid</string> <string name="app_hashtag" translatable="false">#DiasporaForAndroid</string>
<string name="toast_set_proxy_failed">Warning: Could not set network proxy…</string> <string name="toast_set_proxy_failed">Warning: Could not set network proxy…</string>

View file

@ -10,11 +10,6 @@
android:summary="%s" android:summary="%s"
android:entries="@array/pref_entries_font_size" android:entries="@array/pref_entries_font_size"
android:entryValues="@array/pref_entry_values_font_size" /> android:entryValues="@array/pref_entry_values_font_size" />
<CheckBoxPreference
android:title="@string/pref_title_desktop_view"
android:summary="@string/pref_desc_desktop_view"
android:key="pref_key_desktop_mode"
android:defaultValue="false"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory