Add some aliases and fixes placeholder color.
This commit is contained in:
parent
e4cc733f4a
commit
c54471b5e0
2 changed files with 53 additions and 7 deletions
|
|
@ -54,6 +54,11 @@ import com.google.accompanist.placeholder.material.placeholder
|
|||
import io.element.android.features.roomlist.model.RoomListRoomSummary
|
||||
import io.element.android.libraries.designsystem.components.avatar.Avatar
|
||||
import io.element.android.libraries.designsystem.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.theme.roomListPlaceHolder
|
||||
import io.element.android.libraries.designsystem.theme.roomListRoomMessage
|
||||
import io.element.android.libraries.designsystem.theme.roomListRoomMessageDate
|
||||
import io.element.android.libraries.designsystem.theme.roomListRoomName
|
||||
import io.element.android.libraries.designsystem.theme.roomListUnreadIndicator
|
||||
|
||||
private val minHeight = 72.dp
|
||||
|
||||
|
|
@ -95,7 +100,11 @@ internal fun DefaultRoomSummaryRow(
|
|||
) {
|
||||
Avatar(
|
||||
room.avatarData,
|
||||
modifier = Modifier.placeholder(room.isPlaceholder, shape = CircleShape)
|
||||
modifier = Modifier.placeholder(
|
||||
visible = room.isPlaceholder,
|
||||
shape = CircleShape,
|
||||
color = ElementTheme.colors.roomListPlaceHolder,
|
||||
)
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
|
@ -105,19 +114,27 @@ internal fun DefaultRoomSummaryRow(
|
|||
) {
|
||||
// Name
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.placeholder(room.isPlaceholder, shape = TextPlaceholderShape),
|
||||
modifier = Modifier.placeholder(
|
||||
visible = room.isPlaceholder,
|
||||
shape = TextPlaceholderShape,
|
||||
color = ElementTheme.colors.roomListPlaceHolder,
|
||||
),
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
text = room.name,
|
||||
color = ElementTheme.colors.roomListRoomName,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
// Last Message
|
||||
Text(
|
||||
modifier = Modifier.placeholder(room.isPlaceholder, shape = TextPlaceholderShape),
|
||||
modifier = Modifier.placeholder(
|
||||
visible = room.isPlaceholder,
|
||||
shape = TextPlaceholderShape,
|
||||
color = ElementTheme.colors.roomListPlaceHolder,
|
||||
),
|
||||
text = room.lastMessage?.toString().orEmpty(),
|
||||
color = ElementTheme.colors.secondary,
|
||||
color = ElementTheme.colors.roomListRoomMessage,
|
||||
fontSize = 14.sp,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
|
|
@ -132,11 +149,11 @@ internal fun DefaultRoomSummaryRow(
|
|||
modifier = Modifier.placeholder(room.isPlaceholder, shape = TextPlaceholderShape),
|
||||
fontSize = 12.sp,
|
||||
text = room.timestamp ?: "",
|
||||
color = ElementTheme.colors.secondary,
|
||||
color = ElementTheme.colors.roomListRoomMessageDate,
|
||||
)
|
||||
Spacer(Modifier.size(4.dp))
|
||||
val unreadIndicatorColor =
|
||||
if (room.hasUnread) ElementTheme.colors.primary else Color.Transparent
|
||||
if (room.hasUnread) ElementTheme.colors.roomListUnreadIndicator else Color.Transparent
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(12.dp)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2023 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.designsystem.theme
|
||||
|
||||
import io.element.android.libraries.designsystem.SystemGrey4Dark
|
||||
import io.element.android.libraries.designsystem.SystemGrey6Light
|
||||
|
||||
/**
|
||||
* Room list
|
||||
*/
|
||||
val ElementColors.roomListRoomName get() = primary
|
||||
val ElementColors.roomListRoomMessage get() = secondary
|
||||
val ElementColors.roomListRoomMessageDate get() = secondary
|
||||
val ElementColors.roomListUnreadIndicator get() = primary
|
||||
val ElementColors.roomListPlaceHolder get() = if (isLight) SystemGrey6Light else SystemGrey4Dark
|
||||
Loading…
Add table
Add a link
Reference in a new issue