import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.FragmentManager;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.fragment.app.FragmentManager;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.stoutner.privacybrowser.activities.DomainsActivity;
public class DomainsListFragment extends Fragment {
import com.stoutner.privacybrowser.activities.DomainsActivity;
public class DomainsListFragment extends Fragment {
private DismissSnackbarInterface dismissSnackbarInterface;
// Define the public dismiss snackbar interface.
private DismissSnackbarInterface dismissSnackbarInterface;
// Define the public dismiss snackbar interface.
// Inflate `domains_list_fragment`. `false` does not attach it to the root `container`.
View domainsListFragmentView = inflater.inflate(R.layout.domains_list_fragment, container, false);
// Inflate `domains_list_fragment`. `false` does not attach it to the root `container`.
View domainsListFragmentView = inflater.inflate(R.layout.domains_list_fragment, container, false);
ListView domainsListView = domainsListFragmentView.findViewById(R.id.domains_listview);
// Remove the incorrect lint error below that `.getSupportFragmentManager()` might be null.
ListView domainsListView = domainsListFragmentView.findViewById(R.id.domains_listview);
// Remove the incorrect lint error below that `.getSupportFragmentManager()` might be null.
// Get a handle for the domain settings fragment.
Fragment domainSettingsFragment = supportFragmentManager.findFragmentById(R.id.domain_settings_fragment_container);
// Get a handle for the domain settings fragment.
Fragment domainSettingsFragment = supportFragmentManager.findFragmentById(R.id.domain_settings_fragment_container);
assert domainSettingsFragment != null;
// Get a handle for the domain settings fragment view.
View domainSettingsFragmentView = domainSettingsFragment.getView();
assert domainSettingsFragment != null;
// Get a handle for the domain settings fragment view.
View domainSettingsFragmentView = domainSettingsFragment.getView();
DomainSettingsFragment domainSettingsFragment = new DomainSettingsFragment();
domainSettingsFragment.setArguments(argumentsBundle);
DomainSettingsFragment domainSettingsFragment = new DomainSettingsFragment();
domainSettingsFragment.setArguments(argumentsBundle);
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);
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 a handle for the shared preferences.
- SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
-
- // Get the theme preferences.
- boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+ // Get the current theme status.
+ int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
}
}
// Display the domain settings fragment.
supportFragmentManager.beginTransaction().replace(R.id.domain_settings_fragment_container, domainSettingsFragment).commit();
} else { // The device in in single-paned mode
}
}
// Display the domain settings fragment.
supportFragmentManager.beginTransaction().replace(R.id.domain_settings_fragment_container, domainSettingsFragment).commit();
} else { // The device in in single-paned mode
// Show `deleteMenuItem` if the system is not waiting for a `Snackbar` to be dismissed.
if (!DomainsActivity.dismissingSnackbar) {
DomainsActivity.deleteMenuItem.setVisible(true);
// Show `deleteMenuItem` if the system is not waiting for a `Snackbar` to be dismissed.
if (!DomainsActivity.dismissingSnackbar) {
DomainsActivity.deleteMenuItem.setVisible(true);