| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-present eyeo GmbH | |
| 4 * | |
| 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 | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 18 package org.adblockplus.libadblockplus.android.webviewapp; | |
| 19 | |
| 20 import android.content.Context; | |
| 21 | |
| 22 import org.adblockplus.libadblockplus.android.AdblockEngine; | |
| 23 import org.adblockplus.libadblockplus.android.AndroidWebRequestResourceWrapper; | |
| 24 import org.adblockplus.libadblockplus.android.settings.AdblockHelper; | |
| 25 | |
| 26 import java.util.HashMap; | |
| 27 import java.util.Map; | |
| 28 | |
| 29 public class Application extends android.app.Application | |
| 30 { | |
| 31 @Override | |
| 32 public void onCreate() | |
| 33 { | |
| 34 super.onCreate(); | |
| 35 | |
| 36 // init Adblock | |
| 37 String basePath = getDir(AdblockEngine.BASE_PATH_DIRECTORY, Context.MODE_PRI
VATE).getAbsolutePath(); | |
| 38 | |
| 39 // provide preloaded subscriptions | |
| 40 Map<String, Integer> map = new HashMap<String, Integer>(); | |
| 41 map.put(AndroidWebRequestResourceWrapper.EASYLIST, R.raw.easylist); | |
| 42 map.put(AndroidWebRequestResourceWrapper.EASYLIST_CHINESE, R.raw.easylist); | |
| 43 map.put(AndroidWebRequestResourceWrapper.ACCEPTABLE_ADS, R.raw.exceptionrule
s); | |
| 44 | |
| 45 AdblockHelper | |
| 46 .get() | |
| 47 .init(this, basePath, true, AdblockHelper.PREFERENCE_NAME) | |
| 48 .preloadSubscriptions(AdblockHelper.PRELOAD_PREFERENCE_NAME, map); | |
| 49 } | |
| 50 } | |
| OLD | NEW |