Dark mode fix for Settings icon and Grant Permission Button
This commit is contained in:
		
							parent
							
								
									f10e030647
								
							
						
					
					
						commit
						489e57c79f
					
				|  | @ -13,6 +13,7 @@ import androidx.activity.compose.setContent | ||||||
| import androidx.activity.enableEdgeToEdge | import androidx.activity.enableEdgeToEdge | ||||||
| import androidx.activity.result.contract.ActivityResultContracts | import androidx.activity.result.contract.ActivityResultContracts | ||||||
| import androidx.annotation.RequiresApi | import androidx.annotation.RequiresApi | ||||||
|  | import androidx.compose.foundation.isSystemInDarkTheme | ||||||
| import androidx.compose.foundation.layout.Arrangement | import androidx.compose.foundation.layout.Arrangement | ||||||
| import androidx.compose.foundation.layout.Column | import androidx.compose.foundation.layout.Column | ||||||
| import androidx.compose.foundation.layout.PaddingValues | import androidx.compose.foundation.layout.PaddingValues | ||||||
|  | @ -63,7 +64,8 @@ val fontSizeUpper = 16.sp | ||||||
| val fontSizeTitle = 22.sp | val fontSizeTitle = 22.sp | ||||||
| val breezeFontWeight = FontWeight.Bold | val breezeFontWeight = FontWeight.Bold | ||||||
| val iconStyle = Icons.Outlined | val iconStyle = Icons.Outlined | ||||||
| val textColor = Color(0, 0, 0) | val textColorLightMode = Color(0, 0, 0) | ||||||
|  | val textColorDarkMode = Color(255, 255, 255) | ||||||
| val numberFormat = DecimalFormat("00") | val numberFormat = DecimalFormat("00") | ||||||
| val apiKey = "8a6090c4308455152cd8c677b802883b" | val apiKey = "8a6090c4308455152cd8c677b802883b" | ||||||
| 
 | 
 | ||||||
|  | @ -125,6 +127,7 @@ fun fetchCurrentTemp(ctx: Context, lat: Double, lon: Double): WeatherResponse { | ||||||
| @Composable | @Composable | ||||||
| fun WeatherInfo(modifier: Modifier = Modifier) { | fun WeatherInfo(modifier: Modifier = Modifier) { | ||||||
|   val ctx = LocalContext.current |   val ctx = LocalContext.current | ||||||
|  |   var textColor = if (isSystemInDarkTheme()) textColorDarkMode else textColorLightMode | ||||||
|   var forecast by remember { mutableStateOf(ForecastSummary(0.0, 0.0, false, false, false)) } |   var forecast by remember { mutableStateOf(ForecastSummary(0.0, 0.0, false, false, false)) } | ||||||
|   var currentTemp by remember { |   var currentTemp by remember { | ||||||
|     mutableStateOf( |     mutableStateOf( | ||||||
|  | @ -229,12 +232,18 @@ fun WeatherInfo(modifier: Modifier = Modifier) { | ||||||
|         fontWeight = breezeFontWeight, |         fontWeight = breezeFontWeight, | ||||||
|       ) |       ) | ||||||
|     } else { |     } else { | ||||||
|  | 
 | ||||||
|       Button( |       Button( | ||||||
|         onClick = { |         onClick = { | ||||||
|           permissionLauncher.launch(Manifest.permission.ACCESS_FINE_LOCATION) |           permissionLauncher.launch(Manifest.permission.ACCESS_FINE_LOCATION) | ||||||
|         }, |         }, | ||||||
|         colors = ButtonDefaults.buttonColors( |         colors = ButtonDefaults.buttonColors( | ||||||
|           containerColor = Color(0, 0, 0, 20), |           containerColor = Color( | ||||||
|  |             textColor.red, | ||||||
|  |             textColor.green, | ||||||
|  |             textColor.blue, | ||||||
|  |             0.09f, | ||||||
|  |           ), | ||||||
|           contentColor = textColor, |           contentColor = textColor, | ||||||
|         ), |         ), | ||||||
|       ) { |       ) { | ||||||
|  | @ -257,6 +266,7 @@ fun GreetingPreview() { | ||||||
| 
 | 
 | ||||||
| @Composable | @Composable | ||||||
| fun Navigation(icon: ImageVector, iconDescription: String, onClick: () -> Unit = {}) { | fun Navigation(icon: ImageVector, iconDescription: String, onClick: () -> Unit = {}) { | ||||||
|  |   var textColor = if (isSystemInDarkTheme()) textColorDarkMode else textColorLightMode | ||||||
|   Row( |   Row( | ||||||
|     horizontalArrangement = Arrangement.End, |     horizontalArrangement = Arrangement.End, | ||||||
|     modifier = Modifier.fillMaxWidth(), |     modifier = Modifier.fillMaxWidth(), | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue