]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.java
Add a requests activity. https://redmine.stoutner.com/issues/170
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / dialogs / CreateHomeScreenShortcutDialog.java
index f3321280af116a013d0c29d1f403b7e8c253bdda..ca8d72bd115efe43ad2605ecf6ab87aab74782a0 100644 (file)
@@ -50,12 +50,11 @@ public class CreateHomeScreenShortcutDialog extends AppCompatDialogFragment {
 
     // Check to make sure that the parent activity implements the listener.
     public void onAttach(Context context) {
+        // Run the default commands.
         super.onAttach(context);
-        try {
-            createHomeScreenShortcutListener = (CreateHomeScreenShortcutListener) context;
-        } catch(ClassCastException exception) {
-            throw new ClassCastException(context.toString() + " must implement CreateHomeScreenShortcutListener.");
-        }
+
+        // Get a handle for `CreateHomeScreenShortcutListener` from the launching context.
+        createHomeScreenShortcutListener = (CreateHomeScreenShortcutListener) context;
     }
 
     // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`.