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);
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);