]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt
Migrate the remaining classes to Kotlin. https://redmine.stoutner.com/issues/989
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / dialogs / ViewRequestDialog.kt
index 55e6bb585a31bd79a7f4dc8ea262cb2c9d5b39e6..8c9aed2f581c55b5a0adbc156b25a72fdda099a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018-2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2018-2023 Soren Stoutner <soren@stoutner.com>.
  *
  * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
  *
@@ -41,29 +41,7 @@ private const val IS_LAST_REQUEST = "is_last_request"
 private const val REQUEST_DETAILS = "request_details"
 
 class ViewRequestDialog : DialogFragment() {
-    // Define the class variables.
-    private lateinit var viewRequestListener: ViewRequestListener
-
-    // The public interface is used to send information back to the parent activity.
-    interface ViewRequestListener {
-        // Show the previous request.
-        fun onPrevious(currentId: Int)
-
-        // Show the next request.
-        fun onNext(currentId: Int)
-    }
-
-    override fun onAttach(context: Context) {
-        // Run the default commands.
-        super.onAttach(context)
-
-        // Get a handle for the listener from the launching context.
-        viewRequestListener = context as ViewRequestListener
-    }
-
     companion object {
-        // `@JvmStatic` will no longer be required once all the code has transitioned to Kotlin.
-        @JvmStatic
         fun request(id: Int, isLastRequest: Boolean, requestDetails: Array<String>): ViewRequestDialog {
             // Create a bundle.
             val bundle = Bundle()
@@ -84,6 +62,26 @@ class ViewRequestDialog : DialogFragment() {
         }
     }
 
+    // Define the class variables.
+    private lateinit var viewRequestListener: ViewRequestListener
+
+    // The public interface is used to send information back to the parent activity.
+    interface ViewRequestListener {
+        // Show the previous request.
+        fun onPrevious(currentId: Int)
+
+        // Show the next request.
+        fun onNext(currentId: Int)
+    }
+
+    override fun onAttach(context: Context) {
+        // Run the default commands.
+        super.onAttach(context)
+
+        // Get a handle for the listener from the launching context.
+        viewRequestListener = context as ViewRequestListener
+    }
+
     override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
         // Get the arguments from the bundle.
         val id = requireArguments().getInt(ID)