+ // Hide the delete menu item.
+ deleteMenuItem.setVisible(false);
+ } else { // The device is in single-paned mode and domains list fragment is displayed.
+ // 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 (menuItemId == R.id.delete_domain) { // Delete.
+ // Get a handle for the activity.
+ Activity activity = this;
+
+ // Check to see if the domain settings were loaded directly for editing of this app in single-paned mode.
+ if (closeOnBack && !twoPanedMode) { // The activity should delete the domain settings and exit straight to the the main WebView activity.
+ // Delete the selected domain.
+ domainsDatabaseHelper.deleteDomain(currentDomainDatabaseId);
+
+ // Go home.
+ NavUtils.navigateUpFromSameTask(activity);
+ } else { // A snackbar should be shown before deleting the domain settings.