From d6b4ebb938e5efd2900ee9c7f50dddffb856d2fa Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 23 Jun 2017 15:41:37 -0700 Subject: Play store link --- library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'library') diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt index 5d10b3e..72a808a 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt @@ -5,6 +5,7 @@ import android.content.Context import android.content.Intent import android.graphics.drawable.Drawable import android.net.ConnectivityManager +import android.net.Uri import android.os.Bundle import android.os.Handler import android.support.annotation.* @@ -13,11 +14,12 @@ import android.support.v4.content.ContextCompat import android.util.TypedValue import android.widget.Toast import ca.allanwang.kau.R -import com.afollestad.materialdialogs.MaterialDialog import ca.allanwang.kau.changelog.ChangelogAdapter import ca.allanwang.kau.changelog.parse +import com.afollestad.materialdialogs.MaterialDialog import java.util.* + /** * Created by Allan Wang on 2017-06-03. */ @@ -50,6 +52,12 @@ fun Context.startActivitySlideOut(clazz: Class, clearStack: Boolea startActivity(clazz, clearStack, intentBuilder, bundle) } +fun Context.startPlayStoreLink(@StringRes packageIdRes: Int) = startPlayStoreLink(string(packageIdRes)) + +fun Context.startPlayStoreLink(packageId: String) { + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=$packageId"))) +} + //Toast helpers fun Context.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_LONG) = toast(this.string(id), duration) -- cgit v1.2.3