Class WebViewCounters
java.lang.Object
org.adblockplus.libadblockplus.android.webview.WebViewCounters
public final class WebViewCounters
extends java.lang.Object
A class for ad blocking counters, such as a counter of blocked resources, of a particular
instance of WebView.
This class is specifically designed for UI.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceWebViewCounters.EventsListenerListener for changing events. -
Constructor Summary
Constructors Constructor Description WebViewCounters(WebViewCounters.EventsListener eventsListener)Constructs an instance of Counters class. -
Method Summary
Modifier and Type Method Description static AdblockWebView.EventsListenerbindAdblockWebView(WebViewCounters.EventsListener eventsListener)A helper method for creation of AdblockWebView.EventsListener and binding it with Counters.EventsListener.voidincrementAllowlisted()Thread safe incrementation of the allowlisted counter.voidincrementBlocked()Thread safe incrementation of the blocked counter.voidresetAllowlisted()Thread safe resetting of the allowlisted counter.voidresetBlocked()Thread safe resetting of the blocked counter.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
WebViewCounters
Constructs an instance of Counters class.- Parameters:
eventsListener- A reference to an implementation of EventsListener.
-
-
Method Details
-
bindAdblockWebView
public static AdblockWebView.EventsListener bindAdblockWebView(WebViewCounters.EventsListener eventsListener)A helper method for creation of AdblockWebView.EventsListener and binding it with Counters.EventsListener.- Parameters:
eventsListener- which should be bound to the newly created implementation of AdblockWebView.EventsListener.- Returns:
- a newly created implementation of AdblockWebView.EventsListener.
-
resetBlocked
public void resetBlocked()Thread safe resetting of the blocked counter. -
resetAllowlisted
public void resetAllowlisted()Thread safe resetting of the allowlisted counter. -
incrementBlocked
public void incrementBlocked()Thread safe incrementation of the blocked counter. -
incrementAllowlisted
public void incrementAllowlisted()Thread safe incrementation of the allowlisted counter.
-