Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/android/AdvancedPreferences.java

Issue 8959056: android: notification icon option (Closed)
Patch Set: Created Nov. 28, 2012, 8:19 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « res/xml/preferences_advanced.xml ('k') | src/org/adblockplus/android/ProxyService.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/org/adblockplus/android/AdvancedPreferences.java
===================================================================
--- a/src/org/adblockplus/android/AdvancedPreferences.java
+++ b/src/org/adblockplus/android/AdvancedPreferences.java
@@ -52,6 +52,7 @@
private static final String TAG = "AdvancedPreferences";
private static final int CONFIGURATION_DIALOG = 1;
+ private static final int PRIORITY_WARNING_DIALOG = 2;
private static ProxyService proxyService = null;
@@ -116,6 +117,11 @@
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
{
+ if (getString(R.string.pref_priority).equals(key))
+ {
+ if (!sharedPreferences.getBoolean(key, false))
+ showDialog(PRIORITY_WARNING_DIALOG);
+ }
if (getString(R.string.pref_refresh).equals(key))
{
int refresh = Integer.valueOf(sharedPreferences.getString(key, "0"));
@@ -141,8 +147,26 @@
protected Dialog onCreateDialog(int id)
{
Dialog dialog = null;
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+
switch (id)
{
+ case PRIORITY_WARNING_DIALOG:
+ // @formatter:off
Felix Dahlke 2012/11/28 09:47:35 Why do this? You can set up Eclipse do indent that
Andrey Novikov 2012/11/28 09:53:33 Really? How do I achieve that?
+ builder.setTitle(R.string.warning)
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setMessage(R.string.msg_priority_warning)
+ .setCancelable(false)
+ .setPositiveButton(R.string.gotit, new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int id)
+ {
+ dialog.cancel();
+ }
+ });
+ // @formatter:on
+ dialog = builder.create();
+ break;
case CONFIGURATION_DIALOG:
List<String> items = new ArrayList<String>();
items.add(AdblockPlus.getDeviceName());
@@ -206,15 +230,19 @@
});
scrollPane.addView(messageText);
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setView(scrollPane).setTitle(R.string.configuration_name).setIcon(android.R.drawable.ic_dialog_info).setCancelable(false)
- .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int id)
- {
- dialog.cancel();
- }
- });
+ // @formatter:off
Felix Dahlke 2012/11/28 09:47:35 See above, I think we should configure the formatt
+ builder.setView(scrollPane)
+ .setTitle(R.string.configuration_name)
+ .setIcon(android.R.drawable.ic_dialog_info)
+ .setCancelable(false)
+ .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int id)
+ {
+ dialog.cancel();
+ }
+ });
+ // @formatter:on
dialog = builder.create();
break;
}
« no previous file with comments | « res/xml/preferences_advanced.xml ('k') | src/org/adblockplus/android/ProxyService.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld