[UI] Fix status bar icon color in light theme, color&date picker dialogs crashing the app.

This commit is contained in:
Kuba Szczodrzyński 2019-09-23 21:53:04 +02:00
parent 18d9471a94
commit 9500ba52fd
2 changed files with 9 additions and 4 deletions

View File

@ -30,6 +30,7 @@ import pl.szczodrzynski.navlib.drawer.items.DrawerPrimaryItem
import pl.szczodrzynski.navlib.drawer.items.withAppTitle
import pl.szczodrzynski.navlib.getColorFromAttr
import androidx.appcompat.widget.PopupMenu
import androidx.core.graphics.ColorUtils
import androidx.navigation.NavOptions
import com.danimahardhika.cafebar.CafeBar
import com.mikepenz.iconics.IconicsColor
@ -239,6 +240,14 @@ class MainActivity : AppCompatActivity() {
b.navView.configSystemBarsUtil(this)
// fix for setting status bar color to window color, outside of navlib
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.statusBarColor = statusBarColor
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ColorUtils.calculateLuminance(statusBarColor) > 0.6) {
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
// TODO fix navlib navbar detection, orientation change issues, status bar color setting if not fullscreen
commit()

View File

@ -95,8 +95,6 @@
<item name="mal_color_secondary">?android:textColorSecondary</item>
<item name="mal_card_background">?colorSurface</item>
<item name="mal_divider_color">@color/dividerColor</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">?android:windowBackground</item>
</style>
<style name="AppTheme.Dark" parent="NavView.Dark">
<item name="colorPrimary">#64b5f6</item>
@ -121,8 +119,6 @@
<item name="mal_color_secondary">@color/secondaryTextDark</item>
<item name="mal_card_background">?colorSurface</item>
<item name="mal_divider_color">@color/dividerColor</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">?android:windowBackground</item>
</style>