X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Ffragments%2FDomainsListFragment.java;h=92d4b885eaa2d123883cca94058e612f616cb4cb;hp=2aa974b9f2a9576d6b037ad6e17986495da51a84;hb=1b27ac6f2b7c046945fc97e2aff9adbde8a152ce;hpb=74655c0cd0ba72c80ac6c48df55bc3d2f5280ad2 diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java index 2aa974b9..92d4b885 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java @@ -1,26 +1,25 @@ /* - * Copyright © 2017-2020 Soren Stoutner . + * Copyright © 2017-2020,2022 Soren Stoutner . * - * This file is part of Privacy Browser . + * This file is part of Privacy Browser Android . * - * Privacy Browser is free software: you can redistribute it and/or modify + * Privacy Browser Android is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * Privacy Browser is distributed in the hope that it will be useful, + * Privacy Browser Android is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Privacy Browser. If not, see . + * along with Privacy Browser Android. If not, see . */ package com.stoutner.privacybrowser.fragments; import android.content.Context; -import android.content.res.Configuration; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -38,7 +37,7 @@ import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.activities.DomainsActivity; public class DomainsListFragment extends Fragment { - // Instantiate the dismiss snackbar interface handle. + // Instantiate the dismiss snackbar interface. private DismissSnackbarInterface dismissSnackbarInterface; // Define the public dismiss snackbar interface. @@ -50,7 +49,7 @@ public class DomainsListFragment extends Fragment { // Run the default commands. super.onAttach(context); - // Get a handle for the dismiss snackbar interface. + // Populate the dismiss snackbar interface. dismissSnackbarInterface = (DismissSnackbarInterface) context; } @@ -58,7 +57,7 @@ public class DomainsListFragment extends Fragment { // Inflate `domains_list_fragment`. `false` does not attach it to the root `container`. View domainsListFragmentView = inflater.inflate(R.layout.domains_list_fragment, container, false); - // Initialize `domainsListView`. + // Get a handle for the domains listview. ListView domainsListView = domainsListFragmentView.findViewById(R.id.domains_listview); // Remove the incorrect lint error below that `.getSupportFragmentManager()` might be null. @@ -103,27 +102,23 @@ public class DomainsListFragment extends Fragment { DomainSettingsFragment domainSettingsFragment = new DomainSettingsFragment(); domainSettingsFragment.setArguments(argumentsBundle); - // Display the domain settings fragment. + // Check to see if the device is in two paned mode. if (DomainsActivity.twoPanedMode) { // The device in in two-paned mode. // enable `deleteMenuItem` if the system is not waiting for a `Snackbar` to be dismissed. if (!DomainsActivity.dismissingSnackbar) { // Enable the delete menu item. DomainsActivity.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) { - DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_night); - } else { - DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_day); - } + // Set the delete icon. + DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_enabled); } // Display the domain settings fragment. supportFragmentManager.beginTransaction().replace(R.id.domain_settings_fragment_container, domainSettingsFragment).commit(); } else { // The device in in single-paned mode + // Save the domains listview position. + DomainsActivity.domainsListViewPosition = domainsListView.getFirstVisiblePosition(); + // Show `deleteMenuItem` if the system is not waiting for a `Snackbar` to be dismissed. if (!DomainsActivity.dismissingSnackbar) { DomainsActivity.deleteMenuItem.setVisible(true); @@ -138,6 +133,7 @@ public class DomainsListFragment extends Fragment { } }); + // Return the domains list fragment. return domainsListFragmentView; } } \ No newline at end of file