Skip to content

Commit

Permalink
Merge pull request #28 from brandy-kay/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
brandyodhiambo committed Oct 17, 2023
2 parents f0ee698 + 91b2d3e commit 79df933
Show file tree
Hide file tree
Showing 55 changed files with 753 additions and 613 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id("kotlin-kapt")
id("dagger.hilt.android.plugin")
id("kotlin-parcelize")
id("com.google.devtools.ksp") version ("1.7.10-1.0.6")
id("com.google.devtools.ksp") version ("1.8.10-1.0.9")
}

apply {
Expand Down
11 changes: 7 additions & 4 deletions app/src/main/java/com/brandyodhiambo/quench/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.navigation.NavDestination
import androidx.navigation.NavDestination.Companion.hierarchy
import com.brandyodhiambo.common.domain.model.AlarmData
import com.brandyodhiambo.designsystem.theme.QuenchTheme
import com.brandyodhiambo.designsystem.theme.Theme
import com.brandyodhiambo.home.presentation.homeScreen.HomeViewModel
import com.brandyodhiambo.quench.R
import com.brandyodhiambo.quench.navigation.FeatureNavigator
Expand Down Expand Up @@ -59,7 +60,9 @@ class MainActivity : ComponentActivity() {
val viewModel: HomeViewModel by viewModels()
setContent {
createChannel(this)
QuenchTheme {
QuenchTheme(
theme = Theme.FOLLOW_SYSTEM.themeValue
) {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
Expand All @@ -69,9 +72,9 @@ class MainActivity : ComponentActivity() {
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),
Expand Down
55 changes: 31 additions & 24 deletions app/src/main/java/com/brandyodhiambo/quench/ui/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,22 @@ package com.brandyodhiambo.quench.ui
import android.annotation.SuppressLint
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.Icon
import androidx.compose.material.LeadingIconTab
import androidx.compose.material.Scaffold
import androidx.compose.material.TabRow
import androidx.compose.material.TabRowDefaults
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.LeadingIconTab
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.TabRowDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
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.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.brandyodhiambo.designsystem.theme.primaryColor
import com.brandyodhiambo.designsystem.theme.roboto
import com.brandyodhiambo.quench.models.TabItem
import com.brandyodhiambo.settings.presentation.SettingsNavigator
import com.google.accompanist.pager.ExperimentalPagerApi
Expand All @@ -48,15 +45,15 @@ import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import kotlinx.coroutines.launch

@OptIn(ExperimentalPagerApi::class)
@OptIn(ExperimentalPagerApi::class, ExperimentalMaterial3Api::class)
@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
@Composable
@Destination
fun MainScreen(
navigator: DestinationsNavigator,
settingsNavigator: SettingsNavigator
) {
Scaffold {
Scaffold { paddingValue ->
val tabs = listOf(
TabItem.Home(navigator = navigator),
TabItem.Statistic(navigator = navigator),
Expand All @@ -72,15 +69,15 @@ fun MainScreen(
title = {
Text(
text = "Quench",
fontSize = 30.sp,
textAlign = TextAlign.Center,
fontFamily = roboto
style = MaterialTheme.typography.titleLarge,
color = MaterialTheme.colorScheme.onPrimary
)
},
modifier = Modifier.fillMaxWidth(),
backgroundColor = primaryColor,
contentColor = Color.White,
elevation = 4.dp
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.primary,
titleContentColor = MaterialTheme.colorScheme.onPrimary
)
)
CustomTab(tabs = tabs, pagerState = pagerState)
TabContent(
Expand Down Expand Up @@ -114,11 +111,12 @@ fun CustomTab(

TabRow(
selectedTabIndex = pagerState.currentPage,
backgroundColor = primaryColor,
contentColor = Color.White,
backgroundColor = MaterialTheme.colorScheme.primary,
contentColor = MaterialTheme.colorScheme.onPrimary,
indicator = { tabPositions ->
TabRowDefaults.Indicator(
Modifier.pagerTabIndicatorOffset(pagerState, tabPositions)
Modifier.pagerTabIndicatorOffset(pagerState, tabPositions),
color = MaterialTheme.colorScheme.onPrimary
)
}
) {
Expand All @@ -127,6 +125,7 @@ fun CustomTab(
icon = {
Icon(
painter = painterResource(id = tabItem.icon),
tint = MaterialTheme.colorScheme.onPrimary,
contentDescription = ""
)
},
Expand All @@ -136,7 +135,15 @@ fun CustomTab(
pagerState.animateScrollToPage(index)
}
},
text = { Text(text = tabItem.title, maxLines = 1, overflow = TextOverflow.Ellipsis, fontFamily = roboto) }
text = {
Text(
text = tabItem.title,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.onPrimary
)
}
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.google.dagger:hilt-android-gradle-plugin:2.42")
classpath("com.google.dagger:hilt-android-gradle-plugin:2.44")
classpath("com.diffplug.spotless:spotless-plugin-gradle:6.19.0")
}
} // Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version ("7.2.1") apply false
id("com.android.library") version ("7.2.1") apply false
id("org.jetbrains.kotlin.android") version ("1.7.0") apply false
id("org.jetbrains.kotlin.android") version ("1.8.10") apply false

id("org.jlleitschuh.gradle.ktlint") version "11.3.1" apply false
id("com.diffplug.spotless") version "6.19.0" apply false
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/AndroidConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object Versions {
const val compose_version = "1.2.0"
const val compose_version = "1.4.2"
const val room_version = "2.4.3"
const val work_version = "2.7.1"
const val lottie_version = "5.2.0"
Expand Down
Binary file removed core/build/intermediates/ktLint/reporterProviders.bin
Binary file not shown.
Binary file removed core/build/intermediates/ktLint/reporters.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Days>
val hour: Int?,
val minute: Int?,
val ampm: String?,
val isRepeated: Boolean?,
val isAllDay: Boolean?,
val days: List<Days>?
)
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +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
Expand All @@ -43,22 +45,16 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Color.Companion.Gray
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
import com.brandyodhiambo.designsystem.theme.GoldColor
import com.brandyodhiambo.designsystem.theme.primaryColor

@OptIn(ExperimentalMaterialApi::class)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun WaterIntakeDialog(
modifier: Modifier = Modifier,
Expand All @@ -71,19 +67,16 @@ fun WaterIntakeDialog(

) {
Card(
shape = RoundedCornerShape(10.dp),
shape = MaterialTheme.shapes.medium,
modifier = Modifier.padding(10.dp, 5.dp, 10.dp, 10.dp),
elevation = 8.dp

colors = CardDefaults.cardColors(MaterialTheme.colorScheme.background)
) {
Column(
modifier.background(Color.White)
) {
Column() {
Image(
painter = painterResource(id = R.drawable.ic_cup),
contentScale = ContentScale.Fit,
colorFilter = ColorFilter.tint(
color = GoldColor
color = MaterialTheme.colorScheme.secondary
),
contentDescription = null,
modifier = Modifier
Expand All @@ -101,9 +94,9 @@ fun WaterIntakeDialog(
.padding(top = 5.dp)
.fillMaxWidth(),
maxLines = 2,
fontSize = 20.sp,
fontWeight = FontWeight.W500,
overflow = TextOverflow.Ellipsis
style = MaterialTheme.typography.labelLarge,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.onBackground
)
Spacer(modifier = Modifier.height(8.dp))
Row(
Expand All @@ -124,13 +117,13 @@ fun WaterIntakeDialog(
label = {
Text(
"2810",
color = Gray
color = MaterialTheme.colorScheme.onBackground
)
},
shape = RoundedCornerShape(30.dp),
colors = TextFieldDefaults.outlinedTextFieldColors(
focusedBorderColor = Gray,
unfocusedBorderColor = LightGray
focusedBorderColor = MaterialTheme.colorScheme.primary,
unfocusedBorderColor = MaterialTheme.colorScheme.onBackground
)
)

Expand Down Expand Up @@ -158,8 +151,8 @@ fun WaterIntakeDialog(
},
shape = RoundedCornerShape(45.dp),
colors = TextFieldDefaults.outlinedTextFieldColors(
focusedBorderColor = Gray,
unfocusedBorderColor = LightGray
focusedBorderColor = MaterialTheme.colorScheme.primary,
unfocusedBorderColor = MaterialTheme.colorScheme.onBackground
)
)
ExposedDropdownMenu(
Expand Down Expand Up @@ -194,8 +187,8 @@ fun WaterIntakeDialog(
}) {
Text(
"Cancel",
fontWeight = FontWeight.Bold,
color = Color.Black,
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.padding(top = 5.dp, bottom = 5.dp)
)
}
Expand All @@ -205,8 +198,8 @@ fun WaterIntakeDialog(
}) {
Text(
"Okay",
fontWeight = FontWeight.ExtraBold,
color = primaryColor,
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.primary,
modifier = Modifier.padding(top = 5.dp, bottom = 5.dp)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface GoalWaterIntakeDao {
suspend fun insertGoalWaterIntake(goalWaterIntake: GoalWaterIntakeEntity)

@Query("SELECT *FROM goal_table")
fun getGoalWaterIntake(): LiveData<GoalWaterIntakeEntity>
fun getGoalWaterIntake(): LiveData<GoalWaterIntakeEntity?>

@Delete
suspend fun deleteGoalIntake(goalWaterIntake: GoalWaterIntakeEntity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface IdealWaterIntakeDao {
suspend fun insertIdealWaterIntake(idealWaterIntake: IdealWaterIntakeEntity)

@Query("SELECT *FROM ideal_water_table")
fun getIdealWaterIntake(): LiveData<IdealWaterIntakeEntity>
fun getIdealWaterIntake(): LiveData<IdealWaterIntakeEntity?>

@Delete
suspend fun deleteIdealIntake(idealWaterIntake: IdealWaterIntakeEntity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface ReminderTimeDao {
suspend fun insertReminderTime(reminderTime: ReminderTimeEntity)

@Query("SELECT *FROM reminder_table")
fun getReminderTime(): LiveData<ReminderTimeEntity>
fun getReminderTime(): LiveData<ReminderTimeEntity?>

@Delete
suspend fun deleteReminderTime(reminderTime: ReminderTimeEntity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Days>
val hour: Int?,
val minute: Int?,
val ampm: String?,
val isRepeated: Boolean?,
val isAllDay: Boolean?,
val days: List<Days>?
)
Loading

0 comments on commit 79df933

Please sign in to comment.