From 91b2d3e5ef4df55f518caacbee486cf4163bd7ce Mon Sep 17 00:00:00 2001 From: brandy-kay Date: Tue, 17 Oct 2023 12:43:15 +0300 Subject: [PATCH] completes theming --- .../brandyodhiambo/quench/ui/MainActivity.kt | 18 +- .../brandyodhiambo/quench/ui/MainScreen.kt | 31 ++-- .../quench/util/AlarmSchedularImpl.kt | 10 +- buildSrc/src/main/java/AndroidConfig.kt | 4 +- .../common/domain/model/ReminderTime.kt | 12 +- .../component/WaterIntakeGoalDialog.kt | 62 +++---- .../brandyodhiambo/dao/GoalWaterIntakeDao.kt | 2 +- .../brandyodhiambo/dao/IdealWaterIntakeDao.kt | 2 +- .../com/brandyodhiambo/dao/ReminderTimeDao.kt | 2 +- .../entity/ReminderTimeEntity.kt | 12 +- .../designsystem/components/CircularButton.kt | 16 +- .../components/NotificationSwitcher.kt | 6 +- .../designsystem/theme/Color.kt | 1 - .../designsystem/theme/Shape.kt | 2 +- .../designsystem/theme/Theme.kt | 24 +-- .../brandyodhiambo/designsystem/theme/Type.kt | 35 ++-- .../repository/AchievementRepositoryImpl.kt | 2 +- .../GoalWaterIntakeRepositoryImpl.kt | 4 +- .../IdealWaterInkateRepositoryImpl.kt | 6 +- .../repository/ReminderTimeRepositoryImpl.kt | 14 +- .../repository/SelectedDrinkRepositoryImpl.kt | 2 +- .../repository/SleepTimeRepositoryImpl.kt | 4 +- .../data/repository/WakeTimeRepositoryImpl.kt | 4 +- .../presentation/component/CircularRating.kt | 20 +-- .../component/CongratulationDialog.kt | 29 ++-- .../presentation/component/DeleteDialog.kt | 20 +-- .../presentation/component/EmptyDialog.kt | 24 ++- .../component/IdealIntakeGoalDialog.kt | 2 - .../component/SelectDrinkDialog.kt | 41 ++--- .../component/TimeSetterDialog.kt | 43 ++--- .../presentation/component/WaterProgress.kt | 1 - .../presentation/homeScreen/HomeScreen.kt | 149 ++++++++--------- .../sleepWakeScreen/SleepAndWakeUpScreen.kt | 43 +++-- .../presentation/AddReminderScreen.kt | 93 ++++++----- .../presentation/NotificationScreen.kt | 74 +++++---- .../settings/presentation/SettingsScreen.kt | 82 +++++----- .../component/CustomCheckingDialog.kt | 24 +-- .../component/CustomReminderDialog.kt | 35 ++-- .../MonthlyStatisticsRepositoryImpl.kt | 2 +- .../WeeklyStatisticsRepositoryImpl.kt | 2 +- .../presentation/StatisticsScreen.kt | 154 +++++++++--------- 41 files changed, 572 insertions(+), 541 deletions(-) diff --git a/app/src/main/java/com/brandyodhiambo/quench/ui/MainActivity.kt b/app/src/main/java/com/brandyodhiambo/quench/ui/MainActivity.kt index e06cbbc..bb84595 100644 --- a/app/src/main/java/com/brandyodhiambo/quench/ui/MainActivity.kt +++ b/app/src/main/java/com/brandyodhiambo/quench/ui/MainActivity.kt @@ -61,24 +61,24 @@ class MainActivity : ComponentActivity() { setContent { createChannel(this) QuenchTheme( - theme = Theme.FOLLOW_SYSTEM.themeValue, + theme = Theme.FOLLOW_SYSTEM.themeValue ) { Surface( modifier = Modifier.fillMaxSize(), - color = MaterialTheme.colors.background, + color = MaterialTheme.colors.background ) { startAchievementOnetimeWorkRequest(applicationContext) startDailyOnetimeWorkRequest(applicationContext) startMonthlyOnetimeWorkRequest(applicationContext) startWeeklyOnetimeWorkRequest(applicationContext) - val reminderTimeFromDb = viewModel.reminderTime.observeAsState() - val hours = reminderTimeFromDb.value?.hour ?: 0 - val minutes = reminderTimeFromDb.value?.minute ?: 0 + val reminderTimeFromDb = viewModel.reminderTime?.observeAsState() + val hours = reminderTimeFromDb?.value?.hour ?: 0 + val minutes = reminderTimeFromDb?.value?.minute ?: 0 val scheduler = AlarmSchedularImpl(this) val alarmItem = AlarmData( time = LocalDateTime.now().withHour(hours).withMinute(minutes), - message = getString(R.string.it_s_time_to_drink_water), + message = getString(R.string.it_s_time_to_drink_water) ) alarmItem.let(scheduler::schedule) val navController = rememberAnimatedNavController() @@ -90,9 +90,9 @@ class MainActivity : ComponentActivity() { engine = navHostEngine, dependenciesContainerBuilder = { dependency( - currentNavigator(), + currentNavigator() ) - }, + } ) } } @@ -103,7 +103,7 @@ class MainActivity : ComponentActivity() { fun DestinationScope<*>.currentNavigator(): FeatureNavigator { return FeatureNavigator( navController = navController, - navGraph = navBackStackEntry.destination.navGraph(), + navGraph = navBackStackEntry.destination.navGraph() ) } diff --git a/app/src/main/java/com/brandyodhiambo/quench/ui/MainScreen.kt b/app/src/main/java/com/brandyodhiambo/quench/ui/MainScreen.kt index cebe199..68e9139 100644 --- a/app/src/main/java/com/brandyodhiambo/quench/ui/MainScreen.kt +++ b/app/src/main/java/com/brandyodhiambo/quench/ui/MainScreen.kt @@ -51,38 +51,38 @@ import kotlinx.coroutines.launch @Destination fun MainScreen( navigator: DestinationsNavigator, - settingsNavigator: SettingsNavigator, + settingsNavigator: SettingsNavigator ) { Scaffold { paddingValue -> val tabs = listOf( TabItem.Home(navigator = navigator), TabItem.Statistic(navigator = navigator), - TabItem.Settings(navigator = settingsNavigator), + TabItem.Settings(navigator = settingsNavigator) ) val pagerState = rememberPagerState() Column( modifier = Modifier.fillMaxWidth(), - horizontalAlignment = Alignment.CenterHorizontally, + horizontalAlignment = Alignment.CenterHorizontally ) { TopAppBar( title = { Text( text = "Quench", style = MaterialTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.onPrimary, + color = MaterialTheme.colorScheme.onPrimary ) }, modifier = Modifier.fillMaxWidth(), colors = TopAppBarDefaults.topAppBarColors( containerColor = MaterialTheme.colorScheme.primary, - titleContentColor = MaterialTheme.colorScheme.onPrimary, - ), + titleContentColor = MaterialTheme.colorScheme.onPrimary + ) ) CustomTab(tabs = tabs, pagerState = pagerState) TabContent( tabs = tabs, - pagerState = pagerState, + pagerState = pagerState ) } } @@ -92,11 +92,11 @@ fun MainScreen( @Composable fun TabContent( tabs: List, - pagerState: PagerState, + pagerState: PagerState ) { HorizontalPager(count = tabs.size, state = pagerState) { page -> tabs[page].screen( - onClick = { }, + onClick = { } ) } } @@ -105,7 +105,7 @@ fun TabContent( @Composable fun CustomTab( tabs: List, - pagerState: PagerState, + pagerState: PagerState ) { val scope = rememberCoroutineScope() @@ -116,15 +116,17 @@ fun CustomTab( indicator = { tabPositions -> TabRowDefaults.Indicator( Modifier.pagerTabIndicatorOffset(pagerState, tabPositions), + color = MaterialTheme.colorScheme.onPrimary ) - }, + } ) { tabs.forEachIndexed { index, tabItem -> LeadingIconTab( icon = { Icon( painter = painterResource(id = tabItem.icon), - contentDescription = "", + tint = MaterialTheme.colorScheme.onPrimary, + contentDescription = "" ) }, selected = pagerState.currentPage == index, @@ -138,9 +140,10 @@ fun CustomTab( text = tabItem.title, maxLines = 1, overflow = TextOverflow.Ellipsis, - style = MaterialTheme.typography.titleMedium, + style = MaterialTheme.typography.titleSmall, + color = MaterialTheme.colorScheme.onPrimary ) - }, + } ) } } diff --git a/app/src/main/java/com/brandyodhiambo/quench/util/AlarmSchedularImpl.kt b/app/src/main/java/com/brandyodhiambo/quench/util/AlarmSchedularImpl.kt index 36989d5..b94f686 100644 --- a/app/src/main/java/com/brandyodhiambo/quench/util/AlarmSchedularImpl.kt +++ b/app/src/main/java/com/brandyodhiambo/quench/util/AlarmSchedularImpl.kt @@ -23,7 +23,7 @@ import com.brandyodhiambo.common.domain.model.AlarmData import java.time.ZoneId class AlarmSchedularImpl( - private val context: Context, + private val context: Context ) : AlarmSchedular { private val alarmManager = context.getSystemService(AlarmManager::class.java) @@ -39,8 +39,8 @@ class AlarmSchedularImpl( context, item.hashCode(), intent, - PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE, - ), + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE + ) ) } @@ -50,8 +50,8 @@ class AlarmSchedularImpl( context, item.hashCode(), Intent(context, AlarmReceiver::class.java), - PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE, - ), + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE + ) ) } } diff --git a/buildSrc/src/main/java/AndroidConfig.kt b/buildSrc/src/main/java/AndroidConfig.kt index b0d33ab..d6d7d8c 100644 --- a/buildSrc/src/main/java/AndroidConfig.kt +++ b/buildSrc/src/main/java/AndroidConfig.kt @@ -3,6 +3,6 @@ object AndroidConfig { const val minSdk = 26 const val targetSdk = 33 const val compileSdk = 33 - const val versionCode = 2 - const val versionName = "0.0.2" + const val versionCode = 3 + const val versionName = "0.0.3" } diff --git a/core/common/src/main/java/com/brandyodhiambo/common/domain/model/ReminderTime.kt b/core/common/src/main/java/com/brandyodhiambo/common/domain/model/ReminderTime.kt index 0bc128c..cfb73ad 100644 --- a/core/common/src/main/java/com/brandyodhiambo/common/domain/model/ReminderTime.kt +++ b/core/common/src/main/java/com/brandyodhiambo/common/domain/model/ReminderTime.kt @@ -16,10 +16,10 @@ package com.brandyodhiambo.common.domain.model data class ReminderTime( - val hour: Int, - val minute: Int, - val ampm: String, - val isRepeated: Boolean, - val isAllDay: Boolean, - val days: List + val hour: Int?, + val minute: Int?, + val ampm: String?, + val isRepeated: Boolean?, + val isAllDay: Boolean?, + val days: List? ) diff --git a/core/common/src/main/java/com/brandyodhiambo/common/presentation/component/WaterIntakeGoalDialog.kt b/core/common/src/main/java/com/brandyodhiambo/common/presentation/component/WaterIntakeGoalDialog.kt index 994e6d3..bb3ef38 100644 --- a/core/common/src/main/java/com/brandyodhiambo/common/presentation/component/WaterIntakeGoalDialog.kt +++ b/core/common/src/main/java/com/brandyodhiambo/common/presentation/component/WaterIntakeGoalDialog.kt @@ -26,16 +26,17 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material.Card import androidx.compose.material.DropdownMenuItem -import androidx.compose.material.ExperimentalMaterialApi -import androidx.compose.material.ExposedDropdownMenuBox -import androidx.compose.material.ExposedDropdownMenuDefaults -import androidx.compose.material.OutlinedTextField -import androidx.compose.material.Text -import androidx.compose.material.TextButton -import androidx.compose.material.TextFieldDefaults +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExposedDropdownMenuBox +import androidx.compose.material3.ExposedDropdownMenuDefaults import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.getValue @@ -53,7 +54,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.brandyodhiambo.common.R -@OptIn(ExperimentalMaterialApi::class) +@OptIn(ExperimentalMaterial3Api::class) @Composable fun WaterIntakeDialog( modifier: Modifier = Modifier, @@ -62,31 +63,29 @@ fun WaterIntakeDialog( currentWaterIntakeFormText: String, onCurrentWaterIntakeTextChange: (String) -> Unit, onCurrentWaterIntakeFormTextChange: (String) -> Unit, - onOkayClick: () -> Unit, + onOkayClick: () -> Unit ) { Card( shape = MaterialTheme.shapes.medium, modifier = Modifier.padding(10.dp, 5.dp, 10.dp, 10.dp), - elevation = 0.dp, - backgroundColor = MaterialTheme.colorScheme.background, + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { - Column( - ) { + Column() { Image( painter = painterResource(id = R.drawable.ic_cup), contentScale = ContentScale.Fit, colorFilter = ColorFilter.tint( - color = MaterialTheme.colorScheme.secondary, + color = MaterialTheme.colorScheme.secondary ), contentDescription = null, modifier = Modifier .padding(top = 35.dp) .height(70.dp) - .fillMaxWidth(), + .fillMaxWidth() ) Column( - modifier = Modifier.padding(16.dp), + modifier = Modifier.padding(16.dp) ) { Text( text = "Water intake goal", @@ -97,13 +96,14 @@ fun WaterIntakeDialog( maxLines = 2, style = MaterialTheme.typography.labelLarge, overflow = TextOverflow.Ellipsis, + color = MaterialTheme.colorScheme.onBackground ) Spacer(modifier = Modifier.height(8.dp)) Row( Modifier .fillMaxWidth() .padding(top = 10.dp), - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { OutlinedTextField( modifier = Modifier @@ -112,19 +112,19 @@ fun WaterIntakeDialog( value = currentWaterIntakeText, onValueChange = onCurrentWaterIntakeTextChange, keyboardOptions = KeyboardOptions.Default.copy( - keyboardType = KeyboardType.Number, + keyboardType = KeyboardType.Number ), label = { Text( "2810", - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) }, shape = RoundedCornerShape(30.dp), colors = TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colorScheme.primary, - unfocusedBorderColor = MaterialTheme.colorScheme.onBackground, - ), + unfocusedBorderColor = MaterialTheme.colorScheme.onBackground + ) ) val options = listOf("ml", "l") @@ -134,7 +134,7 @@ fun WaterIntakeDialog( expanded = expanded, onExpandedChange = { expanded = !expanded - }, + } ) { OutlinedTextField( modifier = Modifier.fillMaxWidth(), @@ -146,27 +146,27 @@ fun WaterIntakeDialog( label = { Text("ml") }, trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon( - expanded = expanded, + expanded = expanded ) }, shape = RoundedCornerShape(45.dp), colors = TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colorScheme.primary, - unfocusedBorderColor = MaterialTheme.colorScheme.onBackground, - ), + unfocusedBorderColor = MaterialTheme.colorScheme.onBackground + ) ) ExposedDropdownMenu( expanded = expanded, onDismissRequest = { expanded = false - }, + } ) { options.forEach { selectionOption -> DropdownMenuItem( onClick = { onCurrentWaterIntakeFormTextChange(selectionOption) expanded = false - }, + } ) { Text(text = selectionOption) } @@ -180,7 +180,7 @@ fun WaterIntakeDialog( .fillMaxWidth() .padding(top = 10.dp) .background(Color.White), - horizontalArrangement = Arrangement.SpaceAround, + horizontalArrangement = Arrangement.SpaceAround ) { TextButton(onClick = { openCustomDialog.value = false @@ -189,7 +189,7 @@ fun WaterIntakeDialog( "Cancel", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onBackground, - modifier = Modifier.padding(top = 5.dp, bottom = 5.dp), + modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) } TextButton(onClick = { @@ -200,7 +200,7 @@ fun WaterIntakeDialog( "Okay", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.primary, - modifier = Modifier.padding(top = 5.dp, bottom = 5.dp), + modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) } } diff --git a/core/database/src/main/java/com/brandyodhiambo/dao/GoalWaterIntakeDao.kt b/core/database/src/main/java/com/brandyodhiambo/dao/GoalWaterIntakeDao.kt index 60a7682..29051e7 100644 --- a/core/database/src/main/java/com/brandyodhiambo/dao/GoalWaterIntakeDao.kt +++ b/core/database/src/main/java/com/brandyodhiambo/dao/GoalWaterIntakeDao.kt @@ -29,7 +29,7 @@ interface GoalWaterIntakeDao { suspend fun insertGoalWaterIntake(goalWaterIntake: GoalWaterIntakeEntity) @Query("SELECT *FROM goal_table") - fun getGoalWaterIntake(): LiveData + fun getGoalWaterIntake(): LiveData @Delete suspend fun deleteGoalIntake(goalWaterIntake: GoalWaterIntakeEntity) diff --git a/core/database/src/main/java/com/brandyodhiambo/dao/IdealWaterIntakeDao.kt b/core/database/src/main/java/com/brandyodhiambo/dao/IdealWaterIntakeDao.kt index 1ce3479..ee6b3ca 100644 --- a/core/database/src/main/java/com/brandyodhiambo/dao/IdealWaterIntakeDao.kt +++ b/core/database/src/main/java/com/brandyodhiambo/dao/IdealWaterIntakeDao.kt @@ -28,7 +28,7 @@ interface IdealWaterIntakeDao { suspend fun insertIdealWaterIntake(idealWaterIntake: IdealWaterIntakeEntity) @Query("SELECT *FROM ideal_water_table") - fun getIdealWaterIntake(): LiveData + fun getIdealWaterIntake(): LiveData @Delete suspend fun deleteIdealIntake(idealWaterIntake: IdealWaterIntakeEntity) diff --git a/core/database/src/main/java/com/brandyodhiambo/dao/ReminderTimeDao.kt b/core/database/src/main/java/com/brandyodhiambo/dao/ReminderTimeDao.kt index da38d67..5b86c49 100644 --- a/core/database/src/main/java/com/brandyodhiambo/dao/ReminderTimeDao.kt +++ b/core/database/src/main/java/com/brandyodhiambo/dao/ReminderTimeDao.kt @@ -29,7 +29,7 @@ interface ReminderTimeDao { suspend fun insertReminderTime(reminderTime: ReminderTimeEntity) @Query("SELECT *FROM reminder_table") - fun getReminderTime(): LiveData + fun getReminderTime(): LiveData @Delete suspend fun deleteReminderTime(reminderTime: ReminderTimeEntity) diff --git a/core/database/src/main/java/com/brandyodhiambo/entity/ReminderTimeEntity.kt b/core/database/src/main/java/com/brandyodhiambo/entity/ReminderTimeEntity.kt index 395574c..1a6d090 100644 --- a/core/database/src/main/java/com/brandyodhiambo/entity/ReminderTimeEntity.kt +++ b/core/database/src/main/java/com/brandyodhiambo/entity/ReminderTimeEntity.kt @@ -24,10 +24,10 @@ import com.brandyodhiambo.common.domain.model.Days data class ReminderTimeEntity( @PrimaryKey(autoGenerate = true) val id: Int = 0, - val hour: Int, - val minute: Int, - val ampm: String, - val isRepeated: Boolean, - val isAllDay: Boolean, - val days: List + val hour: Int?, + val minute: Int?, + val ampm: String?, + val isRepeated: Boolean?, + val isAllDay: Boolean?, + val days: List? ) diff --git a/designsystem/src/main/java/com/brandyodhiambo/designsystem/components/CircularButton.kt b/designsystem/src/main/java/com/brandyodhiambo/designsystem/components/CircularButton.kt index 2b3cc11..a783498 100644 --- a/designsystem/src/main/java/com/brandyodhiambo/designsystem/components/CircularButton.kt +++ b/designsystem/src/main/java/com/brandyodhiambo/designsystem/components/CircularButton.kt @@ -15,7 +15,6 @@ */ package com.brandyodhiambo.designsystem.components -import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -25,21 +24,21 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.Card import androidx.compose.material.ExperimentalMaterialApi +import androidx.compose.material.Icon import androidx.compose.material.Text +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import com.brandyodhiambo.designsystem.theme.roboto @OptIn(ExperimentalMaterialApi::class) @Composable fun CircularButton( backgroundColor: Color, + contentColor: Color, title: String, icon: Int, onClick: () -> Unit @@ -58,12 +57,17 @@ fun CircularButton( verticalArrangement = Arrangement.Center, modifier = Modifier.padding(4.dp) ) { - Image( + Icon( painter = painterResource(id = icon), + tint = contentColor, contentDescription = null ) Spacer(modifier = Modifier.height(8.dp)) - Text(text = title, fontSize = 12.sp, fontFamily = roboto, fontWeight = FontWeight.Bold) + Text( + text = title, + style = MaterialTheme.typography.bodySmall, + color = contentColor + ) } } } diff --git a/designsystem/src/main/java/com/brandyodhiambo/designsystem/components/NotificationSwitcher.kt b/designsystem/src/main/java/com/brandyodhiambo/designsystem/components/NotificationSwitcher.kt index aeaec68..4d23708 100644 --- a/designsystem/src/main/java/com/brandyodhiambo/designsystem/components/NotificationSwitcher.kt +++ b/designsystem/src/main/java/com/brandyodhiambo/designsystem/components/NotificationSwitcher.kt @@ -68,7 +68,7 @@ fun NotificationSwitcher( .height(size) .clip(shape = parentShape) .clickable { onToggle() } - .background(color = if (isOn) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground) + .background(color = if (isOn) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground.copy(alpha = 0.2f)) ) { Box( modifier = Modifier @@ -98,7 +98,7 @@ fun NotificationSwitcher( modifier = Modifier.size(iconSize), imageVector = Icons.Default.Notifications, contentDescription = "Notification_icon", - tint = if (isOn) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground + tint = if (isOn) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground.copy(alpha = 0.2f) ) } @@ -112,7 +112,7 @@ fun NotificationSwitcher( modifier = Modifier.size(iconSize), imageVector = Icons.Default.Star, contentDescription = "Notification_icon", - tint = if (isOn) MaterialTheme.colorScheme.onBackground else MaterialTheme.colorScheme.primary + tint = if (isOn) MaterialTheme.colorScheme.onBackground.copy(alpha = 0.02f) else MaterialTheme.colorScheme.primary ) } } diff --git a/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Color.kt b/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Color.kt index aafefec..f8e82f1 100644 --- a/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Color.kt +++ b/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Color.kt @@ -34,4 +34,3 @@ val BackgroundDarkColor = Color(0xff121212) val ErrorColor = Color(0xFFFF0000) val OnErrorColor = Color(0xFF000000) - diff --git a/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Shape.kt b/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Shape.kt index 2d24926..306f0e4 100644 --- a/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Shape.kt +++ b/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Shape.kt @@ -22,5 +22,5 @@ import androidx.compose.ui.unit.dp val Shapes = Shapes( small = RoundedCornerShape(4.dp), medium = RoundedCornerShape(8.dp), - large = RoundedCornerShape(12.dp), + large = RoundedCornerShape(12.dp) ) diff --git a/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Theme.kt b/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Theme.kt index 23bf4ec..cc74224 100644 --- a/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Theme.kt +++ b/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Theme.kt @@ -46,7 +46,7 @@ private val LightColors = lightColorScheme( secondaryContainer = PrimaryColor, onSecondaryContainer = Color.White, error = ErrorColor, - onError = OnErrorColor, + onError = OnErrorColor ) private val DarkColors = darkColorScheme( @@ -65,13 +65,13 @@ private val DarkColors = darkColorScheme( secondaryContainer = PrimaryColor, onSecondaryContainer = Color.White, error = ErrorColor, - onError = OnErrorColor, + onError = OnErrorColor ) @Composable fun QuenchTheme( theme: Int, - content: @Composable () -> Unit, + content: @Composable () -> Unit ) { val autoColors = if (isSystemInDarkTheme()) DarkColors else LightColors @@ -97,10 +97,10 @@ fun QuenchTheme( SideEffect { systemUiController.setSystemBarsColor( - color = colors.primary, + color = colors.primary ) systemUiController.setNavigationBarColor( - color = colors.background, + color = colors.background ) } @@ -108,7 +108,7 @@ fun QuenchTheme( colorScheme = colors, typography = Typography, shapes = Shapes, - content = content, + content = content ) } @@ -117,18 +117,18 @@ private fun supportsDynamicTheming() = Build.VERSION.SDK_INT >= Build.VERSION_CO // To be used to set the preferred theme inside settings enum class Theme( - val themeValue: Int, + val themeValue: Int ) { MATERIAL_YOU( - themeValue = 12, + themeValue = 12 ), FOLLOW_SYSTEM( - themeValue = AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM, + themeValue = AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM ), LIGHT_THEME( - themeValue = AppCompatDelegate.MODE_NIGHT_NO, + themeValue = AppCompatDelegate.MODE_NIGHT_NO ), DARK_THEME( - themeValue = AppCompatDelegate.MODE_NIGHT_YES, - ), + themeValue = AppCompatDelegate.MODE_NIGHT_YES + ) } diff --git a/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Type.kt b/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Type.kt index 3a94506..a854f58 100644 --- a/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Type.kt +++ b/designsystem/src/main/java/com/brandyodhiambo/designsystem/theme/Type.kt @@ -39,100 +39,97 @@ val Typography = Typography( fontWeight = FontWeight.W400, fontSize = 57.sp, lineHeight = 64.sp, - letterSpacing = (-0.25).sp, + letterSpacing = (-0.25).sp ), displayMedium = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W400, fontSize = 45.sp, - lineHeight = 52.sp, + lineHeight = 52.sp ), displaySmall = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W400, fontSize = 36.sp, - lineHeight = 44.sp, + lineHeight = 44.sp ), headlineLarge = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W800, fontSize = 32.sp, - lineHeight = 40.sp, + lineHeight = 40.sp ), headlineMedium = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W800, fontSize = 28.sp, - lineHeight = 36.sp, + lineHeight = 36.sp ), headlineSmall = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W800, fontSize = 24.sp, - lineHeight = 32.sp, + lineHeight = 32.sp ), titleLarge = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W800, fontSize = 22.sp, - lineHeight = 28.sp, + lineHeight = 28.sp ), titleMedium = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W800, fontSize = 16.sp, lineHeight = 24.sp, - letterSpacing = 0.1.sp, + letterSpacing = 0.1.sp ), titleSmall = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W800, fontSize = 14.sp, lineHeight = 20.sp, - letterSpacing = 0.1.sp, + letterSpacing = 0.1.sp ), bodyLarge = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W400, fontSize = 16.sp, lineHeight = 24.sp, - letterSpacing = 0.5.sp, + letterSpacing = 0.5.sp ), bodyMedium = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W400, fontSize = 14.sp, lineHeight = 20.sp, - letterSpacing = 0.25.sp, + letterSpacing = 0.25.sp ), bodySmall = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W400, fontSize = 12.sp, lineHeight = 16.sp, - letterSpacing = 0.4.sp, + letterSpacing = 0.4.sp ), labelLarge = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W400, fontSize = 14.sp, lineHeight = 20.sp, - letterSpacing = 0.1.sp, + letterSpacing = 0.1.sp ), labelMedium = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W400, fontSize = 12.sp, lineHeight = 16.sp, - letterSpacing = 0.5.sp, + letterSpacing = 0.5.sp ), labelSmall = TextStyle( fontFamily = roboto, fontWeight = FontWeight.W500, fontSize = 10.sp, - lineHeight = 16.sp, - ), + lineHeight = 16.sp + ) ) - - - diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/AchievementRepositoryImpl.kt b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/AchievementRepositoryImpl.kt index c25df1d..275c8ce 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/AchievementRepositoryImpl.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/AchievementRepositoryImpl.kt @@ -24,7 +24,7 @@ import com.brandyodhiambo.home.data.mapper.toAchievement import com.brandyodhiambo.home.data.mapper.toAchievementsEntity class AchievementRepositoryImpl( - private val achievementDao: AchievementDao, + private val achievementDao: AchievementDao ) : AchievementRepository { override suspend fun insertAchievement(achievement: Achievement) { achievementDao.insertAchievement(achievement.toAchievementsEntity()) diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/GoalWaterIntakeRepositoryImpl.kt b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/GoalWaterIntakeRepositoryImpl.kt index 5434e81..e022ad0 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/GoalWaterIntakeRepositoryImpl.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/GoalWaterIntakeRepositoryImpl.kt @@ -43,8 +43,8 @@ class GoalWaterIntakeRepositoryImpl( } override fun getGoalWaterIntake(): LiveData { - return goalWaterIntakeDao.getGoalWaterIntake().map { goalWaterIntakeEntity-> - goalWaterIntakeEntity.toGoalWaterIntake() + return goalWaterIntakeDao.getGoalWaterIntake().map { goalWaterIntakeEntity -> + goalWaterIntakeEntity?.toGoalWaterIntake() } } } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/IdealWaterInkateRepositoryImpl.kt b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/IdealWaterInkateRepositoryImpl.kt index 18ea003..360abc3 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/IdealWaterInkateRepositoryImpl.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/IdealWaterInkateRepositoryImpl.kt @@ -24,7 +24,7 @@ import com.brandyodhiambo.home.data.mapper.toIdealWaterIntake import com.brandyodhiambo.home.data.mapper.toIdealWaterIntakeEntity class IdealWaterInkateRepositoryImpl( - private val idealWaterIntakeDao: IdealWaterIntakeDao, + private val idealWaterIntakeDao: IdealWaterIntakeDao ) : IdealWaterIntakeRepository { override suspend fun insertIdealWaterIntake(idealWaterIntake: IdealWaterIntake) { @@ -36,7 +36,7 @@ class IdealWaterInkateRepositoryImpl( idealWaterIntakeDao.updateIdealIntake( entityData.id, entityData.waterIntake.toString(), - entityData.form, + entityData.form ) } @@ -50,7 +50,7 @@ class IdealWaterInkateRepositoryImpl( override fun getIdealWaterIntake(): LiveData { return idealWaterIntakeDao.getIdealWaterIntake().map { idealWaterIntakeEntity -> - idealWaterIntakeEntity.toIdealWaterIntake() + idealWaterIntakeEntity?.toIdealWaterIntake() } } } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/ReminderTimeRepositoryImpl.kt b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/ReminderTimeRepositoryImpl.kt index f1bd2e1..bed9a9a 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/ReminderTimeRepositoryImpl.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/ReminderTimeRepositoryImpl.kt @@ -24,7 +24,7 @@ import com.brandyodhiambo.home.data.mapper.toReminderEntity import com.brandyodhiambo.home.data.mapper.toReminderTime class ReminderTimeRepositoryImpl( - private val reminderTimeDao: ReminderTimeDao, + private val reminderTimeDao: ReminderTimeDao ) : ReminderTimeRepository { override suspend fun insertReminderTime(reminderTime: ReminderTime) { reminderTimeDao.insertReminderTime(reminderTime.toReminderEntity()) @@ -36,16 +36,16 @@ class ReminderTimeRepositoryImpl( id = entityData.id, hours = entityData.hour.toString(), minutes = entityData.minute.toString(), - ampm = entityData.ampm, - isRepeated = entityData.isRepeated, - isAllDay = entityData.isAllDay, - days = entityData.days, + ampm = entityData.ampm ?: "", + isRepeated = entityData.isRepeated ?: false, + isAllDay = entityData.isAllDay ?: false, + days = entityData.days ?: listOf() ) } override fun getReminderTime(): LiveData { - return reminderTimeDao.getReminderTime().map { - it.toReminderTime() + return reminderTimeDao.getReminderTime().map { reminderTimeEntity -> + reminderTimeEntity?.toReminderTime() } } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/SelectedDrinkRepositoryImpl.kt b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/SelectedDrinkRepositoryImpl.kt index 1355115..6d67b12 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/SelectedDrinkRepositoryImpl.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/SelectedDrinkRepositoryImpl.kt @@ -24,7 +24,7 @@ import com.brandyodhiambo.home.data.mapper.toSelectedDrink import com.brandyodhiambo.home.data.mapper.toSelectedDrinkEntity class SelectedDrinkRepositoryImpl( - private val selectedDrinkDao: SelectedDrinkDao, + private val selectedDrinkDao: SelectedDrinkDao ) : SelectedDrinkRepository { override fun getSelectedDrink(): LiveData> { return selectedDrinkDao.getSelectedDrink().map { selectedDrinkEntity -> diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/SleepTimeRepositoryImpl.kt b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/SleepTimeRepositoryImpl.kt index 9861c1e..754103e 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/SleepTimeRepositoryImpl.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/SleepTimeRepositoryImpl.kt @@ -24,7 +24,7 @@ import com.brandyodhiambo.home.data.mapper.toSleepTime import com.brandyodhiambo.home.data.mapper.toSleepTimeEntity class SleepTimeRepositoryImpl( - private val sleepTimeDao: SleepTimeDao, + private val sleepTimeDao: SleepTimeDao ) : SleepTimeRepository { override suspend fun insertSleepTime(sleepTime: SleepTime) { sleepTimeDao.insertSleepTime(sleepTime.toSleepTimeEntity()) @@ -36,7 +36,7 @@ class SleepTimeRepositoryImpl( id = entityResult.id, hours = entityResult.hour.toString(), minutes = entityResult.minute.toString(), - ampm = entityResult.ampm, + ampm = entityResult.ampm ) } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/WakeTimeRepositoryImpl.kt b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/WakeTimeRepositoryImpl.kt index c0e2a57..34abaa5 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/WakeTimeRepositoryImpl.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/data/repository/WakeTimeRepositoryImpl.kt @@ -24,7 +24,7 @@ import com.brandyodhiambo.home.data.mapper.toWakeTime import com.brandyodhiambo.home.data.mapper.toWakeTimeEntity class WakeTimeRepositoryImpl( - private val wakeTimeDao: WakeTimeDao, + private val wakeTimeDao: WakeTimeDao ) : WakeTimeRepository { override suspend fun insertWakeTime(wakeTime: WakeTime) { wakeTimeDao.insertWakeTime(wakeTime.toWakeTimeEntity()) @@ -36,7 +36,7 @@ class WakeTimeRepositoryImpl( id = entityData.id, hours = entityData.hour.toString(), minutes = entityData.minute.toString(), - ampm = entityData.ampm, + ampm = entityData.ampm ) } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/CircularRating.kt b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/CircularRating.kt index ba6fdfe..c008130 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/CircularRating.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/CircularRating.kt @@ -51,7 +51,7 @@ fun CircularRating( color: Color = MaterialTheme.colorScheme.primary, strokeWidth: Dp = 8.dp, animationDuration: Int = 1000, - animDelay: Int = 0, + animDelay: Int = 0 ) { var animationPlayed by remember { mutableStateOf(false) @@ -61,8 +61,8 @@ fun CircularRating( targetValue = if (animationPlayed) percentage else 0f, animationSpec = tween( durationMillis = animationDuration, - delayMillis = animDelay, - ), + delayMillis = animDelay + ) ) LaunchedEffect(key1 = true) { @@ -71,32 +71,32 @@ fun CircularRating( Box( contentAlignment = Alignment.Center, - modifier = Modifier.size(radius * 2f), + modifier = Modifier.size(radius * 2f) ) { Canvas( modifier = Modifier - .size(radius * 2f), + .size(radius * 2f) ) { drawArc( color = color, startAngle = 90f, sweepAngle = (360 * (currentPercentage.value * 0.01)).toFloat(), useCenter = false, - style = Stroke(strokeWidth.toPx(), cap = StrokeCap.Round), + style = Stroke(strokeWidth.toPx(), cap = StrokeCap.Round) ) } Column( - horizontalAlignment = Alignment.CenterHorizontally, + horizontalAlignment = Alignment.CenterHorizontally ) { Text( text = "$drunk /$goal ml", color = MaterialTheme.colorScheme.primary, - style = MaterialTheme.typography.labelMedium, + style = MaterialTheme.typography.labelMedium ) Text( text = " You have completed ${(currentPercentage.value * number).toInt()}% of daily target", - color = Color.Gray, - style = MaterialTheme.typography.labelSmall, + color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.2f), + style = MaterialTheme.typography.labelSmall ) } } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/CongratulationDialog.kt b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/CongratulationDialog.kt index 8c9ac65..88a73b1 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/CongratulationDialog.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/CongratulationDialog.kt @@ -15,7 +15,6 @@ */ package com.brandyodhiambo.home.presentation.component -import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -25,9 +24,11 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.Card import androidx.compose.material.Text import androidx.compose.material.TextButton +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -40,28 +41,28 @@ import com.brandyodhiambo.common.R @Composable fun CongratulationsDialog( onOkayClicked: () -> Unit, - onCancelClicked: () -> Unit, + onCancelClicked: () -> Unit ) { val context = LocalContext.current Card( modifier = Modifier.padding(10.dp, 5.dp, 10.dp, 10.dp), shape = RoundedCornerShape(12.dp), - elevation = 8.dp, + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { Column( - modifier = Modifier.fillMaxWidth(), + modifier = Modifier.fillMaxWidth() ) { Box( modifier = Modifier .fillMaxWidth() - .height(300.dp), + .height(300.dp) ) { - Image( + Icon( modifier = Modifier .fillMaxWidth() .height(300.dp), painter = painterResource(id = R.drawable.congratulations), - contentDescription = null, + contentDescription = null ) } @@ -70,16 +71,16 @@ fun CongratulationsDialog( .fillMaxWidth() .padding(top = 10.dp) .background(Color.White), - horizontalArrangement = Arrangement.SpaceAround, + horizontalArrangement = Arrangement.SpaceAround ) { TextButton(onClick = { onCancelClicked() }) { Text( "Cancel", - style = MaterialTheme.typography.labelLarge, - color = Color.Black, - modifier = Modifier.padding(top = 5.dp, bottom = 5.dp), + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.onBackground, + modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) } TextButton(onClick = { @@ -87,9 +88,9 @@ fun CongratulationsDialog( }) { Text( "Okay", - style = MaterialTheme.typography.labelLarge, + style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.primary, - modifier = Modifier.padding(top = 5.dp, bottom = 5.dp), + modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) } } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/DeleteDialog.kt b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/DeleteDialog.kt index a4dfdc8..346ed84 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/DeleteDialog.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/DeleteDialog.kt @@ -24,12 +24,8 @@ import androidx.compose.material.TextButton import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import com.brandyodhiambo.designsystem.theme.roboto @Composable fun DeleteDialog( @@ -38,19 +34,19 @@ fun DeleteDialog( onConfirmClick: (Int) -> Unit ) { AlertDialog( - backgroundColor = Color.White, + backgroundColor = MaterialTheme.colorScheme.background, onDismissRequest = { onDismiss() }, title = { Text( text = "Delete Drink", textAlign = TextAlign.Center, - fontSize = 20.sp, - fontFamily = roboto + style = MaterialTheme.typography.titleMedium, + color = MaterialTheme.colorScheme.onBackground ) }, text = { Divider( - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.5f), modifier = Modifier .fillMaxWidth() .padding(top = 5.dp, bottom = 5.dp) @@ -69,8 +65,8 @@ fun DeleteDialog( }) { Text( "Confirm", - style = MaterialTheme.typography.labelLarge, - color = Color.Black, + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) } @@ -81,8 +77,8 @@ fun DeleteDialog( }) { Text( "Cancel", - style = MaterialTheme.typography.labelLarge, - color = Color.Black, + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/EmptyDialog.kt b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/EmptyDialog.kt index 4b1ef88..df8eedd 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/EmptyDialog.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/EmptyDialog.kt @@ -24,26 +24,22 @@ import androidx.compose.material.TextButton import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import com.brandyodhiambo.designsystem.theme.roboto @Composable fun EmptyDialog( onDismiss: () -> Unit, - onConfirmClick: () -> Unit, + onConfirmClick: () -> Unit ) { AlertDialog( - backgroundColor = Color.White, + backgroundColor = MaterialTheme.colorScheme.background, onDismissRequest = { onDismiss() }, title = { Text( text = "No Drinks", textAlign = TextAlign.Center, - fontSize = 20.sp, - fontFamily = roboto, + style = MaterialTheme.typography.titleMedium ) }, text = { @@ -51,14 +47,14 @@ fun EmptyDialog( color = MaterialTheme.colorScheme.onBackground, modifier = Modifier .fillMaxWidth() - .padding(top = 5.dp, bottom = 5.dp), + .padding(top = 5.dp, bottom = 5.dp) ) Text( "You have no drinks in your list. Add a drink to get started.", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.padding(top = 5.dp, bottom = 5.dp), - textAlign = TextAlign.Center, + textAlign = TextAlign.Center ) }, confirmButton = { @@ -67,9 +63,9 @@ fun EmptyDialog( }) { Text( "Confirm", - style = MaterialTheme.typography.labelLarge, + style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onBackground, - modifier = Modifier.padding(top = 5.dp, bottom = 5.dp), + modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) } }, @@ -79,11 +75,11 @@ fun EmptyDialog( }) { Text( "Cancel", - style = MaterialTheme.typography.labelLarge, + style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onBackground, - modifier = Modifier.padding(top = 5.dp, bottom = 5.dp), + modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) } - }, + } ) } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/IdealIntakeGoalDialog.kt b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/IdealIntakeGoalDialog.kt index 1b6df16..7d2291a 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/IdealIntakeGoalDialog.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/IdealIntakeGoalDialog.kt @@ -49,12 +49,10 @@ import androidx.compose.ui.graphics.Color.Companion.LightGray import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import com.brandyodhiambo.common.R @OptIn(ExperimentalMaterialApi::class) diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/SelectDrinkDialog.kt b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/SelectDrinkDialog.kt index afdf28b..0d4984b 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/SelectDrinkDialog.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/SelectDrinkDialog.kt @@ -15,8 +15,6 @@ */ package com.brandyodhiambo.home.presentation.component -import android.os.Build -import androidx.annotation.RequiresApi import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.clickable @@ -31,10 +29,11 @@ import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.items import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.Card -import androidx.compose.material.Text -import androidx.compose.material.TextButton +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.getValue @@ -43,16 +42,13 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import com.brandyodhiambo.common.R import com.vanpra.composematerialdialogs.MaterialDialog import com.vanpra.composematerialdialogs.MaterialDialogState @@ -118,11 +114,10 @@ fun SelectDrinkComposable( Card( shape = RoundedCornerShape(10.dp), modifier = Modifier.padding(10.dp, 5.dp, 5.dp, 5.dp), - elevation = 8.dp + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { Column( modifier - .background(MaterialTheme.colorScheme.background) .padding(8.dp) ) { Text( @@ -133,7 +128,8 @@ fun SelectDrinkComposable( .fillMaxWidth(), maxLines = 2, style = MaterialTheme.typography.titleMedium, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, + color = MaterialTheme.colorScheme.onBackground ) Spacer(modifier = Modifier.height(12.dp)) LazyVerticalGrid(columns = GridCells.Fixed(count = 4)) { @@ -151,8 +147,7 @@ fun SelectDrinkComposable( Row( Modifier .fillMaxWidth() - .padding(top = 10.dp) - .background(Color.White), + .padding(top = 10.dp), horizontalArrangement = Arrangement.SpaceAround ) { TextButton(onClick = { @@ -160,7 +155,7 @@ fun SelectDrinkComposable( }) { Text( "Cancel", - style = MaterialTheme.typography.labelLarge, + style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) @@ -171,7 +166,7 @@ fun SelectDrinkComposable( }) { Text( "Okay", - style = MaterialTheme.typography.labelLarge, + style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.primary, modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) @@ -214,9 +209,9 @@ fun SelectCard( modifier = Modifier .padding(top = 5.dp), maxLines = 2, - fontSize = 14.sp, - fontWeight = FontWeight.W300, - overflow = TextOverflow.Ellipsis + style = MaterialTheme.typography.labelMedium, + overflow = TextOverflow.Ellipsis, + color = MaterialTheme.colorScheme.onBackground ) if (openTimeDialog.showing) { TimeDialog( @@ -239,10 +234,16 @@ fun TimeDialog( dialogState = openDialog, backgroundColor = MaterialTheme.colorScheme.background.copy(alpha = 0.67f), buttons = { - positiveButton(text = "Ok", textStyle = TextStyle(color = MaterialTheme.colorScheme.primary)) { + positiveButton( + text = "Ok", + textStyle = TextStyle(color = MaterialTheme.colorScheme.primary) + ) { onCurrentSelectedDrinkTime(pickedTime.format(DateTimeFormatter.ofPattern("HH:mm a"))) } - negativeButton(text = "Cancel", textStyle = TextStyle(color = MaterialTheme.colorScheme.primary)) + negativeButton( + text = "Cancel", + textStyle = TextStyle(color = MaterialTheme.colorScheme.onBackground) + ) } ) { timepicker( diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/TimeSetterDialog.kt b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/TimeSetterDialog.kt index 1eb2ab7..51dcf4f 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/TimeSetterDialog.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/TimeSetterDialog.kt @@ -57,10 +57,10 @@ fun TimeSetterDialog( onCurrentPickerValueChanged: (Hours) -> Unit, onDismiss: () -> Unit, onAllDayClicked: () -> Unit, - onConfirmClick: () -> Unit, + onConfirmClick: () -> Unit ) { AlertDialog( - backgroundColor = Color.White, + backgroundColor = MaterialTheme.colorScheme.background, onDismissRequest = { onDismiss() }, title = { Image( @@ -68,12 +68,12 @@ fun TimeSetterDialog( contentDescription = null, contentScale = ContentScale.Fit, colorFilter = ColorFilter.tint( - color = MaterialTheme.colorScheme.primary, + color = MaterialTheme.colorScheme.primary ), modifier = Modifier .padding(top = 35.dp) .height(70.dp) - .fillMaxWidth(), + .fillMaxWidth() ) }, @@ -88,20 +88,21 @@ fun TimeSetterDialog( maxLines = 2, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.onBackground ) Spacer(modifier = Modifier.height(8.dp)) TimePickerForDialogInHours( currentPickerValueText = currentPickerValueText, onPickerValueChange = { onCurrentPickerValueChanged(it) - }, + } ) Row( Modifier .fillMaxWidth() .padding(top = 10.dp), horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = "Reminder Time", @@ -111,6 +112,7 @@ fun TimeSetterDialog( fontWeight = FontWeight.Bold, maxLines = 2, overflow = TextOverflow.Ellipsis, + color = MaterialTheme.colorScheme.onBackground ) TextButton(onClick = { onAllDayClicked() @@ -122,14 +124,14 @@ fun TimeSetterDialog( modifier = Modifier .padding(top = 5.dp), maxLines = 2, - overflow = TextOverflow.Ellipsis, + overflow = TextOverflow.Ellipsis ) } } Spacer(modifier = Modifier.height(8.dp)) LazyRow( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp) ) { items(reminderDays) { singleDay -> DayItem( @@ -138,7 +140,7 @@ fun TimeSetterDialog( onClick = { singleDay.isSelected = !singleDay.isSelected // get the selected day and add it to the list - }, + } ) } } @@ -150,9 +152,9 @@ fun TimeSetterDialog( }) { Text( "Confirm", - style = MaterialTheme.typography.labelLarge, + style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onBackground, - modifier = Modifier.padding(top = 5.dp, bottom = 5.dp), + modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) } }, @@ -162,19 +164,19 @@ fun TimeSetterDialog( }) { Text( "Cancel", - style = MaterialTheme.typography.labelLarge, + style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onBackground, - modifier = Modifier.padding(top = 5.dp, bottom = 5.dp), + modifier = Modifier.padding(top = 5.dp, bottom = 5.dp) ) } - }, + } ) } @Composable fun TimePickerForDialogInHours( currentPickerValueText: Hours, - onPickerValueChange: (Hours) -> Unit, + onPickerValueChange: (Hours) -> Unit ) { HoursNumberPicker( dividersColor = MaterialTheme.colorScheme.onBackground, @@ -188,15 +190,16 @@ fun TimePickerForDialogInHours( modifier = Modifier.padding(horizontal = 8.dp), textAlign = TextAlign.Center, text = ":", + color = MaterialTheme.colorScheme.onBackground ) }, minutesDivider = { Text( modifier = Modifier.padding(horizontal = 8.dp), textAlign = TextAlign.Center, - text = " ", + text = " " ) - }, + } ) } @@ -211,17 +214,17 @@ fun DayItem(color: Color, text: String, onClick: () -> Unit = {}) { .clickable { onClick() }, - elevation = 8.dp, + elevation = 8.dp ) { Column( horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center, + verticalArrangement = Arrangement.Center ) { Text( text = text, textAlign = TextAlign.Center, color = color, - style = MaterialTheme.typography.labelMedium, + style = MaterialTheme.typography.labelMedium ) } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/WaterProgress.kt b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/WaterProgress.kt index 8f57ac2..9bdec86 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/WaterProgress.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/component/WaterProgress.kt @@ -21,7 +21,6 @@ import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.tween import androidx.compose.foundation.Canvas import androidx.compose.foundation.layout.size -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/homeScreen/HomeScreen.kt b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/homeScreen/HomeScreen.kt index f21800c..c354c27 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/homeScreen/HomeScreen.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/homeScreen/HomeScreen.kt @@ -33,15 +33,16 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material.Card -import androidx.compose.material.Divider -import androidx.compose.material.Icon -import androidx.compose.material.IconButton -import androidx.compose.material.Scaffold -import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Delete +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.Divider +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.State @@ -50,11 +51,10 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import androidx.compose.ui.window.Dialog import androidx.hilt.navigation.compose.hiltViewModel import com.brandyodhiambo.common.R @@ -66,7 +66,6 @@ import com.brandyodhiambo.common.domain.model.ReminderTime import com.brandyodhiambo.common.domain.model.SelectedDrink import com.brandyodhiambo.common.presentation.component.WaterIntakeDialog import com.brandyodhiambo.designsystem.components.CircularButton -import com.brandyodhiambo.designsystem.theme.roboto import com.brandyodhiambo.home.presentation.component.CircularRating import com.brandyodhiambo.home.presentation.component.CongratulationsDialog import com.brandyodhiambo.home.presentation.component.DeleteDialog @@ -80,7 +79,7 @@ import com.ramcosta.composedestinations.annotation.Destination @Destination @Composable fun HomeScreen( - viewModel: HomeViewModel = hiltViewModel(), + viewModel: HomeViewModel = hiltViewModel() ) { val openTimeDialog = remember { mutableStateOf(false) } val openDeleteDialog = remember { mutableStateOf(false) } @@ -108,12 +107,12 @@ fun HomeScreen( val minute = reminderTimeFromDb.value?.minute Scaffold( - backgroundColor = MaterialTheme.colorScheme.primary, + containerColor = MaterialTheme.colorScheme.primary ) { paddingValues -> Box( modifier = Modifier .fillMaxSize() - .padding(paddingValues), + .padding(paddingValues) ) { LazyColumn { item { @@ -123,7 +122,7 @@ fun HomeScreen( waterIntake = waterIntake, form = waterIntakeForm, goalForm = goalForm, - goalWaterIntake = goalWaterIntake, + goalWaterIntake = goalWaterIntake ) } item { @@ -142,16 +141,16 @@ fun HomeScreen( val (amount, taken) = incrementProgressCircle( selectedDrinksFromDB = selectedDrinksFromDB, goalWaterIntake = goalWaterIntake, - viewModel = viewModel, + viewModel = viewModel ) viewModel.deleteAllLevels() viewModel.insertLevel( Level( amountTaken = amount, - waterTaken = taken, - ), + waterTaken = taken + ) ) - }, + } ) } item { @@ -175,7 +174,7 @@ fun HomeScreen( openEmptyStateDialog.value = false selectedDrinkDialog.value = true }, - onDismiss = { openEmptyStateDialog.value = false }, + onDismiss = { openEmptyStateDialog.value = false } ) } } @@ -188,7 +187,7 @@ fun HomeScreen( onConfirmClick = { id -> viewModel.deleteOneSelectedDrink(id) openDeleteDialog.value = false - }, + } ) } } @@ -204,7 +203,7 @@ fun HomeScreen( }, onOkayClicked = { openCongratulationsDialog.value = false - }, + } ) } } @@ -220,7 +219,7 @@ fun HomeScreen( }, onAllDayClicked = { viewModel.onAllDaySelected( - isAllDay = true, + isAllDay = true ) viewModel.reminderDays.value = listOf( Days("M", viewModel.isAllDaySelected.value), @@ -229,7 +228,7 @@ fun HomeScreen( Days("T", viewModel.isAllDaySelected.value), Days("F", viewModel.isAllDaySelected.value), Days("S", viewModel.isAllDaySelected.value), - Days("S", viewModel.isAllDaySelected.value), + Days("S", viewModel.isAllDaySelected.value) ) }, onConfirmClick = { @@ -246,7 +245,7 @@ fun HomeScreen( amPm = ampm, isReapeated = false, isAllDay = viewModel.isAllDaySelected.value, - days = viewModel.reminderDays.value, + days = viewModel.reminderDays.value ) if (viewModel.reminderTime.value != null) { viewModel.deleteAllRemindTime() @@ -258,10 +257,10 @@ fun HomeScreen( ampm = viewModel.reminderSelectedTime.value.ampm, isRepeated = false, isAllDay = viewModel.isAllDaySelected.value, - days = viewModel.reminderDays.value, - ), + days = viewModel.reminderDays.value + ) ) - }, + } ) } } @@ -281,10 +280,10 @@ fun HomeScreen( onOkayClick = { val goalWaterIntakeToInsert = GoalWaterIntake( waterIntake = viewModel.goalWaterIntakeValue.value.toInt(), - form = viewModel.goalWaterForm.value, + form = viewModel.goalWaterForm.value ) viewModel.insertGoalWaterIntake(goalWaterIntakeToInsert) - }, + } ) } } @@ -304,10 +303,10 @@ fun HomeScreen( onOkayClick = { val idealWaterIntakeToInsert = IdealWaterIntake( waterIntake = viewModel.idealWaterIntakeValue.value.toInt(), - form = viewModel.idealWaterForm.value, + form = viewModel.idealWaterForm.value ) viewModel.insertIdealWaterIntake(idealWaterIntakeToInsert) - }, + } ) } } @@ -330,10 +329,10 @@ fun HomeScreen( SelectedDrink( drinkValue = viewModel.size.value, icon = viewModel.selectedIcon.value, - time = viewModel.selectedTime.value, - ), + time = viewModel.selectedTime.value + ) ) - }, + } ) } } @@ -344,7 +343,7 @@ fun HomeScreen( private fun incrementProgressCircle( selectedDrinksFromDB: State>, goalWaterIntake: Int, - viewModel: HomeViewModel, + viewModel: HomeViewModel ): Pair { // getting the last selected drink var amountTaken = viewModel.levelFromDB.value?.amountTaken ?: 0f @@ -392,46 +391,46 @@ fun WaterIntake( waterIntake: Int, form: String, goalForm: String, - goalWaterIntake: Int, + goalWaterIntake: Int ) { Card( modifier = Modifier .height(100.dp) .padding(16.dp) .fillMaxWidth(), - elevation = 4.dp, + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { Row( modifier = Modifier .fillMaxWidth() .padding(16.dp), horizontalArrangement = Arrangement.SpaceEvenly, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Row( horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { - Image( + Icon( painter = painterResource(id = R.drawable.ic_glass), - contentDescription = null, + contentDescription = null ) Spacer(modifier = Modifier.width(8.dp)) Column( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.clickable { idealWaterIntakeDialog.value = true - }, + } ) { Text( text = "Ideal water intake", style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f), + color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f) ) Text( text = "$waterIntake $form", color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f), - style = MaterialTheme.typography.labelMedium, + style = MaterialTheme.typography.labelMedium ) } @@ -441,11 +440,11 @@ fun WaterIntake( .fillMaxHeight() .width(2.dp), thickness = 2.dp, - color = MaterialTheme.colorScheme.primary, + color = MaterialTheme.colorScheme.primary ) Row( horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Image(painter = painterResource(id = R.drawable.ic_cup), contentDescription = null) Spacer(modifier = Modifier.width(8.dp)) @@ -453,17 +452,17 @@ fun WaterIntake( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.clickable { openGoalDialog.value = true - }, + } ) { Text( text = "Water intake goal", color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f), - style = MaterialTheme.typography.labelMedium, + style = MaterialTheme.typography.labelMedium ) Text( text = "$goalWaterIntake $goalForm", color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f), - style = MaterialTheme.typography.labelSmall, + style = MaterialTheme.typography.labelSmall ) } } @@ -479,56 +478,59 @@ fun WaterRecord( time: String, goalWaterIntake: Int, selectedDrinkDialog: MutableState, - onAddLevelClick: () -> Unit, + onAddLevelClick: () -> Unit ) { Card( modifier = Modifier .fillMaxWidth() .height(350.dp) .padding(start = 16.dp, end = 16.dp), - elevation = 4.dp, + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { Column( modifier = Modifier .fillMaxSize() .padding(8.dp), - horizontalAlignment = Alignment.CenterHorizontally, + horizontalAlignment = Alignment.CenterHorizontally ) { Spacer(modifier = Modifier.height(8.dp)) CircularRating( percentage = amountTaken, drunk = waterTaken, - goal = goalWaterIntake, + goal = goalWaterIntake ) Spacer(modifier = Modifier.height(8.dp)) Row( modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceEvenly, + horizontalArrangement = Arrangement.SpaceEvenly ) { CircularButton( - backgroundColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.2f), + backgroundColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.67f), + contentColor = MaterialTheme.colorScheme.onPrimary, icon = R.drawable.ic_clock, title = time, onClick = { openDialog.value = true - }, + } ) CircularButton( - backgroundColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.2f), + backgroundColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.67f), + contentColor = MaterialTheme.colorScheme.onPrimary, icon = R.drawable.ic_add, title = "Add Level", onClick = { onAddLevelClick() - }, + } ) CircularButton( - backgroundColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.2f), + backgroundColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.67f), + contentColor = MaterialTheme.colorScheme.onPrimary, icon = R.drawable.ic_glass, title = "Add Drink", onClick = { selectedDrinkDialog.value = true - }, + } ) } } @@ -538,59 +540,60 @@ fun WaterRecord( @Composable fun WaterIntakeTimeAndLevel( intake: SelectedDrink, - onDeleteIconClick: (SelectedDrink) -> Unit, + onDeleteIconClick: (SelectedDrink) -> Unit ) { Column( modifier = Modifier .fillMaxSize() + .clip(MaterialTheme.shapes.medium) .padding(start = 16.dp, end = 16.dp), - horizontalAlignment = Alignment.CenterHorizontally, + horizontalAlignment = Alignment.CenterHorizontally ) { Row( modifier = Modifier .fillMaxWidth() - .background(Color.White) + .background(MaterialTheme.colorScheme.background) .padding(4.dp), horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Row( horizontalArrangement = Arrangement.spacedBy(16.dp), - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Icon( modifier = Modifier.size(20.dp), - painter = painterResource(id = intake.icon), + painter = painterResource(id = R.drawable.ic_glass), tint = MaterialTheme.colorScheme.primary, - contentDescription = null, + contentDescription = null ) Text( text = intake.drinkValue, style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f), - ) + color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f) + ) } Row( horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = intake.time, color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f), - style = MaterialTheme.typography.labelMedium, - ) + style = MaterialTheme.typography.labelMedium + ) IconButton(onClick = { onDeleteIconClick(intake) }) { Icon( imageVector = Icons.Default.Delete, tint = Color.Gray, - contentDescription = null, + contentDescription = null ) } } } Divider( thickness = 1.dp, - color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.2f), + color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.2f) ) } } diff --git a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/sleepWakeScreen/SleepAndWakeUpScreen.kt b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/sleepWakeScreen/SleepAndWakeUpScreen.kt index c6194db..625b845 100644 --- a/feature/home/src/main/java/com/brandyodhiambo/home/presentation/sleepWakeScreen/SleepAndWakeUpScreen.kt +++ b/feature/home/src/main/java/com/brandyodhiambo/home/presentation/sleepWakeScreen/SleepAndWakeUpScreen.kt @@ -31,7 +31,6 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel @@ -50,23 +49,23 @@ interface SleepAndWakeUpScreenScreenNavigator { @Composable fun SleepAndWakeTimeScreen( navigator: SleepAndWakeUpScreenScreenNavigator, - viewModel: SleepWakeViewModel = hiltViewModel(), + viewModel: SleepWakeViewModel = hiltViewModel() ) { Box( - modifier = Modifier.fillMaxSize(), + modifier = Modifier.fillMaxSize() ) { Column( modifier = Modifier .fillMaxSize() .padding(16.dp), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Top, + verticalArrangement = Arrangement.Top ) { Spacer(modifier = Modifier.height(16.dp)) Text( text = "What's your wake up time?", style = MaterialTheme.typography.labelLarge, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) Spacer(modifier = Modifier.height(16.dp)) WakeTimePickerInHours( @@ -80,14 +79,14 @@ fun SleepAndWakeTimeScreen( "PM" } viewModel.onTimeWakeSelected(it.hours, it.minutes, ampm) - }, + } ) Spacer(modifier = Modifier.height(32.dp)) Text( text = "What's your Sleeping time?", style = MaterialTheme.typography.labelLarge, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) Spacer(modifier = Modifier.height(16.dp)) SleepTimePickerInHours( @@ -103,7 +102,7 @@ fun SleepAndWakeTimeScreen( "PM" } viewModel.onTimeSleepSelected(it.hours, it.minutes, ampm) - }, + } ) Spacer(modifier = Modifier.height(32.dp)) @@ -112,7 +111,7 @@ fun SleepAndWakeTimeScreen( modifier = Modifier .fillMaxSize() .padding(bottom = 16.dp, start = 16.dp, end = 16.dp), - verticalArrangement = Arrangement.Bottom, + verticalArrangement = Arrangement.Bottom ) { Button( modifier = Modifier @@ -122,23 +121,23 @@ fun SleepAndWakeTimeScreen( SleepTime( viewModel.sleepSelectedTime.value.hours, viewModel.sleepSelectedTime.value.minutes, - viewModel.sleepSelectedTime.value.amPm, - ), + viewModel.sleepSelectedTime.value.amPm + ) ) viewModel.insertWakeTime( WakeTime( viewModel.wakeSelectedTime.value.hours, viewModel.wakeSelectedTime.value.minutes, - viewModel.wakeSelectedTime.value.amPm, - ), + viewModel.wakeSelectedTime.value.amPm + ) ) navigator.popBackStack() navigator.navigateToMainScreen() }, shape = RoundedCornerShape(15.dp), - colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colorScheme.primary), + colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colorScheme.primary) ) { Text(text = "Next", Modifier.padding(8.dp), color = MaterialTheme.colorScheme.onPrimary) } @@ -150,7 +149,7 @@ fun SleepAndWakeTimeScreen( fun SleepTimePickerInHours( currentPickerValueText: Hours, onCurrentPickerValueTextChange: (Hours) -> Unit, - onTimeSleepSelected: (Hours) -> Unit, + onTimeSleepSelected: (Hours) -> Unit ) { HoursNumberPicker( dividersColor = MaterialTheme.colorScheme.onBackground, @@ -164,16 +163,16 @@ fun SleepTimePickerInHours( Text( modifier = Modifier.padding(horizontal = 8.dp), textAlign = TextAlign.Center, - text = ":", + text = ":" ) }, minutesDivider = { Text( modifier = Modifier.padding(horizontal = 8.dp), textAlign = TextAlign.Center, - text = " ", + text = " " ) - }, + } ) } @@ -181,7 +180,7 @@ fun SleepTimePickerInHours( fun WakeTimePickerInHours( currentPickerValueText: Hours, onCurrentPickerValueTextChange: (Hours) -> Unit, - onTimeWakeSelected: (Hours) -> Unit, + onTimeWakeSelected: (Hours) -> Unit ) { HoursNumberPicker( dividersColor = MaterialTheme.colorScheme.onBackground, @@ -195,15 +194,15 @@ fun WakeTimePickerInHours( Text( modifier = Modifier.padding(horizontal = 8.dp), textAlign = TextAlign.Center, - text = ":", + text = ":" ) }, minutesDivider = { Text( modifier = Modifier.padding(horizontal = 8.dp), textAlign = TextAlign.Center, - text = " ", + text = " " ) - }, + } ) } diff --git a/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/AddReminderScreen.kt b/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/AddReminderScreen.kt index 8d49cc9..4197ca5 100644 --- a/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/AddReminderScreen.kt +++ b/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/AddReminderScreen.kt @@ -24,15 +24,17 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material.Icon -import androidx.compose.material.IconButton -import androidx.compose.material.Scaffold -import androidx.compose.material.Text -import androidx.compose.material.TextButton -import androidx.compose.material.TopAppBar import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -40,11 +42,9 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import androidx.compose.ui.window.Dialog import com.brandyodhiambo.common.R import com.brandyodhiambo.designsystem.components.NotificationSwitcher @@ -62,46 +62,48 @@ interface AddReminderNavigator { @Destination @Composable fun AddReminderScreen( - navigator: AddReminderNavigator, + navigator: AddReminderNavigator ) { val repeateModeDialog = remember { mutableStateOf(false) } Scaffold( topBar = { TopAppBarAddReminder(navigator = navigator) - }, - ) { + } + ) { paddingValue -> Column( modifier = Modifier .fillMaxSize() .padding(start = 16.dp, end = 16.dp), - horizontalAlignment = Alignment.CenterHorizontally, + horizontalAlignment = Alignment.CenterHorizontally ) { + Spacer(modifier = Modifier.height(20.dp)) ReminderTimePickerInHours() Spacer(modifier = Modifier.height(8.dp)) Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = "Reminder Sound", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) Row( horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = "Default Sound", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) IconButton(onClick = { /*TODO*/ }) { Icon( painter = painterResource(id = R.drawable.ic_chevron_right), - contentDescription = null, + tint = MaterialTheme.colorScheme.onBackground, + contentDescription = null ) } } @@ -110,27 +112,28 @@ fun AddReminderScreen( Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = "Reminder Mode", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) Row( horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = "Mon to Fri", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) IconButton(onClick = { repeateModeDialog.value = true }) { Icon( painter = painterResource(id = R.drawable.ic_chevron_right), - contentDescription = null, + tint = MaterialTheme.colorScheme.onBackground, + contentDescription = null ) } } @@ -140,19 +143,19 @@ fun AddReminderScreen( Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = "Vibrate when alarm sounds", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) NotificationSwitcher( isOn = true, size = 35.dp, padding = 5.dp, onToggle = { - }, + } ) } @@ -160,19 +163,19 @@ fun AddReminderScreen( Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = "Delete after goes off", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) NotificationSwitcher( isOn = false, size = 35.dp, padding = 5.dp, onToggle = { - }, + } ) } @@ -182,7 +185,7 @@ fun AddReminderScreen( CustomReminderDialog( openDialog = repeateModeDialog, items = repeatMode, - title = "Repeat Mode", + title = "Repeat Mode" ) } } @@ -190,23 +193,38 @@ fun AddReminderScreen( } } +@OptIn(ExperimentalMaterial3Api::class) @Composable fun TopAppBarAddReminder(navigator: AddReminderNavigator) { TopAppBar( title = { - Text(text = "Add Reminder", color = Color.Black, fontSize = 16.sp) + Text( + text = "Add Reminder", + style = MaterialTheme.typography.titleMedium, + color = MaterialTheme.colorScheme.onBackground + ) }, navigationIcon = { IconButton(onClick = { navigator.navigateUp() }) { - Icon(Icons.Filled.ArrowBack, tint = Color.Black, contentDescription = "Back") + Icon( + Icons.Filled.ArrowBack, + tint = MaterialTheme.colorScheme.onBackground, + contentDescription = "Back" + ) } }, actions = { TextButton(onClick = { /*TODO*/ }) { - Text(text = "Save", color = Color.Black, fontSize = 16.sp) + Text( + text = "Save", + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.onBackground + ) } }, - backgroundColor = Color.White, + colors = TopAppBarDefaults.topAppBarColors( + containerColor = MaterialTheme.colorScheme.background + ) ) } @@ -215,11 +233,11 @@ fun ReminderTimePickerInHours() { Column( modifier = Modifier.fillMaxWidth().height(200.dp).padding(16.dp), verticalArrangement = Arrangement.Top, - horizontalAlignment = Alignment.CenterHorizontally, + horizontalAlignment = Alignment.CenterHorizontally ) { var pickerValue by remember { mutableStateOf(AMPMHours(0, 0, AMPMHours.DayTime.AM)) } HoursNumberPicker( - dividersColor = MaterialTheme.colorScheme.onBackground, + dividersColor = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.5f), value = pickerValue, onValueChange = { pickerValue = it @@ -229,15 +247,16 @@ fun ReminderTimePickerInHours() { modifier = Modifier.padding(horizontal = 8.dp), textAlign = TextAlign.Center, text = ":", + color = MaterialTheme.colorScheme.onBackground ) }, minutesDivider = { Text( modifier = Modifier.padding(horizontal = 8.dp), textAlign = TextAlign.Center, - text = " ", + text = " " ) - }, + } ) } } diff --git a/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/NotificationScreen.kt b/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/NotificationScreen.kt index 0efdf0a..1924c5e 100644 --- a/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/NotificationScreen.kt +++ b/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/NotificationScreen.kt @@ -33,25 +33,23 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.Card -import androidx.compose.material.Icon -import androidx.compose.material.IconButton -import androidx.compose.material.Scaffold -import androidx.compose.material.Text -import androidx.compose.material.TopAppBar import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import com.brandyodhiambo.common.domain.model.Day import com.brandyodhiambo.common.util.toInitials import com.brandyodhiambo.designsystem.components.NotificationSwitcher @@ -63,6 +61,7 @@ interface NotificationNavigator { fun popBackStack() } +@OptIn(ExperimentalMaterial3Api::class) @SuppressLint("UnusedMaterialScaffoldPaddingParameter") @Destination @Composable @@ -88,11 +87,19 @@ fun NotificationScreen( ) Scaffold( - backgroundColor = MaterialTheme.colorScheme.primary, + containerColor = MaterialTheme.colorScheme.primary, topBar = { TopAppBar( - title = { Text(text = "Notification", color = MaterialTheme.colorScheme.onPrimary, fontSize = 16.sp) }, - backgroundColor = MaterialTheme.colorScheme.onBackground, + title = { + Text( + text = "Notification", + color = MaterialTheme.colorScheme.onPrimary, + style = MaterialTheme.typography.titleMedium + ) + }, + colors = TopAppBarDefaults.topAppBarColors( + containerColor = MaterialTheme.colorScheme.primary + ), navigationIcon = { IconButton(onClick = { navigator.popBackStack() @@ -136,8 +143,8 @@ fun AddReminder(navigator: NotificationNavigator) { Card( modifier = Modifier .fillMaxWidth(), - elevation = 4.dp, - shape = RoundedCornerShape(8.dp) + shape = MaterialTheme.shapes.medium, + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { Row( modifier = Modifier @@ -148,12 +155,15 @@ fun AddReminder(navigator: NotificationNavigator) { ) { Text( text = "Add New Reminder", - color = Color.Gray, - fontSize = 16.sp, - fontWeight = FontWeight.SemiBold + color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f), + style = MaterialTheme.typography.labelLarge ) IconButton(onClick = { navigator.navigateToReminderScreen() }) { - Icon(imageVector = Icons.Default.Add, tint = Color.Gray, contentDescription = null) + Icon( + imageVector = Icons.Default.Add, + tint = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f), + contentDescription = null + ) } } } @@ -166,8 +176,8 @@ fun ReminderNotificationTime(reminder: Reminder) { modifier = Modifier .fillMaxWidth() .padding(bottom = 8.dp), - elevation = 4.dp, - shape = RoundedCornerShape(8.dp) + shape = MaterialTheme.shapes.medium, + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -175,9 +185,9 @@ fun ReminderNotificationTime(reminder: Reminder) { .fillMaxSize() .background( if (reminder.isOn) { - MaterialTheme.colorScheme.onPrimary + MaterialTheme.colorScheme.background } else { - Color.LightGray + MaterialTheme.colorScheme.background.copy(alpha = 0.2f) } ) .padding(4.dp) @@ -196,12 +206,11 @@ fun ReminderNotificationTime(reminder: Reminder) { Text( text = reminder.time, color = if (reminder.isOn) { - Color.Black + MaterialTheme.colorScheme.background } else { - Color.Gray + MaterialTheme.colorScheme.background.copy(alpha = 0.2f) }, - fontSize = 16.sp, - fontWeight = FontWeight.SemiBold + style = MaterialTheme.typography.labelMedium ) LazyRow() { items(reminder.days) { day -> @@ -247,9 +256,12 @@ fun WeeksReminder(day: Day, reminder: Reminder) { ) { Text( text = day.day.toInitials(), - fontSize = 12.sp, - textAlign = TextAlign.Center, - fontWeight = FontWeight.SemiBold + color = if (day.isOn && reminder.isOn) { + MaterialTheme.colorScheme.primary + } else { + MaterialTheme.colorScheme.onBackground.copy(alpha = 0.2f) + }, + style = MaterialTheme.typography.labelMedium ) } } diff --git a/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/SettingsScreen.kt b/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/SettingsScreen.kt index 4534392..4fd85b0 100644 --- a/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/SettingsScreen.kt +++ b/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/SettingsScreen.kt @@ -65,7 +65,7 @@ interface SettingsNavigator { @Composable fun SettingScreen( navigator: SettingsNavigator, - homeViewModel: HomeViewModel = hiltViewModel(), + homeViewModel: HomeViewModel = hiltViewModel() ) { val openIntakeDialog = remember { mutableStateOf(false) } val openTimeDialog = remember { mutableStateOf(false) } @@ -75,26 +75,26 @@ fun SettingScreen( val context = LocalContext.current Scaffold( - containerColor = MaterialTheme.colorScheme.primary, + containerColor = MaterialTheme.colorScheme.primary ) { paddingValues -> Box( modifier = Modifier .fillMaxSize() - .padding(paddingValues), + .padding(paddingValues) ) { LazyColumn { item { UnitsWaterIntake( openTimeFormatDialog = openTimeDialog, openWaterUnitDialog = openWaterUnitDialog, - openWeightUnitDialog = openWeightUnitDialog, + openWeightUnitDialog = openWeightUnitDialog ) } item { Goals( openDialog = openIntakeDialog, currentIntake = homeViewModel.goalWaterIntakeValue.value, - currentForm = homeViewModel.goalWaterForm.value, + currentForm = homeViewModel.goalWaterForm.value ) } item { @@ -117,10 +117,10 @@ fun SettingScreen( onOkayClick = { val goalWaterIntakeToInsert = GoalWaterIntake( waterIntake = homeViewModel.goalWaterIntakeValue.value.toInt(), - form = homeViewModel.goalWaterForm.value, + form = homeViewModel.goalWaterForm.value ) homeViewModel.insertGoalWaterIntake(goalWaterIntakeToInsert) - }, + } ) } } @@ -130,7 +130,7 @@ fun SettingScreen( CustomReminderDialog( openDialog = openTimeDialog, items = time, - title = "Time Format", + title = "Time Format" ) } } @@ -141,7 +141,7 @@ fun SettingScreen( CustomReminderDialog( openDialog = openWaterUnitDialog, items = waterUnit, - title = "Water Unit", + title = "Water Unit" ) } } @@ -152,7 +152,7 @@ fun SettingScreen( CustomReminderDialog( openDialog = openWeightUnitDialog, items = weightUnit, - title = "Weight Unit", + title = "Weight Unit" ) } } @@ -164,28 +164,28 @@ fun SettingScreen( fun UnitsWaterIntake( openTimeFormatDialog: MutableState, openWaterUnitDialog: MutableState, - openWeightUnitDialog: MutableState, + openWeightUnitDialog: MutableState ) { Card( modifier = Modifier .fillMaxWidth() .padding(top = 8.dp, start = 16.dp, end = 16.dp), - colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background), + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { Column( - modifier = Modifier.padding(8.dp), + modifier = Modifier.padding(8.dp) ) { Row( modifier = Modifier .fillMaxWidth() .padding(8.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Text( text = "Water Unit", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) TextButton(onClick = { openWaterUnitDialog.value = true }) { @@ -193,7 +193,7 @@ fun UnitsWaterIntake( text = "ml", fontSize = 16.sp, fontWeight = FontWeight.W300, - color = MaterialTheme.colorScheme.primary, + color = MaterialTheme.colorScheme.primary ) } } @@ -202,26 +202,26 @@ fun UnitsWaterIntake( .height(1.dp) .padding(start = 8.dp, end = 8.dp), color = Color.Gray, - thickness = 1.dp, + thickness = 1.dp ) Row( modifier = Modifier .fillMaxWidth() .padding(8.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Text( text = "Weight Unit", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) TextButton(onClick = { openWeightUnitDialog.value = true }) { Text( text = "Kg", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.primary, + color = MaterialTheme.colorScheme.primary ) } } @@ -230,19 +230,19 @@ fun UnitsWaterIntake( .height(1.dp) .padding(start = 8.dp, end = 8.dp), color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.12f), - thickness = 1.dp, + thickness = 1.dp ) Row( modifier = Modifier .fillMaxWidth() .padding(8.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Text( text = "Time Format", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) TextButton(onClick = { openTimeFormatDialog.value = true }) { Text( @@ -263,20 +263,20 @@ fun ReminderWaterIntake(navigator: SettingsNavigator) { modifier = Modifier .fillMaxWidth() .padding(top = 8.dp, start = 16.dp, end = 16.dp, bottom = 16.dp), - colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background), + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { Column( - modifier = Modifier.padding(8.dp), + modifier = Modifier.padding(8.dp) ) { Row( modifier = Modifier .fillMaxWidth() .padding(8.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Row( - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = "Reminder Sound", @@ -309,7 +309,7 @@ fun ReminderWaterIntake(navigator: SettingsNavigator) { RingtoneManager.setActualDefaultRingtoneUri( context, RingtoneManager.TYPE_NOTIFICATION, - uris[which], + uris[which] ) } builder.show() @@ -317,7 +317,7 @@ fun ReminderWaterIntake(navigator: SettingsNavigator) { Toast.makeText( context, "Allow modify system settings ==> ON ", - Toast.LENGTH_LONG, + Toast.LENGTH_LONG ).show() } } catch (e: Exception) { @@ -326,7 +326,7 @@ fun ReminderWaterIntake(navigator: SettingsNavigator) { }) { Image( painter = painterResource(id = R.drawable.ic_chevron_right), - contentDescription = null, + contentDescription = null ) } } @@ -335,17 +335,17 @@ fun ReminderWaterIntake(navigator: SettingsNavigator) { .height(1.dp) .padding(start = 8.dp, end = 8.dp), color = Color.Gray, - thickness = 1.dp, + thickness = 1.dp ) Row( modifier = Modifier .fillMaxWidth() .padding(8.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Row( - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = "Notifications", @@ -358,7 +358,7 @@ fun ReminderWaterIntake(navigator: SettingsNavigator) { }) { Image( painter = painterResource(id = R.drawable.ic_chevron_right), - contentDescription = null, + contentDescription = null ) } } @@ -370,26 +370,26 @@ fun ReminderWaterIntake(navigator: SettingsNavigator) { fun Goals( openDialog: MutableState, currentIntake: String, - currentForm: String, + currentForm: String ) { Card( modifier = Modifier .fillMaxWidth() .padding(top = 8.dp, start = 16.dp, end = 16.dp), - colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background), + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { Column( - modifier = Modifier.padding(8.dp), + modifier = Modifier.padding(8.dp) ) { Row( modifier = Modifier .fillMaxWidth() .padding(16.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Row( - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Text( text = "Intake Goal", @@ -402,7 +402,7 @@ fun Goals( horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.clickable { openDialog.value = true - }, + } ) { Text( text = "$currentIntake $currentForm", @@ -411,7 +411,7 @@ fun Goals( ) Image( painter = painterResource(id = R.drawable.ic_chevron_right), - contentDescription = null, + contentDescription = null ) } } diff --git a/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/component/CustomCheckingDialog.kt b/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/component/CustomCheckingDialog.kt index e752bde..8055da6 100644 --- a/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/component/CustomCheckingDialog.kt +++ b/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/component/CustomCheckingDialog.kt @@ -44,7 +44,7 @@ import androidx.compose.ui.unit.dp fun CustomCheckinDialog( openDialog: MutableState, title: String, - items: List, + items: List ) { val selectedValues = remember { mutableStateListOf() } val isSelectedItem: (String) -> Boolean = { selectedValues.contains(it) } @@ -58,31 +58,31 @@ fun CustomCheckinDialog( Card( shape = RoundedCornerShape(12.dp), - modifier = Modifier.padding(10.dp, 5.dp, 10.dp, 10.dp), + modifier = Modifier.padding(10.dp, 5.dp, 10.dp, 10.dp) ) { Column( Modifier .padding(8.dp) - .background(Color.White), + .background(Color.White) ) { Text( text = "Select $title", - modifier = Modifier.padding(8.dp), + modifier = Modifier.padding(8.dp) ) items.forEach { item -> Row( verticalAlignment = Alignment.CenterVertically, modifier = Modifier - .padding(8.dp), + .padding(8.dp) ) { Checkbox( checked = isSelectedItem(item), - onCheckedChange = { onChangeState(item, it) }, + onCheckedChange = { onChangeState(item, it) } ) Spacer(modifier = Modifier.width(8.dp)) Text( text = item, - modifier = Modifier.fillMaxWidth(), + modifier = Modifier.fillMaxWidth() ) } } @@ -92,7 +92,7 @@ fun CustomCheckinDialog( .fillMaxWidth() .padding(top = 10.dp) .background(Color.White), - horizontalArrangement = Arrangement.SpaceAround, + horizontalArrangement = Arrangement.SpaceAround ) { Card( shape = RoundedCornerShape(20.dp), @@ -102,14 +102,14 @@ fun CustomCheckinDialog( .clickable { openDialog.value = false }, - colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background), + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background) ) { Text( "Cancel", style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.padding(10.dp), - textAlign = TextAlign.Center, + textAlign = TextAlign.Center ) } Card( @@ -119,14 +119,14 @@ fun CustomCheckinDialog( .clickable { openDialog.value = false }, - colors = CardDefaults.cardColors(MaterialTheme.colorScheme.primary), + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.primary) ) { Text( "Okay", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onPrimary, modifier = Modifier.padding(10.dp), - textAlign = TextAlign.Center, + textAlign = TextAlign.Center ) } } diff --git a/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/component/CustomReminderDialog.kt b/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/component/CustomReminderDialog.kt index 424f8c1..d7dc618 100644 --- a/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/component/CustomReminderDialog.kt +++ b/feature/settings/src/main/java/com/brandyodhiambo/settings/presentation/component/CustomReminderDialog.kt @@ -37,7 +37,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.semantics.Role import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp @@ -47,7 +46,7 @@ import androidx.compose.ui.window.Dialog fun CustomReminderDialog( openDialog: MutableState, title: String, - items: List, + items: List ) { val selectedValue = remember { mutableStateOf("") } val isSelectedItem: (String) -> Boolean = { selectedValue.value == it } @@ -55,16 +54,16 @@ fun CustomReminderDialog( Card( shape = RoundedCornerShape(12.dp), - modifier = Modifier.padding(10.dp, 5.dp, 10.dp, 10.dp), + modifier = Modifier.padding(10.dp, 5.dp, 10.dp, 10.dp) ) { Column( Modifier .padding(8.dp) - .background(MaterialTheme.colorScheme.background), + .background(MaterialTheme.colorScheme.background) ) { Text( text = "Select $title", - modifier = Modifier.padding(8.dp), + modifier = Modifier.padding(8.dp) ) items.forEach { item -> Row( @@ -73,18 +72,18 @@ fun CustomReminderDialog( .selectable( selected = isSelectedItem(item), onClick = { onChangeState(item) }, - role = Role.RadioButton, + role = Role.RadioButton ) - .padding(8.dp), + .padding(8.dp) ) { RadioButton( selected = isSelectedItem(item), - onClick = null, + onClick = null ) Spacer(modifier = Modifier.width(8.dp)) Text( text = item, - modifier = Modifier.fillMaxWidth(), + modifier = Modifier.fillMaxWidth() ) } } @@ -94,7 +93,7 @@ fun CustomReminderDialog( .fillMaxWidth() .padding(top = 10.dp) .background(MaterialTheme.colorScheme.background), - horizontalArrangement = Arrangement.SpaceAround, + horizontalArrangement = Arrangement.SpaceAround ) { Card( shape = RoundedCornerShape(20.dp), @@ -106,16 +105,16 @@ fun CustomReminderDialog( }, colors = CardDefaults.cardColors( MaterialTheme.colorScheme.onBackground.copy( - alpha = 0.12f, - ), - ), + alpha = 0.12f + ) + ) ) { Text( "Cancel", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.padding(10.dp), - textAlign = TextAlign.Center, + textAlign = TextAlign.Center ) } Card( @@ -125,14 +124,14 @@ fun CustomReminderDialog( .clickable { openDialog.value = false }, - colors = CardDefaults.cardColors(MaterialTheme.colorScheme.primary), + colors = CardDefaults.cardColors(MaterialTheme.colorScheme.primary) ) { Text( "Okay", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onPrimary, modifier = Modifier.padding(10.dp), - textAlign = TextAlign.Center, + textAlign = TextAlign.Center ) } } @@ -149,8 +148,8 @@ fun CustomReminderDialog( "Thursday", "Friday", "Saturday", - "Sunday", - ), + "Sunday" + ) ) } } diff --git a/feature/statistics/src/main/java/com/brandyodhiambo/statistics/data/repository/MonthlyStatisticsRepositoryImpl.kt b/feature/statistics/src/main/java/com/brandyodhiambo/statistics/data/repository/MonthlyStatisticsRepositoryImpl.kt index 8a33340..7d839a1 100644 --- a/feature/statistics/src/main/java/com/brandyodhiambo/statistics/data/repository/MonthlyStatisticsRepositoryImpl.kt +++ b/feature/statistics/src/main/java/com/brandyodhiambo/statistics/data/repository/MonthlyStatisticsRepositoryImpl.kt @@ -24,7 +24,7 @@ import com.brandyodhiambo.statistics.data.mapper.toMonthlyStatistics import com.brandyodhiambo.statistics.data.mapper.toMonthlyStatisticsEntity class MonthlyStatisticsRepositoryImpl( - private val monthlyStatisticalDao: MonthlyStatisticsDao, + private val monthlyStatisticalDao: MonthlyStatisticsDao ) : MonthlyStatisticsRepository { override suspend fun insertMonthlyStatistics(monthlyStatistics: MonthlyStatistics) { monthlyStatisticalDao.insertMonthlyStatistic(monthlyStatistics.toMonthlyStatisticsEntity()) diff --git a/feature/statistics/src/main/java/com/brandyodhiambo/statistics/data/repository/WeeklyStatisticsRepositoryImpl.kt b/feature/statistics/src/main/java/com/brandyodhiambo/statistics/data/repository/WeeklyStatisticsRepositoryImpl.kt index e0dc1be..e6d8475 100644 --- a/feature/statistics/src/main/java/com/brandyodhiambo/statistics/data/repository/WeeklyStatisticsRepositoryImpl.kt +++ b/feature/statistics/src/main/java/com/brandyodhiambo/statistics/data/repository/WeeklyStatisticsRepositoryImpl.kt @@ -24,7 +24,7 @@ import com.brandyodhiambo.statistics.data.mapper.toWeeklyStatistics import com.brandyodhiambo.statistics.data.mapper.toWeeklyStatisticsEntity class WeeklyStatisticsRepositoryImpl( - private val weeklyStatisticDao: WeeklyStatisticDao, + private val weeklyStatisticDao: WeeklyStatisticDao ) : WeeklyStatisticRepository { override suspend fun insertWeeklyStatistic(weeklyStatistic: WeeklyStatistics) { weeklyStatisticDao.insertWeeklyStatistic(weeklyStatistic.toWeeklyStatisticsEntity()) diff --git a/feature/statistics/src/main/java/com/brandyodhiambo/statistics/presentation/StatisticsScreen.kt b/feature/statistics/src/main/java/com/brandyodhiambo/statistics/presentation/StatisticsScreen.kt index c912fb1..3e7b595 100644 --- a/feature/statistics/src/main/java/com/brandyodhiambo/statistics/presentation/StatisticsScreen.kt +++ b/feature/statistics/src/main/java/com/brandyodhiambo/statistics/presentation/StatisticsScreen.kt @@ -55,9 +55,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel import com.brandyodhiambo.common.R import com.brandyodhiambo.common.domain.model.Achievement @@ -75,7 +73,7 @@ fun StatisticsScreen( navigator: DestinationsNavigator, statisticsViewModel: StatisticsViewModel = hiltViewModel(), homeViewModel: HomeViewModel = hiltViewModel(), - achievementViewModel: AchievementViewModel = hiltViewModel(), + achievementViewModel: AchievementViewModel = hiltViewModel() ) { val dailyStatistics = statisticsViewModel.dailyStatisticsFromDB.observeAsState() val weeklyStatistics = statisticsViewModel.weeklyStatisticsFromDB.observeAsState() @@ -87,7 +85,7 @@ fun StatisticsScreen( BarChartEntity( dailyStat.amountTaken, MaterialTheme.colorScheme.primary, - dailyStat.day.take(3), + dailyStat.day.take(3) ) } ?: emptyList() @@ -99,7 +97,7 @@ fun StatisticsScreen( BarChartEntity( monthStat.amountTaken, MaterialTheme.colorScheme.primary, - monthStat.month.take(3), + monthStat.month.take(3) ) } ?: emptyList() @@ -128,28 +126,28 @@ fun StatisticsScreen( val weekAchievement = achievementViewModel.isAchieved.observeAsState(initial = emptyList()) Scaffold( - containerColor = MaterialTheme.colorScheme.primary, + containerColor = MaterialTheme.colorScheme.primary ) { paddingValues -> Box( modifier = Modifier .fillMaxSize() - .padding(paddingValues), + .padding(paddingValues) ) { LazyColumn { item { Card( modifier = Modifier .fillMaxSize() - .padding(top = 16.dp, start = 16.dp, end = 16.dp), + .padding(top = 16.dp, start = 16.dp, end = 16.dp) ) { Column( - modifier = Modifier.padding(8.dp), + modifier = Modifier.padding(8.dp) ) { Row( modifier = Modifier .fillMaxWidth() .padding(top = 8.dp, start = 8.dp, end = 8.dp), - horizontalArrangement = Arrangement.SpaceEvenly, + horizontalArrangement = Arrangement.SpaceEvenly ) { Box( modifier = Modifier @@ -160,21 +158,21 @@ fun StatisticsScreen( MaterialTheme.colorScheme.primary } else { MaterialTheme.colorScheme.primary.copy( - alpha = 0.2f, + alpha = 0.2f ) }, - shape = RoundedCornerShape(8.dp), + shape = RoundedCornerShape(8.dp) ).clickable { setGraphDaily.value = true setGraphWeek.value = false setGraphMonthly.value = false }, - contentAlignment = Alignment.Center, + contentAlignment = Alignment.Center ) { Text( text = "Daily", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onPrimary ) } Box( @@ -186,21 +184,21 @@ fun StatisticsScreen( MaterialTheme.colorScheme.primary } else { MaterialTheme.colorScheme.primary.copy( - alpha = 0.2f, + alpha = 0.2f ) }, - shape = RoundedCornerShape(8.dp), + shape = RoundedCornerShape(8.dp) ).clickable { setGraphDaily.value = false setGraphWeek.value = true setGraphMonthly.value = false }, - contentAlignment = Alignment.Center, + contentAlignment = Alignment.Center ) { Text( text = "Weekly", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onPrimary ) } Box( @@ -212,21 +210,21 @@ fun StatisticsScreen( MaterialTheme.colorScheme.primary } else { MaterialTheme.colorScheme.primary.copy( - alpha = 0.2f, + alpha = 0.2f ) }, - shape = RoundedCornerShape(8.dp), + shape = RoundedCornerShape(8.dp) ).clickable { setGraphDaily.value = false setGraphWeek.value = false setGraphMonthly.value = true }, - contentAlignment = Alignment.Center, + contentAlignment = Alignment.Center ) { Text( text = "Monthly", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onPrimary ) } } @@ -236,7 +234,7 @@ fun StatisticsScreen( barChartData = barChartDataDaily, verticalAxisValues = verticalAxisValues, isShowHorizontalLines = true, - isShowVerticalAxis = true, + isShowVerticalAxis = true ) } if (setGraphWeek.value) { @@ -245,7 +243,7 @@ fun StatisticsScreen( barChartData = barChartDataWeek, verticalAxisValues = verticalAxisValues, isShowHorizontalLines = true, - isShowVerticalAxis = true, + isShowVerticalAxis = true ) } if (setGraphMonthly.value) { @@ -254,7 +252,7 @@ fun StatisticsScreen( barChartData = barChartDataMonth, verticalAxisValues = verticalAxisValues, isShowHorizontalLines = true, - isShowVerticalAxis = true, + isShowVerticalAxis = true ) } } @@ -262,7 +260,7 @@ fun StatisticsScreen( } item { Last7DayGoals( - weekAchivement = weekAchievement.value ?: emptyList(), + weekAchivement = weekAchievement.value ?: emptyList() ) } item { @@ -271,7 +269,7 @@ fun StatisticsScreen( currentWeeklyAverage = weeklyAverage.toInt(), currentMonthlyAverage = monthlyAverage.toInt(), currentAverage = average.toInt(), - currentDrinkFrequency = drinkFrequency, + currentDrinkFrequency = drinkFrequency ) } } @@ -285,30 +283,31 @@ fun Last7DayGoals(weekAchivement: List) { modifier = Modifier .height(135.dp) .padding(top = 8.dp, start = 16.dp, end = 16.dp) - .fillMaxWidth(), + .fillMaxWidth() ) { Column( modifier = Modifier.padding(8.dp), - horizontalAlignment = Alignment.CenterHorizontally, + horizontalAlignment = Alignment.CenterHorizontally ) { Text( text = "Last 7 Days Goals Achieve", style = MaterialTheme.typography.labelLarge, - color = MaterialTheme.colorScheme.primary, + color = MaterialTheme.colorScheme.primary ) Box( contentAlignment = Alignment.Center, - modifier = Modifier.fillMaxSize(), + modifier = Modifier.fillMaxSize() ) { if (weekAchivement.isEmpty()) { Text( text = "You have no achievements yet", style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.onBackground ) } LazyRow( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceEvenly, + horizontalArrangement = Arrangement.SpaceEvenly ) { items(weekAchivement.takeLast(7)) { weeks -> WeeksAcheive(weeks = weeks) @@ -321,17 +320,21 @@ fun Last7DayGoals(weekAchivement: List) { @Composable fun WeeksAcheive( - weeks: Achievement, + weeks: Achievement ) { Column( - horizontalAlignment = Alignment.CenterHorizontally, + horizontalAlignment = Alignment.CenterHorizontally ) { if (weeks.isAchieved) { GoldCup() } else { BlackCup() } - Text(text = weeks.day.take(3), fontSize = 16.sp, fontWeight = FontWeight.W400) + Text( + text = weeks.day.take(3), + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.onBackground + ) } } @@ -342,7 +345,7 @@ fun GoldCup() { border = BorderStroke(2.dp, color = MaterialTheme.colorScheme.primary), modifier = Modifier .size(48.dp) - .padding(4.dp), + .padding(4.dp) ) { Image( painter = painterResource(id = R.drawable.ic_cup), @@ -350,7 +353,7 @@ fun GoldCup() { modifier = Modifier .size(48.dp) .padding(8.dp), - contentDescription = null, + contentDescription = null ) } } @@ -361,11 +364,11 @@ fun BlackCup() { shape = CircleShape, border = BorderStroke( 2.dp, - color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.2f), + color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.2f) ), modifier = Modifier .size(48.dp) - .padding(4.dp), + .padding(4.dp) ) { Image( painter = painterResource(id = R.drawable.ic_black_cup), @@ -373,7 +376,7 @@ fun BlackCup() { modifier = Modifier .size(48.dp) .padding(8.dp), - contentDescription = null, + contentDescription = null ) } } @@ -384,180 +387,179 @@ fun DrinkWaterReport( currentWeeklyAverage: Int, currentMonthlyAverage: Int, currentDrinkFrequency: Int, - currentAverage: Int, + currentAverage: Int ) { Card( modifier = Modifier .fillMaxWidth() - .padding(top = 8.dp, start = 16.dp, end = 16.dp), + .padding(top = 8.dp, start = 16.dp, end = 16.dp) ) { Column( - modifier = Modifier.padding(8.dp), + modifier = Modifier.padding(8.dp) ) { Text( text = "Drink Water Report", style = MaterialTheme.typography.labelLarge, - color = MaterialTheme.colorScheme.primary, + color = MaterialTheme.colorScheme.primary ) Row( modifier = Modifier .fillMaxWidth() .padding(16.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Row( - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Icon( imageVector = Icons.Default.DateRange, tint = MaterialTheme.colorScheme.primary, - contentDescription = null, + contentDescription = null ) Spacer(modifier = Modifier.width(8.dp)) Text( text = "Daily Average", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) } Text( text = "$currentDailyAverage ml/day", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.primary, + color = MaterialTheme.colorScheme.primary ) } Divider( modifier = Modifier.height(1.dp).padding(start = 8.dp, end = 8.dp), color = Color.Gray, - thickness = 1.dp, + thickness = 1.dp ) Row( modifier = Modifier .fillMaxWidth() .padding(16.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Row( - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Icon( imageVector = Icons.Default.DateRange, tint = MaterialTheme.colorScheme.primary, - contentDescription = null, + contentDescription = null ) Spacer(modifier = Modifier.width(8.dp)) Text( text = "Weekly Average", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) } Text( text = "$currentWeeklyAverage ml/day", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.primary, + color = MaterialTheme.colorScheme.primary ) } Divider( modifier = Modifier.height(1.dp).padding(start = 8.dp, end = 8.dp), - color = Color.Gray, - thickness = 1.dp, + color = MaterialTheme.colorScheme.background.copy(alpha = 0.2f), + thickness = 1.dp ) Row( modifier = Modifier .fillMaxWidth() .padding(16.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Row( - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Icon( imageVector = Icons.Default.DateRange, tint = MaterialTheme.colorScheme.primary, - contentDescription = null, + contentDescription = null ) Spacer(modifier = Modifier.width(8.dp)) Text( text = "Monthly Average", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) } Text( text = "$currentMonthlyAverage ml/day", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.primary, + color = MaterialTheme.colorScheme.primary ) } Divider( modifier = Modifier.height(1.dp).padding(start = 8.dp, end = 8.dp), color = Color.Gray, - thickness = 1.dp, + thickness = 1.dp ) Row( modifier = Modifier .fillMaxWidth() .padding(16.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Row( - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Icon( imageVector = Icons.Default.Done, tint = MaterialTheme.colorScheme.primary, - contentDescription = null, + contentDescription = null ) Spacer(modifier = Modifier.width(8.dp)) Text( text = "Average Completion", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) } Text( text = "$currentAverage%", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.primary, + color = MaterialTheme.colorScheme.primary ) } Divider( modifier = Modifier.height(1.dp).padding(start = 8.dp, end = 8.dp), color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.12f), - thickness = 1.dp, + thickness = 1.dp ) Row( modifier = Modifier .fillMaxWidth() .padding(16.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Row( - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Icon( imageVector = Icons.Default.AccountCircle, tint = MaterialTheme.colorScheme.primary, - contentDescription = null, + contentDescription = null ) Spacer(modifier = Modifier.width(8.dp)) Text( text = "Drink Frequency", style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onBackground, + color = MaterialTheme.colorScheme.onBackground ) } Text( text = "$currentDrinkFrequency Times/day", - fontSize = 16.sp, - fontWeight = FontWeight.W400, - color = MaterialTheme.colorScheme.primary, + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.primary ) } }