X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FSaveDialog.kt;fp=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FSaveDialog.kt;h=12a1d44050bacb45dfb1332a05c5d69867c408e0;hp=2f7868e93817fad2e92c15f8114ac2584b007307;hb=dc36dea65a4eb37496fb1ecbbd9f8e1906f50216;hpb=12042264a50769030361cf51b0ac197050209f0f diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveDialog.kt index 2f7868e9..12a1d440 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Soren Stoutner . + * Copyright 2019-2023 Soren Stoutner . * * This file is part of Privacy Browser Android . * @@ -42,7 +42,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -// Define the class constants. +// Define the private class constants. private const val URL_STRING = "url_string" private const val FILE_SIZE_STRING = "file_size_string" private const val FILE_NAME_STRING = "file_name_string" @@ -50,25 +50,7 @@ private const val USER_AGENT_STRING = "user_agent_string" private const val COOKIES_ENABLED = "cookies_enabled" class SaveDialog : DialogFragment() { - // Declare the class variables. - private lateinit var saveListener: SaveListener - - // The public interface is used to send information back to the parent activity. - interface SaveListener { - fun onSaveUrl(originalUrlString: String, fileNameString: String, dialogFragment: DialogFragment) - } - - override fun onAttach(context: Context) { - // Run the default commands. - super.onAttach(context) - - // Get a handle for the save webpage listener from the launching context. - saveListener = context as SaveListener - } - companion object { - // `@JvmStatic` will no longer be required once all the code has transitioned to Kotlin. - @JvmStatic fun saveUrl(urlString: String, fileNameString: String, fileSizeString: String, userAgentString: String, cookiesEnabled: Boolean): SaveDialog { // Create an arguments bundle. val argumentsBundle = Bundle() @@ -91,6 +73,22 @@ class SaveDialog : DialogFragment() { } } + // Declare the class variables. + private lateinit var saveListener: SaveListener + + // The public interface is used to send information back to the parent activity. + interface SaveListener { + fun onSaveUrl(originalUrlString: String, fileNameString: String, dialogFragment: DialogFragment) + } + + override fun onAttach(context: Context) { + // Run the default commands. + super.onAttach(context) + + // Get a handle for the save webpage listener from the launching context. + saveListener = context as SaveListener + } + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { // Get the arguments from the bundle. val originalUrlString = requireArguments().getString(URL_STRING)!!