import android.app.Dialog
import android.content.Context
import android.content.DialogInterface
import android.app.Dialog
import android.content.Context
import android.content.DialogInterface
import com.stoutner.privacybrowser.R
import com.stoutner.privacybrowser.helpers.DomainsDatabaseHelper
import com.stoutner.privacybrowser.R
import com.stoutner.privacybrowser.helpers.DomainsDatabaseHelper
// The public interface is used to send information back to the parent activity.
interface AddDomainListener {
fun onAddDomain(dialogFragment: DialogFragment)
}
// The public interface is used to send information back to the parent activity.
interface AddDomainListener {
fun onAddDomain(dialogFragment: DialogFragment)
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
// Get the arguments.
val arguments = requireArguments()
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
// Get the arguments.
val arguments = requireArguments()
val urlString = arguments.getString(URL_STRING)
// Use an alert dialog builder to create the alert dialog.
val urlString = arguments.getString(URL_STRING)
// Use an alert dialog builder to create the alert dialog.
dialogBuilder.setPositiveButton(R.string.add) { _: DialogInterface, _: Int ->
// Return the dialog fragment to the parent activity on add.
addDomainListener.onAddDomain(this)
dialogBuilder.setPositiveButton(R.string.add) { _: DialogInterface, _: Int ->
// Return the dialog fragment to the parent activity on add.
addDomainListener.onAddDomain(this)