aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-05-21 07:16:51 -0700
committerScott Jackson <daneren2005@gmail.com>2013-05-21 07:16:51 -0700
commit988e79ec4e25adcc935ec1bf010b5962ab77f480 (patch)
treee7d8b7e79e737b1a645145dccdb921ecba8ca1f9 /subsonic-android
parente0f4fe41d82dd85cadb3b8cd3ec66a38eb502205 (diff)
downloaddsub-988e79ec4e25adcc935ec1bf010b5962ab77f480.tar.gz
dsub-988e79ec4e25adcc935ec1bf010b5962ab77f480.tar.bz2
dsub-988e79ec4e25adcc935ec1bf010b5962ab77f480.zip
Added button to open server in browser
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/res/values/strings.xml1
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java24
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/Constants.java1
3 files changed, 26 insertions, 0 deletions
diff --git a/subsonic-android/res/values/strings.xml b/subsonic-android/res/values/strings.xml
index 61fca626..0ba2b5c0 100644
--- a/subsonic-android/res/values/strings.xml
+++ b/subsonic-android/res/values/strings.xml
@@ -183,6 +183,7 @@
<string name="settings.server_address">Server address</string>
<string name="settings.server_username">Username</string>
<string name="settings.server_password">Password</string>
+ <string name="settings.server_open_browser">Open in browser</string>
<string name="settings.cache_title">Music cache</string>
<string name="settings.preload_wifi">Songs to preload (Wifi)</string>
<string name="settings.preload_mobile">Songs to preload (Mobile)</string>
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java
index 1996173f..773f4def 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java
@@ -18,7 +18,9 @@
*/
package github.daneren2005.dsub.activity;
+import android.content.Intent;
import android.content.SharedPreferences;
+import android.net.Uri;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
@@ -230,6 +232,18 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
serverPasswordPreference.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
serverPasswordPreference.setSummary("***");
serverPasswordPreference.setTitle(R.string.settings_server_password);
+
+ final Preference serverOpenBrowser = new Preference(this);
+ serverOpenBrowser.setKey(Constants.PREFERENCES_KEY_OPEN_BROWSER);
+ serverOpenBrowser.setPersistent(false);
+ serverOpenBrowser.setTitle(R.string.settings_server_open_browser);
+ serverOpenBrowser.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ openInBrowser(instance);
+ return true;
+ }
+ });
Preference serverRemoveServerPreference = new Preference(this);
serverRemoveServerPreference.setKey(Constants.PREFERENCES_KEY_SERVER_REMOVE + instance);
@@ -280,6 +294,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
screen.addPreference(serverPasswordPreference);
screen.addPreference(serverRemoveServerPreference);
screen.addPreference(serverTestConnectionPreference);
+ screen.addPreference(serverOpenBrowser);
return screen;
}
@@ -392,6 +407,15 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
};
task.execute();
}
+
+ private void openInBrowser(final int instance) {
+ SharedPreferences prefs = Util.getPreferences(this);
+ String url = prefs.getString(Constants.PREFERENCES_KEY_SERVER_URL + instance, null);
+ Uri uriServer = Uri.parse(url);
+
+ Intent browserIntent = new Intent(Intent.ACTION_VIEW, uriServer);
+ startActivity(browserIntent);
+ }
private class ServerSettings {
private EditTextPreference serverName;
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java
index 65263e49..12ee9e90 100644
--- a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java
+++ b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java
@@ -65,6 +65,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_SERVER_NAME = "serverName";
public static final String PREFERENCES_KEY_SERVER_URL = "serverUrl";
public static final String PREFERENCES_KEY_TEST_CONNECTION = "serverTestConnection";
+ public static final String PREFERENCES_KEY_OPEN_BROWSER = "openBrowser";
public static final String PREFERENCES_KEY_MUSIC_FOLDER_ID = "musicFolderId";
public static final String PREFERENCES_KEY_USERNAME = "username";
public static final String PREFERENCES_KEY_PASSWORD = "password";