aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-10-23 15:53:13 -0700
committerScott Jackson <daneren2005@gmail.com>2015-10-23 15:53:13 -0700
commit836a80632698eb56a5dbb05ed0676583a5b1ea7b (patch)
tree8abece3b976d522f2669c5dbd9116b1fed10f5fb /app/src/main
parent67965f871cc78689da43926a11cfe1068ba51e5c (diff)
downloaddsub-836a80632698eb56a5dbb05ed0676583a5b1ea7b.tar.gz
dsub-836a80632698eb56a5dbb05ed0676583a5b1ea7b.tar.bz2
dsub-836a80632698eb56a5dbb05ed0676583a5b1ea7b.zip
Fix some cases of possibly referencing the wrong instace
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java3
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/parser/ShareParser.java1
3 files changed, 3 insertions, 3 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java
index 52748e7b..925d69d7 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java
@@ -480,7 +480,8 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared
serverUsernamePreference.setText(null);
serverPasswordPreference.setText(null);
- int activeServer = Util.getActiveServer(context);
+ // Don't use Util.getActiveServer since it is 0 if offline
+ int activeServer = Util.getPreferences(context).getInt(Constants.PREFERENCES_KEY_SERVER_INSTANCE, 1);
for (int i = instance; i <= serverCount; i++) {
Util.removeInstanceName(context, i, activeServer);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index b405211d..24a75c73 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -1954,7 +1954,7 @@ public class RESTMusicService implements MusicService {
request.addHeader("User-Agent", Constants.REST_CLIENT_ID);
// Set credentials to get through apache proxies that require authentication.
- int instance = prefs.getInt(Constants.PREFERENCES_KEY_SERVER_INSTANCE, 1);
+ int instance = getInstance(context);
String username = prefs.getString(Constants.PREFERENCES_KEY_USERNAME + instance, null);
String password = prefs.getString(Constants.PREFERENCES_KEY_PASSWORD + instance, null);
httpClient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
diff --git a/app/src/main/java/github/daneren2005/dsub/service/parser/ShareParser.java b/app/src/main/java/github/daneren2005/dsub/service/parser/ShareParser.java
index 418393d1..ea7934f4 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/parser/ShareParser.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/parser/ShareParser.java
@@ -57,7 +57,6 @@ public class ShareParser extends MusicDirectoryEntryParser {
int eventType;
SharedPreferences prefs = Util.getPreferences(context);
- int instance = prefs.getInt(Constants.PREFERENCES_KEY_SERVER_INSTANCE, 1);
String serverUrl = prefs.getString(Constants.PREFERENCES_KEY_SERVER_URL + instance, null);
if(serverUrl.charAt(serverUrl.length() - 1) != '/') {
serverUrl += '/';