| Index: libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java | 
| diff --git a/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java b/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java | 
| index 0840fa3e182bd8896eae3fb937c1415504657cdb..156bf43a611f7128df3fc0efaff2b36b373e75f8 100644 | 
| --- a/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java | 
| +++ b/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java | 
| @@ -21,6 +21,8 @@ import android.content.Context; | 
| import android.content.SharedPreferences; | 
| import android.util.Log; | 
| +import org.adblockplus.libadblockplus.IsAllowedConnectionCallback; | 
| +import org.adblockplus.libadblockplus.UpdateCheckDoneCallback; | 
| import org.adblockplus.libadblockplus.android.AdblockEngine; | 
| import org.adblockplus.libadblockplus.android.Utils; | 
| @@ -48,6 +50,8 @@ public class AdblockHelper | 
| private AdblockSettingsStorage storage; | 
| private CountDownLatch engineCreated; | 
| + private IsAllowedConnectionCallback isAllowedConnectionCallback; | 
| + | 
| /* | 
| Simple ARC management for AdblockEngine | 
| Use `retain` and `release` | 
| @@ -100,6 +104,8 @@ public class AdblockHelper | 
| private void createAdblock() | 
| { | 
| + this.isAllowedConnectionCallback = new IsAllowedConnectionCallbackImpl(context); | 
| + | 
| Log.d(TAG, "Creating adblock engine ..."); | 
| // read and apply current settings | 
| @@ -112,8 +118,16 @@ public class AdblockHelper | 
| engine = AdblockEngine.create( | 
| 
 
anton
2017/03/10 06:50:40
i'm thinking of refactoring in AdblockEngine: movi
 
 | 
| AdblockEngine.generateAppInfo(context, developmentBuild), | 
| context.getCacheDir().getAbsolutePath(), | 
| - true); // `true` as we need element hiding | 
| - Log.d(TAG, "AdblockHelper engine created"); | 
| + true, | 
| + isAllowedConnectionCallback, | 
| + null, | 
| + null, | 
| + null, | 
| + null); // `true` as we need element hiding | 
| + Log.d(TAG, "Adblock engine created"); | 
| + | 
| + engine.getFilterEngine().setAllowedConnectionType("new_type"); | 
| 
 
anton
2017/03/15 12:25:06
to be removed!
 
 | 
| + String ct = engine.getFilterEngine().getAllowedConnectionType(); | 
| AdblockSettings settings = storage.load(); | 
| if (settings != null) | 
| @@ -121,9 +135,15 @@ public class AdblockHelper | 
| Log.d(TAG, "Applying saved adblock settings to adblock engine"); | 
| // apply last saved settings to adblock engine | 
| - // all the settings except `enabled` and whitelisted domains are saved by adblock engine itself | 
| + // all the settings except `enabled`, whitelisted domains list | 
| + // and allowed connection type are saved by adblock engine itself | 
| engine.setEnabled(settings.isAdblockEnabled()); | 
| engine.setWhitelistedDomains(settings.getWhitelistedDomains()); | 
| + | 
| + String connectionType = (settings.getAllowedConnectionType() != null | 
| + ? settings.getAllowedConnectionType().getValue() | 
| + : null); | 
| + engine.getFilterEngine().setAllowedConnectionType(connectionType); | 
| } | 
| else | 
| { | 
| @@ -169,6 +189,10 @@ public class AdblockHelper | 
| engineCreated = null; | 
| storage = null; | 
| + | 
| + // callbacks | 
| + this.isAllowedConnectionCallback.dispose(); | 
| + this.isAllowedConnectionCallback = null; | 
| } | 
| /** |