diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-05-21 07:16:51 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-05-21 07:16:51 -0700 |
commit | 988e79ec4e25adcc935ec1bf010b5962ab77f480 (patch) | |
tree | e7d8b7e79e737b1a645145dccdb921ecba8ca1f9 /subsonic-android/src | |
parent | e0f4fe41d82dd85cadb3b8cd3ec66a38eb502205 (diff) | |
download | dsub-988e79ec4e25adcc935ec1bf010b5962ab77f480.tar.gz dsub-988e79ec4e25adcc935ec1bf010b5962ab77f480.tar.bz2 dsub-988e79ec4e25adcc935ec1bf010b5962ab77f480.zip |
Added button to open server in browser
Diffstat (limited to 'subsonic-android/src')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java | 24 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/util/Constants.java | 1 |
2 files changed, 25 insertions, 0 deletions
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"; |