Merge pull request #7226 from Bnyro/master

fix: current playlist doesn't close after deletion
This commit is contained in:
Bnyro 2025-03-19 21:17:16 +01:00 committed by GitHub
commit 83e121beb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 9 deletions

View File

@ -41,11 +41,14 @@ class DeletePlaylistDialog : DialogFragment() {
context.toastFromMainDispatcher( context.toastFromMainDispatcher(
if (success) R.string.success else R.string.fail if (success) R.string.success else R.string.fail
) )
setFragmentResult( withContext(Dispatchers.Main) {
PlaylistOptionsBottomSheet.PLAYLIST_OPTIONS_REQUEST_KEY, dismiss()
bundleOf(IntentData.playlistTask to true)
) setFragmentResult(
withContext(Dispatchers.Main) { dismiss() } PlaylistOptionsBottomSheet.PLAYLIST_OPTIONS_REQUEST_KEY,
bundleOf(IntentData.playlistTask to true)
)
}
} }
} }
} }

View File

@ -186,9 +186,10 @@ class LibraryFragment : DynamicLayoutManagerFragment(R.layout.fragment_library)
val binding = _binding ?: return@repeatOnLifecycle val binding = _binding ?: return@repeatOnLifecycle
binding.playlistRefresh.isRefreshing = false binding.playlistRefresh.isRefreshing = false
if (playlists.isNotEmpty()) { // also update playlists recycler when the playlists are empty in order to remove
showPlaylists(playlists) // playlists that were removed by the user
} else { showPlaylists(playlists)
if (playlists.isEmpty()) {
binding.sortTV.isVisible = false binding.sortTV.isVisible = false
binding.nothingHere.isVisible = true binding.nothingHere.isVisible = true
} }

View File

@ -14,6 +14,7 @@ import androidx.core.view.isVisible
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
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.navigation.fragment.navArgs import androidx.navigation.fragment.navArgs
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -192,7 +193,7 @@ class PlaylistFragment : DynamicLayoutManagerFragment(R.layout.fragment_playlist
} }
if (isPlaylistToBeDeleted) { if (isPlaylistToBeDeleted) {
// TODO move back: navController().popBackStack() crashes findNavController().popBackStack()
return@setFragmentResultListener return@setFragmentResultListener
} }
} }