mirror of
https://github.com/gsantner/dandelion
synced 2025-12-16 01:01:11 +01:00
Added some strings and started to integrate settingsActivity into the app
This commit is contained in:
parent
ec922f139f
commit
8996d4a73a
5 changed files with 38 additions and 19 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue