aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-07-01 19:33:27 -0700
committerScott Jackson <daneren2005@gmail.com>2013-07-01 19:33:27 -0700
commit2099a03e4ec57504b5d5ab5dd8b9a2f90d62ca19 (patch)
tree40205ff3bbc0df5aaeea0b628fc26e24b23ad15a /subsonic-android/src/github/daneren2005
parent00dafb14fbb3d90d481550f1953ea0d789eec093 (diff)
downloaddsub-2099a03e4ec57504b5d5ab5dd8b9a2f90d62ca19.tar.gz
dsub-2099a03e4ec57504b5d5ab5dd8b9a2f90d62ca19.tar.bz2
dsub-2099a03e4ec57504b5d5ab5dd8b9a2f90d62ca19.zip
Close #145 Require confirmation to remove server
Diffstat (limited to 'subsonic-android/src/github/daneren2005')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java42
1 files changed, 24 insertions, 18 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java
index 9b74987d..220b635d 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SettingsActivity.java
@@ -18,6 +18,7 @@
*/
package github.daneren2005.dsub.activity;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
@@ -259,25 +260,30 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
serverRemoveServerPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
- // Reset values to null so when we ask for them again they are new
- serverNamePreference.setText(null);
- serverUrlPreference.setText(null);
- serverUsernamePreference.setText(null);
- serverPasswordPreference.setText(null);
+ Util.confirmDialog(SettingsActivity.this, R.string.common_delete, screen.getTitle().toString(), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ // Reset values to null so when we ask for them again they are new
+ serverNamePreference.setText(null);
+ serverUrlPreference.setText(null);
+ serverUsernamePreference.setText(null);
+ serverPasswordPreference.setText(null);
+
+ int activeServer = Util.getActiveServer(SettingsActivity.this);
+ for (int i = instance; i <= serverCount; i++) {
+ Util.removeInstanceName(SettingsActivity.this, i, activeServer);
+ }
+
+ serverCount--;
+ SharedPreferences.Editor editor = settings.edit();
+ editor.putInt(Constants.PREFERENCES_KEY_SERVER_COUNT, serverCount);
+ editor.commit();
+
+ serversCategory.removePreference(screen);
+ screen.getDialog().dismiss();
+ }
+ });
- int activeServer = Util.getActiveServer(SettingsActivity.this);
- for (int i = instance; i <= serverCount; i++) {
- Util.removeInstanceName(SettingsActivity.this, i, activeServer);
- }
-
- serverCount--;
- SharedPreferences.Editor editor = settings.edit();
- editor.putInt(Constants.PREFERENCES_KEY_SERVER_COUNT, serverCount);
- editor.commit();
-
- serversCategory.removePreference(screen);
- screen.getDialog().dismiss();
-
return true;
}
});