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

Side by Side Diff: README.md

Issue 29677606: Issue 6301 - Update documentation (Closed)
Patch Set: Created Jan. 23, 2018, 7:58 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 | libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/MainActivity.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Adblock Plus Library for Android 1 Adblock Plus Library for Android
2 ================================ 2 ================================
3 3
4 An Android library project, tests and demo application for AdblockWebView widget . 4 An Android library project, tests and demo application for AdblockWebView widget .
5 5
6 ## Updating the dependencies 6 ## Updating the dependencies
7 7
8 Adblock Plus for Android has dependencies that aren't in this repository. 8 Adblock Plus for Android has dependencies that aren't in this repository.
9 To update those, call: 9 To update those, call:
10 10
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 ## Settings 213 ## Settings
214 214
215 An Android library that provides a configuration interface for Adblock Plus. 215 An Android library that provides a configuration interface for Adblock Plus.
216 You can find it in the 'libadblockplus-android-settings' directory: 216 You can find it in the 'libadblockplus-android-settings' directory:
217 * GeneralSettingsFragment - main fragment 217 * GeneralSettingsFragment - main fragment
218 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment 218 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment
219 219
220 ### Usage 220 ### Usage
221 221
222 Create `AdblockEngine` instance with factory methods and `AdblockSettingsStorage ` instance. 222 Create `AdblockEngineProvider` instance and `AdblockSettingsStorage` instance.
223 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref erences`. 223 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref erences`.
224 Or you can use AdblockHelper: 224 Or you can use AdblockHelper:
225 225
226 AdblockHelper.get().init(this, getFilesDir().getAbsolutePath(), true, Adbloc kHelper.PREFERENCE_NAME); 226 AdblockHelper
227 .get()
228 .init(this, getFilesDir().getAbsolutePath(), true, AdblockHelper.PREFERENC E_NAME);
227 229
228 // optional - provide preloaded subscription files in app resoruces 230 // optional - provide preloaded subscription files in app resoruces
229 AdblockHelper.get().preloadSubscriptions(AdblockHelper.PRELOAD_PREFERENCE_NA ME, map); 231 .preloadSubscriptions(AdblockHelper.PRELOAD_PREFERENCE_NAME, map);
230 232
231 Implement the following interfaces in your settings activity: 233 Implement the following interfaces in your settings activity:
232 234
233 * `BaseSettingsFragment.Provider` 235 * `BaseSettingsFragment.Provider`
234 * `GeneralSettingsFragment.Listener` 236 * `GeneralSettingsFragment.Listener`
235 * `WhitelistedDomainsSettingsFragment.Listener` 237 * `WhitelistedDomainsSettingsFragment.Listener`
236 238
237 and return created instance or AdblockHelper instances: 239 and return created instance or AdblockHelper instances:
238 240
239 AdblockHelper.get().getEngine(); // engine 241 AdblockHelper.get().getProvider().getEngine(); // engine
240 AdblockHelper.get().getStorage(); // storage 242 AdblockHelper.get().getStorage(); // storage
241 243
242 Retain Adblock instance in activity `onCreate` in synchronous mode (it may take few seconds): 244 Retain Adblock instance in activity `onCreate` in synchronous mode (it may take few seconds):
243 245
244 AdblockHelper.get().retain(false); 246 AdblockHelper.get().getProvider().retain(false);
245 247
246 or in asynchronous mode (without current thread lock): 248 or in asynchronous mode (without current thread lock):
247 249
248 AdblockHelper.get().retain(true); 250 AdblockHelper.get().getProvider().retain(true);
249 251
250 Invoke `waitforReady` every time you need AdblockEngine instance if retained in asynchronous mode: 252 Invoke `waitforReady` every time you need AdblockEngine instance if retained in asynchronous mode:
251 253
252 AdblockHelper.get().waitForReady(); 254 AdblockHelper.get().getProvider().waitForReady();
253 255
254 Release Adblock instance in activity `onDestroy`: 256 Release Adblock instance in activity `onDestroy`:
255 257
256 AdblockHelper.get().release(); 258 AdblockHelper.get().getProvider().release();
257 259
258 Insert `GeneralSettingsFragment` fragment instance in runtime to start showing s ettings UI. 260 Insert `GeneralSettingsFragment` fragment instance in runtime to start showing s ettings UI.
259 261
260 ### Building 262 ### Building
261 263
262 #### Building with Ant 264 #### Building with Ant
263 265
264 In the 'libadblockplus-android-settings' directory create the file _local.proper ties_ and set 266 In the 'libadblockplus-android-settings' directory create the file _local.proper ties_ and set
265 _sdk.dir_ to where you installed it, e.g.: 267 _sdk.dir_ to where you installed it, e.g.:
266 268
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 In java source code: 302 In java source code:
301 303
302 AdblockWebView webView = (AdblockWebView) findViewById(R.id.main_webview); 304 AdblockWebView webView = (AdblockWebView) findViewById(R.id.main_webview);
303 305
304 Use `setAdblockEnabled(boolean adblockEnabled)` to enable/disable adblocking. 306 Use `setAdblockEnabled(boolean adblockEnabled)` to enable/disable adblocking.
305 307
306 Use `setDebugMode(boolean debugMode)` to turn debug log output (Android log and JS console) on/off. 308 Use `setDebugMode(boolean debugMode)` to turn debug log output (Android log and JS console) on/off.
307 309
308 Use `setAllowDrawDelay(int allowDrawDelay)` to set custom delay to start render webpage after 'DOMContentLoaded' event is fired. 310 Use `setAllowDrawDelay(int allowDrawDelay)` to set custom delay to start render webpage after 'DOMContentLoaded' event is fired.
309 311
310 Use `setAdblockEngine(AdblockEngine adblockEngine)` to use external adblock engi ne. 312 Use `setProvider(AdblockEngineProvider provider)` to use external adblock engine provider.
311 If adblock engine is not set, it's created by AdblockWebView instance automatica lly. 313 The simplest solution is to use `AdblockHelper` from `-settings` as external adb lock engine provider:
314
315 webView.setProvider(AdblockHelper.get().getProvider());
316
317 If adblock engine provider is not set, it's created by AdblockWebView instance a utomatically.
312 318
313 Use `dispose(Runnable disposeFinished)` to release resources (**required**). 319 Use `dispose(Runnable disposeFinished)` to release resources (**required**).
314 Note it can be invoked from background thread. 320 Note it can be invoked from background thread.
315 321
316 ### Building 322 ### Building
317 323
318 #### Building with Ant 324 #### Building with Ant
319 325
320 In the 'libadblockplus-android-webview' directory create the file _local.propert ies_ and set 326 In the 'libadblockplus-android-webview' directory create the file _local.propert ies_ and set
321 _sdk.dir_ to where you installed it, e.g.: 327 _sdk.dir_ to where you installed it, e.g.:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 363
358 This will generate *.apk in the 'libadblockplus-android-webviewapp/bin/' directo ry. 364 This will generate *.apk in the 'libadblockplus-android-webviewapp/bin/' directo ry.
359 365
360 #### Building with Gradle 366 #### Building with Gradle
361 367
362 In the project root directory run: 368 In the project root directory run:
363 369
364 ./gradlew assemble 370 ./gradlew assemble
365 371
366 This will generate *.apk in the 'libadblockplus-android-webviewapp/build/outputs /apk/' directory. 372 This will generate *.apk in the 'libadblockplus-android-webviewapp/build/outputs /apk/' directory.
OLDNEW
« no previous file with comments | « no previous file | libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/MainActivity.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld