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 25 matching lines...) Expand all Loading... |
36 BaseSettingsFragment.Provider, | 36 BaseSettingsFragment.Provider, |
37 GeneralSettingsFragment.Listener, | 37 GeneralSettingsFragment.Listener, |
38 WhitelistedDomainsSettingsFragment.Listener | 38 WhitelistedDomainsSettingsFragment.Listener |
39 { | 39 { |
40 private static final String TAG = Utils.getTag(SettingsActivity.class); | 40 private static final String TAG = Utils.getTag(SettingsActivity.class); |
41 | 41 |
42 @Override | 42 @Override |
43 protected void onCreate(Bundle savedInstanceState) | 43 protected void onCreate(Bundle savedInstanceState) |
44 { | 44 { |
45 super.onCreate(savedInstanceState); | 45 super.onCreate(savedInstanceState); |
46 AdblockHelper.get().retain(MainActivity.ADBLOCKENGINE_RETAIN_ASYNC); | 46 |
| 47 // retaining AdblockEngine asynchronously |
| 48 AdblockHelper.get().getProvider().retain(true); |
47 | 49 |
48 insertGeneralFragment(); | 50 insertGeneralFragment(); |
49 } | 51 } |
50 | 52 |
51 private void insertGeneralFragment() | 53 private void insertGeneralFragment() |
52 { | 54 { |
53 getFragmentManager() | 55 getFragmentManager() |
54 .beginTransaction() | 56 .beginTransaction() |
55 .replace( | 57 .replace( |
56 android.R.id.content, | 58 android.R.id.content, |
(...skipping 11 matching lines...) Expand all Loading... |
68 .addToBackStack(WhitelistedDomainsSettingsFragment.class.getSimpleName()) | 70 .addToBackStack(WhitelistedDomainsSettingsFragment.class.getSimpleName()) |
69 .commit(); | 71 .commit(); |
70 } | 72 } |
71 | 73 |
72 // provider | 74 // provider |
73 | 75 |
74 @Override | 76 @Override |
75 public AdblockEngine getAdblockEngine() | 77 public AdblockEngine getAdblockEngine() |
76 { | 78 { |
77 // if it's retained asynchronously we have to wait until it's ready | 79 // if it's retained asynchronously we have to wait until it's ready |
78 AdblockHelper.get().waitForReady(); | 80 AdblockHelper.get().getProvider().waitForReady(); |
79 return AdblockHelper.get().getEngine(); | 81 return AdblockHelper.get().getProvider().getEngine(); |
80 } | 82 } |
81 | 83 |
82 @Override | 84 @Override |
83 public AdblockSettingsStorage getAdblockSettingsStorage() | 85 public AdblockSettingsStorage getAdblockSettingsStorage() |
84 { | 86 { |
85 return AdblockHelper.get().getStorage(); | 87 return AdblockHelper.get().getStorage(); |
86 } | 88 } |
87 | 89 |
88 // listener | 90 // listener |
89 | 91 |
(...skipping 15 matching lines...) Expand all Loading... |
105 AdblockSettings settings) | 107 AdblockSettings settings) |
106 { | 108 { |
107 // show error here if domain is invalid | 109 // show error here if domain is invalid |
108 return domain != null && domain.length() > 0; | 110 return domain != null && domain.length() > 0; |
109 } | 111 } |
110 | 112 |
111 @Override | 113 @Override |
112 protected void onDestroy() | 114 protected void onDestroy() |
113 { | 115 { |
114 super.onDestroy(); | 116 super.onDestroy(); |
115 AdblockHelper.get().release(); | 117 AdblockHelper.get().getProvider().release(); |
116 } | 118 } |
117 } | 119 } |
OLD | NEW |