diff options
author | Scott Jackson <daneren2005@gmail.com> | 2012-07-07 11:23:48 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2012-07-07 11:23:48 -0700 |
commit | 3e560496b7951cda1724fa2580ee0601dbe5b88c (patch) | |
tree | f8d0ad5573433724796cae42a699b078f3f1d7e4 /subsonic-android/src/github | |
parent | 912fe4c2e67c3a13debc4c80c612e7209085f75f (diff) | |
download | dsub-3e560496b7951cda1724fa2580ee0601dbe5b88c.tar.gz dsub-3e560496b7951cda1724fa2580ee0601dbe5b88c.tar.bz2 dsub-3e560496b7951cda1724fa2580ee0601dbe5b88c.zip |
Basic Network Timeout setting
Diffstat (limited to 'subsonic-android/src/github')
3 files changed, 7 insertions, 0 deletions
diff --git a/subsonic-android/src/github/daneren2005/subphonic/activity/SettingsActivity.java b/subsonic-android/src/github/daneren2005/subphonic/activity/SettingsActivity.java index bb8fdd35..5cc70d14 100644 --- a/subsonic-android/src/github/daneren2005/subphonic/activity/SettingsActivity.java +++ b/subsonic-android/src/github/daneren2005/subphonic/activity/SettingsActivity.java @@ -52,6 +52,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer private ListPreference theme; private ListPreference maxBitrateWifi; private ListPreference maxBitrateMobile; + private ListPreference networkTimeout; private EditTextPreference cacheSize; private EditTextPreference cacheLocation; private ListPreference preloadCount; @@ -64,6 +65,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer theme = (ListPreference) findPreference(Constants.PREFERENCES_KEY_THEME); maxBitrateWifi = (ListPreference) findPreference(Constants.PREFERENCES_KEY_MAX_BITRATE_WIFI); maxBitrateMobile = (ListPreference) findPreference(Constants.PREFERENCES_KEY_MAX_BITRATE_MOBILE); + networkTimeout = (ListPreference) findPreference(Constants.PREFERENCES_KEY_NETWORK_TIMEOUT); cacheSize = (EditTextPreference) findPreference(Constants.PREFERENCES_KEY_CACHE_SIZE); cacheLocation = (EditTextPreference) findPreference(Constants.PREFERENCES_KEY_CACHE_LOCATION); preloadCount = (ListPreference) findPreference(Constants.PREFERENCES_KEY_PRELOAD_COUNT); @@ -145,6 +147,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer theme.setSummary(theme.getEntry()); maxBitrateWifi.setSummary(maxBitrateWifi.getEntry()); maxBitrateMobile.setSummary(maxBitrateMobile.getEntry()); + networkTimeout.setSummary(networkTimeout.getEntry()); cacheSize.setSummary(cacheSize.getText()); cacheLocation.setSummary(cacheLocation.getText()); preloadCount.setSummary(preloadCount.getEntry()); diff --git a/subsonic-android/src/github/daneren2005/subphonic/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/subphonic/service/RESTMusicService.java index 7a7d1415..b9da4c1a 100644 --- a/subsonic-android/src/github/daneren2005/subphonic/service/RESTMusicService.java +++ b/subsonic-android/src/github/daneren2005/subphonic/service/RESTMusicService.java @@ -711,6 +711,9 @@ public class RESTMusicService implements MusicService { String password = prefs.getString(Constants.PREFERENCES_KEY_PASSWORD + instance, null); httpClient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials(username, password)); + + int networkTimeout = Integer.parseInt(prefs.getString(Constants.PREFERENCES_KEY_NETWORK_TIMEOUT, "10000")); + httpClient.getParams().setParameter("http.socket.timeout", networkTimeout); try { HttpResponse response = httpClient.execute(request, httpContext); diff --git a/subsonic-android/src/github/daneren2005/subphonic/util/Constants.java b/subsonic-android/src/github/daneren2005/subphonic/util/Constants.java index c9b339d6..532ef81f 100644 --- a/subsonic-android/src/github/daneren2005/subphonic/util/Constants.java +++ b/subsonic-android/src/github/daneren2005/subphonic/util/Constants.java @@ -65,6 +65,7 @@ public final class Constants { public static final String PREFERENCES_KEY_THEME = "theme"; public static final String PREFERENCES_KEY_MAX_BITRATE_WIFI = "maxBitrateWifi"; public static final String PREFERENCES_KEY_MAX_BITRATE_MOBILE = "maxBitrateMobile"; + public static final String PREFERENCES_KEY_NETWORK_TIMEOUT = "networkTimeout"; public static final String PREFERENCES_KEY_CACHE_SIZE = "cacheSize"; public static final String PREFERENCES_KEY_CACHE_LOCATION = "cacheLocation"; public static final String PREFERENCES_KEY_PRELOAD_COUNT = "preloadCount"; |