package com.github.libretube import android.app.Dialog import android.os.Bundle import android.widget.ArrayAdapter import androidx.fragment.app.DialogFragment import com.google.android.material.dialog.MaterialAlertDialogBuilder class VideoOptionsDialog : DialogFragment() { /** * List that stores the different menu options. */ private val list = arrayListOf("Background mode") override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { return MaterialAlertDialogBuilder(requireContext()) .setAdapter( ArrayAdapter( requireContext(), R.layout.video_options_dialog_item, list ) ) { _, which -> // For now, this checks the position of the option with the position that is in the // list. I don't like it, but we will do like this for now. when (which) { // This for example will be the "Background mode" option 1 -> { TODO("Implement the background mode option") } else -> { this.dismiss() } } } .show() } companion object { const val TAG = "VideoOptionsDialog" } }