- switch (menuItemId) {
- case android.R.id.home: // The home arrow is identified as `android.R.id.home`, not just `R.id.home`.
- if (twoPanedMode) { // The device is in two-paned mode.
- // Save the current domain settings if the domain settings fragment is displayed.
- if (findViewById(R.id.domain_settings_scrollview) != null) {
- saveDomainSettings(coordinatorLayout, resources);
- }
-
- // Dismiss the undo delete `SnackBar` if it is shown.
- if (undoDeleteSnackbar != null && undoDeleteSnackbar.isShown()) {
- // Set the close flag.
- closeActivityAfterDismissingSnackbar = true;
-
- // Dismiss the snackbar.
- undoDeleteSnackbar.dismiss();
- } else {
- // Go home.
- NavUtils.navigateUpFromSameTask(this);
- }
- } else if (closeOnBack) { // Go directly back to the main WebView activity because the domains activity was launched from the options menu.
- // Save the current domain settings.
+ // Run the command according to the selected menu item.
+ if (menuItemId == android.R.id.home) { // The home arrow is identified as `android.R.id.home`, not just `R.id.home`.
+ // Check if the device is in two-paned mode.
+ if (twoPanedMode) { // The device is in two-paned mode.
+ // Save the current domain settings if the domain settings fragment is displayed.
+ if (findViewById(R.id.domain_settings_scrollview) != null) {