Fix crash on screen rotation while entering SoundCloud import URL
(cherry picked from commit bf2916206c)
This commit is contained in:
parent
f4e140e090
commit
4f62904a03
1 changed files with 8 additions and 5 deletions
|
|
@ -18,18 +18,17 @@ import org.schabi.newpipe.R;
|
||||||
public class ImportConfirmationDialog extends DialogFragment {
|
public class ImportConfirmationDialog extends DialogFragment {
|
||||||
@State
|
@State
|
||||||
protected Intent resultServiceIntent;
|
protected Intent resultServiceIntent;
|
||||||
|
static final String EXTRA_RESULT_SERVICE_INTENT = "extra_result_service_intent";
|
||||||
|
|
||||||
public static void show(@NonNull final Fragment fragment,
|
public static void show(@NonNull final Fragment fragment,
|
||||||
@NonNull final Intent resultServiceIntent) {
|
@NonNull final Intent resultServiceIntent) {
|
||||||
final ImportConfirmationDialog confirmationDialog = new ImportConfirmationDialog();
|
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);
|
confirmationDialog.show(fragment.getParentFragmentManager(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResultServiceIntent(final Intent resultServiceIntent) {
|
|
||||||
this.resultServiceIntent = resultServiceIntent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(@Nullable final Bundle savedInstanceState) {
|
public Dialog onCreateDialog(@Nullable final Bundle savedInstanceState) {
|
||||||
|
|
@ -50,6 +49,10 @@ public class ImportConfirmationDialog extends DialogFragment {
|
||||||
public void onCreate(@Nullable final Bundle savedInstanceState) {
|
public void onCreate(@Nullable final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
if (getArguments() != null) {
|
||||||
|
resultServiceIntent = getArguments().getParcelable(EXTRA_RESULT_SERVICE_INTENT);
|
||||||
|
}
|
||||||
|
|
||||||
if (resultServiceIntent == null) {
|
if (resultServiceIntent == null) {
|
||||||
throw new IllegalStateException("Result intent is null");
|
throw new IllegalStateException("Result intent is null");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue