Download directly

With good –most of the time– also comes the bad. In this episode, Kaushik and Donn chat about the small annoying things about being an Android developer, or more aptly – “Micro Frustrations”.

We usually cover the new, latest, greatest and awesome developments. But it helps to step back and also point out the things that are broken and the 1000 cuts so to speak.

Sit back and enjoy this hearty rant!

Shownotes

layout complaints

If you’re looking for a solution to just hide system bar (and not the navigation bar), here’s what Kaushik landed up using (you’re welcome):

fun Window.makeStatusBarTransparent(activity: Activity) {
    sdkUpto(20) {
        setWindowFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, true)
    }
    decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
    sdk(21) {
        setWindowFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false)
        setTranslucentStatusBarLollipop()
    }
}

private fun setWindowFlag(activity: Activity, bits: Int, on: Boolean) {
    val win = activity.window
    val winParams = win.attributes
    if (on) {
        winParams.flags = winParams.flags or bits
    } else {
        winParams.flags = winParams.flags and bits.inv()
    }
    win.attributes = winParams
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private fun Window.setTranslucentStatusBarLollipop() {
    statusBarColor = Color.TRANSPARENT
}

Sponsors

Contact