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

Delta Between Two Patch Sets: src/org/adblockplus/android/Preferences.java

Issue 28457002: Only execute first run logic once (Closed)
Left Patch Set: Created Nov. 7, 2013, 2:29 p.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 final AdblockPlus application = AdblockPlus.getApplication(); 135 final AdblockPlus application = AdblockPlus.getApplication();
136 136
137 Subscription current = null; 137 Subscription current = null;
138 Subscription[] subscriptions = application.getListedSubscriptions(); 138 Subscription[] subscriptions = application.getListedSubscriptions();
139 if (subscriptions.length > 0) 139 if (subscriptions.length > 0)
140 { 140 {
141 current = subscriptions[0]; 141 current = subscriptions[0];
142 } 142 }
143 143
144 boolean firstRun = firstRunActionsPending && application.isFirstRun(); 144 boolean firstRun = firstRunActionsPending && application.isFirstRun();
145 firstRunActionsPending = false;
146
145 if (firstRun && current != null) 147 if (firstRun && current != null)
146 { 148 {
147 new AlertDialog.Builder(this).setTitle(R.string.app_name) 149 new AlertDialog.Builder(this).setTitle(R.string.app_name)
148 .setMessage(String.format(getString(R.string.msg_subscription_offer, c urrent.title))) 150 .setMessage(String.format(getString(R.string.msg_subscription_offer, c urrent.title)))
149 .setIcon(android.R.drawable.ic_dialog_info) 151 .setIcon(android.R.drawable.ic_dialog_info)
150 .setPositiveButton(R.string.ok, null).create().show(); 152 .setPositiveButton(R.string.ok, null).create().show();
151 } 153 }
152 154
153 // Enable manual subscription refresh 155 // Enable manual subscription refresh
154 subscriptionList.setOnRefreshClickListener(new View.OnClickListener() 156 subscriptionList.setOnRefreshClickListener(new View.OnClickListener()
(...skipping 28 matching lines...) Expand all
183 185
184 // This is weird but UI does not update on back button (when returning from advanced preferences) 186 // This is weird but UI does not update on back button (when returning from advanced preferences)
185 ((SwitchPreference) findPreference(getString(R.string.pref_enabled))).setChe cked(enabled); 187 ((SwitchPreference) findPreference(getString(R.string.pref_enabled))).setChe cked(enabled);
186 188
187 if (enabled || firstRun) 189 if (enabled || firstRun)
188 setFilteringEnabled(true); 190 setFilteringEnabled(true);
189 if (enabled || firstRun || (proxyenabled && !autoconfigured)) 191 if (enabled || firstRun || (proxyenabled && !autoconfigured))
190 setProxyEnabled(true); 192 setProxyEnabled(true);
191 193
192 bindService(new Intent(this, ProxyService.class), proxyServiceConnection, 0) ; 194 bindService(new Intent(this, ProxyService.class), proxyServiceConnection, 0) ;
193 firstRunActionsPending = false;
Wladimir Palant 2013/11/08 06:08:20 IMHO it's better to group related operations - I w
Felix Dahlke 2013/11/08 08:37:36 Hehe, I was actually pondering that :) I'd prefer
194 } 195 }
195 196
196 @Override 197 @Override
197 public void onPause() 198 public void onPause()
198 { 199 {
199 super.onPause(); 200 super.onPause();
200 try 201 try
201 { 202 {
202 unregisterReceiver(receiver); 203 unregisterReceiver(receiver);
203 } 204 }
(...skipping 320 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 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld