+ // Run the default commands and return the result.
+ return super.onTouchEvent(motionEvent);
+ }
+
+ public Bundle saveNestedScrollWebViewState() {
+ // Create a saved state bundle.
+ Bundle savedState = new Bundle();
+
+ // Initialize the long date variables.
+ long pinnedSslStartDateLong = 0;
+ long pinnedSslEndDateLong = 0;
+
+ // Convert the dates to longs.
+ if (pinnedSslStartDate != null) {
+ pinnedSslStartDateLong = pinnedSslStartDate.getTime();
+ }
+
+ if (pinnedSslEndDate != null) {
+ pinnedSslEndDateLong = pinnedSslEndDate.getTime();
+ }
+
+ // Populate the saved state bundle.
+ savedState.putBoolean(DOMAIN_SETTINGS_APPLIED, domainSettingsApplied);
+ savedState.putInt(DOMAIN_SETTINGS_DATABASE_ID, domainSettingsDatabaseId);
+ savedState.putString(CURRENT_URl, currentUrl);
+ savedState.putString(CURRENT_DOMAIN_NAME, currentDomainName);
+ savedState.putBoolean(ACCEPT_COOKIES, acceptCookies);
+ savedState.putBoolean(EASYLIST_ENABLED, easyListEnabled);
+ savedState.putBoolean(EASYPRIVACY_ENABLED, easyPrivacyEnabled);
+ savedState.putBoolean(FANBOYS_ANNOYANCE_LIST_ENABLED, fanboysAnnoyanceListEnabled);
+ savedState.putBoolean(FANBOYS_SOCIAL_BLOCKING_LIST_ENABLED, fanboysSocialBlockingListEnabled);
+ savedState.putBoolean(ULTRALIST_ENABLED, ultraListEnabled);
+ savedState.putBoolean(ULTRAPRIVACY_ENABLED, ultraPrivacyEnabled);
+ savedState.putBoolean(BLOCK_ALL_THIRD_PARTY_REQUESTS, blockAllThirdPartyRequests);
+ savedState.putBoolean(HAS_PINNED_SSL_CERTIFICATE, hasPinnedSslCertificate);
+ savedState.putString(PINNED_SSL_ISSUED_TO_CNAME, pinnedSslIssuedToCName);
+ savedState.putString(PINNED_SSL_ISSUED_TO_ONAME, pinnedSslIssuedToOName);
+ savedState.putString(PINNED_SSL_ISSUED_TO_UNAME, pinnedSslIssuedToUName);
+ savedState.putString(PINNED_SSL_ISSUED_BY_CNAME, pinnedSslIssuedByCName);
+ savedState.putString(PINNED_SSL_ISSUED_BY_ONAME, pinnedSslIssuedByOName);
+ savedState.putString(PINNED_SSL_ISSUED_BY_UNAME, pinnedSslIssuedByUName);
+ savedState.putLong(PINNED_SSL_START_DATE, pinnedSslStartDateLong);
+ savedState.putLong(PINNED_SSL_END_DATE, pinnedSslEndDateLong);
+ savedState.putBoolean(HAS_PINNED_IP_ADDRESSES, hasPinnedIpAddresses);
+ savedState.putString(PINNED_IP_ADDRESSES, pinnedIpAddresses);
+ savedState.putBoolean(IGNORE_PINNED_DOMAIN_INFORMATION, ignorePinnedDomainInformation);
+ savedState.putBoolean(SWIPE_TO_REFRESH, swipeToRefresh);
+ savedState.putBoolean(JAVASCRIPT_ENABLED, this.getSettings().getJavaScriptEnabled());
+ savedState.putBoolean(DOM_STORAGE_ENABLED, this.getSettings().getDomStorageEnabled());
+ savedState.putString(USER_AGENT, this.getSettings().getUserAgentString());
+ savedState.putBoolean(WIDE_VIEWPORT, this.getSettings().getUseWideViewPort());
+ savedState.putInt(FONT_SIZE, this.getSettings().getTextZoom());
+
+ // Return the saved state bundle.
+ return savedState;
+ }
+
+ public void restoreNestedScrollWebViewState(Bundle savedState) {
+ // Restore the class variables.
+ domainSettingsApplied = savedState.getBoolean(DOMAIN_SETTINGS_APPLIED);
+ domainSettingsDatabaseId = savedState.getInt(DOMAIN_SETTINGS_DATABASE_ID);
+ currentUrl = savedState.getString(CURRENT_URl);
+ currentDomainName = savedState.getString(CURRENT_DOMAIN_NAME);
+ acceptCookies = savedState.getBoolean(ACCEPT_COOKIES);
+ easyListEnabled = savedState.getBoolean(EASYLIST_ENABLED);
+ easyPrivacyEnabled = savedState.getBoolean(EASYPRIVACY_ENABLED);
+ fanboysAnnoyanceListEnabled = savedState.getBoolean(FANBOYS_ANNOYANCE_LIST_ENABLED);
+ fanboysSocialBlockingListEnabled = savedState.getBoolean(FANBOYS_SOCIAL_BLOCKING_LIST_ENABLED);
+ ultraListEnabled = savedState.getBoolean(ULTRALIST_ENABLED);
+ ultraPrivacyEnabled = savedState.getBoolean(ULTRAPRIVACY_ENABLED);
+ blockAllThirdPartyRequests = savedState.getBoolean(BLOCK_ALL_THIRD_PARTY_REQUESTS);
+ hasPinnedSslCertificate = savedState.getBoolean(HAS_PINNED_SSL_CERTIFICATE);
+ pinnedSslIssuedToCName = savedState.getString(PINNED_SSL_ISSUED_TO_CNAME);
+ pinnedSslIssuedToOName = savedState.getString(PINNED_SSL_ISSUED_TO_ONAME);
+ pinnedSslIssuedToUName = savedState.getString(PINNED_SSL_ISSUED_TO_UNAME);
+ pinnedSslIssuedByCName = savedState.getString(PINNED_SSL_ISSUED_BY_CNAME);
+ pinnedSslIssuedByOName = savedState.getString(PINNED_SSL_ISSUED_BY_ONAME);
+ pinnedSslIssuedByUName = savedState.getString(PINNED_SSL_ISSUED_BY_UNAME);
+ hasPinnedIpAddresses = savedState.getBoolean(HAS_PINNED_IP_ADDRESSES);
+ pinnedIpAddresses = savedState.getString(PINNED_IP_ADDRESSES);
+ ignorePinnedDomainInformation = savedState.getBoolean(IGNORE_PINNED_DOMAIN_INFORMATION);
+ swipeToRefresh = savedState.getBoolean(SWIPE_TO_REFRESH);
+ this.getSettings().setJavaScriptEnabled(savedState.getBoolean(JAVASCRIPT_ENABLED));
+ this.getSettings().setDomStorageEnabled(savedState.getBoolean(DOM_STORAGE_ENABLED));
+ this.getSettings().setUserAgentString(savedState.getString(USER_AGENT));
+ this.getSettings().setUseWideViewPort(savedState.getBoolean(WIDE_VIEWPORT));
+ this.getSettings().setTextZoom(savedState.getInt(FONT_SIZE));
+
+ // Get the date longs.
+ long pinnedSslStartDateLong = savedState.getLong(PINNED_SSL_START_DATE);
+ long pinnedSslEndDateLong = savedState.getLong(PINNED_SSL_END_DATE);
+
+ // Set the pinned SSL start date to `null` if the saved date long is 0 because creating a new date results in an error if the input is 0.
+ if (pinnedSslStartDateLong == 0) {
+ pinnedSslStartDate = null;
+ } else {
+ pinnedSslStartDate = new Date(pinnedSslStartDateLong);
+ }
+
+ // Set the Pinned SSL end date to `null` if the saved date long is 0 because creating a new date results in an error if the input is 0.
+ if (pinnedSslEndDateLong == 0) {
+ pinnedSslEndDate = null;
+ } else {
+ pinnedSslEndDate = new Date(pinnedSslEndDateLong);
+ }