diff --git a/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/MainScreen.kt b/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/MainScreen.kt index 8148937af2..c13507eb39 100644 --- a/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/MainScreen.kt +++ b/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/MainScreen.kt @@ -943,19 +943,33 @@ fun MainScreen( } } + val updateButtonColors = if (viewModel.updateAvailable) { + ButtonDefaults.outlinedButtonColors( + containerColor = MaterialTheme.colorScheme.primaryContainer.copy( + alpha = if (LocalNightMode.current.isNightMode()) 0.5f + else 1f + ), + contentColor = MaterialTheme.colorScheme.onPrimaryContainer.copy( + alpha = 0.5f + ) + ) + } else { + ButtonDefaults.outlinedButtonColors( + containerColor = MaterialTheme.colorScheme.secondaryContainer.copy( + alpha = if (LocalNightMode.current.isNightMode()) 0.5f + else 1f + ), + contentColor = MaterialTheme.colorScheme.onSecondaryContainer.copy( + alpha = 0.5f + ) + ) + } + BottomAppBar( modifier = Modifier.drawHorizontalStroke(top = true), actions = { OutlinedButton( - colors = ButtonDefaults.outlinedButtonColors( - containerColor = MaterialTheme.colorScheme.secondaryContainer.copy( - alpha = if (LocalNightMode.current.isNightMode()) 0.5f - else 1f - ), - contentColor = MaterialTheme.colorScheme.onSecondaryContainer.copy( - alpha = 0.5f - ), - ), + colors = updateButtonColors, border = BorderStroke( LocalBorderWidth.current, MaterialTheme.colorScheme.outlineVariant(onTopOf = MaterialTheme.colorScheme.secondaryContainer) diff --git a/app/src/main/java/ru/tech/imageresizershrinker/main_screen/viewModel/MainViewModel.kt b/app/src/main/java/ru/tech/imageresizershrinker/main_screen/viewModel/MainViewModel.kt index c771101d41..d1940ff280 100644 --- a/app/src/main/java/ru/tech/imageresizershrinker/main_screen/viewModel/MainViewModel.kt +++ b/app/src/main/java/ru/tech/imageresizershrinker/main_screen/viewModel/MainViewModel.kt @@ -83,6 +83,9 @@ class MainViewModel @Inject constructor( private val _showUpdateDialog = mutableStateOf(false) val showUpdateDialog by _showUpdateDialog + private val _updateAvailable = mutableStateOf(false) + val updateAvailable by _updateAvailable + private val _cancelledUpdate = mutableStateOf(false) private val _shouldShowDialog = mutableStateOf(true) @@ -230,6 +233,7 @@ class MainViewModel @Inject constructor( } if (tag != BuildConfig.VERSION_NAME) { + _updateAvailable.value = true _showUpdateDialog.value = true } else { onNoUpdates()