X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FCreateBookmarkDialog.kt;h=0b1dea00386ccc572f98b4071e26205a55616750;hp=5bc2da25c4a01896b861a64184333826fb84481a;hb=6bc00e202749ba0cb337be462825002ba74be8fc;hpb=9df712df3780161d77d10c6f3a2444bf8f218c99 diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.kt index 5bc2da25..0b1dea00 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.kt @@ -94,7 +94,7 @@ class CreateBookmarkDialog: DialogFragment() { @SuppressLint("InflateParams") override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { // Get the arguments. - val arguments = arguments!! + val arguments = requireArguments() // Get the contents of the arguments. val urlString = arguments.getString("url_string") @@ -128,7 +128,7 @@ class CreateBookmarkDialog: DialogFragment() { dialogBuilder.setIcon(favoriteIconDrawable) // Set the view. The parent view is `null` because it will be assigned by the alert dialog. - dialogBuilder.setView(activity!!.layoutInflater.inflate(R.layout.create_bookmark_dialog, null)) + dialogBuilder.setView(requireActivity().layoutInflater.inflate(R.layout.create_bookmark_dialog, null)) // Set a listener on the cancel button. Using `null` as the listener closes the dialog without doing anything else. dialogBuilder.setNegativeButton(R.string.cancel, null) @@ -151,8 +151,8 @@ class CreateBookmarkDialog: DialogFragment() { alertDialog.show() // Get a handle for the edit texts. - val createBookmarkNameEditText: EditText = alertDialog.findViewById(R.id.create_bookmark_name_edittext) - val createBookmarkUrlEditText: EditText = alertDialog.findViewById(R.id.create_bookmark_url_edittext) + val createBookmarkNameEditText = alertDialog.findViewById(R.id.create_bookmark_name_edittext) + val createBookmarkUrlEditText = alertDialog.findViewById(R.id.create_bookmark_url_edittext) // Set the initial texts for the edit texts. createBookmarkNameEditText.setText(titleString)