Skip to content

Commit 1d67774

Browse files
AndyScherzingerbackportbot[bot]
authored andcommitted
style: optimize leading icon vertical position and padding at card-bottom
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent 25c36b5 commit 1d67774

1 file changed

Lines changed: 34 additions & 8 deletions

File tree

app/src/main/java/com/nextcloud/talk/ui/OutOfOffice.kt

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,19 @@ fun OutOfOfficeView(data: OutOfOfficeViewData, viewThemeUtils: ViewThemeUtils, o
113113
colors = CardDefaults.cardColors(containerColor = colorScheme.surface),
114114
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant)
115115
) {
116-
Row(modifier = Modifier.padding(start = 8.dp, end = 0.dp)) {
116+
Row(modifier = Modifier.padding(start = 8.dp, end = 0.dp, bottom = 4.dp)) {
117117
Icon(
118118
imageVector = Icons.Outlined.Bedtime,
119119
contentDescription = null,
120120
modifier = Modifier
121-
.padding(top = 8.dp)
121+
.padding(top = 10.dp)
122122
.size(24.dp)
123123
)
124124
Spacer(modifier = Modifier.size(8.dp))
125125
Column(
126126
modifier = Modifier
127127
.weight(1f)
128-
.padding(top = 8.dp, bottom = 8.dp),
128+
.padding(top = 10.dp, bottom = 8.dp),
129129
verticalArrangement = Arrangement.spacedBy(8.dp)
130130
) {
131131
Text(
@@ -177,8 +177,7 @@ private fun OutOfOfficeExpandedContent(
177177
Column(
178178
modifier = Modifier
179179
.heightIn(max = MAX_CONTENT_HEIGHT.dp)
180-
.verticalScroll(scrollState),
181-
verticalArrangement = Arrangement.spacedBy(8.dp)
180+
.verticalScroll(scrollState)
182181
) {
183182
if (period != null) {
184183
Text(
@@ -194,6 +193,8 @@ private fun OutOfOfficeExpandedContent(
194193
baseUrl = baseUrl,
195194
onReplacementClick = onReplacementClick
196195
)
196+
} else {
197+
Spacer(modifier = Modifier.size(8.dp))
197198
}
198199
Text(
199200
text = userAbsence.message,
@@ -289,13 +290,38 @@ fun OutOfOfficePreviewRtlCollapsed() {
289290
OutOfOfficePreview(displayName = "جين", initialExpanded = false)
290291
}
291292

293+
@Preview(name = "Light Mode / No Replacement")
294+
@Composable
295+
fun OutOfOfficePreviewNoReplacement() {
296+
OutOfOfficePreview(replacementUserId = null, replacementUserDisplayName = null)
297+
}
298+
299+
@Preview(name = "Dark Mode / No Replacement", uiMode = android.content.res.Configuration.UI_MODE_NIGHT_YES)
300+
@Composable
301+
fun OutOfOfficePreviewDarkNoReplacement() {
302+
OutOfOfficePreview(replacementUserId = null, replacementUserDisplayName = null)
303+
}
304+
305+
@Preview(name = "R-t-L / No Replacement", locale = "ar")
306+
@Composable
307+
fun OutOfOfficePreviewRtlNoReplacement() {
308+
OutOfOfficePreview(
309+
displayName = "جين",
310+
message = "مرحباً، أنا خارج المكتب هذا الأسبوع.",
311+
replacementUserId = null,
312+
replacementUserDisplayName = null
313+
)
314+
}
315+
292316
@Suppress("MagicNumber")
293317
@Preview(name = "Light Mode")
294318
@Composable
295319
fun OutOfOfficePreview(
296320
displayName: String = "Jane",
297321
initialExpanded: Boolean = true,
298-
message: String = "Hi, I am out of office this week. Please contact Bob for urgent matters."
322+
message: String = "Hi, I am out of office this week. Please contact Bob for urgent matters.",
323+
replacementUserId: String? = "bob",
324+
replacementUserDisplayName: String? = "Bob"
299325
) {
300326
val context = LocalContext.current
301327
val previewUtils = ComposePreviewUtils.getInstance(context)
@@ -309,8 +335,8 @@ fun OutOfOfficePreview(
309335
endDate = 1749340800,
310336
shortMessage = "Out of office",
311337
message = message,
312-
replacementUserId = "bob",
313-
replacementUserDisplayName = "Bob"
338+
replacementUserId = replacementUserId,
339+
replacementUserDisplayName = replacementUserDisplayName
314340
)
315341

316342
MaterialTheme(colorScheme = colorScheme) {

0 commit comments

Comments
 (0)