]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.java
Add a requests activity. https://redmine.stoutner.com/issues/170
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / dialogs / EditBookmarkDatabaseViewDialog.java
index 028db1b79c7c538cd4bc3b16ce88cfc170fe2f7b..e24c893bd5c4877818f2109fe6aafcf3b384e72f 100644 (file)
@@ -58,7 +58,6 @@ public class EditBookmarkDatabaseViewDialog extends AppCompatDialogFragment {
 
     // Instantiate the class variables.
     private EditBookmarkDatabaseViewListener editBookmarkDatabaseViewListener;
 
     // Instantiate the class variables.
     private EditBookmarkDatabaseViewListener editBookmarkDatabaseViewListener;
-    private int bookmarkDatabaseId;
     private String currentBookmarkName;
     private String currentUrl;
     private int currentFolderDatabaseId;
     private String currentBookmarkName;
     private String currentUrl;
     private int currentFolderDatabaseId;
@@ -80,12 +79,9 @@ public class EditBookmarkDatabaseViewDialog extends AppCompatDialogFragment {
         // Run the default commands.
         super.onAttach(context);
 
         // Run the default commands.
         super.onAttach(context);
 
-        // Get a handle for `EditBookmarkDatabaseViewListener` from `context`.
-        try {
-            editBookmarkDatabaseViewListener = (EditBookmarkDatabaseViewListener) context;
-        } catch(ClassCastException exception) {
-            throw new ClassCastException(context.toString() + " must implement EditBookmarkDatabaseViewListener.");
-        }
+        // Get a handle for `EditBookmarkDatabaseViewListener` from the launching context.
+
+        editBookmarkDatabaseViewListener = (EditBookmarkDatabaseViewListener) context;
     }
 
     // Store the database ID in the arguments bundle.
     }
 
     // Store the database ID in the arguments bundle.
@@ -104,24 +100,18 @@ public class EditBookmarkDatabaseViewDialog extends AppCompatDialogFragment {
         return editBookmarkDatabaseViewDialog;
     }
 
         return editBookmarkDatabaseViewDialog;
     }
 
+        // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`.
+    @SuppressLint("InflateParams")
     @Override
     @Override
-    public void onCreate(Bundle savedInstanceState) {
-        // Run the default commands.
-        super.onCreate(savedInstanceState);
-
+    @NonNull
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
         // Remove the incorrect lint warning below that `getInt()` might be null.
         assert getArguments() != null;
 
         // Remove the incorrect lint warning below that `getInt()` might be null.
         assert getArguments() != null;
 
-        // Store the bookmark database ID in the class variable.
-        bookmarkDatabaseId = getArguments().getInt("Database ID");
-    }
+        // Get the bookmark database ID from the bundle.
+        int bookmarkDatabaseId = getArguments().getInt("Database ID");
 
 
-    // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`.
-    @SuppressLint("InflateParams")
-    @Override
-    @NonNull
-    public Dialog onCreateDialog(Bundle savedInstanceState) {
-        // Initialize the database helper.  The two `nulls` do not specify the database name or a `CursorFactory`.  The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`.
+        // Initialize the database helper.  The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`.
         BookmarksDatabaseHelper bookmarksDatabaseHelper = new BookmarksDatabaseHelper(getContext(), null, null, 0);
 
         // Get a cursor with the selected bookmark and move it to the first position.
         BookmarksDatabaseHelper bookmarksDatabaseHelper = new BookmarksDatabaseHelper(getContext(), null, null, 0);
 
         // Get a cursor with the selected bookmark and move it to the first position.