]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java
Add a requests activity. https://redmine.stoutner.com/issues/170
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / dialogs / MoveToFolderDialog.java
index 2dfda3612f4fbaff245cd1888c1a8b267d9f6be2..2bbd4e6674cbe2f9397aa8e70fe0c2b5d9a8d52f 100644 (file)
@@ -55,7 +55,8 @@ import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
 import java.io.ByteArrayOutputStream;
 
 public class MoveToFolderDialog extends AppCompatDialogFragment {
-    // Instantiate class variables.
+    // Instantiate the class variables.
+    private MoveToFolderListener moveToFolderListener;
     private BookmarksDatabaseHelper bookmarksDatabaseHelper;
     private StringBuilder exceptFolders;
 
@@ -64,18 +65,12 @@ public class MoveToFolderDialog extends AppCompatDialogFragment {
         void onMoveToFolder(AppCompatDialogFragment dialogFragment);
     }
 
-    // `moveToFolderListener` is used in `onAttach()` and `onCreateDialog`.
-    private MoveToFolderListener moveToFolderListener;
-
     public void onAttach(Context context) {
+        // Run the default commands.
         super.onAttach(context);
 
-        // Get a handle for `MoveToFolderListener` from `parentActivity`.
-        try {
-            moveToFolderListener = (MoveToFolderListener) context;
-        } catch(ClassCastException exception) {
-            throw new ClassCastException(context.toString() + " must implement EditBookmarkFolderListener.");
-        }
+        // Get a handle for `MoveToFolderListener` from the launching context.
+        moveToFolderListener = (MoveToFolderListener) context;
     }
 
     // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`.