From e2ac8e3e82b842ea05c8c7a2c92d566553d8ea91 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 25 Sep 2021 18:19:21 -0700 Subject: Add checkSdkIntAtLeast annotation; fixes #267 --- core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core') diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt index 0bd534e..d8524fa 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt @@ -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. @@ -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" -- cgit v1.2.3