diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/editlocation/EditLocationScreen.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/editlocation/EditLocationScreen.kt index 9389db33c..629cc434a 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/editlocation/EditLocationScreen.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/editlocation/EditLocationScreen.kt @@ -127,6 +127,23 @@ fun EditLocationScreen( append(" (${effectiveOpenMeteoModel.displayName})") } } + + val effectiveAlertSource = uiState.selectedAlertSource ?: uiState.location.alertSource + val selectedAlertSourceString = buildString { + append(effectiveAlertSource.displayName) + effectiveAlertSource.countryNameRes?.let { + append(" (${stringResource(it)})") + } + } + + val effectiveAirQualitySource = + uiState.selectedAirQualitySource ?: uiState.location.airQualitySource + val selectedAirQualitySourceString = buildString { + append(effectiveAlertSource.displayName) + effectiveAirQualitySource.countryNameRes?.let { + append(" (${stringResource(it)})") + } + } LargeTopBarScaffold( title = stringResource(R.string.location_edit), navigationIcon = { NavigateUpBtn(navController) }, @@ -195,8 +212,7 @@ fun EditLocationScreen( ), SettingTile.ActionTile( title = stringResource(R.string.weather_alert_source), - description = uiState.selectedAlertSource?.displayName - ?: uiState.location.alertSource.displayName, + description = selectedAlertSourceString, colorDesc = colorDesc, onClick = { viewModel.showAlertSourcesSheet() @@ -204,8 +220,7 @@ fun EditLocationScreen( ), SettingTile.ActionTile( title = stringResource(R.string.weather_airquality_source), - description = uiState.selectedAirQualitySource?.displayName - ?: uiState.location.airQualitySource.displayName, + description = selectedAirQualitySourceString, colorDesc = colorDesc, onClick = { viewModel.showAirQualitySourcesSheet() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/editlocation/ui/EditLocationBottomSheet.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/editlocation/ui/EditLocationBottomSheet.kt index 403c1ccb7..772d3e41e 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/editlocation/ui/EditLocationBottomSheet.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/editlocation/ui/EditLocationBottomSheet.kt @@ -216,7 +216,8 @@ object EditLocationBottomSheet { var recommendedSources = getSourcesForCountry(countryCode?.uppercase()) - recommendedSources = recommendedSources.filter { Capability.ALERTS in it.capabilities } + recommendedSources = + recommendedSources.filter { Capability.AIR_QUALITY in it.capabilities } val isApiKeyAvailable: (Source) -> Boolean = { source -> if (source.requiresUserApiKey) { @@ -287,6 +288,7 @@ object EditLocationBottomSheet { tiles = sources.filter { it !in recommendedSources }.map { source -> val isSelected = currentSelectedSource == source + SettingTile.ActionTile( leading = { if (isSelected) Symbol( diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/MainScreenBottomSheets.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/MainScreenBottomSheets.kt index 84e3f6e9f..9cba110f9 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/MainScreenBottomSheets.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/MainScreenBottomSheets.kt @@ -47,8 +47,21 @@ object MainScreenBottomSheets { } + val alertSourceString = buildString { + append(location!!.alertSource.fullName) + if (location.alertSource.countryNameRes != null) { + append(" (${stringResource(location.alertSource.countryNameRes)})") + } + } + val airQualitySourceString = buildString { + append(location!!.airQualitySource.fullName) + if (location.airQualitySource.countryNameRes != null) { + append(" (${stringResource(location.airQualitySource.countryNameRes)})") + } + } + ActionBottomSheet( sheetState = sheetState, onCancel = viewModel::hideWeatherSourcesInfoForLocationSheet, @@ -76,7 +89,7 @@ object MainScreenBottomSheets { title = stringResource(R.string.weather_air_quality), tiles = listOf( SettingTile.ActionTile( - title = location.airQualitySource.fullName, + title = airQualitySourceString, description = location.airQualitySource.displayLink, trailing = { SettingsTileIcon(R.drawable.open_in_new_24px) }, onClick = { @@ -92,7 +105,7 @@ object MainScreenBottomSheets { title = "Alerts", tiles = listOf( SettingTile.ActionTile( - title = location.alertSource.fullName, + title = alertSourceString, description = location.alertSource.displayLink, trailing = { SettingsTileIcon(R.drawable.open_in_new_24px) }, onClick = {