Merge pull request #126 from esensar/fix/status-bar-icon-colors
Properly update status bar icon colors when opening all apps and widgets drawers
This commit is contained in:
commit
9f951ea3bc
|
@ -482,6 +482,10 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||||
binding.homeScreenGrid.root.fragmentExpanded()
|
binding.homeScreenGrid.root.fragmentExpanded()
|
||||||
binding.homeScreenGrid.root.hideResizeLines()
|
binding.homeScreenGrid.root.hideResizeLines()
|
||||||
fragment.root.performAccessibilityAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null)
|
fragment.root.performAccessibilityAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null)
|
||||||
|
|
||||||
|
Handler(Looper.getMainLooper()).postDelayed({
|
||||||
|
updateStatusBarIcons()
|
||||||
|
}, ANIMATION_DURATION)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hideFragment(fragment: ViewBinding) {
|
private fun hideFragment(fragment: ViewBinding) {
|
||||||
|
@ -493,6 +497,7 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||||
|
|
||||||
window.navigationBarColor = Color.TRANSPARENT
|
window.navigationBarColor = Color.TRANSPARENT
|
||||||
binding.homeScreenGrid.root.fragmentCollapsed()
|
binding.homeScreenGrid.root.fragmentCollapsed()
|
||||||
|
updateStatusBarIcons(Color.TRANSPARENT)
|
||||||
Handler(Looper.getMainLooper()).postDelayed({
|
Handler(Looper.getMainLooper()).postDelayed({
|
||||||
if (fragment is AllAppsFragmentBinding) {
|
if (fragment is AllAppsFragmentBinding) {
|
||||||
fragment.allAppsGrid.scrollToPosition(0)
|
fragment.allAppsGrid.scrollToPosition(0)
|
||||||
|
@ -540,6 +545,7 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||||
binding.allAppsFragment.allAppsGrid.scrollToPosition(0)
|
binding.allAppsFragment.allAppsGrid.scrollToPosition(0)
|
||||||
binding.allAppsFragment.root.touchDownY = -1
|
binding.allAppsFragment.root.touchDownY = -1
|
||||||
binding.homeScreenGrid.root.fragmentCollapsed()
|
binding.homeScreenGrid.root.fragmentCollapsed()
|
||||||
|
updateStatusBarIcons(Color.TRANSPARENT)
|
||||||
}
|
}
|
||||||
if (delayed) {
|
if (delayed) {
|
||||||
Handler(Looper.getMainLooper()).postDelayed(close, APP_DRAWER_CLOSE_DELAY)
|
Handler(Looper.getMainLooper()).postDelayed(close, APP_DRAWER_CLOSE_DELAY)
|
||||||
|
@ -556,6 +562,7 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||||
binding.widgetsFragment.widgetsList.scrollToPosition(0)
|
binding.widgetsFragment.widgetsList.scrollToPosition(0)
|
||||||
binding.widgetsFragment.root.touchDownY = -1
|
binding.widgetsFragment.root.touchDownY = -1
|
||||||
binding.homeScreenGrid.root.fragmentCollapsed()
|
binding.homeScreenGrid.root.fragmentCollapsed()
|
||||||
|
updateStatusBarIcons(Color.TRANSPARENT)
|
||||||
}
|
}
|
||||||
if (delayed) {
|
if (delayed) {
|
||||||
Handler(Looper.getMainLooper()).postDelayed(close, APP_DRAWER_CLOSE_DELAY)
|
Handler(Looper.getMainLooper()).postDelayed(close, APP_DRAWER_CLOSE_DELAY)
|
||||||
|
@ -1036,6 +1043,10 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateStatusBarIcons(backgroundColor: Int = getProperBackgroundColor()) {
|
||||||
|
WindowCompat.getInsetsController(window, binding.root).isAppearanceLightStatusBars = backgroundColor.getContrastColor() == DARK_GREY
|
||||||
|
}
|
||||||
|
|
||||||
// taken from https://gist.github.com/maxjvh/a6ab15cbba9c82a5065d
|
// taken from https://gist.github.com/maxjvh/a6ab15cbba9c82a5065d
|
||||||
private fun calculateAverageColor(bitmap: Bitmap): Int {
|
private fun calculateAverageColor(bitmap: Bitmap): Int {
|
||||||
var red = 0
|
var red = 0
|
||||||
|
|
Loading…
Reference in New Issue