2222import android .os .Build .VERSION ;
2323import android .os .Build .VERSION_CODES ;
2424import androidx .fragment .app .Fragment ;
25+ import androidx .annotation .ChecksSdkIntAtLeast ;
2526import dagger .Provides ;
2627import dagger .android .ContributesAndroidInjector ;
2728import dagger .multibindings .IntoSet ;
3839/** A landing fragment that links to Transition demos for the Catalog app. */
3940public class TransitionFragment extends DemoLandingFragment {
4041
42+ @ ChecksSdkIntAtLeast (api = VERSION_CODES .LOLLIPOP )
43+ private static final boolean PLATFORM_TRANSITIONS_AVAILABLE =
44+ VERSION .SDK_INT >= VERSION_CODES .LOLLIPOP ;
45+
4146 @ Override
4247 public int getTitleResId () {
4348 return R .string .cat_transition_title ;
@@ -61,8 +66,7 @@ public Intent createActivityIntent() {
6166 @ Override
6267 public List <Demo > getAdditionalDemos () {
6368 List <Demo > demos = new ArrayList <>();
64- boolean shouldAddPlatformDemos = VERSION .SDK_INT >= VERSION_CODES .LOLLIPOP ;
65- if (shouldAddPlatformDemos ) {
69+ if (PLATFORM_TRANSITIONS_AVAILABLE ) {
6670 demos .add (
6771 new Demo (R .string .cat_transition_container_transform_activity_title ) {
6872 @ Override
@@ -86,7 +90,7 @@ public Fragment createFragment() {
8690 }
8791 }));
8892
89- if (shouldAddPlatformDemos ) {
93+ if (PLATFORM_TRANSITIONS_AVAILABLE ) {
9094 demos .add (
9195 new Demo (R .string .cat_transition_shared_axis_activity_title ) {
9296 @ Override
0 commit comments