diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ea60ae3a..43ebf8b7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -42,7 +42,7 @@ android:label="@string/diaspora"> diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java index f2aa1283..660ef3fa 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java @@ -6,8 +6,12 @@ import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceActivity; +import android.preference.PreferenceFragment; +import android.util.Log; +import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.R; +import com.github.dfa.diaspora_android.data.AppSettings; /** * @author vanitas @@ -18,11 +22,26 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); + setEditTextPreferenceSummaries(); + } + + private void setEditTextPreferenceSummaries() { + String[] prefKeys = new String[]{"pref_key_proxy_host", "pref_key_proxy_port"}; + for(String key : prefKeys) { + EditTextPreference p = (EditTextPreference) findPreference(key); + p.setSummary(p.getText()); + } } @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { updatePreference(findPreference(key), key); + + switch (key) { + case AppSettings.PREF.MINIMUM_FONT_SIZE: + int newFontSize = Integer.parseInt(((ListPreference)findPreference(key)).getValue().substring(1)); + Log.d(App.TAG, newFontSize+""); + } } private void updatePreference(Preference preference, String key) { 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 fe4e3178..4e763b88 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 @@ -62,14 +62,14 @@ public class AppSettings { // Preferences */ public static class PREF { - private static final String PREVIOUS_PODLIST = "previousPodlist"; - private static final String IS_LOAD_IMAGES = "loadImages"; - private static final String MINIMUM_FONT_SIZE = "minimumFontSize"; - private static final String PODUSERPROFILE_AVATAR_URL = "podUserProfile_avatar"; - private static final String PODUSERPROFILE_NAME = "podUserProfile_name"; - private static final String PODUSERPROFILE_ID = "podUserProfile_guid"; - private static final String PODDOMAIN = "podDomain"; - private static final String PODUSERPROFILE_ASPECTS = "podUserProfile_aspects"; + public static final String PREVIOUS_PODLIST = "previousPodlist"; + public static final String IS_LOAD_IMAGES = "pref_key_load_images"; + public static final String MINIMUM_FONT_SIZE = "pref_key_font_size"; + public static final String PODUSERPROFILE_AVATAR_URL = "podUserProfile_avatar"; + public static final String PODUSERPROFILE_NAME = "podUserProfile_name"; + public static final String PODUSERPROFILE_ID = "podUserProfile_guid"; + public static final String PODDOMAIN = "podDomain"; + public static final String PODUSERPROFILE_ASPECTS = "podUserProfile_aspects"; } @@ -89,11 +89,6 @@ public class AppSettings { return prefApp.getBoolean(PREF.IS_LOAD_IMAGES, true); } - public void setLoadImages(boolean loadImages) { - setBool(prefApp, PREF.IS_LOAD_IMAGES, loadImages); - } - - public int getMinimumFontSize() { return prefApp.getInt(PREF.MINIMUM_FONT_SIZE, 8); } diff --git a/app/src/main/res/values/strings-preferences.xml b/app/src/main/res/values/strings-preferences.xml index 3095ceee..90589312 100644 --- a/app/src/main/res/values/strings-preferences.xml +++ b/app/src/main/res/values/strings-preferences.xml @@ -12,10 +12,11 @@ Large Huge + - normal - big - huge + s8 + s16 + s20 Desktop mode @@ -23,10 +24,11 @@ Load images - You can disable image loading to safe mobile data + Disable image loading to safe mobile data Enable Proxy + Proxy Diaspora\'s traffic to circumvent firewalls.\nMay require restart Host Port diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 9ce53d3d..1a78c306 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -6,6 +6,7 @@ @@ -28,11 +29,13 @@ + android:dependency="pref_key_proxy_enabled" + android:inputType="textNoSuggestions"/>