Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57d8d38a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Merge existing bundle with ActivityOptions" into sc-dev

parents 72c3debb 377410de
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -148,10 +148,14 @@ public class SettingsBaseActivity extends FragmentActivity {

    @Override
    public void startActivity(Intent intent, @androidx.annotation.Nullable Bundle options) {
        if (!Utils.isPageTransitionEnabled(this) || options != null) {
        if (!Utils.isPageTransitionEnabled(this)) {
            super.startActivity(intent, options);
            return;
        }
        if (options != null) {
            super.startActivity(intent, getMergedBundleForTransition(options));
            return;
        }
        super.startActivity(intent, getActivityOptionsBundle());
    }

@@ -169,11 +173,15 @@ public class SettingsBaseActivity extends FragmentActivity {
    @Override
    public void startActivityForResult(Intent intent, int requestCode,
            @androidx.annotation.Nullable Bundle options) {
        if (!Utils.isPageTransitionEnabled(this) || requestCode == DEFAULT_REQUEST
                || options != null) {
        if (!Utils.isPageTransitionEnabled(this) || requestCode == DEFAULT_REQUEST) {
            super.startActivityForResult(intent, requestCode, options);
            return;
        }
        if (options != null) {
            super.startActivityForResult(intent, requestCode,
                    getMergedBundleForTransition(options));
            return;
        }
        super.startActivityForResult(intent, requestCode, getActivityOptionsBundle());
    }

@@ -339,6 +347,16 @@ public class SettingsBaseActivity extends FragmentActivity {
                "shared_element_view").toBundle();
    }

    private Bundle getMergedBundleForTransition(@NonNull Bundle options) {
        final Bundle mergedBundle = new Bundle();
        mergedBundle.putAll(options);
        final Bundle activityOptionsBundle = getActivityOptionsBundle();
        if (activityOptionsBundle != null) {
            mergedBundle.putAll(activityOptionsBundle);
        }
        return mergedBundle;
    }

    public interface CategoryListener {
        /**
         * @param categories the changed categories that have to be refreshed, or null to force