mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
Merge pull request #7226 from Bnyro/master
fix: current playlist doesn't close after deletion
This commit is contained in:
commit
83e121beb9
@ -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)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user