Skip to content

Commit

Permalink
Add checkSdkIntAtLeast annotation; fixes #267
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanWang committed Sep 26, 2021
1 parent 302011d commit e2ac8e3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.provider.Settings
import androidx.annotation.ChecksSdkIntAtLeast

/**
* Created by Allan Wang on 2017-06-23.
Expand Down Expand Up @@ -67,14 +68,21 @@ fun Context.showAppInfo(packageName: String) {
}

inline val buildIsMarshmallowAndUp: Boolean
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.M)
get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M

inline val buildIsLollipopAndUp: Boolean
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.LOLLIPOP)
get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP

inline val buildIsNougatAndUp: Boolean
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.N)
get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N

inline val buildIsOreoAndUp: Boolean
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O)
get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O

const val INSTALLER_GOOGLE_PLAY_VENDING = "com.android.vending"
const val INSTALLER_GOOGLE_PLAY_FEEDBACK = "com.google.android.feedback"

Expand Down

0 comments on commit e2ac8e3

Please sign in to comment.