diff options
Diffstat (limited to 'library')
-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) |