X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fviews%2FNestedScrollWebView.java;h=b6708a40a2558e72a71c4cc6e8dff94f34370b82;hp=c7e5ade3dee5a2a45dfe5b970bac98c6c10e9a70;hb=729652a6a06a8c1bf6244c56089a9c0db84e283e;hpb=9d5e4c56326502b6b74e8f3e463275f5c1e176cc diff --git a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.java b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.java index c7e5ade3..b6708a40 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.java +++ b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.java @@ -24,6 +24,7 @@ import android.util.AttributeSet; import android.view.MotionEvent; import android.webkit.WebView; +import androidx.annotation.NonNull; import androidx.core.view.NestedScrollingChild2; import androidx.core.view.NestedScrollingChildHelper; import androidx.core.view.ViewCompat; @@ -49,6 +50,9 @@ public class NestedScrollWebView extends WebView implements NestedScrollingChild private boolean domainSettingsApplied; private int domainSettingsDatabaseId; + // Keep track of when the domain name changes so that domain settings can be reapplied. This should never be null. + private String currentDomainName = ""; + // Track the resource requests. private ArrayList resourceRequests = new ArrayList<>(); private int blockedRequests; @@ -151,6 +155,23 @@ public class NestedScrollWebView extends WebView implements NestedScrollingChild } + // Current domain name. To function well when called, the domain name should never be allowed to be null. + public void setCurrentDomainName(@NonNull String domainName) { + // Store the current domain name. + currentDomainName = domainName; + } + + public void resetCurrentDomainName() { + // Reset the current domain name. + currentDomainName = ""; + } + + public String getCurrentDomainName() { + // Return the current domain name. + return currentDomainName; + } + + // Resource requests. public void addResourceRequest(String[] resourceRequest) { // Add the resource request to the list.