diff --git a/core/res/values/strings.xml b/core/res/values/strings.xml
index eaa3dcf7..f09211cc 100644
--- a/core/res/values/strings.xml
+++ b/core/res/values/strings.xml
@@ -221,6 +221,7 @@
RSS feeds
Add RSS feed
Other settings
+ Are you sure you want to remove these settings?
Name
Optional personal name
diff --git a/core/src/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java b/core/src/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java
index cea9732f..3c066da9 100644
--- a/core/src/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java
+++ b/core/src/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java
@@ -20,28 +20,34 @@ import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.OptionsItem;
import org.androidannotations.annotations.OptionsMenu;
import org.transdroid.core.R;
-import org.transdroid.core.app.settings.*;
+import org.transdroid.core.app.settings.ApplicationSettings_;
import android.annotation.TargetApi;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
/**
- * Activity that allows for a configuration of some RSS feed. The key can be supplied to update an
- * existing RSS feed setting instead of creating a new one.
+ * Activity that allows for a configuration of some RSS feed. The key can be supplied to update an existing RSS feed
+ * setting instead of creating a new one.
* @author Eric Kok
*/
@EActivity
-@OptionsMenu(resName="activity_deleteableprefs")
+@OptionsMenu(resName = "activity_deleteableprefs")
public class RssfeedSettingsActivity extends KeyBoundPreferencesActivity {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
+ private static final int DIALOG_CONFIRMREMOVE = 0;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
+
// Load the raw preferences to show in this screen
init(R.xml.pref_rssfeed, ApplicationSettings_.getInstance_(this).getMaxRssfeed());
initTextPreference("rssfeed_name");
@@ -57,10 +63,25 @@ public class RssfeedSettingsActivity extends KeyBoundPreferencesActivity {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();
}
+ @SuppressWarnings("deprecation")
@OptionsItem(resName = "action_removesettings")
protected void removeSettings() {
- ApplicationSettings_.getInstance_(this).removeRssfeedSettings(key);
- finish();
+ showDialog(DIALOG_CONFIRMREMOVE);
+ }
+
+ protected Dialog onCreateDialog(int id) {
+ switch (id) {
+ case DIALOG_CONFIRMREMOVE:
+ return new AlertDialog.Builder(this).setMessage(R.string.pref_confirmremove)
+ .setPositiveButton(android.R.string.ok, new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ ApplicationSettings_.getInstance_(RssfeedSettingsActivity.this).removeRssfeedSettings(key);
+ finish();
+ }
+ }).setNegativeButton(android.R.string.cancel, null).create();
+ }
+ return null;
}
}
diff --git a/core/src/org/transdroid/core/gui/settings/ServerSettingsActivity.java b/core/src/org/transdroid/core/gui/settings/ServerSettingsActivity.java
index fcbc3421..4a5a5700 100644
--- a/core/src/org/transdroid/core/gui/settings/ServerSettingsActivity.java
+++ b/core/src/org/transdroid/core/gui/settings/ServerSettingsActivity.java
@@ -20,10 +20,14 @@ import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.OptionsItem;
import org.androidannotations.annotations.OptionsMenu;
import org.transdroid.core.R;
-import org.transdroid.core.app.settings.*;
+import org.transdroid.core.app.settings.ApplicationSettings_;
import org.transdroid.daemon.Daemon;
import android.annotation.TargetApi;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
@@ -40,6 +44,8 @@ import android.preference.PreferenceManager;
@OptionsMenu(resName = "activity_deleteableprefs")
public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
+ private static final int DIALOG_CONFIRMREMOVE = 0;
+
private EditTextPreference extraPass, folder, downloadDir;
@Override
@@ -47,7 +53,7 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
+
// Load the raw preferences to show in this screen
init(R.xml.pref_server, ApplicationSettings_.getInstance_(this).getMaxNormalServer());
initTextPreference("server_name");
@@ -82,12 +88,28 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();
}
+ @SuppressWarnings("deprecation")
@OptionsItem(resName = "action_removesettings")
protected void removeSettings() {
- ApplicationSettings_.getInstance_(this).removeNormalServerSettings(key);
- finish();
+ showDialog(DIALOG_CONFIRMREMOVE);
}
-
+
+ protected Dialog onCreateDialog(int id) {
+ switch (id) {
+ case DIALOG_CONFIRMREMOVE:
+ return new AlertDialog.Builder(this).setMessage(R.string.pref_confirmremove)
+ .setPositiveButton(android.R.string.ok, new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ ApplicationSettings_.getInstance_(ServerSettingsActivity.this).removeNormalServerSettings(
+ key);
+ finish();
+ }
+ }).setNegativeButton(android.R.string.cancel, null).create();
+ }
+ return null;
+ }
+
@Override
protected void onPreferencesChanged() {
diff --git a/core/src/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java b/core/src/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java
index fb4cefdb..6e874451 100644
--- a/core/src/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java
+++ b/core/src/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java
@@ -20,9 +20,13 @@ import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.OptionsItem;
import org.androidannotations.annotations.OptionsMenu;
import org.transdroid.core.R;
-import org.transdroid.core.app.settings.*;
+import org.transdroid.core.app.settings.ApplicationSettings_;
import android.annotation.TargetApi;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
@@ -36,7 +40,9 @@ import android.os.Bundle;
@OptionsMenu(resName="activity_deleteableprefs")
public class WebsearchSettingsActivity extends KeyBoundPreferencesActivity {
- @Override
+ private static final int DIALOG_CONFIRMREMOVE = 0;
+
+ @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -56,10 +62,25 @@ public class WebsearchSettingsActivity extends KeyBoundPreferencesActivity {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();
}
+ @SuppressWarnings("deprecation")
@OptionsItem(resName = "action_removesettings")
protected void removeSettings() {
- ApplicationSettings_.getInstance_(this).removeWebsearchSettings(key);
- finish();
+ showDialog(DIALOG_CONFIRMREMOVE);
+ }
+
+ protected Dialog onCreateDialog(int id) {
+ switch (id) {
+ case DIALOG_CONFIRMREMOVE:
+ return new AlertDialog.Builder(this).setMessage(R.string.pref_confirmremove)
+ .setPositiveButton(android.R.string.ok, new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ ApplicationSettings_.getInstance_(WebsearchSettingsActivity.this).removeWebsearchSettings(key);
+ finish();
+ }
+ }).setNegativeButton(android.R.string.cancel, null).create();
+ }
+ return null;
}
}