Support different types of transitions.

In Settings, some cases are not suitable to apply the shared x-axis
transition, and some pages shared with SUW may need to apply other
transitions. Hence, create a mechanism for flexibility.

Bug: 187542491
Test: robotest & navigate though settings pages
Change-Id: I041bbb5e1d9177f234860864651f618700867b96
This commit is contained in:
Yi-Ling Chuang
2021-05-24 16:23:45 +08:00
parent 56713ae05c
commit 8db5cb03eb
3 changed files with 65 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ import androidx.fragment.app.FragmentActivity;
import com.android.settings.SettingsActivity;
import com.android.settings.testutils.shadow.ShadowUtils;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.transition.SettingsTransitionHelper;
import org.junit.Before;
import org.junit.Test;
@@ -97,6 +98,7 @@ public class SubSettingLauncherTest {
.setDestination(SubSettingLauncherTest.class.getName())
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setSourceMetricsCategory(123)
.setTransitionType(SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE)
.launch();
doNothing().when(launcher).launch(any(Intent.class));
verify(launcher).launch(intentArgumentCaptor.capture());
@@ -109,6 +111,8 @@ public class SubSettingLauncherTest {
assertThat(intent.getFlags()).isEqualTo(Intent.FLAG_ACTIVITY_NEW_TASK);
assertThat(intent.getIntExtra(MetricsFeatureProvider.EXTRA_SOURCE_METRICS_CATEGORY, -1))
.isEqualTo(123);
assertThat(intent.getIntExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE, -1))
.isEqualTo(SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE);
}
@Test