addDomainDialog.show(supportFragmentManager, resources.getString(R.string.add_domain))
}
- // Get a handle for the activity.
- val activity: Activity = this
-
- // Control what the navigation bar back button does.
+ // Control what the system back command does.
val onBackPressedCallback: OnBackPressedCallback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if (twoPanedMode) { // The device is in two-paned mode.
undoDeleteSnackbar!!.dismiss()
} else {
// Go home.
- NavUtils.navigateUpFromSameTask(activity)
+ finish()
}
} else if (closeOnBack) { // Go directly back to the main WebView activity because the domains activity was launched from the options menu.
// Save the current domain settings.
saveDomainSettings(coordinatorLayout)
// Go home.
- NavUtils.navigateUpFromSameTask(activity)
+ finish()
} else if (findViewById<View?>(R.id.domain_settings_scrollview) != null) { // The device is in single-paned mode and domain settings fragment is displayed.
// Save the current domain settings.
saveDomainSettings(coordinatorLayout)
undoDeleteSnackbar!!.dismiss()
} else {
// Go home.
- NavUtils.navigateUpFromSameTask(activity)
+ finish()
}
}
}
undoDeleteSnackbar!!.dismiss()
} else {
// Go home.
- NavUtils.navigateUpFromSameTask(this)
+ finish()
}
} else if (closeOnBack) { // Go directly back to the main WebView activity because the domains activity was launched from the options menu.
// Save the current domain settings.
saveDomainSettings(coordinatorLayout)
// Go home.
- NavUtils.navigateUpFromSameTask(this)
+ finish()
} else if (findViewById<View?>(R.id.domain_settings_scrollview) != null) { // The device is in single-paned mode and the domain settings fragment is displayed.
// Save the current domain settings.
saveDomainSettings(coordinatorLayout)
undoDeleteSnackbar!!.dismiss()
} else {
// Go home.
- NavUtils.navigateUpFromSameTask(this)
+ finish()
}
}
}
val blockAllThirdPartyRequestsSwitch = view.findViewById<SwitchCompat>(R.id.block_all_third_party_requests_switch)
val userAgentSpinner = view.findViewById<Spinner>(R.id.user_agent_spinner)
val customUserAgentEditText = view.findViewById<EditText>(R.id.custom_user_agent_edittext)
- val xRequestedWithHeaderSpinner = view.findViewById<Spinner>(R.id.x_requested_with_header_spinner)
val fontSizeSpinner = view.findViewById<Spinner>(R.id.font_size_spinner)
val customFontSizeEditText = view.findViewById<EditText>(R.id.custom_font_size_edittext)
val swipeToRefreshSpinner = view.findViewById<Spinner>(R.id.swipe_to_refresh_spinner)
val ultraPrivacy = ultraPrivacySwitch.isChecked
val blockAllThirdPartyRequests = blockAllThirdPartyRequestsSwitch.isChecked
val userAgentSwitchPosition = userAgentSpinner.selectedItemPosition
- val xRequestedWithHeaderSwitchInt = xRequestedWithHeaderSpinner.selectedItemPosition
val fontSizeSwitchPosition = fontSizeSpinner.selectedItemPosition
val swipeToRefreshInt = swipeToRefreshSpinner.selectedItemPosition
val webViewThemeInt = webViewThemeSpinner.selectedItemPosition
// Save the domain settings.
domainsDatabaseHelper.updateDomain(currentDomainDatabaseId, domainNameString, javaScript, cookies, domStorage, formData, easyList, easyPrivacy, fanboysAnnoyance, fanboysSocialBlocking, ultraList,
- ultraPrivacy, blockAllThirdPartyRequests, userAgentName, xRequestedWithHeaderSwitchInt, fontSizeInt, swipeToRefreshInt, webViewThemeInt, wideViewportInt, displayWebpageImagesInt,
+ ultraPrivacy, blockAllThirdPartyRequests, userAgentName, fontSizeInt, swipeToRefreshInt, webViewThemeInt, wideViewportInt, displayWebpageImagesInt,
pinnedSslCertificate, pinnedIpAddress)
// Update the pinned SSL certificate if a new one is checked.