diff options
Diffstat (limited to 'subsonic-android/src/github')
-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"; |