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

Side by Side Diff: src/org/adblockplus/android/Preferences.java

Issue 28457002: Only execute first run logic once (Closed)
Patch Set: Move firstRunActionsPending = false up Created Nov. 8, 2013, 8:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 */ 59 */
60 public class Preferences extends SummarizedPreferences 60 public class Preferences extends SummarizedPreferences
61 { 61 {
62 private static final String TAG = "Preferences"; 62 private static final String TAG = "Preferences";
63 63
64 private static final int ABOUT_DIALOG = 1; 64 private static final int ABOUT_DIALOG = 1;
65 private static final int HIDEICONWARNING_DIALOG = 2; 65 private static final int HIDEICONWARNING_DIALOG = 2;
66 66
67 private static ProxyService proxyService = null; 67 private static ProxyService proxyService = null;
68 68
69 private static boolean firstRunActionsPending = true;
70
69 private RefreshableListPreference subscriptionList; 71 private RefreshableListPreference subscriptionList;
70 72
71 private String subscriptionSummary; 73 private String subscriptionSummary;
72 74
73 @Override 75 @Override
74 public void onCreate(Bundle savedInstanceState) 76 public void onCreate(Bundle savedInstanceState)
75 { 77 {
76 super.onCreate(savedInstanceState); 78 super.onCreate(savedInstanceState);
77 79
78 PreferenceManager.setDefaultValues(this, R.xml.preferences, true); 80 PreferenceManager.setDefaultValues(this, R.xml.preferences, true);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 134
133 final AdblockPlus application = AdblockPlus.getApplication(); 135 final AdblockPlus application = AdblockPlus.getApplication();
134 136
135 Subscription current = null; 137 Subscription current = null;
136 Subscription[] subscriptions = application.getListedSubscriptions(); 138 Subscription[] subscriptions = application.getListedSubscriptions();
137 if (subscriptions.length > 0) 139 if (subscriptions.length > 0)
138 { 140 {
139 current = subscriptions[0]; 141 current = subscriptions[0];
140 } 142 }
141 143
142 boolean firstRun = false; 144 boolean firstRun = firstRunActionsPending && application.isFirstRun();
143 if (application.isFirstRun()) 145 firstRunActionsPending = false;
146
147 if (firstRun && current != null)
144 { 148 {
145 firstRun = true; 149 new AlertDialog.Builder(this).setTitle(R.string.app_name)
146 150 .setMessage(String.format(getString(R.string.msg_subscription_offer, c urrent.title)))
147 if (current != null) 151 .setIcon(android.R.drawable.ic_dialog_info)
148 { 152 .setPositiveButton(R.string.ok, null).create().show();
149 new AlertDialog.Builder(this).setTitle(R.string.app_name).setMessage(Str ing.format(getString(R.string.msg_subscription_offer, current.title))).setIcon(a ndroid.R.drawable.ic_dialog_info)
150 .setPositiveButton(R.string.ok, null).create().show();
151 }
152 } 153 }
153 154
154 // Enable manual subscription refresh 155 // Enable manual subscription refresh
155 subscriptionList.setOnRefreshClickListener(new View.OnClickListener() 156 subscriptionList.setOnRefreshClickListener(new View.OnClickListener()
156 { 157 {
157 @Override 158 @Override
158 public void onClick(View v) 159 public void onClick(View v)
159 { 160 {
160 application.refreshSubscriptions(); 161 application.refreshSubscriptions();
161 } 162 }
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 showConfigurationMsg(getString(R.string.msg_configuration)); 525 showConfigurationMsg(getString(R.string.msg_configuration));
525 } 526 }
526 527
527 public void onServiceDisconnected(ComponentName className) 528 public void onServiceDisconnected(ComponentName className)
528 { 529 {
529 proxyService = null; 530 proxyService = null;
530 Log.d(TAG, "Proxy service disconnected"); 531 Log.d(TAG, "Proxy service disconnected");
531 } 532 }
532 }; 533 };
533 } 534 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld