LEFT | RIGHT |
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 | 8 |
9 Adblock Plus Library for Android has dependencies that aren't in this repository
. | 9 Adblock Plus Library for Android has dependencies that aren't in this repository
. |
10 To update those, call: | 10 To update those, call: |
(...skipping 27 matching lines...) Expand all Loading... |
38 ------------------- | 38 ------------------- |
39 | 39 |
40 ### Requirements | 40 ### Requirements |
41 | 41 |
42 All 'Building with Ant' requirements and additional requirements: | 42 All 'Building with Ant' requirements and additional requirements: |
43 | 43 |
44 * [Maven](https://maven.apache.org) | 44 * [Maven](https://maven.apache.org) |
45 | 45 |
46 ### Building | 46 ### Building |
47 | 47 |
| 48 Go to android sdk directory '/platforms/android-21' and run: |
| 49 |
| 50 mvn install:install-file -Dfile=./android.jar -DgroupId=com.google.android -
DartifactId=android |
| 51 -Dversion=5.0 -Dpackaging=jar -DgeneratePom=true |
| 52 |
48 Set environment variable ANDROID_HOME to your Android SDK directory or pass it i
n command-line (below). | 53 Set environment variable ANDROID_HOME to your Android SDK directory or pass it i
n command-line (below). |
49 In the 'libadblockplus-android' directory run: | 54 In the root directory run: |
50 | 55 |
51 mvn clean install [-Dandroid.sdk.path=/some/where/sdk] | 56 mvn clean install [-Dandroid.sdk.path=/some/where/sdk] |
52 | 57 |
53 This will generate *.aar library artifact in the 'target' directory. | 58 This will generate *.aar library artifacts in the 'libadblockplus-android/target
', |
| 59 'libadblockplus-android-webview/target' directories and *.apk in |
| 60 'libadblockplus-android-webviewapp/target' directory. |
54 | 61 |
55 Building with Gradle/Android Studio | 62 Building with Gradle/Android Studio |
56 ----------------------------------- | 63 ----------------------------------- |
57 | 64 |
58 ### Requirements | 65 ### Requirements |
59 | 66 |
60 * [The Android SDK](http://developer.android.com/sdk) | 67 * [The Android SDK](http://developer.android.com/sdk) |
61 * Android SDK Build tools 22.0.1 | 68 * Android SDK Build tools 22.0.1 |
62 * [The Android NDK](https://developer.android.com/tools/sdk/ndk) | 69 * [The Android NDK](https://developer.android.com/tools/sdk/ndk) |
63 | 70 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 You can find 'AdblockWebView' class in 'libadblockplus-android-webview' director
y. | 146 You can find 'AdblockWebView' class in 'libadblockplus-android-webview' director
y. |
140 | 147 |
141 `AdblockWebView` class provides built-in ad blocking | 148 `AdblockWebView` class provides built-in ad blocking |
142 (both resource loading filtering and element hiding) and inherits from Android | 149 (both resource loading filtering and element hiding) and inherits from Android |
143 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. | 150 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. |
144 | 151 |
145 ### Usage | 152 ### Usage |
146 | 153 |
147 In layout XML: | 154 In layout XML: |
148 | 155 |
149 <org.adblockplus.android.AdblockWebView | 156 <org.adblockplus.libadblockplus.android.webview.AdblockWebView |
150 android:id="@+id/main_webview" | 157 android:id="@+id/main_webview" |
151 android:layout_width="match_parent" | 158 android:layout_width="match_parent" |
152 android:layout_height="match_parent"/> | 159 android:layout_height="match_parent"/> |
153 | 160 |
154 In java source code: | 161 In java source code: |
155 | 162 |
156 AdblockWebView webView = (AdblockWebView) findViewById(R.id.main_webview); | 163 AdblockWebView webView = (AdblockWebView) findViewById(R.id.main_webview); |
157 | 164 |
| 165 Use `setAdblockEnabled(boolean adblockEnabled)` to enable/disable adblocking. |
| 166 |
158 Use `setDebugMode(boolean debugMode)` to turn debug log output (Android log and
JS console) on/off. | 167 Use `setDebugMode(boolean debugMode)` to turn debug log output (Android log and
JS console) on/off. |
159 | 168 |
160 Use `setAllowDrawDelay(int allowDrawDelay)` to set custom delay to start render
webpage after 'DOMContentLoaded' event is fired. | 169 Use `setAllowDrawDelay(int allowDrawDelay)` to set custom delay to start render
webpage after 'DOMContentLoaded' event is fired. |
161 | 170 |
162 Use `setFilterEngine(FilterEngine newFilterEngine)` to use external filter engin
e | 171 Use `setAdblockEngine(AdblockEngine adblockEngine)` to use external adblock engi
ne |
163 If filter engine is not set, it's created by AdblockWebView instance automatical
ly. | 172 If adblock engine is not set, it's created by AdblockWebView instance automatica
lly. |
164 | 173 |
165 Use `setAcceptableAdsEnabled(boolean enabled)` to enable/disable Acceptable Ads. | 174 Use `dispose(Runnable disposeFinished)` to release resources (**required**). |
166 | 175 Note it can be invoked from background thread. |
167 Use `dispose()` to release resources (**required**). | |
168 | 176 |
169 ### Building | 177 ### Building |
170 | 178 |
171 Building with Ant | 179 Building with Ant |
172 ----------------- | 180 ----------------- |
173 | 181 |
174 In the 'libadblockplus-android-webview' directory create the file _local.propert
ies_ and set | 182 In the 'libadblockplus-android-webview' directory create the file _local.propert
ies_ and set |
175 _sdk.dir_ to where you installed it, e.g.: | 183 _sdk.dir_ to where you installed it, e.g.: |
176 | 184 |
177 sdk.dir = /some/where/sdk | 185 sdk.dir = /some/where/sdk |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 This will generate *.apk in 'libadblockplus-android-webviewapp/bin/' directory. | 222 This will generate *.apk in 'libadblockplus-android-webviewapp/bin/' directory. |
215 | 223 |
216 Building with Gradle | 224 Building with Gradle |
217 -------------------- | 225 -------------------- |
218 | 226 |
219 In the project root directory run: | 227 In the project root directory run: |
220 | 228 |
221 ./gradlew assemble | 229 ./gradlew assemble |
222 | 230 |
223 This will generate *.apk in 'libadblockplus-android-webviewapp/build/outputs/apk
/' directory. | 231 This will generate *.apk in 'libadblockplus-android-webviewapp/build/outputs/apk
/' directory. |
LEFT | RIGHT |