| LEFT | RIGHT |
| (no file at all) | |
| 1 Adblock Android SDK | 1 Adblock Android SDK |
| 2 ================================ | 2 ================================ |
| 3 | 3 |
| 4 An Android library project, tests, settings fragments and demo application for A
dblockWebView. | 4 An Android library project, tests, settings fragments and demo application for A
dblockWebView. |
| 5 | 5 |
| 6 ## Updating the dependencies | 6 ## Updating the dependencies |
| 7 | 7 |
| 8 Adblock Android SDK has dependencies that aren't in this repository. | 8 Adblock Android SDK 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 the core functionality of Adblock Plus. | 15 An Android library that provides the core functionality of Adblock Plus. |
| 16 You can find it in the 'adblock-android' directory. | 16 You can find it in the 'adblock-android' directory. |
| 17 |
| 18 ### Using as a Gradle dependency |
| 19 |
| 20 Make sure you have `jcenter()` in the list of repositories and then add the foll
owing dependency: |
| 21 |
| 22 ```groovy |
| 23 dependencies { |
| 24 implementation 'org.adblockplus:adblock-android:3.0' |
| 25 } |
| 26 ``` |
| 17 | 27 |
| 18 ### Building | 28 ### Building |
| 19 | 29 |
| 20 #### Requirements | 30 #### Requirements |
| 21 | 31 |
| 22 * [The Android SDK](https://developer.android.com/sdk) | 32 * [The Android SDK](https://developer.android.com/sdk) |
| 23 * Android SDK Build tools 25.0.0 | 33 * Android SDK Build tools 25.0.0 |
| 24 * [The Android NDK, 16b](https://developer.android.com/ndk) | 34 * [The Android NDK, 16b](https://developer.android.com/ndk) |
| 25 | 35 |
| 26 Edit 'buildToolsVersion' in 'build.gradle' files if necessary. | 36 Edit 'buildToolsVersion' in 'build.gradle' files if necessary. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 89 |
| 80 This can be desired to use product's V8 (let's say Chromium) instead of built-in
V8. | 90 This can be desired to use product's V8 (let's say Chromium) instead of built-in
V8. |
| 81 Put prebuilt shared V8 library file(s) in ARCH directories and set `SHARED_V8_LI
B_FILENAMES` | 91 Put prebuilt shared V8 library file(s) in ARCH directories and set `SHARED_V8_LI
B_FILENAMES` |
| 82 environment variable and `SHARED_V8_LIB_DIR` before building. | 92 environment variable and `SHARED_V8_LIB_DIR` before building. |
| 83 You can pass multiple filenames in `SHARED_V8_LIB_FILENAMES`, separated with spa
ce. | 93 You can pass multiple filenames in `SHARED_V8_LIB_FILENAMES`, separated with spa
ce. |
| 84 Libadblockplus is required to be linked with that library file(s). | 94 Libadblockplus is required to be linked with that library file(s). |
| 85 | 95 |
| 86 For example: | 96 For example: |
| 87 | 97 |
| 88 SHARED_V8_LIB_FILENAMES=libv8.cr.so SHARED_V8_LIB_DIR="/tmp/shared_v8" ./gra
dlew clean assembleAbi_arm | 98 SHARED_V8_LIB_FILENAMES=libv8.cr.so SHARED_V8_LIB_DIR="/tmp/shared_v8" ./gra
dlew clean assembleAbi_arm |
| 89 | 99 |
| 90 or | 100 or |
| 91 | 101 |
| 92 SHARED_V8_LIB_FILENAMES="libv8.cr.so libv8_libbase.cr.so libv8_libplatform.c
r.so" SHARED_V8_LIB_DIR="/tmp/shared_v8" ./gradlew clean assembleAbi_arm | 102 SHARED_V8_LIB_FILENAMES="libv8.cr.so libv8_libbase.cr.so libv8_libplatform.c
r.so" SHARED_V8_LIB_DIR="/tmp/shared_v8" ./gradlew clean assembleAbi_arm |
| 93 | 103 |
| 94 for multiple library files. | 104 for multiple library files. |
| 95 | 105 |
| 96 Note | 106 Note |
| 97 | 107 |
| 98 [Configuration] Excluding shared v8 library libv8.cr.so from AAR | 108 [Configuration] Excluding shared v8 library libv8.cr.so from AAR |
| 99 ... | 109 ... |
| 100 [Configuration] Linking dynamically with shared v8 library /tmp/shared_v8/re
lease/libv8.cr.so | 110 [Configuration] Linking dynamically with shared v8 library /tmp/shared_v8/re
lease/libv8.cr.so |
| 101 ... | 111 ... |
| 102 | 112 |
| 103 output while building. | 113 output while building. |
| 104 | 114 |
| 105 ### Building for single ARCH | 115 ### Building for single ARCH |
| 106 | 116 |
| 107 By default adblock-android is built for both ARM and x86 and it can be filtered
when | 117 By default adblock-android is built for both ARM and x86 and it can be filtered
when |
| 108 building end-user android application. However sometimes it can be desired to bu
ild | 118 building end-user android application. However sometimes it can be desired to bu
ild |
| 109 "adblock-android.aar" for single ARCH. | 119 "adblock-android.aar" for single ARCH. |
| 110 | 120 |
| 111 Pass `abi_arm` or `abi_x86` to build it for single arch or `abi_all` for all ARC
Hs: | 121 Pass `abi_arm` or `abi_x86` to build it for single arch or `abi_all` for all ARC
Hs: |
| 112 | 122 |
| 113 `./gradlew clean assembleAbi_arm` | 123 `./gradlew clean assembleAbi_arm` |
| 114 | 124 |
| 115 Note | 125 Note |
| 116 | 126 |
| 117 [Configuration] Using adblock-android ABI flavor: abi_arm | 127 [Configuration] Using adblock-android ABI flavor: abi_arm |
| 118 | 128 |
| 119 output while building. | 129 output while building. |
| 120 | 130 |
| 121 ## Library tests | 131 ## Library tests |
| 122 | 132 |
| 123 Android tests for the library. | 133 Android tests for the library. |
| 124 You can find them in the 'adblock-android-tests' directory. | 134 You can find them in the 'adblock-android-tests' directory. |
| 125 | 135 |
| 126 ### Requirements | 136 ### Requirements |
| 127 | 137 |
| 128 Make sure _Library_ requirements are present. | 138 Make sure _Library_ requirements are present. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 140 | 150 |
| 141 You can select test class/method and click 'Run ..Test'. The library and test ap
p will be | 151 You can select test class/method and click 'Run ..Test'. The library and test ap
p will be |
| 142 compiled, installed to emulator/device and launched automatically. | 152 compiled, installed to emulator/device and launched automatically. |
| 143 | 153 |
| 144 ## Settings | 154 ## Settings |
| 145 | 155 |
| 146 An Android library that provides a configuration interface for Adblock Plus. | 156 An Android library that provides a configuration interface for Adblock Plus. |
| 147 You can find it in the 'adblock-android-settings' directory: | 157 You can find it in the 'adblock-android-settings' directory: |
| 148 * GeneralSettingsFragment - main fragment | 158 * GeneralSettingsFragment - main fragment |
| 149 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment | 159 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment |
| 160 |
| 161 ### Using as a Gradle dependency |
| 162 |
| 163 Make sure you have `jcenter()` in the list of repositories and then add the foll
owing dependency: |
| 164 |
| 165 ```groovy |
| 166 dependencies { |
| 167 implementation 'org.adblockplus:adblock-android-settings:3.0' |
| 168 } |
| 169 ``` |
| 150 | 170 |
| 151 ### Usage | 171 ### Usage |
| 152 | 172 |
| 153 Create `AdblockEngineProvider` instance and `AdblockSettingsStorage` instance. | 173 Create `AdblockEngineProvider` instance and `AdblockSettingsStorage` instance. |
| 154 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref
erences`. | 174 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref
erences`. |
| 155 Or you can use AdblockHelper: | 175 Or you can use AdblockHelper: |
| 156 | 176 |
| 157 AdblockHelper | 177 AdblockHelper |
| 158 .get() | 178 .get() |
| 159 .init(this, getFilesDir().getAbsolutePath(), true, AdblockHelper.PREFERENC
E_NAME); | 179 .init(this, getFilesDir().getAbsolutePath(), true, AdblockHelper.PREFERENC
E_NAME); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 243 |
| 224 ## WebView | 244 ## WebView |
| 225 | 245 |
| 226 An Android library that provides a WebView component with Adblock Plus integrate
d. | 246 An Android library that provides a WebView component with Adblock Plus integrate
d. |
| 227 You can find it in the 'adblock-android-webview' directory. | 247 You can find it in the 'adblock-android-webview' directory. |
| 228 | 248 |
| 229 `AdblockWebView` class provides built-in ad blocking | 249 `AdblockWebView` class provides built-in ad blocking |
| 230 (both resource loading filtering and element hiding) and inherits from Android | 250 (both resource loading filtering and element hiding) and inherits from Android |
| 231 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. | 251 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. |
| 232 | 252 |
| 253 ### Using as a Gradle dependency |
| 254 |
| 255 Make sure you have `jcenter()` in the list of repositories and then add the foll
owing dependency: |
| 256 |
| 257 ```groovy |
| 258 dependencies { |
| 259 implementation 'org.adblockplus:adblock-android-webview:3.0' |
| 260 } |
| 261 ``` |
| 262 |
| 233 ### Usage | 263 ### Usage |
| 234 | 264 |
| 235 In layout XML: | 265 In layout XML: |
| 236 | 266 |
| 237 <org.adblockplus.libadblockplus.android.webview.AdblockWebView | 267 <org.adblockplus.libadblockplus.android.webview.AdblockWebView |
| 238 android:id="@+id/main_webview" | 268 android:id="@+id/main_webview" |
| 239 android:layout_width="match_parent" | 269 android:layout_width="match_parent" |
| 240 android:layout_height="match_parent"/> | 270 android:layout_height="match_parent"/> |
| 241 | 271 |
| 242 In java source code: | 272 In java source code: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 304 |
| 275 ### Building | 305 ### Building |
| 276 | 306 |
| 277 Make sure _Library_ requirements are present. | 307 Make sure _Library_ requirements are present. |
| 278 | 308 |
| 279 In the project root directory run: | 309 In the project root directory run: |
| 280 | 310 |
| 281 ./gradlew assemble | 311 ./gradlew assemble |
| 282 | 312 |
| 283 This will generate *.apk in the 'adblock-android-webviewapp/build/outputs/apk/'
directory. | 313 This will generate *.apk in the 'adblock-android-webviewapp/build/outputs/apk/'
directory. |
| LEFT | RIGHT |