Merge "Merge existing bundle with ActivityOptions" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
57d8d38a3c
@@ -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
|
||||
|
Reference in New Issue
Block a user