Skip to content

Commit 23b7f21

Browse files
committed
Fix crash on screen rotation while entering SoundCloud import URL
1 parent 7283701 commit 23b7f21

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@
1818
public class ImportConfirmationDialog extends DialogFragment {
1919
@State
2020
protected Intent resultServiceIntent;
21+
static final String EXTRA_RESULT_SERVICE_INTENT = "extra_result_service_intent";
2122

2223
public static void show(@NonNull final Fragment fragment,
2324
@NonNull final Intent resultServiceIntent) {
2425
final ImportConfirmationDialog confirmationDialog = new ImportConfirmationDialog();
25-
confirmationDialog.setResultServiceIntent(resultServiceIntent);
26+
final Bundle args = new Bundle();
27+
args.putParcelable(EXTRA_RESULT_SERVICE_INTENT, resultServiceIntent);
28+
confirmationDialog.setArguments(args);
2629
confirmationDialog.show(fragment.getParentFragmentManager(), null);
2730
}
2831

29-
public void setResultServiceIntent(final Intent resultServiceIntent) {
30-
this.resultServiceIntent = resultServiceIntent;
31-
}
32-
3332
@NonNull
3433
@Override
3534
public Dialog onCreateDialog(@Nullable final Bundle savedInstanceState) {
@@ -50,6 +49,10 @@ public Dialog onCreateDialog(@Nullable final Bundle savedInstanceState) {
5049
public void onCreate(@Nullable final Bundle savedInstanceState) {
5150
super.onCreate(savedInstanceState);
5251

52+
if (getArguments() != null) {
53+
resultServiceIntent = getArguments().getParcelable(EXTRA_RESULT_SERVICE_INTENT);
54+
}
55+
5356
if (resultServiceIntent == null) {
5457
throw new IllegalStateException("Result intent is null");
5558
}

0 commit comments

Comments
 (0)