diff options
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt | 10 |
1 files changed, 9 insertions, 1 deletions
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<out Activity>, 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) |