| OLD | NEW |
| 1 Adblock Plus Library for Android | 1 Adblock Android SDK |
| 2 ================================ | 2 ================================ |
| 3 | 3 |
| 4 An Android library project, tests and demo application for AdblockWebView widget
. | 4 An Android library project, tests, settings fragments and demo application for A
dblockWebView view. |
| 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 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 'libadblockplus-android' directory. | 16 You can find it in the 'adblockplus-android' directory. |
| 17 | 17 |
| 18 ### Building | 18 ### Building |
| 19 | 19 |
| 20 #### Requirements | 20 #### Requirements |
| 21 | 21 |
| 22 * [The Android SDK](https://developer.android.com/sdk) | 22 * [The Android SDK](https://developer.android.com/sdk) |
| 23 * Android SDK Build tools 24.0.1 | 23 * Android SDK Build tools 25.0.0 |
| 24 * [The Android NDK, 12b](https://developer.android.com/ndk) | 24 * [The Android NDK, 12b](https://developer.android.com/ndk) |
| 25 | 25 |
| 26 Edit 'buildToolsVersion' in 'build.gradle' files if necessary. | 26 Edit 'buildToolsVersion' in 'build.gradle' files if necessary. |
| 27 | 27 |
| 28 #### Building from command-line | 28 #### Building from command-line |
| 29 | 29 |
| 30 In the project root directory create the file _local.properties_ and set | 30 In the project root directory create the file _local.properties_ and set |
| 31 _sdk.dir_ and _ndk.dir_ to where you installed it, e.g.: | 31 _sdk.dir_ and _ndk.dir_ to where you installed it, e.g.: |
| 32 | 32 |
| 33 sdk.dir = /some/where/sdk | 33 sdk.dir = /some/where/sdk |
| 34 ndk.dir = /some/where/ndk | 34 ndk.dir = /some/where/ndk |
| 35 | 35 |
| 36 In the project root directory run: | 36 In the project root directory run: |
| 37 | 37 |
| 38 ./gradlew assembleDebug | 38 ./gradlew assembleDebug |
| 39 | 39 |
| 40 This will generate *.aar library artifact in the 'libadblockplus-android/build/o
utputs/aar/' directory. | 40 This will generate *.aar library artifact in the 'adblockplus-android/build/outp
uts/aar/' directory. |
| 41 | 41 |
| 42 **Android permissions note** | 42 **Android permissions note** |
| 43 | 43 |
| 44 An app that uses the library have to add the following permissions to `AndroidMa
nifest.xml`: | 44 An app that uses the library have to add the following permissions to `AndroidMa
nifest.xml`: |
| 45 * `<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>` | 45 * `<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>` |
| 46 * `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>` | 46 * `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>` |
| 47 | 47 |
| 48 (added automatically if building with Gradle or should be added manually otherwi
se). | 48 (added automatically if building with Gradle or should be added manually otherwi
se). |
| 49 | 49 |
| 50 ### Build directory configuration | 50 ### Build directory configuration |
| (...skipping 24 matching lines...) Expand all Loading... |
| 75 or | 75 or |
| 76 | 76 |
| 77 SHARED_V8_LIB_FILENAMES="libv8.cr.so libfoo.so" ./gradlew clean assemble | 77 SHARED_V8_LIB_FILENAMES="libv8.cr.so libfoo.so" ./gradlew clean assemble |
| 78 | 78 |
| 79 for multiple library files. | 79 for multiple library files. |
| 80 | 80 |
| 81 Note | 81 Note |
| 82 | 82 |
| 83 [Configuration] Excluding shared v8 library libv8.cr.so from AAR | 83 [Configuration] Excluding shared v8 library libv8.cr.so from AAR |
| 84 ... | 84 ... |
| 85 [Configuration] Linking dynamically with shared v8 library ./libadblockplus-
binaries/android_armeabi-v7a/libv8.cr.so | 85 [Configuration] Linking dynamically with shared v8 library ./adblockplus-bin
aries/android_armeabi-v7a/libv8.cr.so |
| 86 ... | 86 ... |
| 87 | 87 |
| 88 output while building. | 88 output while building. |
| 89 | 89 |
| 90 Set `SHARED_V8_LIB_DIR` environment variable as full absolute path to pass | 90 Set `SHARED_V8_LIB_DIR` environment variable as full absolute path to pass |
| 91 specific directory instead of default one (`libadblockplus-android/jni/libadbloc
kplus-binaries`). | 91 specific directory instead of default one (`adblockplus-android/jni/libadblockpl
us-binaries`). |
| 92 | 92 |
| 93 ### Building for single ARCH | 93 ### Building for single ARCH |
| 94 | 94 |
| 95 By default libadblockplus-android is built for both ARM and x86 and it can be fi
ltered when | 95 By default adblockplus-android is built for both ARM and x86 and it can be filte
red when |
| 96 building end-user android application. However sometimes it can be desired to bu
ild | 96 building end-user android application. However sometimes it can be desired to bu
ild |
| 97 "libadblockplus-android.aar" for single ARCH. | 97 "adblockplus-android.aar" for single ARCH. |
| 98 | 98 |
| 99 Pass `abi_arm` or `abi_x86` to build it for single arch or `abi_all` for all ARC
Hs: | 99 Pass `abi_arm` or `abi_x86` to build it for single arch or `abi_all` for all ARC
Hs: |
| 100 | 100 |
| 101 `./gradlew clean assembleAbi_arm` | 101 `./gradlew clean assembleAbi_arm` |
| 102 | 102 |
| 103 Note | 103 Note |
| 104 | 104 |
| 105 [Configuration] Using libadblockplus-android ABI flavor: abi_arm | 105 [Configuration] Using adblockplus-android ABI flavor: abi_arm |
| 106 | 106 |
| 107 output while building. | 107 output while building. |
| 108 | 108 |
| 109 ## Library tests | 109 ## Library tests |
| 110 | 110 |
| 111 Android tests for the library. | 111 Android tests for the library. |
| 112 You can find them in the 'libadblockplus-android-tests' directory. | 112 You can find them in the 'adblockplus-android-tests' directory. |
| 113 | 113 |
| 114 ### Requirements | 114 ### Requirements |
| 115 | 115 |
| 116 Make sure _Library_ requirements are present. | 116 Make sure _Library_ requirements are present. |
| 117 | 117 |
| 118 ### Building | 118 ### Building |
| 119 | 119 |
| 120 Make sure you've created the _local.properties_ file to build the library (see a
bove). | 120 Make sure you've created the _local.properties_ file to build the library (see a
bove). |
| 121 In the project root directory run: | 121 In the project root directory run: |
| 122 | 122 |
| 123 ./gradlew assembleDebugAndroidTest | 123 ./gradlew assembleDebugAndroidTest |
| 124 | 124 |
| 125 This will generate *.apk in the 'libadblockplus-android-tests/build/outputs/apk/
' directory. | 125 This will generate *.apk in the 'adblockplus-android-tests/build/outputs/apk/' d
irectory. |
| 126 | 126 |
| 127 ### Testing | 127 ### Testing |
| 128 | 128 |
| 129 You can select test class/method and click 'Run ..Test'. The library and test ap
p will be | 129 You can select test class/method and click 'Run ..Test'. The library and test ap
p will be |
| 130 compiled, installed to emulator/device and launched automatically. | 130 compiled, installed to emulator/device and launched automatically. |
| 131 | 131 |
| 132 ## Settings | 132 ## Settings |
| 133 | 133 |
| 134 An Android library that provides a configuration interface for Adblock Plus. | 134 An Android library that provides a configuration interface for Adblock Plus. |
| 135 You can find it in the 'libadblockplus-android-settings' directory: | 135 You can find it in the 'adblockplus-android-settings' directory: |
| 136 * GeneralSettingsFragment - main fragment | 136 * GeneralSettingsFragment - main fragment |
| 137 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment | 137 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment |
| 138 | 138 |
| 139 ### Usage | 139 ### Usage |
| 140 | 140 |
| 141 Create `AdblockEngineProvider` instance and `AdblockSettingsStorage` instance. | 141 Create `AdblockEngineProvider` instance and `AdblockSettingsStorage` instance. |
| 142 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref
erences`. | 142 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref
erences`. |
| 143 Or you can use AdblockHelper: | 143 Or you can use AdblockHelper: |
| 144 | 144 |
| 145 AdblockHelper | 145 AdblockHelper |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 AdblockHelper.get().getProvider().release(); | 177 AdblockHelper.get().getProvider().release(); |
| 178 | 178 |
| 179 Insert `GeneralSettingsFragment` fragment instance in runtime to start showing s
ettings UI. | 179 Insert `GeneralSettingsFragment` fragment instance in runtime to start showing s
ettings UI. |
| 180 | 180 |
| 181 ### Building | 181 ### Building |
| 182 | 182 |
| 183 In the project root directory run: | 183 In the project root directory run: |
| 184 | 184 |
| 185 ./gradlew assemble | 185 ./gradlew assemble |
| 186 | 186 |
| 187 This will generate *.aar in the 'libadblockplus-android-settings/build/outputs/a
ar' directory. | 187 This will generate *.aar in the 'adblockplus-android-settings/build/outputs/aar'
directory. |
| 188 | 188 |
| 189 ## WebView | 189 ## WebView |
| 190 | 190 |
| 191 An Android library that provides a WebView component with Adblock Plus integrate
d. | 191 An Android library that provides a WebView component with Adblock Plus integrate
d. |
| 192 You can find it in the 'libadblockplus-android-webview' directory. | 192 You can find it in the 'adblockplus-android-webview' directory. |
| 193 | 193 |
| 194 `AdblockWebView` class provides built-in ad blocking | 194 `AdblockWebView` class provides built-in ad blocking |
| 195 (both resource loading filtering and element hiding) and inherits from Android | 195 (both resource loading filtering and element hiding) and inherits from Android |
| 196 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. | 196 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. |
| 197 | 197 |
| 198 ### Usage | 198 ### Usage |
| 199 | 199 |
| 200 In layout XML: | 200 In layout XML: |
| 201 | 201 |
| 202 <org.adblockplus.libadblockplus.android.webview.AdblockWebView | 202 <org.adblockplus.libadblockplus.android.webview.AdblockWebView |
| (...skipping 20 matching lines...) Expand all Loading... |
| 223 | 223 |
| 224 Use `dispose(Runnable disposeFinished)` to release resources (**required**). | 224 Use `dispose(Runnable disposeFinished)` to release resources (**required**). |
| 225 Note it can be invoked from background thread. | 225 Note it can be invoked from background thread. |
| 226 | 226 |
| 227 ### Building | 227 ### Building |
| 228 | 228 |
| 229 In the project root directory run: | 229 In the project root directory run: |
| 230 | 230 |
| 231 ./gradlew assemble | 231 ./gradlew assemble |
| 232 | 232 |
| 233 This will generate *.aar in the 'libadblockplus-android-webview/build/outputs/aa
r' directory. | 233 This will generate *.aar in the 'adblockplus-android-webview/build/outputs/aar'
directory. |
| 234 | 234 |
| 235 ## WebView Application | 235 ## WebView Application |
| 236 | 236 |
| 237 An Android application that demonstrates how to use AdblockWebView. | 237 An Android application that demonstrates how to use AdblockWebView. |
| 238 You can find it in the 'libadblockplus-android-webviewapp' directory. | 238 You can find it in the 'adblockplus-android-webviewapp' directory. |
| 239 | 239 |
| 240 ### Building | 240 ### Building |
| 241 | 241 |
| 242 Make sure _Library_ requirements are present. | 242 Make sure _Library_ requirements are present. |
| 243 | 243 |
| 244 In the project root directory run: | 244 In the project root directory run: |
| 245 | 245 |
| 246 ./gradlew assemble | 246 ./gradlew assemble |
| 247 | 247 |
| 248 This will generate *.apk in the 'libadblockplus-android-webviewapp/build/outputs
/apk/' directory. | 248 This will generate *.apk in the 'adblockplus-android-webviewapp/build/outputs/ap
k/' directory. |
| OLD | NEW |