Added dew point scale closes #990

This commit is contained in:
PranshulGG committed 2026-08-03 16:33:22 +05:30
1 parent 0f49cff675
commit 3ca2d4e372
3 files changed
+116 -35

No files matched your search

@@ -23,6 +23,7 @@ import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.navigation
import androidx.navigation.navArgument
import com.pranshulgg.weather_master_app.core.model.domain.weather.WeatherBlockType
import com.pranshulgg.weather_master_app.feature.alerts.AlertsScreen
import com.pranshulgg.weather_master_app.feature.blocks.screens.SunMoonScreen
import com.pranshulgg.weather_master_app.feature.blocks.screens.airquality.AirQualityScreen
@@ -72,7 +73,6 @@ fun AppNavHost(
navigation(
route = "root",
startDestination = NavRoutes.MAIN
// startDestination = NavRoutes.alerts("5e8c6c88-e85a-4e76-8d0b-5d1eb2906acd")
) {
composable(
NavRoutes.MAIN
@@ -6,16 +6,20 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ListItem
import androidx.compose.material3.ListItemDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
@@ -23,6 +27,10 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import androidx.navigation.NavController
import com.pranshulgg.weather_master_app.R
import com.pranshulgg.weather_master_app.core.model.weather.TemperatureUnit
import com.pranshulgg.weather_master_app.core.model.weather.uv.toColor
import com.pranshulgg.weather_master_app.core.model.weather.uv.toLabel
import com.pranshulgg.weather_master_app.core.ui.components.AvatarIcon
import com.pranshulgg.weather_master_app.core.ui.components.Gap
import com.pranshulgg.weather_master_app.core.ui.components.LargeTopBarScaffold
import com.pranshulgg.weather_master_app.core.ui.components.NavigateUpBtn
@@ -33,6 +41,7 @@ import com.pranshulgg.weather_master_app.feature.blocks.BlocksScreenViewModel
import com.pranshulgg.weather_master_app.feature.blocks.components.AboutCard
import com.pranshulgg.weather_master_app.feature.blocks.components.AboutCardText
import com.pranshulgg.weather_master_app.feature.blocks.components.NoHourlyDataAvailable
import com.pranshulgg.weather_master_app.feature.blocks.components.ScaleCard
import com.pranshulgg.weather_master_app.feature.blocks.screens.humidity.components.DewPointHourlyCard
import com.pranshulgg.weather_master_app.feature.blocks.screens.humidity.components.HumidityHourlyCard
@@ -61,6 +70,26 @@ fun HumidityScreen(navController: NavController, index: Int = 0, locationId: Str
)
val dewPointScaleText = listOf(
"Dry and comfortable", "Comfortable", "Sticky", "Muggy", "Uncomfortable"
)
val dewPointScaleTemps = listOf(
Pair("~ < 10°C", "< 50°F"),
Pair("~ 10-15°C", "~ 50-59°F"),
Pair("~ 15-20°C:", "~ 59-68°F"),
Pair("~ 20-24°C", "~ 68-75°F"),
Pair("~ > 24°C", "~ > 75°F")
)
val dewPointScaleColors = listOf(
Color(0xFF1565C0),
Color(0xFF42A5F5),
Color(0xFF66BB6A),
Color(0xFFFDD835),
Color(0xFFFB8C00)
)
val date = toDateString(weather.daily[index].time, weather.location.timezone)
val dewPointData = data.map { it.dewPoint }
@@ -107,6 +136,32 @@ fun HumidityScreen(navController: NavController, index: Int = 0, locationId: Str
Gap(14.dp)
AboutCard {
AboutCardText(stringResource(R.string.weather_about_dewpoint))
}
Gap(14.dp)
ScaleCard {
dewPointScaleTemps.forEachIndexed { index, pair ->
ListItem(
modifier = Modifier.height(45.dp),
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
leadingContent = {
AvatarIcon(
R.drawable.wb_sunny_24px,
containerColor = dewPointScaleColors[index],
contentColor = Color.White
)
},
headlineContent = { Text(dewPointScaleText[index]) },
trailingContent = {
Text(
if (units.tempUnit == TemperatureUnit.FAHRENHEIT) pair.second else pair.first,
color = MaterialTheme.colorScheme.onSurface,
style = MaterialTheme.typography.bodyLarge
)
}
)
}
}
Gap(WindowInsets.systemBars.asPaddingValues().calculateBottomPadding() + 30.dp)
@@ -4,7 +4,10 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.HorizontalDivider
@@ -22,42 +25,65 @@ import com.pranshulgg.weather_master_app.core.ui.components.Gap
@Composable
fun ChangelogContent(hideSheet: () -> Unit) {
Text(
"Changelog ${BuildConfig.APP_VERSION}",
modifier = Modifier.padding(16.dp),
style = MaterialTheme.typography.headlineMedium,
color = MaterialTheme.colorScheme.onSurface
)
HorizontalDivider()
Gap(5.dp)
ChangelogBox {
ChangelogHeader("New stuff")
ChangelogText("Edit location names")
ChangelogText("Option to choose Air quality and Alert sources")
ChangelogText("New source: WeatherApi.com")
ChangelogText("Changelog dialog should appear on first time install of every new release")
}
ChangelogBox {
ChangelogHeader("Fixed")
ChangelogText("AccuWeather redundant calls for location keys")
ChangelogText("Fixed null value crashes for NWS")
ChangelogText("Search results without time zone should not show")
ChangelogText("Main hourly forecast should also include next day hours #974")
}
ChangelogBox {
ChangelogHeader("Improvements")
ChangelogText("Summary now only shows for the upcoming events and dismisses the past hours")
ChangelogText("Improved source picker")
Column(Modifier.heightIn(max = 700.dp)) {
Text(
"Changelog ${BuildConfig.APP_VERSION}",
modifier = Modifier.padding(16.dp),
style = MaterialTheme.typography.headlineMedium,
color = MaterialTheme.colorScheme.onSurface
)
HorizontalDivider()
}
Column(
Modifier
.verticalScroll(rememberScrollState())
.weight(1f)
) {
Gap(5.dp)
ChangelogBox {
ChangelogHeader("New stuff")
ChangelogText("Edit location names")
ChangelogText("Option to choose Air quality and Alert sources")
ChangelogText("New source: WeatherApi.com, IPMA (Portugal) #983")
ChangelogText("Changelog should appear on first-time install of every new release")
ChangelogText("AccuWeather now available as a search source")
ChangelogText("Widget \"Weather3\" now has options to change the background color to follow current conditions and to display hourly data instead of daily")
ChangelogText("Add dates to the daily forecast on the main screen #975")
ChangelogText("Widget \"Weather 2\" now has options to change text and background color #973")
ChangelogText("Added dew point scale #990")
}
ChangelogBox {
ChangelogHeader("Fixed")
ChangelogText("AccuWeather redundant calls for location keys")
ChangelogText("Fixed null value crashes for NWS")
ChangelogText("Search results without time zone should not show")
ChangelogText("Main hourly forecast should also include next day hours #974")
ChangelogText("Fixed wrong summary for night-time rain")
ChangelogText("Fixed visibility graph overflow @arpitagarwal1301")
ChangelogText("Fixed wrong weather conditions for MeteoFrance @hydrielax")
ChangelogText("Fixed translation crashes")
Button(
onClick = hideSheet, modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
shapes = ButtonDefaults.shapes()
) {
Text(stringResource(R.string.action_ok))
}
ChangelogBox {
ChangelogHeader("Improvements")
ChangelogText("Summary now only shows upcoming events and hides past ones")
ChangelogText("Improved source picker")
ChangelogText("Updated all translations")
ChangelogText("Improved font sizes")
ChangelogText("Few UI tweaks")
ChangelogText("Improved landscape/tablet layout")
}
}
Button(
onClick = hideSheet, modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
shapes = ButtonDefaults.shapes()
) {
Text(stringResource(R.string.action_ok))
}
}
}