X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FDomainsActivity.java;h=b9a4fb7d3271f3e8299bb1957624e4558ffca3c5;hb=38919c77d15eeacbee96ab337afc62b30ddc74ca;hp=9de4fb8e97a89883a4ff96f2281d38b8c3878ddc;hpb=8142ac5fc2489de735de4b6fa21a1eae733ccfce;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java index 9de4fb8e..b9a4fb7d 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java @@ -23,7 +23,6 @@ import android.app.Activity; 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; @@ -203,8 +202,8 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo // 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); @@ -529,15 +528,8 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo // 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(); @@ -564,15 +556,8 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo // 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); @@ -891,7 +876,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo 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) { @@ -904,7 +889,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo // 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(); @@ -925,15 +910,8 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo // 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);