Skip to content

Commit 265cb86

Browse files
committed
[Catalog] Surround TransitionFragment platform demos with proper sdk int check to fix lint error
PiperOrigin-RevId: 449045527
1 parent 9de56c2 commit 265cb86

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

catalog/java/io/material/catalog/transition/TransitionFragment.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import android.os.Build.VERSION;
2323
import android.os.Build.VERSION_CODES;
2424
import androidx.fragment.app.Fragment;
25+
import androidx.annotation.ChecksSdkIntAtLeast;
2526
import dagger.Provides;
2627
import dagger.android.ContributesAndroidInjector;
2728
import dagger.multibindings.IntoSet;
@@ -38,6 +39,10 @@
3839
/** A landing fragment that links to Transition demos for the Catalog app. */
3940
public 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

Comments
 (0)