Fix crash when the user clicks download then quits the history fragment
This commit is contained in:
parent
02deaa0f1a
commit
10e18ec9ea
|
@ -112,12 +112,19 @@ public enum StreamDialogDefaultEntry {
|
||||||
ShareUtils.shareText(fragment.requireContext(), item.getName(), item.getUrl(),
|
ShareUtils.shareText(fragment.requireContext(), item.getName(), item.getUrl(),
|
||||||
item.getThumbnailUrl())),
|
item.getThumbnailUrl())),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens a {@link DownloadDialog} after fetching some stream info.
|
||||||
|
* If the user quits the current fragment, it will not open a DownloadDialog.
|
||||||
|
*/
|
||||||
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 -> {
|
||||||
|
if (fragment.getContext() != null) {
|
||||||
final DownloadDialog downloadDialog =
|
final DownloadDialog downloadDialog =
|
||||||
new DownloadDialog(fragment.requireContext(), info);
|
new DownloadDialog(fragment.requireContext(), info);
|
||||||
downloadDialog.show(fragment.getChildFragmentManager(), "downloadDialog");
|
downloadDialog.show(fragment.getChildFragmentManager(),
|
||||||
|
"downloadDialog");
|
||||||
|
}
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue