Skip to content

Instantly share code, notes, and snippets.

@nightcrawler-
Created May 10, 2020 07:07
Show Gist options
  • Select an option

  • Save nightcrawler-/24efd23da45ae7c7c770b18294914ba3 to your computer and use it in GitHub Desktop.

Select an option

Save nightcrawler-/24efd23da45ae7c7c770b18294914ba3 to your computer and use it in GitHub Desktop.
Fucntion to switch the status bar and nav bar colors on open/close navigation drawer
//TODO: Frederick, until this is figured out, just dont, functionality trumps subtle color shade differences and jarring changes
//BG: This gives a uniform background color and content color when drawer is open on +10 devices,
// without it, sattus bar retains light theme..and 'up' navigation is shot
//DEAD CODE ALERT
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// binding.drawerLayout.addDrawerListener(object : ActionBarDrawerToggle(
// this,
// binding.drawerLayout,
// binding.toolbar,
// R.string.nav_app_bar_open_drawer_description,
// R.string.nav_app_bar_open_drawer_description
// ) {
// override fun onDrawerOpened(drawerView: View) {
// super.onDrawerOpened(drawerView)
// //make status bar clear? might have to disable fit systemwindows?
// //set bottombar/nav bar waever at the bottom to same color
// clearLightStatusBar(this@HomeActivity)
// changeSystemUIColor(this@HomeActivity, R.color.colorAccent)
// }
//
// override fun onDrawerClosed(drawerView: View) {
// super.onDrawerClosed(drawerView)
// //reverse the above
// setLightStatusBar(this@HomeActivity)
// changeSystemUIColor(this@HomeActivity, R.color.white)
// }
// })
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment