Move back in navigation after deleting playlist

This commit is contained in:
Bnyro 2023-03-23 19:53:49 +01:00
parent f1da5d2151
commit d471cedd5d
2 changed files with 5 additions and 2 deletions

View File

@ -31,7 +31,7 @@ class PlaylistAdapter(
private val playlistType: PlaylistType private val playlistType: PlaylistType
) : RecyclerView.Adapter<PlaylistViewHolder>() { ) : RecyclerView.Adapter<PlaylistViewHolder>() {
var visibleCount = minOf(20, videoFeed.size) private var visibleCount = minOf(20, videoFeed.size)
override fun getItemCount(): Int { override fun getItemCount(): Int {
return when (playlistType) { return when (playlistType) {

View File

@ -9,6 +9,7 @@ import androidx.core.view.updatePadding
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -128,7 +129,9 @@ class PlaylistFragment : Fragment() {
// show playlist options // show playlist options
binding.optionsMenu.setOnClickListener { binding.optionsMenu.setOnClickListener {
PlaylistOptionsBottomSheet(playlistId!!, playlistName ?: "", playlistType).show( PlaylistOptionsBottomSheet(playlistId!!, playlistName.orEmpty(), playlistType) {
findNavController().popBackStack()
}.show(
childFragmentManager, childFragmentManager,
PlaylistOptionsBottomSheet::class.java.name PlaylistOptionsBottomSheet::class.java.name
) )