Skip to content

Commit 49db6fb

Browse files
committed
perf: SubsSheet mtimeStr
1 parent 1579a56 commit 49db6fb

File tree

1 file changed

+31
-43
lines changed

1 file changed

+31
-43
lines changed

app/src/main/kotlin/li/songe/gkd/ui/component/SubsSheet.kt

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import li.songe.gkd.MainActivity
5656
import li.songe.gkd.data.deleteSubscription
5757
import li.songe.gkd.ui.style.EmptyHeight
5858
import li.songe.gkd.ui.style.itemHorizontalPadding
59-
import li.songe.gkd.ui.style.itemVerticalPadding
6059
import li.songe.gkd.util.LOCAL_SUBS_ID
6160
import li.songe.gkd.util.LocalNavController
6261
import li.songe.gkd.util.checkSubsUpdate
@@ -122,7 +121,7 @@ fun SubsSheet(
122121
val childModifier = remember {
123122
Modifier
124123
.fillMaxWidth()
125-
.padding(horizontal = itemHorizontalPadding, vertical = itemVerticalPadding / 2)
124+
.padding(horizontal = itemHorizontalPadding, vertical = 8.dp)
126125
}
127126
Column(
128127
modifier = Modifier
@@ -138,16 +137,34 @@ fun SubsSheet(
138137
modifier = childModifier
139138
)
140139
if (subscription != null) {
141-
if (!subsItem.isLocal) {
140+
Column(
141+
modifier = childModifier
142+
) {
142143
Row(
144+
modifier = Modifier.fillMaxWidth(),
145+
verticalAlignment = Alignment.CenterVertically,
143146
horizontalArrangement = Arrangement.SpaceBetween,
144-
modifier = childModifier
145147
) {
146-
Column {
147-
Text(
148-
text = "作者",
149-
style = MaterialTheme.typography.labelLarge,
150-
)
148+
Text(
149+
text = "作者",
150+
style = MaterialTheme.typography.labelLarge,
151+
)
152+
Text(
153+
text = "v${subscription.version}",
154+
style = MaterialTheme.typography.labelMedium,
155+
color = MaterialTheme.colorScheme.tertiary,
156+
modifier = Modifier
157+
.clip(MaterialTheme.shapes.extraSmall)
158+
.background(MaterialTheme.colorScheme.tertiaryContainer)
159+
.padding(horizontal = 2.dp),
160+
)
161+
}
162+
Row(
163+
modifier = Modifier.fillMaxWidth(),
164+
verticalAlignment = Alignment.CenterVertically,
165+
horizontalArrangement = Arrangement.SpaceBetween,
166+
) {
167+
if (!subsItem.isLocal) {
151168
Text(
152169
text = subscription.author ?: "未知",
153170
style = MaterialTheme.typography.labelMedium,
@@ -162,49 +179,20 @@ fun SubsSheet(
162179
softWrap = false,
163180
overflow = TextOverflow.Ellipsis,
164181
)
165-
}
166-
Column(
167-
horizontalAlignment = Alignment.End
168-
) {
182+
} else {
169183
Text(
170-
text = "v${subscription.version}",
184+
text = META.appName,
171185
style = MaterialTheme.typography.labelMedium,
172-
color = MaterialTheme.colorScheme.tertiary,
173-
modifier = Modifier
174-
.clip(MaterialTheme.shapes.extraSmall)
175-
.background(MaterialTheme.colorScheme.tertiaryContainer)
176-
.padding(horizontal = 2.dp),
186+
color = MaterialTheme.colorScheme.secondary,
177187
)
178188
}
179-
}
180-
} else {
181-
Column(
182-
modifier = childModifier
183-
) {
184189
Text(
185-
text = "作者",
186-
style = MaterialTheme.typography.labelLarge,
187-
)
188-
Text(
189-
text = META.appName,
190+
text = subsItem.mtimeStr,
190191
style = MaterialTheme.typography.labelMedium,
191-
color = MaterialTheme.colorScheme.secondary,
192+
color = MaterialTheme.colorScheme.onSurfaceVariant,
192193
)
193194
}
194195
}
195-
Column(
196-
modifier = childModifier
197-
) {
198-
Text(
199-
text = "更新时间",
200-
style = MaterialTheme.typography.labelLarge,
201-
)
202-
Text(
203-
text = subsItem.mtimeStr,
204-
style = MaterialTheme.typography.labelMedium,
205-
color = MaterialTheme.colorScheme.onSurfaceVariant,
206-
)
207-
}
208196
if (subscription.globalGroups.isNotEmpty() || subsItem.isLocal) {
209197
Row(
210198
modifier = Modifier

0 commit comments

Comments
 (0)