/* * Copyright (C) 2013 WhiteCat 白猫 (www.thinkandroid.cn) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ta.common; import android.os.Build; /** * @Title AndroidVersionCheckUtils * @Package com.ta.core.util.extend.app * @Description AndroidVersionCheckUtils 用于多版本兼容检测 * @author 白猫 * @date 2013-1-10 上午 9:53 * @version V1.0 */ public class AndroidVersionCheckUtils { private AndroidVersionCheckUtils() { }; /** * 当前Android系统版本是否在( Donut) Android 1.6或以上 * * @return */ public static boolean hasDonut() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.DONUT; } /** * 当前Android系统版本是否在( Eclair) Android 2.0或 以上 * * @return */ public static boolean hasEclair() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR; } /** * 当前Android系统版本是否在( Froyo) Android 2.2或 Android 2.2以上 * * @return */ public static boolean hasFroyo() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO; } /** * 当前Android系统版本是否在( Gingerbread) Android 2.3x或 Android 2.3x 以上 * * @return */ public static boolean hasGingerbread() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD; } /** * 当前Android系统版本是否在( Honeycomb) Android3.1或 Android3.1以上 * * @return */ public static boolean hasHoneycomb() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; } /** * 当前Android系统版本是否在( HoneycombMR1) Android3.1.1或 Android3.1.1以上 * * @return */ public static boolean hasHoneycombMR1() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1; } /** * 当前Android系统版本是否在( IceCreamSandwich) Android4.0或 Android4.0以上 * * @return */ public static boolean hasIcecreamsandwich() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH; } /* * public static boolean hasJellyBean() { return Build.VERSION.SDK_INT >= * Build.VERSION_CODES.JELLY_BEAN; } */ }