aboutsummaryrefslogtreecommitdiff
path: root/library/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-23 15:41:37 -0700
committerAllan Wang <me@allanwang.ca>2017-06-23 15:41:37 -0700
commitd6b4ebb938e5efd2900ee9c7f50dddffb856d2fa (patch)
tree4429bcf5530618b1a657b003c39517a94c93e410 /library/src/main/kotlin
parent3205160b3b0552e438cd53832e35d7843bebc43f (diff)
downloadkau-d6b4ebb938e5efd2900ee9c7f50dddffb856d2fa.tar.gz
kau-d6b4ebb938e5efd2900ee9c7f50dddffb856d2fa.tar.bz2
kau-d6b4ebb938e5efd2900ee9c7f50dddffb856d2fa.zip
Play store link
Diffstat (limited to 'library/src/main/kotlin')
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt10
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)