Fix crash on screen rotation while entering SoundCloud import URL

(cherry picked from commit 23b7f21d7c6582fb82793f06cd94b371e6a1b38a)
This commit is contained in:
Siddhesh Dhainje 2026-01-04 01:06:18 +05:30 committed by Tobi
parent dc5c5b6604
commit d5d92e8340

View File

@ -18,18 +18,17 @@ import org.schabi.newpipe.R;
public class ImportConfirmationDialog extends DialogFragment {
@State
protected Intent resultServiceIntent;
static final String EXTRA_RESULT_SERVICE_INTENT = "extra_result_service_intent";
public static void show(@NonNull final Fragment fragment,
@NonNull final Intent resultServiceIntent) {
final ImportConfirmationDialog confirmationDialog = new ImportConfirmationDialog();
confirmationDialog.setResultServiceIntent(resultServiceIntent);
final Bundle args = new Bundle();
args.putParcelable(EXTRA_RESULT_SERVICE_INTENT, resultServiceIntent);
confirmationDialog.setArguments(args);
confirmationDialog.show(fragment.getParentFragmentManager(), null);
}
public void setResultServiceIntent(final Intent resultServiceIntent) {
this.resultServiceIntent = resultServiceIntent;
}
@NonNull
@Override
public Dialog onCreateDialog(@Nullable final Bundle savedInstanceState) {
@ -50,6 +49,10 @@ public class ImportConfirmationDialog extends DialogFragment {
public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
resultServiceIntent = getArguments().getParcelable(EXTRA_RESULT_SERVICE_INTENT);
}
if (resultServiceIntent == null) {
throw new IllegalStateException("Result intent is null");
}