Skip to content

Commit 7772249

Browse files
committed
improvements.
1 parent 2bb8aa2 commit 7772249

9 files changed

Lines changed: 124 additions & 176 deletions

File tree

.idea/deploymentTargetDropDown.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ dependencies {
8181
kapt(Room.compiler)
8282
implementation(Room.ktx)
8383

84+
implementation("com.github.commandiron:HandyCompose:1.0.3")
85+
8486
testImplementation(Testing.junit)
8587

8688
androidTestImplementation(Testing.junitAndroidExt)

app/src/main/java/com/commandiron/vacationchecklist/presentation/checklist/ChecklistScreen.kt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.*
55
import androidx.compose.foundation.lazy.LazyColumn
66
import androidx.compose.foundation.lazy.grid.GridCells
77
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
8-
import androidx.compose.foundation.lazy.grid.items
98
import androidx.compose.foundation.lazy.grid.itemsIndexed
109
import androidx.compose.foundation.lazy.itemsIndexed
1110
import androidx.compose.material.icons.Icons
@@ -19,19 +18,13 @@ import androidx.compose.ui.Modifier
1918
import androidx.compose.ui.graphics.Color
2019
import androidx.compose.ui.unit.dp
2120
import androidx.hilt.navigation.compose.hiltViewModel
22-
import com.commandiron.vacationchecklist.presentation.checklist.components.ChecklistHeader
23-
import com.commandiron.vacationchecklist.presentation.checklist.components.ColumnItem
24-
import com.commandiron.vacationchecklist.presentation.checklist.components.GridItem
25-
import com.commandiron.vacationchecklist.presentation.checklist.components.ReadyToGoView
21+
import com.commandiron.vacationchecklist.presentation.checklist.components.*
2622
import com.commandiron.vacationchecklist.presentation.components.CustomAlertDialog
2723
import com.commandiron.vacationchecklist.presentation.components.LoadingThreeDotAnimation
2824
import com.commandiron.vacationchecklist.util.LocalSpacing
29-
import com.commandiron.vacationchecklist.util.Strings
3025
import com.commandiron.vacationchecklist.util.Strings.English.IN_YOUR_BAG
3126
import com.commandiron.vacationchecklist.util.Strings.English.LOADING
32-
import com.commandiron.vacationchecklist.util.Strings.English.NO
3327
import com.commandiron.vacationchecklist.util.Strings.English.PLEASE_CREATE_VACATION
34-
import com.commandiron.vacationchecklist.util.Strings.English.YES
3528
import com.commandiron.vacationchecklist.util.UiEvent
3629

3730
@Composable
@@ -136,7 +129,6 @@ fun ChecklistScreen(
136129
GridItem(
137130
checklistItem = checklistItem,
138131
isChecked = checklistItem.isChecked,
139-
listScale = state.listScale,
140132
onClick = {
141133
viewModel.onEvent(ChecklistUserEvent.OnCheck(index, checklistItem))
142134
}
@@ -160,8 +152,17 @@ fun ChecklistScreen(
160152
) {
161153
itemsIndexed(vacation.checklistItems){ index, checklistItem ->
162154
ColumnItem(
155+
modifier = Modifier
156+
.height(
157+
when(state.listScale){
158+
1 -> 32.dp
159+
2 -> 64.dp
160+
3 -> 96.dp
161+
else -> 32.dp
162+
}
163+
)
164+
.fillMaxWidth(),
163165
checklistItem = checklistItem,
164-
listScale = state.listScale,
165166
onCheckedChange = {
166167
viewModel.onEvent(ChecklistUserEvent.OnCheck(index, checklistItem))
167168
}

app/src/main/java/com/commandiron/vacationchecklist/presentation/checklist/ChecklistUserEvent.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.commandiron.vacationchecklist.domain.model.ChecklistItem
44

55
sealed class ChecklistUserEvent{
66
data class OnCheck(val index: Int, val checklistItem: ChecklistItem): ChecklistUserEvent()
7+
data class OnAddAlarmClick(val index: Int, val checklistItem: ChecklistItem): ChecklistUserEvent()
78
object OnAlertDialogDismiss : ChecklistUserEvent()
89
object OnAlertDialogConfirm : ChecklistUserEvent()
910
object OnChecklistCompleteBack: ChecklistUserEvent()

app/src/main/java/com/commandiron/vacationchecklist/presentation/checklist/ChecklistViewModel.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ class ChecklistViewModel @Inject constructor(
103103
showAlertDialog = false
104104
)
105105
}
106-
106+
is ChecklistUserEvent.OnAddAlarmClick -> {
107+
//Burda alarm kurulacak.
108+
}
107109
}
108110
}
109111

Lines changed: 41 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
package com.commandiron.vacationchecklist.presentation.checklist.components
22

3+
import androidx.compose.foundation.border
34
import androidx.compose.foundation.layout.*
45
import androidx.compose.foundation.shape.RoundedCornerShape
6+
import androidx.compose.material.icons.Icons
7+
import androidx.compose.material.icons.filled.Alarm
58
import androidx.compose.material3.*
69
import androidx.compose.runtime.Composable
710
import androidx.compose.ui.Alignment
811
import androidx.compose.ui.Modifier
12+
import androidx.compose.ui.graphics.Color
13+
import androidx.compose.ui.res.painterResource
914
import androidx.compose.ui.text.font.FontWeight
15+
import androidx.compose.ui.text.style.TextAlign
16+
import androidx.compose.ui.text.style.TextOverflow
1017
import androidx.compose.ui.unit.dp
18+
import com.commandiron.handy_compose.core.HandyCard
19+
import com.commandiron.handy_compose.core.HandyRowCard
1120
import com.commandiron.vacationchecklist.domain.model.ChecklistItem
1221
import com.commandiron.vacationchecklist.presentation.components.CustomCircularIcon
1322
import com.commandiron.vacationchecklist.presentation.components.ImportanceLevelDot
@@ -16,88 +25,45 @@ import com.commandiron.vacationchecklist.util.LocalSpacing
1625

1726
@Composable
1827
fun ColumnItem(
28+
modifier: Modifier = Modifier,
1929
checklistItem: ChecklistItem,
20-
listScale: Int,
21-
onCheckedChange:(Boolean) -> Unit
30+
onCheckedChange: (Boolean) -> Unit
2231
) {
2332
val spacing = LocalSpacing.current
24-
Surface(
25-
modifier = Modifier
26-
.height(
27-
when(listScale){
28-
1 -> spacing.bottomNavigationHeight / 2
29-
2 -> spacing.bottomNavigationHeight
30-
3 -> spacing.bottomNavigationHeight * 2
31-
else -> spacing.bottomNavigationHeight
32-
}
33-
34-
)
35-
.fillMaxWidth(),
33+
HandyRowCard(
34+
modifier = modifier,
3635
color = MaterialTheme.colorScheme.secondaryContainer,
37-
shape = RoundedCornerShape(spacing.spaceMedium)
38-
) {
39-
Row(
40-
modifier = Modifier
41-
.fillMaxSize()
42-
.padding(spacing.spaceSmall),
43-
verticalAlignment = Alignment.CenterVertically
44-
) {
45-
Box(
46-
modifier = Modifier
47-
.weight(1f),
48-
contentAlignment =
49-
when(listScale){
50-
1 -> Alignment.Center
51-
2 -> Alignment.CenterStart
52-
3 -> Alignment.CenterStart
53-
else -> Alignment.CenterStart
54-
}
36+
shadowElevation = 4.dp,
37+
startContentWeight = 1f,
38+
startContent = {
39+
HandyCard(
40+
modifier = Modifier.fillMaxSize(),
41+
shapeSizeFraction = 0f,
42+
color = LocalContentColor.current.copy(0f)
5543
) {
56-
CustomCircularIcon(
57-
surfaceShape = RoundedCornerShape(spacing.spaceSmall),
58-
surfaceColor = iconBackgroundColor,
59-
iconDrawable = checklistItem.iconDrawable,
60-
iconPadding = when(listScale){
61-
1 -> 0.dp
62-
2 -> spacing.spaceExtraSmall
63-
3 -> spacing.spaceExtraSmall
64-
else -> spacing.spaceExtraSmall
65-
}
44+
Icon(
45+
painter = painterResource(checklistItem.iconDrawable),
46+
contentDescription = null,
47+
tint = Color.Unspecified
6648
)
6749
}
68-
Spacer(
69-
modifier = Modifier.width(
70-
when(listScale){
71-
1 -> 0.dp
72-
2 -> spacing.spaceSmall
73-
3 -> spacing.spaceLarge
74-
else -> spacing.spaceSmall
75-
}
76-
)
50+
},
51+
centerContentWeight = 3f,
52+
centerContent = {
53+
Text(
54+
text = checklistItem.name,
55+
textAlign = TextAlign.Center,
56+
style = MaterialTheme.typography.bodySmall,
57+
overflow = TextOverflow.Ellipsis
7758
)
78-
Row(
79-
modifier = Modifier.weight(3f),
80-
horizontalArrangement = Arrangement.Start,
81-
verticalAlignment = Alignment.CenterVertically
82-
) {
83-
ImportanceLevelDot(
84-
modifier = Modifier.size(spacing.spaceExtraSmall),
85-
importanceLevel = checklistItem.importanceLevel
86-
)
87-
Spacer(modifier = Modifier.width(spacing.spaceSmall))
88-
Text(
89-
text = checklistItem.name,
90-
style = when(listScale){
91-
1 -> MaterialTheme.typography.bodyMedium.copy(fontWeight = FontWeight.Medium)
92-
2 -> MaterialTheme.typography.bodyLarge.copy(fontWeight = FontWeight.Medium)
93-
3 -> MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Medium)
94-
else -> MaterialTheme.typography.bodyLarge.copy(fontWeight = FontWeight.Medium)
95-
}
96-
)
97-
}
98-
Box(
99-
modifier = Modifier.weight(1f),
100-
contentAlignment = Alignment.CenterEnd
59+
},
60+
endContentWeight = 1f,
61+
endContent = {
62+
HandyCard(
63+
modifier = Modifier.fillMaxSize(),
64+
shapeSizeFraction = 0f,
65+
paddingFraction = 0.1f,
66+
color = LocalContentColor.current.copy(0f)
10167
) {
10268
Checkbox(
10369
checked = checklistItem.isChecked,
@@ -110,5 +76,5 @@ fun ColumnItem(
11076
)
11177
}
11278
}
113-
}
79+
)
11480
}

0 commit comments

Comments
 (0)