diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-01-16 20:30:03 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-01-16 20:30:03 -0800 |
commit | f9612cbea3869b87d52772149d391286aae08640 (patch) | |
tree | e396190606a3fe00022f1481e0cc057a601291fd /src | |
parent | 21df175198b4137681da5ca63fd7032c5597b842 (diff) | |
download | dsub-f9612cbea3869b87d52772149d391286aae08640.tar.gz dsub-f9612cbea3869b87d52772149d391286aae08640.tar.bz2 dsub-f9612cbea3869b87d52772149d391286aae08640.zip |
#244 Move sync to own section, disable when enable is unchecked
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/activity/SettingsActivity.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/activity/SettingsActivity.java b/src/github/daneren2005/dsub/activity/SettingsActivity.java index 9d0b5bbd..b5524ccf 100644 --- a/src/github/daneren2005/dsub/activity/SettingsActivity.java +++ b/src/github/daneren2005/dsub/activity/SettingsActivity.java @@ -28,6 +28,7 @@ import android.content.SharedPreferences; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; @@ -82,6 +83,11 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer private EditTextPreference chatRefreshRate; private ListPreference videoPlayer; private ListPreference syncInterval; + private CheckBoxPreference syncEnabled; + private CheckBoxPreference syncWifi; + private CheckBoxPreference syncNotification; + private CheckBoxPreference syncStarred; + private CheckBoxPreference syncMostRecent; private String internalSSID; private int serverCount = 3; @@ -119,6 +125,11 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer chatRefreshRate = (EditTextPreference) findPreference(Constants.PREFERENCES_KEY_CHAT_REFRESH); videoPlayer = (ListPreference) findPreference(Constants.PREFERENCES_KEY_VIDEO_PLAYER); syncInterval = (ListPreference) findPreference(Constants.PREFERENCES_KEY_SYNC_INTERVAL); + syncEnabled = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_SYNC_ENABLED); + syncWifi = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_SYNC_WIFI); + syncNotification = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_SYNC_NOTIFICATION); + syncStarred = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_SYNC_STARRED); + syncMostRecent = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_SYNC_MOST_RECENT); settings = Util.getPreferences(this); serverCount = settings.getInt(Constants.PREFERENCES_KEY_SERVER_COUNT, 3); @@ -296,6 +307,23 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer chatRefreshRate.setSummary(chatRefreshRate.getText()); videoPlayer.setSummary(videoPlayer.getEntry()); syncInterval.setSummary(syncInterval.getEntry()); + if(syncEnabled.isChecked()) { + if(!syncInterval.isEnabled()) { + syncInterval.setEnabled(true); + syncWifi.setEnabled(true); + syncNotification.setEnabled(true); + syncStarred.setEnabled(true); + syncMostRecent.setEnabled(true); + } + } else { + if(syncInterval.isEnabled()) { + syncInterval.setEnabled(false); + syncWifi.setEnabled(false); + syncNotification.setEnabled(false); + syncStarred.setEnabled(false); + syncMostRecent.setEnabled(false); + } + } for (ServerSettings ss : serverSettings.values()) { ss.update(); } |