Skip to content

Commit d377b1e

Browse files
committed
🔧 updated ui components
1 parent a5933f7 commit d377b1e

File tree

6 files changed

+224
-72
lines changed

6 files changed

+224
-72
lines changed

app/src/main/java/com/shub39/rush/presentation/ChangelogSheet.kt

Lines changed: 63 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,77 +16,105 @@
1616
*/
1717
package com.shub39.rush.presentation
1818

19+
import androidx.compose.foundation.background
1920
import androidx.compose.foundation.layout.Arrangement
21+
import androidx.compose.foundation.layout.Box
2022
import androidx.compose.foundation.layout.Column
2123
import androidx.compose.foundation.layout.PaddingValues
22-
import androidx.compose.foundation.layout.Row
24+
import androidx.compose.foundation.layout.Spacer
2325
import androidx.compose.foundation.layout.fillMaxWidth
24-
import androidx.compose.foundation.layout.heightIn
26+
import androidx.compose.foundation.layout.height
2527
import androidx.compose.foundation.layout.padding
28+
import androidx.compose.foundation.layout.size
2629
import androidx.compose.foundation.lazy.LazyColumn
2730
import androidx.compose.foundation.lazy.itemsIndexed
28-
import androidx.compose.material3.BasicAlertDialog
29-
import androidx.compose.material3.Card
31+
import androidx.compose.material3.Button
3032
import androidx.compose.material3.ExperimentalMaterial3Api
31-
import androidx.compose.material3.HorizontalDivider
33+
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
34+
import androidx.compose.material3.Icon
35+
import androidx.compose.material3.ListItem
36+
import androidx.compose.material3.MaterialShapes
3237
import androidx.compose.material3.MaterialTheme
3338
import androidx.compose.material3.Text
34-
import androidx.compose.material3.TextButton
39+
import androidx.compose.material3.toShape
3540
import androidx.compose.runtime.Composable
41+
import androidx.compose.ui.Alignment
3642
import androidx.compose.ui.Modifier
43+
import androidx.compose.ui.draw.clip
44+
import androidx.compose.ui.res.painterResource
3745
import androidx.compose.ui.res.stringResource
38-
import androidx.compose.ui.text.font.FontWeight
3946
import androidx.compose.ui.unit.dp
4047
import com.shub39.rush.R
4148
import com.shub39.rush.app.VersionEntry
49+
import com.shub39.rush.presentation.components.RushBottomSheet
4250

43-
@OptIn(ExperimentalMaterial3Api::class)
51+
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
4452
@Composable
4553
fun ChangelogSheet(
4654
modifier: Modifier = Modifier,
4755
currentLog: VersionEntry,
4856
onDismissRequest: () -> Unit,
4957
) {
50-
BasicAlertDialog(onDismissRequest = onDismissRequest, modifier = modifier) {
51-
Card(
52-
modifier = Modifier.fillMaxWidth().heightIn(max = 500.dp),
53-
shape = MaterialTheme.shapes.extraLarge,
58+
RushBottomSheet(onDismissRequest = onDismissRequest, modifier = modifier, padding = 0.dp) {
59+
Column(
60+
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp),
61+
verticalArrangement = Arrangement.spacedBy(4.dp),
5462
) {
55-
Column(modifier = Modifier.padding(16.dp)) {
63+
Box(
64+
contentAlignment = Alignment.Center,
65+
modifier =
66+
Modifier.size(48.dp)
67+
.background(
68+
color = MaterialTheme.colorScheme.primaryContainer,
69+
shape = MaterialShapes.Pill.toShape(),
70+
),
71+
) {
72+
Icon(
73+
painter = painterResource(R.drawable.settings),
74+
contentDescription = null,
75+
tint = MaterialTheme.colorScheme.onPrimaryContainer,
76+
)
77+
}
78+
79+
Column {
80+
Text(
81+
text = stringResource(R.string.whats_changed),
82+
style =
83+
MaterialTheme.typography.headlineSmall.copy(fontFamily = flexFontEmphasis()),
84+
)
5685
Text(
57-
text = stringResource(R.string.changelog),
86+
text = currentLog.version,
5887
style =
59-
MaterialTheme.typography.displaySmall.copy(fontFamily = flexFontEmphasis()),
88+
MaterialTheme.typography.titleMedium.copy(fontFamily = flexFontRounded()),
6089
)
61-
Text(text = currentLog.version, style = MaterialTheme.typography.titleLarge)
6290
}
63-
HorizontalDivider()
6491

6592
LazyColumn(
66-
verticalArrangement = Arrangement.spacedBy(8.dp),
93+
verticalArrangement = Arrangement.spacedBy(2.dp),
6794
contentPadding = PaddingValues(vertical = 16.dp),
6895
) {
6996
itemsIndexed(currentLog.changes) { index, change ->
70-
Row(
71-
modifier = Modifier.padding(horizontal = 16.dp),
72-
horizontalArrangement = Arrangement.spacedBy(4.dp),
73-
) {
74-
Text(text = "${index.plus(1)}.", fontWeight = FontWeight.Bold)
75-
Text(text = change)
76-
}
77-
}
78-
79-
item {
80-
Row(
81-
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp),
82-
horizontalArrangement = Arrangement.End,
83-
) {
84-
TextButton(onClick = onDismissRequest) {
85-
Text(text = stringResource(R.string.done))
97+
val shape =
98+
when {
99+
currentLog.changes.size == 1 -> detachedItemShape()
100+
index == 0 -> leadingItemShape()
101+
index == currentLog.changes.size - 1 -> endItemShape()
102+
else -> middleItemShape()
86103
}
87-
}
104+
105+
ListItem(
106+
colors = listItemColors(),
107+
modifier = Modifier.clip(shape),
108+
headlineContent = { Text(text = change) },
109+
)
88110
}
89111
}
112+
113+
Button(onClick = onDismissRequest, modifier = Modifier.fillMaxWidth()) {
114+
Text(text = stringResource(R.string.done))
115+
}
116+
117+
Spacer(modifier = Modifier.height(16.dp))
90118
}
91119
}
92120
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (C) 2026 Shubham Gorai
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package com.shub39.rush.presentation.components
18+
19+
import androidx.compose.animation.animateContentSize
20+
import androidx.compose.foundation.layout.Arrangement
21+
import androidx.compose.foundation.layout.Column
22+
import androidx.compose.foundation.layout.ColumnScope
23+
import androidx.compose.foundation.layout.fillMaxWidth
24+
import androidx.compose.foundation.layout.padding
25+
import androidx.compose.material3.ExperimentalMaterial3Api
26+
import androidx.compose.material3.ModalBottomSheet
27+
import androidx.compose.material3.SheetState
28+
import androidx.compose.material3.rememberModalBottomSheetState
29+
import androidx.compose.runtime.Composable
30+
import androidx.compose.ui.Alignment
31+
import androidx.compose.ui.Modifier
32+
import androidx.compose.ui.unit.Dp
33+
import androidx.compose.ui.unit.dp
34+
35+
@OptIn(ExperimentalMaterial3Api::class)
36+
@Composable
37+
fun RushBottomSheet(
38+
onDismissRequest: () -> Unit,
39+
sheetState: SheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
40+
modifier: Modifier = Modifier,
41+
padding: Dp = 32.dp,
42+
content: @Composable (ColumnScope.() -> Unit),
43+
) {
44+
ModalBottomSheet(
45+
onDismissRequest = onDismissRequest,
46+
sheetMaxWidth = 500.dp,
47+
modifier = modifier,
48+
sheetState = sheetState,
49+
) {
50+
Column(
51+
modifier = Modifier.padding(padding).animateContentSize().fillMaxWidth(),
52+
horizontalAlignment = Alignment.CenterHorizontally,
53+
verticalArrangement = Arrangement.spacedBy(8.dp),
54+
content = content,
55+
)
56+
}
57+
}

app/src/main/java/com/shub39/rush/presentation/setting/component/AboutApp.kt

Lines changed: 75 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@
1616
*/
1717
package com.shub39.rush.presentation.setting.component
1818

19+
import androidx.compose.foundation.background
20+
import androidx.compose.foundation.clickable
1921
import androidx.compose.foundation.layout.Arrangement
2022
import androidx.compose.foundation.layout.Column
21-
import androidx.compose.foundation.layout.FlowRow
2223
import androidx.compose.foundation.layout.Row
2324
import androidx.compose.foundation.layout.Spacer
2425
import androidx.compose.foundation.layout.fillMaxWidth
2526
import androidx.compose.foundation.layout.padding
2627
import androidx.compose.foundation.layout.size
27-
import androidx.compose.material3.Button
28+
import androidx.compose.foundation.layout.width
2829
import androidx.compose.material3.Card
2930
import androidx.compose.material3.CardDefaults
3031
import androidx.compose.material3.Icon
@@ -34,13 +35,18 @@ import androidx.compose.material3.Text
3435
import androidx.compose.runtime.Composable
3536
import androidx.compose.ui.Alignment
3637
import androidx.compose.ui.Modifier
38+
import androidx.compose.ui.draw.clip
3739
import androidx.compose.ui.platform.LocalUriHandler
3840
import androidx.compose.ui.res.painterResource
3941
import androidx.compose.ui.res.stringResource
4042
import androidx.compose.ui.unit.dp
4143
import com.shub39.rush.BuildConfig
4244
import com.shub39.rush.R
45+
import com.shub39.rush.presentation.endItemShape
4346
import com.shub39.rush.presentation.flexFontEmphasis
47+
import com.shub39.rush.presentation.flexFontRounded
48+
import com.shub39.rush.presentation.leadingItemShape
49+
import com.shub39.rush.presentation.middleItemShape
4450

4551
@Composable
4652
fun AboutApp() {
@@ -62,13 +68,14 @@ fun AboutApp() {
6268
) {
6369
Column {
6470
Text(
65-
text = "Rush",
71+
text = "Grit",
6672
style =
67-
MaterialTheme.typography.headlineMedium.copy(
68-
fontFamily = flexFontEmphasis()
69-
),
73+
MaterialTheme.typography.headlineLarge.copy(fontFamily = flexFontEmphasis()),
74+
)
75+
Text(
76+
text = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})",
77+
fontFamily = flexFontRounded(),
7078
)
71-
Text(text = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})")
7279
}
7380

7481
Spacer(modifier = Modifier.weight(1f))
@@ -82,7 +89,7 @@ fun AboutApp() {
8289
)
8390
}
8491

85-
IconButton(onClick = { uriHandler.openUri("https://github.com/shub39/Rush") }) {
92+
IconButton(onClick = { uriHandler.openUri("https://github.com/shub39/Grit") }) {
8693
Icon(
8794
painter = painterResource(R.drawable.github),
8895
contentDescription = "Github",
@@ -92,58 +99,98 @@ fun AboutApp() {
9299
}
93100
}
94101

95-
FlowRow(
102+
Column(
96103
modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp),
97-
horizontalArrangement = Arrangement.spacedBy(8.dp),
104+
verticalArrangement = Arrangement.spacedBy(2.dp),
98105
) {
99-
Button(onClick = { uriHandler.openUri("https://buymeacoffee.com/shub39") }) {
106+
Row(
107+
modifier =
108+
Modifier.background(
109+
color = MaterialTheme.colorScheme.primary,
110+
shape = leadingItemShape(),
111+
)
112+
.clip(leadingItemShape())
113+
.clickable { uriHandler.openUri("https://buymeacoffee.com/shub39") }
114+
) {
100115
Row(
101-
horizontalArrangement = Arrangement.spacedBy(8.dp),
116+
modifier = Modifier.fillMaxWidth().padding(16.dp),
117+
horizontalArrangement = Arrangement.Center,
102118
verticalAlignment = Alignment.CenterVertically,
103119
) {
104120
Icon(
105121
painter = painterResource(R.drawable.buymeacoffee),
106122
contentDescription = "Buy me a coffee",
107123
modifier = Modifier.size(24.dp),
124+
tint = MaterialTheme.colorScheme.onPrimary,
125+
)
126+
Spacer(modifier = Modifier.width(8.dp))
127+
Text(
128+
text = stringResource(R.string.bmc),
129+
color = MaterialTheme.colorScheme.onPrimary,
130+
fontFamily = flexFontRounded(),
108131
)
109-
110-
Text(text = stringResource(R.string.bmc))
111132
}
112133
}
113134

114-
Button(onClick = { uriHandler.openUri("https://hosted.weblate.org/engage/rush/") }) {
135+
Row(
136+
modifier =
137+
Modifier.background(
138+
color = MaterialTheme.colorScheme.primary,
139+
shape = middleItemShape(),
140+
)
141+
.clip(middleItemShape())
142+
.clickable { uriHandler.openUri("https://hosted.weblate.org/engage/grit/") }
143+
) {
115144
Row(
116-
horizontalArrangement = Arrangement.spacedBy(8.dp),
145+
modifier = Modifier.fillMaxWidth().padding(16.dp),
146+
horizontalArrangement = Arrangement.Center,
117147
verticalAlignment = Alignment.CenterVertically,
118148
) {
119149
Icon(
120150
painter = painterResource(R.drawable.language),
121151
contentDescription = "Translate",
122152
modifier = Modifier.size(24.dp),
153+
tint = MaterialTheme.colorScheme.onPrimary,
154+
)
155+
Spacer(modifier = Modifier.width(8.dp))
156+
Text(
157+
text = stringResource(R.string.translate),
158+
color = MaterialTheme.colorScheme.onPrimary,
159+
fontFamily = flexFontRounded(),
123160
)
124-
125-
Text(text = stringResource(R.string.translate))
126161
}
127162
}
128163

129-
Button(
130-
onClick = {
131-
uriHandler.openUri(
132-
"https://play.google.com/store/apps/details?id=com.shub39.rush.play"
133-
)
134-
}
164+
Row(
165+
modifier =
166+
Modifier.background(
167+
color = MaterialTheme.colorScheme.primary,
168+
shape = endItemShape(),
169+
)
170+
.clip(endItemShape())
171+
.clickable {
172+
uriHandler.openUri(
173+
"https://play.google.com/store/apps/details?id=com.shub39.grit"
174+
)
175+
}
135176
) {
136177
Row(
137-
horizontalArrangement = Arrangement.spacedBy(8.dp),
178+
modifier = Modifier.fillMaxWidth().padding(16.dp),
179+
horizontalArrangement = Arrangement.Center,
138180
verticalAlignment = Alignment.CenterVertically,
139181
) {
140182
Icon(
141183
painter = painterResource(R.drawable.play_store),
142184
contentDescription = "Rate On Google Play",
143-
modifier = Modifier.size(20.dp),
185+
modifier = Modifier.size(24.dp),
186+
tint = MaterialTheme.colorScheme.onPrimary,
187+
)
188+
Spacer(modifier = Modifier.width(8.dp))
189+
Text(
190+
text = stringResource(R.string.rate_on_play),
191+
color = MaterialTheme.colorScheme.onPrimary,
192+
fontFamily = flexFontRounded(),
144193
)
145-
146-
Text(text = stringResource(R.string.rate_on_play))
147194
}
148195
}
149196
}

0 commit comments

Comments
 (0)