Cyanea icon indicating copy to clipboard operation
Cyanea copied to clipboard

Custom Status Bar Color

Open ItsAnubhav opened this issue 5 years ago • 1 comments

I want the status bar colour to match the Toolbar colour. How can I achieve that ? Is there any API for that or do I have to edit the plugin ?

ItsAnubhav avatar Feb 20 '20 15:02 ItsAnubhav

I did that using Kotlin:

//Your statusBarColor method
//depends if you doing this in Activity or Fragment
fun Fragment.statusBarColor(@ColorInt color: Int) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        activity?.window?.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
        activity?.window?.statusBarColor = color
    }
}

And calling in Fragment or Activity:

statusBarColor(Cyanea.instance.primary)

DatL4g avatar Jun 03 '20 20:06 DatL4g