import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
import android.os.Bundle;
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
- // Set the theme.
- setTheme(R.style.PrivacyBrowser);
-
// Run the default commands.
super.onCreate(savedInstanceState);
// Set the back arrow on the action bar.
actionBar.setDisplayHomeAsUpEnabled(true);
- // Initialize the database handler. The `0` specifies the database version, but that is ignored and set instead using a constant in `DomainsDatabaseHelper`.
- domainsDatabaseHelper = new DomainsDatabaseHelper(this, null, null, 0);
+ // Initialize the database handler.
+ domainsDatabaseHelper = new DomainsDatabaseHelper(this);
// Determine if we are in two pane mode. `domain_settings_fragment_container` does not exist on devices with a width less than 900dp.
twoPanedMode = (findViewById(R.id.domain_settings_fragment_container) != null);
// Enable the options delete menu item.
deleteMenuItem.setEnabled(true);
- // Get the current theme status.
- int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
-
- // Set the delete menu item icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- deleteMenuItem.setIcon(R.drawable.delete_night);
- } else {
- deleteMenuItem.setIcon(R.drawable.delete_day);
- }
+ // Set the delete menu item icon.
+ deleteMenuItem.setIcon(R.drawable.delete_enabled);
} else { // The device in in one-paned mode.
// Display the domain settings fragment.
fragmentManager.beginTransaction().replace(R.id.domains_listview_fragment_container, domainSettingsFragment).commit();
// Enable the delete menu item.
deleteMenuItem.setEnabled(true);
- // Get the current theme status.
- int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
-
- // Set the delete menu item icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- deleteMenuItem.setIcon(R.drawable.delete_night);
- } else {
- deleteMenuItem.setIcon(R.drawable.delete_day);
- }
+ // Set the delete menu item icon.
+ deleteMenuItem.setIcon(R.drawable.delete_enabled);
} else { // Single-paned mode.
// Show the delete menu item.
deleteMenuItem.setVisible(true);
SwitchCompat blockAllThirdPartyRequestsSwitch = view.findViewById(R.id.block_all_third_party_requests_switch);
Spinner userAgentSpinner = view.findViewById(R.id.user_agent_spinner);
EditText customUserAgentEditText = view.findViewById(R.id.custom_user_agent_edittext);
+ Spinner xRequestedWithHeaderSpinner = view.findViewById(R.id.x_requested_with_header_spinner);
Spinner fontSizeSpinner = view.findViewById(R.id.font_size_spinner);
EditText customFontSizeEditText = view.findViewById(R.id.custom_font_size_edittext);
Spinner swipeToRefreshSpinner = view.findViewById(R.id.swipe_to_refresh_spinner);
boolean ultraPrivacy = ultraPrivacySwitch.isChecked();
boolean blockAllThirdPartyRequests = blockAllThirdPartyRequestsSwitch.isChecked();
int userAgentSwitchPosition = userAgentSpinner.getSelectedItemPosition();
+ int xRequestedWithHeaderSwitchInt = xRequestedWithHeaderSpinner.getSelectedItemPosition();
int fontSizeSwitchPosition = fontSizeSpinner.getSelectedItemPosition();
int swipeToRefreshInt = swipeToRefreshSpinner.getSelectedItemPosition();
int webViewThemeInt = webViewThemeSpinner.getSelectedItemPosition();
// Save the domain settings.
domainsDatabaseHelper.updateDomain(DomainsActivity.currentDomainDatabaseId, domainNameString, javaScript, cookies, domStorage, formData, easyList, easyPrivacy,
- fanboysAnnoyance, fanboysSocialBlocking, ultraList, ultraPrivacy, blockAllThirdPartyRequests, userAgentName, fontSizeInt, swipeToRefreshInt, webViewThemeInt, wideViewportInt,
- displayWebpageImagesInt, pinnedSslCertificate, pinnedIpAddress);
+ fanboysAnnoyance, fanboysSocialBlocking, ultraList, ultraPrivacy, blockAllThirdPartyRequests, userAgentName, xRequestedWithHeaderSwitchInt, fontSizeInt, swipeToRefreshInt, webViewThemeInt,
+ wideViewportInt, displayWebpageImagesInt, pinnedSslCertificate, pinnedIpAddress);
// Update the pinned SSL certificate if a new one is checked.
if (currentWebsiteCertificateRadioButton.isChecked()) {
domainsCursor.moveToPosition(i);
// Get the database ID for this position.
- int currentDatabaseId = domainsCursor.getInt(domainsCursor.getColumnIndexOrThrow(DomainsDatabaseHelper._ID));
+ int currentDatabaseId = domainsCursor.getInt(domainsCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ID));
// Set `highlightedDomainPosition` if the database ID for this matches `highlightedDomainDatabaseId`.
if (highlightedDomainDatabaseId == currentDatabaseId) {
// Get the database ID for the highlighted domain.
domainsCursor.moveToPosition(highlightedDomainPosition);
- currentDomainDatabaseId = domainsCursor.getInt(domainsCursor.getColumnIndexOrThrow(DomainsDatabaseHelper._ID));
+ currentDomainDatabaseId = domainsCursor.getInt(domainsCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ID));
// Create an arguments bundle.
Bundle argumentsBundle = new Bundle();
// Enable the delete options menu items.
deleteMenuItem.setEnabled(true);
- // Get the current theme status.
- int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
-
- // Set the delete icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- deleteMenuItem.setIcon(R.drawable.delete_night);
- } else {
- deleteMenuItem.setIcon(R.drawable.delete_day);
- }
+ // Set the delete icon.
+ deleteMenuItem.setIcon(R.drawable.delete_enabled);
} else if (twoPanedMode) { // Two-paned mode is enabled but there are no domains.
// Disable the options `MenuItems`.
deleteMenuItem.setEnabled(false);