Fix light theme colors

This commit is contained in:
Ensar Sarajčić 2023-10-02 10:42:18 +02:00
parent de2ce0ea73
commit cd02f52d12
4 changed files with 13 additions and 35 deletions

View File

@ -104,7 +104,7 @@ class BrightDisplayActivity : SimpleActivity() {
private val _timerVisible: MutableStateFlow<Boolean> = MutableStateFlow(false) private val _timerVisible: MutableStateFlow<Boolean> = MutableStateFlow(false)
val timerVisible = _timerVisible.asStateFlow() val timerVisible = _timerVisible.asStateFlow()
private val _backgroundColor: MutableStateFlow<Int> = MutableStateFlow(application.config.backgroundColor) private val _backgroundColor: MutableStateFlow<Int> = MutableStateFlow(application.config.brightDisplayColor)
val backgroundColor = _backgroundColor.asStateFlow() val backgroundColor = _backgroundColor.asStateFlow()
init { init {

View File

@ -122,32 +122,6 @@ class MainActivity : SimpleActivity() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
viewModel.onResume() viewModel.onResume()
// val contrastColor = getContrastColor()
// binding.apply {
// changeIconColor(contrastColor, brightDisplayBtn)
// brightDisplayBtn.beVisibleIf(preferences.brightDisplay)
// sosBtn.beVisibleIf(preferences.sos)
//
// if (sosBtn.currentTextColor != getProperPrimaryColor()) {
// sosBtn.setTextColor(contrastColor)
// }
//
// stroboscopeBtn.beVisibleIf(preferences.stroboscope)
//
// if (!preferences.stroboscope) {
// mCameraImpl!!.stopStroboscope()
// stroboscopeBar.beInvisible()
// }
//
// updateTextColors(mainHolder)
// if (stroboscopeBar.isInvisible()) {
// changeIconColor(contrastColor, stroboscopeBtn)
// }
// }
//
// binding.sleepTimerHolder.background = ColorDrawable(getProperBackgroundColor())
// binding.sleepTimerStop.applyColorFilter(getProperTextColor())
requestedOrientation = if (preferences.forcePortraitMode) ActivityInfo.SCREEN_ORIENTATION_PORTRAIT else ActivityInfo.SCREEN_ORIENTATION_SENSOR requestedOrientation = if (preferences.forcePortraitMode) ActivityInfo.SCREEN_ORIENTATION_PORTRAIT else ActivityInfo.SCREEN_ORIENTATION_SENSOR
invalidateOptionsMenu() invalidateOptionsMenu()

View File

@ -112,7 +112,7 @@ internal fun MainScreen(
), ),
painter = painterResource(id = R.drawable.ic_flashlight_vector), painter = painterResource(id = R.drawable.ic_flashlight_vector),
contentDescription = stringResource(id = R.string.flashlight_short), contentDescription = stringResource(id = R.string.flashlight_short),
tint = if (flashlightActive) MaterialTheme.colorScheme.primary else Color.Unspecified tint = if (flashlightActive) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurface
) )
if (showBrightDisplayButton) { if (showBrightDisplayButton) {
@ -128,7 +128,8 @@ internal fun MainScreen(
onClick = onBrightDisplayPress onClick = onBrightDisplayPress
), ),
painter = painterResource(id = R.drawable.ic_bright_display_vector), painter = painterResource(id = R.drawable.ic_bright_display_vector),
contentDescription = stringResource(id = R.string.bright_display) contentDescription = stringResource(id = R.string.bright_display),
tint = MaterialTheme.colorScheme.onSurface
) )
} }
@ -146,7 +147,7 @@ internal fun MainScreen(
text = "SOS", text = "SOS",
fontSize = TextUnit(dimensionResource(id = R.dimen.sos_text_size).value, TextUnitType.Sp), fontSize = TextUnit(dimensionResource(id = R.dimen.sos_text_size).value, TextUnitType.Sp),
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
color = if (sosActive) MaterialTheme.colorScheme.primary else Color.Unspecified color = if (sosActive) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurface
) )
} }
@ -164,7 +165,7 @@ internal fun MainScreen(
), ),
painter = painterResource(id = R.drawable.ic_stroboscope_vector), painter = painterResource(id = R.drawable.ic_stroboscope_vector),
contentDescription = "", contentDescription = "",
tint = if (stroboscopeActive) MaterialTheme.colorScheme.primary else Color.Unspecified tint = if (stroboscopeActive) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurface
) )
} }

View File

@ -31,7 +31,7 @@ internal fun SleepTimer(
Row( Row(
modifier = modifier modifier = modifier
.wrapContentSize() .wrapContentSize()
.background(MaterialTheme.colorScheme.background) .background(MaterialTheme.colorScheme.surface)
.border( .border(
width = 1.dp, width = 1.dp,
color = Color.Gray, color = Color.Gray,
@ -43,20 +43,23 @@ internal fun SleepTimer(
.align(Alignment.CenterVertically) .align(Alignment.CenterVertically)
.padding(horizontal = dimensionResource(id = R.dimen.normal_margin)), .padding(horizontal = dimensionResource(id = R.dimen.normal_margin)),
text = stringResource(id = R.string.sleep_timer), text = stringResource(id = R.string.sleep_timer),
color = MaterialTheme.colorScheme.onSurface
) )
Text( Text(
modifier = Modifier.align(Alignment.CenterVertically), modifier = Modifier.align(Alignment.CenterVertically),
text = timerText text = timerText,
color = MaterialTheme.colorScheme.onSurface
) )
IconButton( IconButton(
modifier = Modifier modifier = Modifier
.align(Alignment.CenterVertically) .align(Alignment.CenterVertically)
.padding(dimensionResource(id = R.dimen.medium_margin)), .padding(dimensionResource(id = R.dimen.medium_margin)),
onClick = onCloseClick, onClick = onCloseClick
) { ) {
Icon( Icon(
painter = painterResource(id = R.drawable.ic_cross_vector), painter = painterResource(id = R.drawable.ic_cross_vector),
contentDescription = stringResource(id = R.string.close) contentDescription = stringResource(id = R.string.close),
tint = MaterialTheme.colorScheme.onSurface
) )
} }
} }