| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 Adblock Plus for Android | 1 Adblock Plus Library for Android |
| 2 ======================== | 2 ======================== |
|
Felix Dahlke
2017/02/23 12:53:59
Nit: Please prolong this to match the title above.
| |
| 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 |
| 11 ./ensure_dependencies.py | 11 ./ensure_dependencies.py |
| 12 | 12 |
| 13 ## Library | 13 ## Library |
| 14 | 14 |
| 15 An Android library that provides an opportunity to use Adblock Plus core functio nality | 15 An Android library that provides the core functionality of Adblock Plus. |
| 16 in Java/Android. You can find adblock library in the 'libadblockplus-android' di rectory. | 16 You can find it in the 'libadblockplus-android' directory. |
| 17 | 17 |
| 18 ### Building with Ant | 18 ### Building with Ant |
| 19 | 19 |
| 20 #### Requirements | 20 #### Requirements |
| 21 | 21 |
| 22 * [The Android SDK](http://developer.android.com/sdk) | 22 * [The Android SDK](http://developer.android.com/sdk) |
| 23 * [The Android NDK](https://developer.android.com/tools/sdk/ndk) | 23 * [The Android NDK](https://developer.android.com/tools/sdk/ndk) |
| 24 * [Ant](http://ant.apache.org) | 24 * [Ant](http://ant.apache.org) |
| 25 | 25 |
| 26 #### Building | 26 #### Building |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 ndk.dir = /some/where/ndk | 78 ndk.dir = /some/where/ndk |
| 79 | 79 |
| 80 In the project root directory run: | 80 In the project root directory run: |
| 81 | 81 |
| 82 ./gradlew assembleDebug | 82 ./gradlew assembleDebug |
| 83 | 83 |
| 84 This will generate *.aar library artifact in the 'libadblockplus-android/build/o utputs/aar/' directory. | 84 This will generate *.aar library artifact in the 'libadblockplus-android/build/o utputs/aar/' directory. |
| 85 | 85 |
| 86 ## Library tests | 86 ## Library tests |
| 87 | 87 |
| 88 An Android tests for the Library. | 88 Android tests for the library. |
|
diegocarloslima
2017/02/06 20:35:33
The indefinite article 'An' can only be used for a
anton
2017/02/07 05:29:53
Acknowledged.
| |
| 89 You can find adblock library tests in the 'libadblockplus-android-tests' directo ry. | 89 You can find them in the 'libadblockplus-android-tests' directory. |
| 90 | 90 |
| 91 ### Requirements | 91 ### Requirements |
| 92 | 92 |
| 93 Make sure _Library_ requirements are present. | 93 Make sure _Library_ requirements are present. |
| 94 | 94 |
| 95 ### Building with Ant | 95 ### Building with Ant |
| 96 | 96 |
| 97 Set ANDROID_HOME environment variable to your Android SDK directory. | 97 Set ANDROID_HOME environment variable to your Android SDK directory. |
| 98 | 98 |
| 99 In the 'libadblockplus-android-tests' directory run: | 99 In the 'libadblockplus-android-tests' directory run: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 | 138 |
| 139 This will generate *.apk in the 'libadblockplus-android-tests/build/outputs/apk/ ' directory. | 139 This will generate *.apk in the 'libadblockplus-android-tests/build/outputs/apk/ ' directory. |
| 140 | 140 |
| 141 ### Testing with Gradle/Android Studio | 141 ### Testing with Gradle/Android Studio |
| 142 | 142 |
| 143 You can select test class/method and click 'Run ..Test'. The library and test ap p will be | 143 You can select test class/method and click 'Run ..Test'. The library and test ap p will be |
| 144 compiled, installed to emulator/device and launched automatically. | 144 compiled, installed to emulator/device and launched automatically. |
| 145 | 145 |
| 146 ## Settings | 146 ## Settings |
| 147 | 147 |
| 148 An Android library for the settings UI. | 148 An Android library that provides a configuration interface for Adblock Plus. |
| 149 You can find adblock fragments in the 'libadblockplus-android-settings' director y: | 149 You can find it in the 'libadblockplus-android-settings' directory: |
| 150 * GeneralSettingsFragment - main fragment | 150 * GeneralSettingsFragment - main fragment |
| 151 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment | 151 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment |
| 152 | 152 |
| 153 ### Usage | 153 ### Usage |
| 154 | 154 |
| 155 Create `AdblockEngine` instance with factory methods and `AdblockSettingsStorage ` instance. | 155 Create `AdblockEngine` instance with factory methods and `AdblockSettingsStorage ` instance. |
| 156 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref erences`. | 156 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref erences`. |
| 157 Or you can use AdblockHelper: | 157 Or you can use AdblockHelper: |
| 158 | 158 |
| 159 AdblockHelper.get().init(this, true, AdblockHelper.PREFERENCE_NAME); | 159 AdblockHelper.get().init(this, true, AdblockHelper.PREFERENCE_NAME); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 #### Building with Gradle | 204 #### Building with Gradle |
| 205 | 205 |
| 206 In the project root directory run: | 206 In the project root directory run: |
| 207 | 207 |
| 208 ./gradlew assemble | 208 ./gradlew assemble |
| 209 | 209 |
| 210 This will generate *.aar in the 'libadblockplus-android-settings/build/outputs/a ar' directory. | 210 This will generate *.aar in the 'libadblockplus-android-settings/build/outputs/a ar' directory. |
| 211 | 211 |
| 212 ## WebView | 212 ## WebView |
| 213 | 213 |
| 214 An Android library for WebView UI with Adblock Plus integrated. | 214 An Android library that provides a WebView component with Adblock Plus integrate d. |
| 215 You can find 'AdblockWebView' class in the 'libadblockplus-android-webview' dire ctory. | 215 You can find it in the 'libadblockplus-android-webview' directory. |
| 216 | 216 |
| 217 `AdblockWebView` class provides built-in ad blocking | 217 `AdblockWebView` class provides built-in ad blocking |
| 218 (both resource loading filtering and element hiding) and inherits from Android | 218 (both resource loading filtering and element hiding) and inherits from Android |
| 219 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html) . | 219 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html) . |
| 220 | 220 |
| 221 ### Usage | 221 ### Usage |
| 222 | 222 |
| 223 In layout XML: | 223 In layout XML: |
| 224 | 224 |
| 225 <org.adblockplus.libadblockplus.android.webview.AdblockWebView | 225 <org.adblockplus.libadblockplus.android.webview.AdblockWebView |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 #### Building with Gradle | 260 #### Building with Gradle |
| 261 | 261 |
| 262 In the project root directory run: | 262 In the project root directory run: |
| 263 | 263 |
| 264 ./gradlew assemble | 264 ./gradlew assemble |
| 265 | 265 |
| 266 This will generate *.aar in the 'libadblockplus-android-webview/build/outputs/aa r' directory. | 266 This will generate *.aar in the 'libadblockplus-android-webview/build/outputs/aa r' directory. |
| 267 | 267 |
| 268 ## WebView Application | 268 ## WebView Application |
| 269 | 269 |
| 270 An Android application with AdblockWebView usage example. | 270 An Android application that demonstrates how to use AdblockWebView. |
| 271 You can find demo application for 'AdblockWebView' class in the | 271 You can find it in the 'libadblockplus-android-webviewapp' directory. |
| 272 'libadblockplus-android-webviewapp' directory. | |
| 273 | 272 |
| 274 ### Building | 273 ### Building |
| 275 | 274 |
| 276 Make sure _Library_ requirements are present. | 275 Make sure _Library_ requirements are present. |
| 277 | 276 |
| 278 #### Building with Ant | 277 #### Building with Ant |
| 279 | 278 |
| 280 In the 'libadblockplus-android-webviewapp' directory create the file _local.prop erties_ and set | 279 In the 'libadblockplus-android-webviewapp' directory create the file _local.prop erties_ and set |
| 281 _sdk.dir_ to where you installed it, e.g.: | 280 _sdk.dir_ to where you installed it, e.g.: |
| 282 | 281 |
| 283 sdk.dir = /some/where/sdk | 282 sdk.dir = /some/where/sdk |
| 284 | 283 |
| 285 Then run: | 284 Then run: |
| 286 | 285 |
| 287 ant debug | 286 ant debug |
| 288 | 287 |
| 289 This will generate *.apk in the 'libadblockplus-android-webviewapp/bin/' directo ry. | 288 This will generate *.apk in the 'libadblockplus-android-webviewapp/bin/' directo ry. |
| 290 | 289 |
| 291 #### Building with Gradle | 290 #### Building with Gradle |
| 292 | 291 |
| 293 In the project root directory run: | 292 In the project root directory run: |
| 294 | 293 |
| 295 ./gradlew assemble | 294 ./gradlew assemble |
| 296 | 295 |
| 297 This will generate *.apk in the 'libadblockplus-android-webviewapp/build/outputs /apk/' directory. | 296 This will generate *.apk in the 'libadblockplus-android-webviewapp/build/outputs /apk/' directory. |
| LEFT | RIGHT |