diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-15 14:17:08 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-15 14:17:08 -0700 |
commit | 5aba646c138116e0df0f33f071468c4e09a27e3b (patch) | |
tree | ac2d1ce7406cf3654146305f2d33f15dbcb33dc4 /library/src/main/kotlin | |
parent | 594e0354c80f24e1b80b8071e55cfec1d86e44ad (diff) | |
download | kau-5aba646c138116e0df0f33f071468c4e09a27e3b.tar.gz kau-5aba646c138116e0df0f33f071468c4e09a27e3b.tar.bz2 kau-5aba646c138116e0df0f33f071468c4e09a27e3b.zip |
Status bar color setter
Diffstat (limited to 'library/src/main/kotlin')
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt | 3 | ||||
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt b/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt index 36c0feb..5b26eb0 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt @@ -10,6 +10,7 @@ import ca.allanwang.kau.R import ca.allanwang.kau.kpref.items.KPrefItemCore import ca.allanwang.kau.utils.bindView import ca.allanwang.kau.utils.resolveColor +import ca.allanwang.kau.utils.statusBarColor import ca.allanwang.kau.views.RippleCanvas import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter @@ -26,7 +27,7 @@ abstract class KPrefActivity : AppCompatActivity() { setContentView(R.layout.kau_activity_kpref) setSupportActionBar(toolbar) window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - window.statusBarColor = 0x30000000 + statusBarColor = 0x30000000 toolbarCanvas.set(resolveColor(R.attr.colorPrimary)) bgCanvas.set(resolveColor(android.R.attr.colorBackground)) adapter = recycler.setKPrefAdapter(onCreateKPrefs(savedInstanceState)) 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 b12b24d..b7b1586 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt @@ -67,6 +67,12 @@ var Activity.navigationBarColor: Int if (buildIsLollipopAndUp) window.navigationBarColor = value } +var Activity.statusBarColor: Int + get() = if (buildIsLollipopAndUp) window.statusBarColor else Color.BLACK + set(value) { + if (buildIsLollipopAndUp) window.statusBarColor = value + } + //Toast helpers fun Context.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_LONG) = toast(this.string(id), duration) |