diff options
author | Allan Wang <me@allanwang.ca> | 2018-12-24 20:05:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-24 20:05:06 -0500 |
commit | 8447b1ae8ce89b3f1bbe79dbae8847d901831c12 (patch) | |
tree | ce516950e452581766e905ead32970d891bb46f6 /core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt | |
parent | 701b94ab09ff53aca682fac6c4ef5364566339be (diff) | |
download | kau-8447b1ae8ce89b3f1bbe79dbae8847d901831c12.tar.gz kau-8447b1ae8ce89b3f1bbe79dbae8847d901831c12.tar.bz2 kau-8447b1ae8ce89b3f1bbe79dbae8847d901831c12.zip |
Enhancement/coroutines (#180)
* Add coroutine dependency
* Add coroutines to kprefactivity
* Change base job to supervisor
* Update coroutines for faq
* Update changelog
* Use preloading in media picker core
* Make test logging internal
* Remove anko
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt index a655e5b..3dd4bb9 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt @@ -28,13 +28,13 @@ import android.os.Build import android.os.Bundle import android.view.Menu import android.view.View +import android.view.ViewGroup import androidx.annotation.ColorInt import androidx.annotation.RequiresApi import androidx.annotation.StringRes import ca.allanwang.kau.R import com.google.android.material.snackbar.Snackbar import com.mikepenz.iconics.typeface.IIcon -import org.jetbrains.anko.contentView /** * Created by Allan Wang on 2017-06-21. @@ -160,6 +160,17 @@ inline fun Activity.showKeyboard() { currentFocus?.showKeyboard() } +/** + * Gets the view set by [Activity.setContentView] if it exists. + * + * Taken courtesy of <a href="https://github.com/Kotlin/anko">Anko</a> + * + * Previously, Anko was a dependency in KAU, but has been removed on 12/24/2018 + * as most of the methods weren't used + */ +inline val Activity.contentView: View? + get() = (findViewById(android.R.id.content) as? ViewGroup)?.getChildAt(0) + inline fun Activity.snackbar( text: String, duration: Int = Snackbar.LENGTH_LONG, |