Skip to content

Commit 1ed4928

Browse files
committed
Add comment for fragment lifecycle checks before showing DownloadDialog
1 parent 63bc982 commit 1ed4928

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ public enum StreamDialogDefaultEntry {
113113
DOWNLOAD(R.string.download, (fragment, item) ->
114114
fetchStreamInfoAndSaveToDatabase(fragment.requireContext(), item.getServiceId(),
115115
item.getUrl(), info -> {
116+
// Ensure the fragment is attached and its state hasn't been saved to avoid
117+
// showing the dialog during lifecycle changes or when the activity is paused.
116118
if (fragment.isAdded() && !fragment.isStateSaved()) {
117119
final DownloadDialog downloadDialog =
118120
new DownloadDialog(fragment.requireContext(), info);

0 commit comments

Comments
 (0)