ui: use colorOnSurface

Use colorOnSurface for the first time ever. I decided to pick a color
that was as non-intrusive as possible that was still differentiateable,
and I think it looks like a net improvement. It will probably be
tweaked a bit in the future as I expand it to other elevated views.
This commit is contained in:
OxygenCobalt
2021-08-30 20:19:52 -06:00
parent 765f92ca98
commit acabe9217b
5 changed files with 44 additions and 17 deletions
@@ -33,7 +33,6 @@ import org.oxycblt.auxio.databinding.ActivityMainBinding
import org.oxycblt.auxio.playback.PlaybackViewModel
import org.oxycblt.auxio.playback.system.PlaybackService
import org.oxycblt.auxio.settings.SettingsManager
import org.oxycblt.auxio.util.applyEdge
import org.oxycblt.auxio.util.isNight
import org.oxycblt.auxio.util.logD
@@ -54,12 +53,6 @@ class MainActivity : AppCompatActivity() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
applyEdgeToEdgeWindow(binding)
// If there are left/right insets [signalling that we are in phone landscape mode],
// we will always apply them.
binding.applyEdge { bars ->
binding.root.updatePadding(left = bars.left, right = bars.right)
}
} else {
binding.root.fitsSystemWindows = true
}
@@ -126,15 +119,35 @@ class MainActivity : AppCompatActivity() {
WindowInsets.Type.systemBars(),
insets.getInsetsIgnoringVisibility(WindowInsets.Type.systemBars())
)
.build()
.build().also {
val bars = it.getInsets(WindowInsets.Type.systemBars())
// If left/right insets are present [implying phone landscape mode],
// make sure that we apply them.
binding.root.updatePadding(
left = bars.left,
right = bars.right
)
}
}
} else {
// Do old edge-to-edge otherwise.
logD("Doing legacy edge-to-edge.")
@Suppress("DEPRECATION")
binding.root.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
binding.root.apply {
systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
setOnApplyWindowInsetsListener { v, insets ->
updatePadding(
left = insets.systemWindowInsetLeft,
right = insets.systemWindowInsetRight
)
insets
}
}
}
}