aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2012-07-07 11:23:48 -0700
committerScott Jackson <daneren2005@gmail.com>2012-07-07 11:23:48 -0700
commit3e560496b7951cda1724fa2580ee0601dbe5b88c (patch)
treef8d0ad5573433724796cae42a699b078f3f1d7e4 /subsonic-android
parent912fe4c2e67c3a13debc4c80c612e7209085f75f (diff)
downloaddsub-3e560496b7951cda1724fa2580ee0601dbe5b88c.tar.gz
dsub-3e560496b7951cda1724fa2580ee0601dbe5b88c.tar.bz2
dsub-3e560496b7951cda1724fa2580ee0601dbe5b88c.zip
Basic Network Timeout setting
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/res/values/arrays.xml15
-rw-r--r--subsonic-android/res/values/strings.xml7
-rw-r--r--subsonic-android/res/xml/settings.xml7
-rw-r--r--subsonic-android/src/github/daneren2005/subphonic/activity/SettingsActivity.java3
-rw-r--r--subsonic-android/src/github/daneren2005/subphonic/service/RESTMusicService.java3
-rw-r--r--subsonic-android/src/github/daneren2005/subphonic/util/Constants.java1
6 files changed, 36 insertions, 0 deletions
diff --git a/subsonic-android/res/values/arrays.xml b/subsonic-android/res/values/arrays.xml
index 087206a9..17ea4b6a 100644
--- a/subsonic-android/res/values/arrays.xml
+++ b/subsonic-android/res/values/arrays.xml
@@ -58,5 +58,20 @@
<item>@string/settings.max_bitrate_320</item>
<item>@string/settings.max_bitrate_unlimited</item>
</string-array>
+
+ <string-array name="networkTimeoutValues">
+ <item>10000</item>
+ <item>15000</item>
+ <item>30000</item>
+ <item>45000</item>
+ <item>60000</item>
+ </string-array>
+ <string-array name="networkTimeoutNames">
+ <item>@string/settings.network_timeout_10000</item>
+ <item>@string/settings.network_timeout_15000</item>
+ <item>@string/settings.network_timeout_30000</item>
+ <item>@string/settings.network_timeout_45000</item>
+ <item>@string/settings.network_timeout_60000</item>
+ </string-array>
</resources> \ No newline at end of file
diff --git a/subsonic-android/res/values/strings.xml b/subsonic-android/res/values/strings.xml
index 6acfed87..47487e43 100644
--- a/subsonic-android/res/values/strings.xml
+++ b/subsonic-android/res/values/strings.xml
@@ -157,11 +157,18 @@
<string name="settings.max_bitrate_unlimited">Unlimited</string>
<string name="settings.wifi_required_title">Wi-Fi streaming only</string>
<string name="settings.wifi_required_summary">Only stream media if connected to Wi-Fi</string>
+ <string name="settings.network_timeout_title">Network Timeout</string>
+ <string name="settings.network_timeout_10000">10 seconds</string>
+ <string name="settings.network_timeout_15000">15 seconds</string>
+ <string name="settings.network_timeout_30000">30 seconds</string>
+ <string name="settings.network_timeout_45000">45 seconds</string>
+ <string name="settings.network_timeout_60000">60 seconds</string>
<string name="settings.preload_1">1 song</string>
<string name="settings.preload_2">2 songs</string>
<string name="settings.preload_3">3 songs</string>
<string name="settings.preload_5">5 songs</string>
<string name="settings.preload_10">10 songs</string>
+ <string name="settings.preload_unlimited">Unlimited</string>
<string name="settings.clear_search_history">Clear search history</string>
<string name="settings.search_history_cleared">Search history cleared</string>
<string name="settings.other_title">Other settings</string>
diff --git a/subsonic-android/res/xml/settings.xml b/subsonic-android/res/xml/settings.xml
index 4e4cd7dd..21d0568a 100644
--- a/subsonic-android/res/xml/settings.xml
+++ b/subsonic-android/res/xml/settings.xml
@@ -137,6 +137,13 @@
android:summary="@string/settings.wifi_required_summary"
android:key="wifiRequiredForDownload"
android:defaultValue="false"/>
+
+ <ListPreference
+ android:title="@string/settings.network_timeout_title"
+ android:key="networkTimeout"
+ android:defaultValue="15000"
+ android:entryValues="@array/networkTimeoutValues"
+ android:entries="@array/networkTimeoutNames"/>
</PreferenceCategory>
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";