Skip to content

Commit

Permalink
Merge pull request #688 from mukaiyachidaiki/master
Browse files Browse the repository at this point in the history
Home button is difficult to see in dark Theme.
  • Loading branch information
takahirom authored Feb 2, 2020
2 parents b91cccb + 3ca8348 commit 8f37a33
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ class MainActivity : AppCompatActivity(), HasAndroidInjector {
statusBarColors.statusBarColor.distinctUntilChanged().observe(this) { color ->
window.statusBarColor = color
}
statusBarColors.navigationBarColor.distinctUntilChanged().observe(this) { color ->
window.navigationBarColor = color
}
}

private fun handleNavigation(@IdRes itemId: Int): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class SystemUiManager(
MutableLiveData(COLOR_STATUS_BAR_INVISIBLE)
val statusBarColor: LiveData<Int> = _statusBarColor

private val _navigationBarColor =
MutableLiveData(COLOR_NAVIGATION_BAR_INVISIBLE)
val navigationBarColor: LiveData<Int> = _navigationBarColor

var drawerSlideOffset: Float = 0f
set(value) {
if (field != value) {
Expand Down Expand Up @@ -70,6 +74,18 @@ class SystemUiManager(
} else {
COLOR_STATUS_BAR_INVISIBLE
}

// Navigation bar color
_navigationBarColor.value =
if (context.isNightMode()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
COLOR_NAVIGATION_BAR_INVISIBLE
} else {
COLOR_NAVIGATION_BAR_VISIBLE
}
} else {
COLOR_NAVIGATION_BAR_INVISIBLE
}
}

private fun updateColorsPreM() {
Expand All @@ -90,10 +106,24 @@ class SystemUiManager(
} else {
COLOR_STATUS_BAR_INVISIBLE
}

// Navigation bar color
_navigationBarColor.value =
if (context.isNightMode()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
COLOR_NAVIGATION_BAR_INVISIBLE
} else {
COLOR_NAVIGATION_BAR_VISIBLE
}
} else {
COLOR_NAVIGATION_BAR_INVISIBLE
}
}

companion object {
private const val COLOR_STATUS_BAR_INVISIBLE = Color.TRANSPARENT
private const val COLOR_STATUS_BAR_VISIBLE = 0x8a000000.toInt()
private const val COLOR_NAVIGATION_BAR_INVISIBLE = Color.TRANSPARENT
private const val COLOR_NAVIGATION_BAR_VISIBLE = 0x4DFFFFFF
}
}

0 comments on commit 8f37a33

Please sign in to comment.