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.
// Run the default commands.
super.onAttach(context);
- // Get a handle for the dismiss snackbar interface.
+ // Populate the dismiss snackbar interface.
dismissSnackbarInterface = (DismissSnackbarInterface) context;
}
// 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.
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) {
// 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);
}
});
+ // Return the domains list fragment.
return domainsListFragmentView;
}
}
\ No newline at end of file