Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/Application.java

Issue 29678590: Issue 6307 - Introduce external engine created callback (Closed)
Patch Set: introduced custom listener interfaces Created Jan. 26, 2018, 12:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/Application.java
diff --git a/libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/Application.java b/libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/Application.java
index 8788335568e691afb73c6b74b3404df09742a5ac..ed901ced299ec1db5f3789bc893b98eb3948172a 100644
--- a/libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/Application.java
+++ b/libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/Application.java
@@ -21,6 +21,7 @@ import android.content.Context;
import org.adblockplus.libadblockplus.android.AdblockEngine;
import org.adblockplus.libadblockplus.android.AndroidWebRequestResourceWrapper;
+import org.adblockplus.libadblockplus.android.SingleInstanceEngineProvider;
import org.adblockplus.libadblockplus.android.settings.AdblockHelper;
import java.util.HashMap;
@@ -28,6 +29,26 @@ import java.util.Map;
public class Application extends android.app.Application
{
+ private final SingleInstanceEngineProvider.EngineCreatedListener engineCreatedListener =
+ new SingleInstanceEngineProvider.EngineCreatedListener()
+ {
+ @Override
+ public void onAdblockEngineCreated(AdblockEngine engine)
+ {
+ // put your Adblock FilterEngine init here
+ }
+ };
+
+ private final SingleInstanceEngineProvider.EngineDisposedListener engineDisposedListener =
+ new SingleInstanceEngineProvider.EngineDisposedListener()
+ {
+ @Override
+ public void onAdblockEngineDisposed()
+ {
+ // put your Adblock FilterEngine deinit here
+ }
+ };
+
@Override
public void onCreate()
{
@@ -45,6 +66,8 @@ public class Application extends android.app.Application
AdblockHelper
.get()
.init(this, basePath, true, AdblockHelper.PREFERENCE_NAME)
- .preloadSubscriptions(AdblockHelper.PRELOAD_PREFERENCE_NAME, map);
+ .preloadSubscriptions(AdblockHelper.PRELOAD_PREFERENCE_NAME, map)
+ .addEngineCreatedListener(engineCreatedListener)
+ .addEngineDisposedListener(engineDisposedListener);
}
}

Powered by Google App Engine
This is Rietveld