package com.github.libretube.dialogs import android.app.Dialog import android.os.Bundle import android.util.TypedValue import android.view.View import android.widget.Button import android.widget.TextView import android.widget.Toast import androidx.core.text.HtmlCompat import androidx.fragment.app.DialogFragment import com.github.libretube.R import com.github.libretube.obj.CustomInstance import com.github.libretube.util.PreferenceHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.textfield.TextInputEditText import java.net.URL class CustomInstanceDialog : DialogFragment() { val TAG = "CustomInstanceDialog" override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { return activity?.let { val builder = MaterialAlertDialogBuilder(it) val inflater = requireActivity().layoutInflater val view: View = inflater.inflate(R.layout.dialog_custom_instance, null) val instanceNameEditText = view.findViewById(R.id.instanceName) val instanceApiUrlEditText = view.findViewById(R.id.instanceApiUrl) val instanceFrontendUrlEditText = view .findViewById(R.id.instanceFrontendUrl) val addInstanceButton = view.findViewById