mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 11:02:35 +01:00
Fix crash when the user clicks download then quits the history fragment (#9143)
* Fix crash when the user clicks download then quits the history fragment * add a nonnull annotation to the context parameter in the DownloadDialog constructor. * Revert "Merge branch 'TeamNewPipe:dev' into fix/HistoryFragmentDownloadDialogCrash" This reverts commit968d7a7603
. * Revert "Merge branch 'TeamNewPipe:dev' into fix/HistoryFragmentDownloadDialogCrash" This reverts commit968d7a7603
, reversing changes made to52963ba37d
. Reverted merge jlhzxc * update project to the latest dev branch * Revert "update project to the latest dev branch" This reverts commitfb3ed83d51
. revert changes to build files * Revert "Revert "Merge branch 'TeamNewPipe:dev' into fix/HistoryFragmentDownloadDialogCrash"" This reverts commitf9e1835e71
.
This commit is contained in:
parent
16860603fd
commit
40815086ad
@ -159,7 +159,7 @@ public class DownloadDialog extends DialogFragment
|
|||||||
* @param context the context to use just to obtain preferences and strings (will not be stored)
|
* @param context the context to use just to obtain preferences and strings (will not be stored)
|
||||||
* @param info the info from which to obtain downloadable streams and other info (e.g. title)
|
* @param info the info from which to obtain downloadable streams and other info (e.g. title)
|
||||||
*/
|
*/
|
||||||
public DownloadDialog(final Context context, @NonNull final StreamInfo info) {
|
public DownloadDialog(@NonNull final Context context, @NonNull final StreamInfo info) {
|
||||||
this.currentInfo = info;
|
this.currentInfo = info;
|
||||||
|
|
||||||
// TODO: Adapt this code when the downloader support other types of stream deliveries
|
// TODO: Adapt this code when the downloader support other types of stream deliveries
|
||||||
|
@ -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 -> {
|
||||||
final DownloadDialog downloadDialog =
|
if (fragment.getContext() != null) {
|
||||||
new DownloadDialog(fragment.requireContext(), info);
|
final DownloadDialog downloadDialog =
|
||||||
downloadDialog.show(fragment.getChildFragmentManager(), "downloadDialog");
|
new DownloadDialog(fragment.requireContext(), info);
|
||||||
|
downloadDialog.show(fragment.getChildFragmentManager(),
|
||||||
|
"downloadDialog");
|
||||||
|
}
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user