Improve API of UnreadIndicatorAtom
This commit is contained in:
parent
b75100b2ab
commit
c06a0d46f6
4 changed files with 4 additions and 11 deletions
|
|
@ -32,7 +32,6 @@ import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.AnnotatedString
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
|
|
@ -56,8 +55,6 @@ import io.element.android.libraries.designsystem.theme.components.Button
|
||||||
import io.element.android.libraries.designsystem.theme.components.OutlinedButton
|
import io.element.android.libraries.designsystem.theme.components.OutlinedButton
|
||||||
import io.element.android.libraries.designsystem.theme.components.Text
|
import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
import io.element.android.libraries.designsystem.theme.noFontPadding
|
import io.element.android.libraries.designsystem.theme.noFontPadding
|
||||||
import io.element.android.libraries.designsystem.theme.unreadIndicator
|
|
||||||
import io.element.android.libraries.theme.ElementTheme
|
|
||||||
import io.element.android.libraries.ui.strings.CommonStrings
|
import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
|
|
||||||
private val minHeight = 72.dp
|
private val minHeight = 72.dp
|
||||||
|
|
@ -161,8 +158,7 @@ internal fun DefaultInviteSummaryRow(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val unreadIndicatorColor = if (invite.isNew) ElementTheme.colors.unreadIndicator else Color.Transparent
|
UnreadIndicatorAtom(isVisible = invite.isNew)
|
||||||
UnreadIndicatorAtom(color = unreadIndicatorColor)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ fun InvitesEntryPointView(
|
||||||
|
|
||||||
if (state == InvitesState.NewInvites) {
|
if (state == InvitesState.NewInvites) {
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
|
|
||||||
UnreadIndicatorAtom()
|
UnreadIndicatorAtom()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.geometry.Rect
|
import androidx.compose.ui.geometry.Rect
|
||||||
import androidx.compose.ui.geometry.Size
|
import androidx.compose.ui.geometry.Size
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.graphics.Outline
|
import androidx.compose.ui.graphics.Outline
|
||||||
import androidx.compose.ui.graphics.Path
|
import androidx.compose.ui.graphics.Path
|
||||||
import androidx.compose.ui.graphics.Shape
|
import androidx.compose.ui.graphics.Shape
|
||||||
|
|
@ -170,11 +169,9 @@ private fun RowScope.LastMessageAndIndicatorRow(room: RoomListRoomSummary) {
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
// Unread
|
// Unread
|
||||||
val unreadIndicatorColor =
|
|
||||||
if (room.hasUnread) ElementTheme.colors.unreadIndicator else Color.Transparent
|
|
||||||
UnreadIndicatorAtom(
|
UnreadIndicatorAtom(
|
||||||
modifier = Modifier.padding(top = 3.dp),
|
modifier = Modifier.padding(top = 3.dp),
|
||||||
color = unreadIndicatorColor,
|
isVisible = room.hasUnread,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,13 @@ fun UnreadIndicatorAtom(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
size: Dp = 12.dp,
|
size: Dp = 12.dp,
|
||||||
color: Color = ElementTheme.colors.unreadIndicator,
|
color: Color = ElementTheme.colors.unreadIndicator,
|
||||||
|
isVisible: Boolean = true,
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.size(size)
|
.size(size)
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.background(color)
|
.background(if (isVisible) color else Color.Transparent)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue