From 23b7f21d7c6582fb82793f06cd94b371e6a1b38a Mon Sep 17 00:00:00 2001 From: Siddhesh Dhainje Date: Sun, 4 Jan 2026 01:06:18 +0530 Subject: [PATCH 1/3] Fix crash on screen rotation while entering SoundCloud import URL --- .../subscription/ImportConfirmationDialog.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java b/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java index 03dd4a1cd..aa15b26d8 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java @@ -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"); } From a3673f8c3b3152c5fdef7313693ef16654ea3931 Mon Sep 17 00:00:00 2001 From: Siddhesh Dhainje Date: Sun, 4 Jan 2026 21:40:40 +0530 Subject: [PATCH 2/3] Used requireArguments instead of getArguments --- .../local/subscription/ImportConfirmationDialog.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java b/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java index aa15b26d8..b586ad3e1 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java @@ -18,7 +18,7 @@ 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"; + private static final String EXTRA_RESULT_SERVICE_INTENT = "extra_result_service_intent"; public static void show(@NonNull final Fragment fragment, @NonNull final Intent resultServiceIntent) { @@ -49,13 +49,7 @@ 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"); - } + resultServiceIntent = requireArguments().getParcelable(EXTRA_RESULT_SERVICE_INTENT); Bridge.restoreInstanceState(this, savedInstanceState); } From 418e34172a8528437c9cd1c6097503dbb053b61f Mon Sep 17 00:00:00 2001 From: Siddhesh Dhainje Date: Thu, 8 Jan 2026 21:31:31 +0530 Subject: [PATCH 3/3] Removed restoreInstanceState and resultServiceIntent condition --- .../local/subscription/ImportConfirmationDialog.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java b/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java index b586ad3e1..0067e1154 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/ImportConfirmationDialog.java @@ -10,13 +10,11 @@ import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.Fragment; -import com.evernote.android.state.State; import com.livefront.bridge.Bridge; import org.schabi.newpipe.R; public class ImportConfirmationDialog extends DialogFragment { - @State protected Intent resultServiceIntent; private static final String EXTRA_RESULT_SERVICE_INTENT = "extra_result_service_intent"; @@ -37,9 +35,7 @@ public class ImportConfirmationDialog extends DialogFragment { .setCancelable(true) .setNegativeButton(R.string.cancel, null) .setPositiveButton(R.string.ok, (dialogInterface, i) -> { - if (resultServiceIntent != null && getContext() != null) { - getContext().startService(resultServiceIntent); - } + requireContext().startService(resultServiceIntent); dismiss(); }) .create(); @@ -50,8 +46,6 @@ public class ImportConfirmationDialog extends DialogFragment { super.onCreate(savedInstanceState); resultServiceIntent = requireArguments().getParcelable(EXTRA_RESULT_SERVICE_INTENT); - - Bridge.restoreInstanceState(this, savedInstanceState); } @Override