Use correct fragment manager for download dialog

Tapping download on the long-press menu of queue items when the queue is shown inside the player would crash otherwise
This commit is contained in:
Stypox 2022-12-31 19:31:24 +01:00
parent 0923594e51
commit b3bfec9505
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 3 additions and 5 deletions

View File

@ -8,7 +8,6 @@ import android.view.ContextThemeWrapper;
import android.view.View; import android.view.View;
import android.widget.PopupMenu; import android.widget.PopupMenu;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import org.schabi.newpipe.database.stream.model.StreamEntity; import org.schabi.newpipe.database.stream.model.StreamEntity;
@ -79,12 +78,11 @@ public final class QueueItemMenuUtil {
item.getThumbnailUrl()); item.getThumbnailUrl());
return true; return true;
case R.id.menu_item_download: case R.id.menu_item_download:
fetchStreamInfoAndSaveToDatabase(context, item.getServiceId(), fetchStreamInfoAndSaveToDatabase(context, item.getServiceId(), item.getUrl(),
item.getUrl(), info -> { info -> {
final DownloadDialog downloadDialog = new DownloadDialog(context, final DownloadDialog downloadDialog = new DownloadDialog(context,
info); info);
downloadDialog.show(((AppCompatActivity) context) downloadDialog.show(fragmentManager, "downloadDialog");
.getSupportFragmentManager(), "downloadDialog");
}); });
return true; return true;
} }