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

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

Issue 5444834596749312: Update the checkbox when enabling Acceptable Ads (Closed)
Patch Set: Created Nov. 27, 2013, 9:02 p.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 23 matching lines...) Expand all
34 import android.content.Intent; 34 import android.content.Intent;
35 import android.content.IntentFilter; 35 import android.content.IntentFilter;
36 import android.content.ServiceConnection; 36 import android.content.ServiceConnection;
37 import android.content.SharedPreferences; 37 import android.content.SharedPreferences;
38 import android.content.pm.PackageManager.NameNotFoundException; 38 import android.content.pm.PackageManager.NameNotFoundException;
39 import android.content.res.AssetManager; 39 import android.content.res.AssetManager;
40 import android.net.Uri; 40 import android.net.Uri;
41 import android.os.Build; 41 import android.os.Build;
42 import android.os.Bundle; 42 import android.os.Bundle;
43 import android.os.IBinder; 43 import android.os.IBinder;
44 import android.preference.CheckBoxPreference;
44 import android.preference.ListPreference; 45 import android.preference.ListPreference;
45 import android.preference.PreferenceManager; 46 import android.preference.PreferenceManager;
46 import android.text.Html; 47 import android.text.Html;
47 import android.text.TextUtils; 48 import android.text.TextUtils;
48 import android.text.format.DateFormat; 49 import android.text.format.DateFormat;
49 import android.text.method.LinkMovementMethod; 50 import android.text.method.LinkMovementMethod;
50 import android.util.Log; 51 import android.util.Log;
51 import android.view.View; 52 import android.view.View;
52 import android.view.ViewGroup; 53 import android.view.ViewGroup;
53 import android.widget.TextView; 54 import android.widget.TextView;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 101 }
101 } 102 }
102 catch (NameNotFoundException e) 103 catch (NameNotFoundException e)
103 { 104 {
104 copyAssets(); 105 copyAssets();
105 } 106 }
106 107
107 // Set Acceptable Ads FAQ link 108 // Set Acceptable Ads FAQ link
108 HelpfulCheckBoxPreference acceptableAdsCheckBox = (HelpfulCheckBoxPreference ) findPreference(getString(R.string.pref_acceptableads)); 109 HelpfulCheckBoxPreference acceptableAdsCheckBox = (HelpfulCheckBoxPreference ) findPreference(getString(R.string.pref_acceptableads));
109 // TODO Set proper url 110 // TODO Set proper url
110 acceptableAdsCheckBox.setHelpUrl("https://adblockplus.org/en/acceptable-ads" ); 111 acceptableAdsCheckBox.setHelpUrl("https://adblockplus.org/en/acceptable-ads" );
Wladimir Palant 2013/11/28 08:59:42 Please address this TODO comment.
111 } 112 }
112 113
113 @Override 114 @Override
114 protected void onStart() 115 protected void onStart()
115 { 116 {
116 super.onStart(); 117 super.onStart();
117 AdblockPlus application = AdblockPlus.getApplication(); 118 AdblockPlus application = AdblockPlus.getApplication();
118 application.startEngine(); 119 application.startEngine();
119 120
120 // Initialize subscription list 121 // Initialize subscription list
(...skipping 29 matching lines...) Expand all
150 151
151 boolean firstRun = firstRunActionsPending && application.isFirstRun(); 152 boolean firstRun = firstRunActionsPending && application.isFirstRun();
152 firstRunActionsPending = false; 153 firstRunActionsPending = false;
153 154
154 if (firstRun && current != null) 155 if (firstRun && current != null)
155 { 156 {
156 showNotificationDialog(getString(R.string.install_name), 157 showNotificationDialog(getString(R.string.install_name),
157 String.format(getString(R.string.msg_subscription_offer, current.title )), 158 String.format(getString(R.string.msg_subscription_offer, current.title )),
158 application.getAcceptableAdsUrl()); 159 application.getAcceptableAdsUrl());
159 application.setNotifiedAboutAcceptableAds(true); 160 application.setNotifiedAboutAcceptableAds(true);
160 application.setAcceptableAdsEnabled(true); 161 setAcceptableAdsEnabled(true);
161 } 162 }
162 else if (!application.isNotifiedAboutAcceptableAds()) 163 else if (!application.isNotifiedAboutAcceptableAds())
163 { 164 {
164 showNotificationDialog(getString(R.string.acceptableads_name), 165 showNotificationDialog(getString(R.string.acceptableads_name),
165 getString(R.string.msg_acceptable_ads), application.getAcceptableAdsUr l()); 166 getString(R.string.msg_acceptable_ads), application.getAcceptableAdsUr l());
166 application.setNotifiedAboutAcceptableAds(true); 167 application.setNotifiedAboutAcceptableAds(true);
167 application.setAcceptableAdsEnabled(true); 168 setAcceptableAdsEnabled(true);
168 } 169 }
169 170
170 // Enable manual subscription refresh 171 // Enable manual subscription refresh
171 subscriptionList.setOnRefreshClickListener(new View.OnClickListener() 172 subscriptionList.setOnRefreshClickListener(new View.OnClickListener()
172 { 173 {
173 @Override 174 @Override
174 public void onClick(View v) 175 public void onClick(View v)
175 { 176 {
176 application.refreshSubscriptions(); 177 application.refreshSubscriptions();
177 } 178 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 showDialog(ABOUT_DIALOG); 276 showDialog(ABOUT_DIALOG);
276 return true; 277 return true;
277 case R.id.menu_advanced: 278 case R.id.menu_advanced:
278 startActivity(new Intent(this, AdvancedPreferences.class)); 279 startActivity(new Intent(this, AdvancedPreferences.class));
279 return true; 280 return true;
280 default: 281 default:
281 return super.onOptionsItemSelected(item); 282 return super.onOptionsItemSelected(item);
282 } 283 }
283 } 284 }
284 285
286 private void setAcceptableAdsEnabled(boolean enabled)
287 {
288 CheckBoxPreference acceptableAdsPreference =
289 (CheckBoxPreference) findPreference(getString(R.string.pref_acceptablead s));
290 acceptableAdsPreference.setChecked(enabled);
291 AdblockPlus application = AdblockPlus.getApplication();
292 application.setAcceptableAdsEnabled(enabled);
293 }
294
285 private void setFilteringEnabled(boolean enabled) 295 private void setFilteringEnabled(boolean enabled)
286 { 296 {
287 SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferen ces(this).edit(); 297 SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferen ces(this).edit();
288 editor.putBoolean(getString(R.string.pref_enabled), enabled); 298 editor.putBoolean(getString(R.string.pref_enabled), enabled);
289 editor.commit(); 299 editor.commit();
290 ((SwitchPreference) findPreference(getString(R.string.pref_enabled))).setChe cked(enabled); 300 ((SwitchPreference) findPreference(getString(R.string.pref_enabled))).setChe cked(enabled);
291 AdblockPlus application = AdblockPlus.getApplication(); 301 AdblockPlus application = AdblockPlus.getApplication();
292 application.setFilteringEnabled(enabled); 302 application.setFilteringEnabled(enabled);
293 } 303 }
294 304
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 showConfigurationMsg(getString(R.string.msg_configuration)); 571 showConfigurationMsg(getString(R.string.msg_configuration));
562 } 572 }
563 573
564 public void onServiceDisconnected(ComponentName className) 574 public void onServiceDisconnected(ComponentName className)
565 { 575 {
566 proxyService = null; 576 proxyService = null;
567 Log.d(TAG, "Proxy service disconnected"); 577 Log.d(TAG, "Proxy service disconnected");
568 } 578 }
569 }; 579 };
570 } 580 }
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