mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-21 18:42:35 +01:00
Add comment for fragment lifecycle checks before showing DownloadDialog
This commit is contained in:
parent
63bc982cb2
commit
1ed4928f40
@ -113,6 +113,8 @@ public enum StreamDialogDefaultEntry {
|
|||||||
DOWNLOAD(R.string.download, (fragment, item) ->
|
DOWNLOAD(R.string.download, (fragment, item) ->
|
||||||
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
|
||||||
|
// showing the dialog during lifecycle changes or when the activity is paused.
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user