diff options
author | Allan Wang <me@allanwang.ca> | 2018-01-01 23:22:51 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2018-01-01 23:22:51 -0500 |
commit | 71f5dc2f7ce5b8183421586e6a77be65040a4dff (patch) | |
tree | fedd18e271463ce2430637a9913e8470e84181ce /core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt | |
parent | f94d6f9694973c2a323e565794d948002593df0a (diff) | |
download | kau-71f5dc2f7ce5b8183421586e6a77be65040a4dff.tar.gz kau-71f5dc2f7ce5b8183421586e6a77be65040a4dff.tar.bz2 kau-71f5dc2f7ce5b8183421586e6a77be65040a4dff.zip |
Format everything and use reified generics
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt | 9 |
1 files changed, 6 insertions, 3 deletions
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 ebd7161..77750d3 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt @@ -17,7 +17,8 @@ import android.provider.Settings * @param packageName packageId * @return true if installed with activity, false otherwise */ -@KauUtils fun Context.isAppInstalled(packageName: String): Boolean { +@KauUtils +fun Context.isAppInstalled(packageName: String): Boolean { try { packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES) return true @@ -26,7 +27,8 @@ import android.provider.Settings } } -@KauUtils fun Context.isAppEnabled(packageName: String): Boolean { +@KauUtils +fun Context.isAppEnabled(packageName: String): Boolean { try { return packageManager.getApplicationInfo(packageName, 0).enabled } catch (e: Exception) { @@ -34,7 +36,8 @@ import android.provider.Settings } } -@KauUtils fun Context.showAppInfo(packageName: String) { +@KauUtils +fun Context.showAppInfo(packageName: String) { try { //Open the specific App Info page: val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) |