Update app/src/main/java/org/schabi/newpipe/info_list/dialog/StreamDialogDefaultEntry.java

This commit is contained in:
Tobi 2024-10-27 09:41:45 +01:00 committed by GitHub
parent 0190bcee25
commit f4baf4628e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -114,7 +114,8 @@ public enum StreamDialogDefaultEntry {
fetchStreamInfoAndSaveToDatabase(fragment.requireContext(), item.getServiceId(), fetchStreamInfoAndSaveToDatabase(fragment.requireContext(), item.getServiceId(),
item.getUrl(), info -> { item.getUrl(), info -> {
// Ensure the fragment is attached and its state hasn't been saved to avoid // Ensure the fragment is attached and its state hasn't been saved to avoid
// showing dialog during lifecycle changes or when the activity is paused. // showing dialog during lifecycle changes or when the activity is paused,
// e.g. by selecting the download option and opening a different fragment.
if (fragment.isAdded() && !fragment.isStateSaved()) { if (fragment.isAdded() && !fragment.isStateSaved()) {
final DownloadDialog downloadDialog = final DownloadDialog downloadDialog =
new DownloadDialog(fragment.requireContext(), info); new DownloadDialog(fragment.requireContext(), info);