[Catalog] Surround TransitionFragment platform demos with proper sdk int check to fix lint error

PiperOrigin-RevId: 449045527
This commit is contained in:
dsn5ft 2022-05-16 16:52:03 -04:00 committed by Daniel Nizri
parent 9de56c2207
commit 265cb867cd

View File

@ -22,6 +22,7 @@ import android.content.Intent;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import androidx.fragment.app.Fragment;
import androidx.annotation.ChecksSdkIntAtLeast;
import dagger.Provides;
import dagger.android.ContributesAndroidInjector;
import dagger.multibindings.IntoSet;
@ -38,6 +39,10 @@ import java.util.List;
/** A landing fragment that links to Transition demos for the Catalog app. */
public class TransitionFragment extends DemoLandingFragment {
@ChecksSdkIntAtLeast(api = VERSION_CODES.LOLLIPOP)
private static final boolean PLATFORM_TRANSITIONS_AVAILABLE =
VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP;
@Override
public int getTitleResId() {
return R.string.cat_transition_title;
@ -61,8 +66,7 @@ public class TransitionFragment extends DemoLandingFragment {
@Override
public List<Demo> getAdditionalDemos() {
List<Demo> demos = new ArrayList<>();
boolean shouldAddPlatformDemos = VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP;
if (shouldAddPlatformDemos) {
if (PLATFORM_TRANSITIONS_AVAILABLE) {
demos.add(
new Demo(R.string.cat_transition_container_transform_activity_title) {
@Override
@ -86,7 +90,7 @@ public class TransitionFragment extends DemoLandingFragment {
}
}));
if (shouldAddPlatformDemos) {
if (PLATFORM_TRANSITIONS_AVAILABLE) {
demos.add(
new Demo(R.string.cat_transition_shared_axis_activity_title) {
@Override