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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 You can find 'AdblockWebView' class in 'libadblockplus-android-webview' director
y. | 146 You can find 'AdblockWebView' class in 'libadblockplus-android-webview' director
y. |
147 | 147 |
148 `AdblockWebView` class provides built-in ad blocking | 148 `AdblockWebView` class provides built-in ad blocking |
149 (both resource loading filtering and element hiding) and inherits from Android | 149 (both resource loading filtering and element hiding) and inherits from Android |
150 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. | 150 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. |
151 | 151 |
152 ### Usage | 152 ### Usage |
153 | 153 |
154 In layout XML: | 154 In layout XML: |
155 | 155 |
156 <org.adblockplus.android.AdblockWebView | 156 <org.adblockplus.libadblockplus.android.webview.AdblockWebView |
157 android:id="@+id/main_webview" | 157 android:id="@+id/main_webview" |
158 android:layout_width="match_parent" | 158 android:layout_width="match_parent" |
159 android:layout_height="match_parent"/> | 159 android:layout_height="match_parent"/> |
160 | 160 |
161 In java source code: | 161 In java source code: |
162 | 162 |
163 AdblockWebView webView = (AdblockWebView) findViewById(R.id.main_webview); | 163 AdblockWebView webView = (AdblockWebView) findViewById(R.id.main_webview); |
164 | 164 |
| 165 Use `setAdblockEnabled(boolean adblockEnabled)` to enable/disable adblocking. |
| 166 |
165 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. |
166 | 168 |
167 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. |
168 | 170 |
169 Use `setFilterEngine(FilterEngine newFilterEngine)` to use external filter engin
e | 171 Use `setAdblockEngine(AdblockEngine adblockEngine)` to use external adblock engi
ne |
170 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. |
171 | 173 |
172 Use `setAcceptableAdsEnabled(boolean enabled)` to enable/disable Acceptable Ads. | 174 Use `dispose(Runnable disposeFinished)` to release resources (**required**). |
173 | 175 Note it can be invoked from background thread. |
174 Use `dispose()` to release resources (**required**). | |
175 | 176 |
176 ### Building | 177 ### Building |
177 | 178 |
178 Building with Ant | 179 Building with Ant |
179 ----------------- | 180 ----------------- |
180 | 181 |
181 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 |
182 _sdk.dir_ to where you installed it, e.g.: | 183 _sdk.dir_ to where you installed it, e.g.: |
183 | 184 |
184 sdk.dir = /some/where/sdk | 185 sdk.dir = /some/where/sdk |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 This will generate *.apk in 'libadblockplus-android-webviewapp/bin/' directory. | 222 This will generate *.apk in 'libadblockplus-android-webviewapp/bin/' directory. |
222 | 223 |
223 Building with Gradle | 224 Building with Gradle |
224 -------------------- | 225 -------------------- |
225 | 226 |
226 In the project root directory run: | 227 In the project root directory run: |
227 | 228 |
228 ./gradlew assemble | 229 ./gradlew assemble |
229 | 230 |
230 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 |