sdkcheck

Project Url: akodiakson/sdkcheck
Introduction: -- A utility that answers the question: is my user running on at least this SDK?
More: Author   ReportBugs   
Tags:

What version of Android is your user running?

Replaces checks like:

if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
  ...
}

with:

if(Sdk.isAtLeastLollipop()){
  ...
}

Examples:

//com.akodiakson.sdk.simple.Sdk
public void example(){
        if(Sdk.isAtLeastMarshmallow()){
            System.out.println("I'm fluffy");
        } else if(Sdk.isAtLeastLollipop()){
            System.out.println("I'm sticky");
        } else if(Sdk.isAtLeastKitKat()){
            System.out.println("I'm crunchy");
        }
}

Non-static variant (more test-friendly):

//com.akodiakson.sdk.Sdk
public void example(){
        Sdk sdk = new SdkImpl();
        if(sdk.isAtLeastMarshmallow()){
            System.out.println("I'm fluffy");
        } else if(sdk.isAtLeastLollipop()){
            System.out.println("I'm sticky");
        } else if(sdk.isAtLeastKitKat()){
            System.out.println("I'm crunchy");
        }
}

Download

maven { url "https://jitpack.io" }
compile 'com.github.akodiakson:sdkcheck:0.2.4'
Apps
About Me
GitHub: Trinea
Facebook: Dev Tools