-
-
Save ferdy182/1388c77b373c66608747 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.aracem.utils.version; | |
import android.os.Build; | |
/** | |
* Util class to check if the current device is running some of the awesome Android versions. | |
* | |
* Created by Marcos Trujillo (─‿‿─) on 3/02/14. | |
*/ | |
public class SupportVersion { | |
/** | |
* @return true when the caller API version is at least Cupcake 3 | |
*/ | |
public static boolean Cupcake() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE; | |
} | |
/** | |
* @return true when the caller API version is at least Donut 4 | |
*/ | |
public static boolean Donut() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.DONUT; | |
} | |
/** | |
* @return true when the caller API version is at least Eclair 5 | |
*/ | |
public static boolean Eclair() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR; | |
} | |
/** | |
* @return true when the caller API version is at least Froyo 8 | |
*/ | |
public static boolean Froyo() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO; | |
} | |
/** | |
* @return true when the caller API version is at least GingerBread 9 | |
*/ | |
public static boolean Gingerbread() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD; | |
} | |
/** | |
* @return true when the caller API version is at least Honeycomb 11 | |
*/ | |
public static boolean Honeycomb() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; | |
} | |
/** | |
* @return true when the caller API version is at least Honeycomb 3.2, 13 | |
*/ | |
public static boolean HoneycombMR2() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2; | |
} | |
/** | |
* @return true when the caller API version is at least ICS 14 | |
*/ | |
public static boolean IceCreamSandwich() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH; | |
} | |
/** | |
* @return true when the caller API version is at least JellyBean 16 | |
*/ | |
public static boolean JellyBean() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; | |
} | |
/** | |
* @return true when the caller API version is at least JellyBean MR1 17 | |
*/ | |
public static boolean JellyBeanMR1() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1; | |
} | |
/** | |
* @return true when the caller API version is at least JellyBean MR2 18 | |
*/ | |
public static boolean JellyBeanMR2() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2; | |
} | |
/** | |
* @return true when the caller API version is at least Kitkat 19 | |
*/ | |
public static boolean Kitkat() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; | |
} | |
/** | |
* @return true when the caller API version is at least Lollipop 21 | |
*/ | |
public static boolean Lollipop() { | |
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; | |
} | |
/** | |
* Returns true if the OS API level is at least the one passed through parameter | |
* @param apiLevel the API level you want to check against | |
* @return true if the OS API level is >= than apiLevel | |
*/ | |
public static boolean isAtLeastAPI(int apiLevel) { | |
return Build.VERSION.SDK_INT >= apiLevel; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment