Skip to content

Files

Latest commit

b56a555 · Dec 25, 2019

History

History
14 lines (13 loc) · 438 Bytes

WindowExtensions.md

File metadata and controls

14 lines (13 loc) · 438 Bytes

WindowExtensions.kt

/**
* Sets color to status bar
*/
fun Window.addStatusBarColor(@ColorRes color: Int) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
       this.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
       this.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
       this.statusBarColor = ContextCompat.getColor(this.context, color)
   }
}