diff --git a/app/src/main/java/com/github/libretube/CreatePlaylistDialog.kt b/app/src/main/java/com/github/libretube/CreatePlaylistDialog.kt
index c5704aa9c..722097b56 100644
--- a/app/src/main/java/com/github/libretube/CreatePlaylistDialog.kt
+++ b/app/src/main/java/com/github/libretube/CreatePlaylistDialog.kt
@@ -1,12 +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
@@ -16,50 +15,52 @@ 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 retrofit2.HttpException
import java.io.IOException
+import retrofit2.HttpException
class CreatePlaylistDialog : DialogFragment() {
val TAG = "CreatePlaylistDialog"
private var token: String = ""
- override fun onCreateView(
- inflater: LayoutInflater,
- container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View? {
- var rootView: View = inflater.inflate(R.layout.dialog_create_playlist, container, false)
+ 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 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
+ 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
+ )
+ view.findViewById(R.id.title).text = appName
- val cancelBtn = rootView.findViewById