OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 20 matching lines...) Expand all Loading... |
31 import android.webkit.WebViewClient; | 31 import android.webkit.WebViewClient; |
32 import android.widget.Button; | 32 import android.widget.Button; |
33 import android.widget.EditText; | 33 import android.widget.EditText; |
34 import android.widget.ProgressBar; | 34 import android.widget.ProgressBar; |
35 | 35 |
36 public class MainActivity extends Activity | 36 public class MainActivity extends Activity |
37 { | 37 { |
38 public static final boolean DEVELOPMENT_BUILD = true; | 38 public static final boolean DEVELOPMENT_BUILD = true; |
39 | 39 |
40 // webView can create AdblockEngine instance itself if not passed with `webVie
w.setAdblockEngine()` | 40 // webView can create AdblockEngine instance itself if not passed with `webVie
w.setAdblockEngine()` |
41 public static final boolean USE_EXTERNAL_ADBLOCKENGINE = false; | 41 public static final boolean USE_EXTERNAL_ADBLOCKENGINE = true; |
42 | 42 |
43 private ProgressBar progress; | 43 private ProgressBar progress; |
44 private EditText url; | 44 private EditText url; |
45 private Button ok; | 45 private Button ok; |
46 private Button back; | 46 private Button back; |
47 private Button forward; | 47 private Button forward; |
48 private Button settings; | 48 private Button settings; |
49 | 49 |
50 private AdblockWebView webView; | 50 private AdblockWebView webView; |
51 | 51 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 private void navigateSettings() | 192 private void navigateSettings() |
193 { | 193 { |
194 startActivity(new Intent(this, SettingsActivity.class)); | 194 startActivity(new Intent(this, SettingsActivity.class)); |
195 } | 195 } |
196 | 196 |
197 private void initAdblockWebView() | 197 private void initAdblockWebView() |
198 { | 198 { |
199 if (USE_EXTERNAL_ADBLOCKENGINE) | 199 if (USE_EXTERNAL_ADBLOCKENGINE) |
200 { | 200 { |
201 // external AdblockEngine | 201 // external AdblockEngine |
202 webView.setAdblockEngineProvider(AdblockHelper.get().getAdblockEngineProvi
der()); | 202 webView.setProvider(AdblockHelper.get().getProvider()); |
203 } | 203 } |
204 else | 204 else |
205 { | 205 { |
206 // AdblockWebView will create internal AdblockEngine instance | 206 // AdblockWebView will create internal AdblockEngine instance |
207 } | 207 } |
208 } | 208 } |
209 | 209 |
210 private void hideSoftwareKeyboard() | 210 private void hideSoftwareKeyboard() |
211 { | 211 { |
212 InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_S
ERVICE); | 212 InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_S
ERVICE); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 247 } |
248 | 248 |
249 @Override | 249 @Override |
250 protected void onDestroy() | 250 protected void onDestroy() |
251 { | 251 { |
252 webView.dispose(null); | 252 webView.dispose(null); |
253 | 253 |
254 super.onDestroy(); | 254 super.onDestroy(); |
255 } | 255 } |
256 } | 256 } |
OLD | NEW |