diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 77b0584070..24d19ccbbb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -79,6 +79,22 @@ + + + + + + + + + + finish() } + + AddToPlaylistDialog().apply { + arguments = bundleOf(IntentData.videoId to videoId) + }.show(supportFragmentManager, null) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt index 90f237f50b..23473db1e1 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt @@ -6,8 +6,10 @@ import android.content.DialogInterface import android.os.Bundle import android.util.Log import android.widget.Toast +import androidx.core.os.bundleOf import androidx.fragment.app.DialogFragment import androidx.fragment.app.activityViewModels +import androidx.fragment.app.setFragmentResult import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle @@ -133,4 +135,14 @@ class AddToPlaylistDialog : DialogFragment() { appContext.toastFromMainDispatcher(R.string.fail) } } + + override fun onDismiss(dialog: DialogInterface) { + super.onDismiss(dialog) + + setFragmentResult(ADD_TO_PLAYLIST_DIALOG_DISMISSED_KEY, bundleOf()) + } + + companion object { + const val ADD_TO_PLAYLIST_DIALOG_DISMISSED_KEY = "add_to_playlist_dialog_dismissed" + } }