diff --git a/app/src/main/java/com/github/libretube/CreatePlaylistDialog.kt b/app/src/main/java/com/github/libretube/CreatePlaylistDialog.kt index bfbfa70f2..722097b56 100644 --- a/app/src/main/java/com/github/libretube/CreatePlaylistDialog.kt +++ b/app/src/main/java/com/github/libretube/CreatePlaylistDialog.kt @@ -1,10 +1,11 @@ package com.github.libretube +import android.app.Dialog +import android.content.Context import android.os.Bundle +import android.util.Log import android.util.TypedValue -import android.view.LayoutInflater import android.view.View -import android.view.ViewGroup import android.widget.Button import android.widget.TextView import android.widget.Toast @@ -12,42 +13,81 @@ import androidx.core.os.bundleOf import androidx.core.text.HtmlCompat import androidx.fragment.app.DialogFragment import androidx.fragment.app.setFragmentResult +import androidx.lifecycle.lifecycleScope +import com.github.libretube.obj.Playlists +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.textfield.TextInputEditText +import java.io.IOException +import retrofit2.HttpException class CreatePlaylistDialog : DialogFragment() { - override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - var rootView: View = inflater.inflate(R.layout.dialog_create_playlist, container, false) + val TAG = "CreatePlaylistDialog" + private var token: String = "" - val typedValue = TypedValue() - this.requireActivity().theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true) - val hexColor = String.format("#%06X", (0xFFFFFF and typedValue.data)) - val appName = HtmlCompat.fromHtml( - "LibreTube", - HtmlCompat.FROM_HTML_MODE_COMPACT - ) - rootView.findViewById(R.id.title).text = appName + 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_create_playlist, null) - val cancelBtn = rootView.findViewById