]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/EditBookmark.java
Remove the third-party cookies icon from the list of additional icons to display...
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / EditBookmark.java
index 8343ace2ff3818dd3afb149604de1698a45459b3..ed6cc85089c4d595833e535e4fe247950c94b3d9 100644 (file)
@@ -26,8 +26,6 @@ import android.content.DialogInterface;
 import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 // If we don't use `android.support.v7.app.AlertDialog` instead of `android.app.AlertDialog` then the dialog will be covered by the keyboard.
 import android.support.v7.app.AlertDialog;
@@ -40,8 +38,6 @@ import android.widget.ImageView;
 public class EditBookmark extends DialogFragment {
     // The public interface is used to send information back to the parent activity.
     public interface EditBookmarkListener {
-        void onCancelEditBookmark(DialogFragment dialogFragment);
-
         void onSaveEditBookmark(DialogFragment dialogFragment);
     }
 
@@ -79,8 +75,7 @@ public class EditBookmark extends DialogFragment {
         dialogBuilder.setNegativeButton(R.string.cancel, new Dialog.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
-                // Return the `DialogFragment` to the parent activity on cancel.
-                editBookmarkListener.onCancelEditBookmark(EditBookmark.this);
+                // Do nothing.  The `AlertDialog` will close automatically.
             }
         });
 
@@ -97,7 +92,7 @@ public class EditBookmark extends DialogFragment {
         // Create an `AlertDialog` from the `AlertDialog.Builder`.
         final AlertDialog alertDialog = dialogBuilder.create();
 
-        // Show the keyboard when the `Dialog` is displayed on the screen.
+        // Show the keyboard when `alertDialog` is displayed on the screen.
         alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
 
         // We need to show the `AlertDialog` before we can modify items in the layout.
@@ -124,10 +119,11 @@ public class EditBookmark extends DialogFragment {
 
         // Allow the `enter` key on the keyboard to save the bookmark from `edit_bookmark_name_edittext`.
         bookmarkNameEditText.setOnKeyListener(new View.OnKeyListener() {
+            @Override
             public boolean onKey(View v, int keyCode, KeyEvent event) {
-                // If the event is a key-down on the "enter" button, select the PositiveButton `Save`.
+                // If the event is an `ACTION_DOWN` on the `enter` key, save the bookmark.
                 if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
-                    // Trigger `editBookmarkListener` and return the DialogFragment to the parent activity.
+                    // Trigger `onSaveEditBookmark()` and return the `DialogFragment` to the parent activity.
                     editBookmarkListener.onSaveEditBookmark(EditBookmark.this);
                     // Manually dismiss `alertDialog`.
                     alertDialog.dismiss();