OLD | NEW |
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 Library 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 the core functionality of Adblock Plus. |
| 16 You can find it in the 'libadblockplus-android' directory. |
| 17 |
15 ### Building with Ant | 18 ### Building with Ant |
16 | 19 |
17 #### Requirements | 20 #### Requirements |
18 | 21 |
19 * [The Android SDK](http://developer.android.com/sdk) | 22 * [The Android SDK](http://developer.android.com/sdk) |
20 * [The Android NDK](https://developer.android.com/tools/sdk/ndk) | 23 * [The Android NDK](https://developer.android.com/tools/sdk/ndk) |
21 * [Ant](http://ant.apache.org) | 24 * [Ant](http://ant.apache.org) |
22 | 25 |
23 #### Building | 26 #### Building |
24 | 27 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 ndk.dir = /some/where/ndk | 78 ndk.dir = /some/where/ndk |
76 | 79 |
77 In the project root directory run: | 80 In the project root directory run: |
78 | 81 |
79 ./gradlew assembleDebug | 82 ./gradlew assembleDebug |
80 | 83 |
81 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. |
82 | 85 |
83 ## Library tests | 86 ## Library tests |
84 | 87 |
| 88 Android tests for the library. |
| 89 You can find them in the 'libadblockplus-android-tests' directory. |
| 90 |
85 ### Requirements | 91 ### Requirements |
86 | 92 |
87 Make sure _Library_ requirements are present. | 93 Make sure _Library_ requirements are present. |
88 | 94 |
89 ### Building with Ant | 95 ### Building with Ant |
90 | 96 |
91 Set ANDROID_HOME environment variable to your Android SDK directory. | 97 Set ANDROID_HOME environment variable to your Android SDK directory. |
92 | 98 |
93 In the 'libadblockplus-android-tests' directory run: | 99 In the 'libadblockplus-android-tests' directory run: |
94 | 100 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 138 |
133 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. |
134 | 140 |
135 ### Testing with Gradle/Android Studio | 141 ### Testing with Gradle/Android Studio |
136 | 142 |
137 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 |
138 compiled, installed to emulator/device and launched automatically. | 144 compiled, installed to emulator/device and launched automatically. |
139 | 145 |
140 ## Settings | 146 ## Settings |
141 | 147 |
142 You can find adblock fragments in the 'libadblockplus-android-settings' director
y: | 148 An Android library that provides a configuration interface for Adblock Plus. |
| 149 You can find it in the 'libadblockplus-android-settings' directory: |
143 * GeneralSettingsFragment - main fragment | 150 * GeneralSettingsFragment - main fragment |
144 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment | 151 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment |
145 | 152 |
146 ### Usage | 153 ### Usage |
147 | 154 |
148 Create `AdblockEngine` instance with factory methods and `AdblockSettingsStorage
` instance. | 155 Create `AdblockEngine` instance with factory methods and `AdblockSettingsStorage
` instance. |
149 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref
erences`. | 156 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref
erences`. |
150 Or you can use AdblockHelper: | 157 Or you can use AdblockHelper: |
151 | 158 |
152 AdblockHelper.get().init(this, true, AdblockHelper.PREFERENCE_NAME); | 159 AdblockHelper.get().init(this, true, AdblockHelper.PREFERENCE_NAME); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 202 |
196 | 203 |
197 #### Building with Gradle | 204 #### Building with Gradle |
198 | 205 |
199 In the project root directory run: | 206 In the project root directory run: |
200 | 207 |
201 ./gradlew assemble | 208 ./gradlew assemble |
202 | 209 |
203 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. |
204 | 211 |
205 ## WebView Application | |
206 | |
207 You can find demo application for 'AdblockWebView' class in | |
208 'libadblockplus-android-webviewapp' directory. | |
209 | |
210 ### Building | |
211 | |
212 Make sure _Library_ requirements are present. | |
213 | |
214 #### Building with Ant | |
215 | |
216 In the 'libadblockplus-android-webviewapp' directory create the file _local.prop
erties_ and set | |
217 _sdk.dir_ to where you installed it, e.g.: | |
218 | |
219 sdk.dir = /some/where/sdk | |
220 | |
221 Then run: | |
222 | |
223 ant debug | |
224 | |
225 This will generate *.apk in the 'libadblockplus-android-webviewapp/bin/' directo
ry. | |
226 | |
227 #### Building with Gradle | |
228 | |
229 In the project root directory run: | |
230 | |
231 ./gradlew assemble | |
232 | |
233 This will generate *.apk in the 'libadblockplus-android-webviewapp/build/outputs
/apk/' directory. | |
234 | |
235 | |
236 ## WebView | 212 ## WebView |
237 | 213 |
238 You can find 'AdblockWebView' class in the 'libadblockplus-android-webview' dire
ctory. | 214 An Android library that provides a WebView component with Adblock Plus integrate
d. |
| 215 You can find it in the 'libadblockplus-android-webview' directory. |
239 | 216 |
240 `AdblockWebView` class provides built-in ad blocking | 217 `AdblockWebView` class provides built-in ad blocking |
241 (both resource loading filtering and element hiding) and inherits from Android | 218 (both resource loading filtering and element hiding) and inherits from Android |
242 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. | 219 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. |
243 | 220 |
244 ### Usage | 221 ### Usage |
245 | 222 |
246 In layout XML: | 223 In layout XML: |
247 | 224 |
248 <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... |
283 #### Building with Gradle | 260 #### Building with Gradle |
284 | 261 |
285 In the project root directory run: | 262 In the project root directory run: |
286 | 263 |
287 ./gradlew assemble | 264 ./gradlew assemble |
288 | 265 |
289 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. |
290 | 267 |
291 ## WebView Application | 268 ## WebView Application |
292 | 269 |
293 You can find demo application for 'AdblockWebView' class in the | 270 An Android application that demonstrates how to use AdblockWebView. |
294 'libadblockplus-android-webviewapp' directory. | 271 You can find it in the 'libadblockplus-android-webviewapp' directory. |
295 | 272 |
296 ### Building | 273 ### Building |
297 | 274 |
298 Make sure _Library_ requirements are present. | 275 Make sure _Library_ requirements are present. |
299 | 276 |
300 #### Building with Ant | 277 #### Building with Ant |
301 | 278 |
302 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 |
303 _sdk.dir_ to where you installed it, e.g.: | 280 _sdk.dir_ to where you installed it, e.g.: |
304 | 281 |
305 sdk.dir = /some/where/sdk | 282 sdk.dir = /some/where/sdk |
306 | 283 |
307 Then run: | 284 Then run: |
308 | 285 |
309 ant debug | 286 ant debug |
310 | 287 |
311 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. |
312 | 289 |
313 #### Building with Gradle | 290 #### Building with Gradle |
314 | 291 |
315 In the project root directory run: | 292 In the project root directory run: |
316 | 293 |
317 ./gradlew assemble | 294 ./gradlew assemble |
318 | 295 |
319 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. |
OLD | NEW |