android: show selection check badge on chat avatars
This commit is contained in:
@@ -603,3 +603,9 @@
|
|||||||
### Step 94 - Pinned-only drag markers in selection mode
|
### Step 94 - Pinned-only drag markers in selection mode
|
||||||
- Updated chats multi-select row UI: drag markers are now shown only for pinned chats.
|
- Updated chats multi-select row UI: drag markers are now shown only for pinned chats.
|
||||||
- Non-pinned chats no longer render reorder marker in selection mode.
|
- Non-pinned chats no longer render reorder marker in selection mode.
|
||||||
|
|
||||||
|
### Step 95 - Selection badge on avatar (Telegram-like)
|
||||||
|
- Added explicit selection indicator directly on chat avatars in multi-select mode:
|
||||||
|
- selected chat -> colored circle with check icon,
|
||||||
|
- unselected chat -> empty outlined circle.
|
||||||
|
- This matches the reference behavior and makes selected rows easier to scan.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import androidx.activity.compose.BackHandler
|
|||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -55,6 +56,7 @@ import androidx.compose.foundation.shape.CircleShape
|
|||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.ui.platform.LocalConfiguration
|
import androidx.compose.ui.platform.LocalConfiguration
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -63,6 +65,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||||
import androidx.compose.material.icons.filled.Close
|
import androidx.compose.material.icons.filled.Close
|
||||||
|
import androidx.compose.material.icons.filled.Check
|
||||||
import androidx.compose.material.icons.filled.Delete
|
import androidx.compose.material.icons.filled.Delete
|
||||||
import androidx.compose.material.icons.filled.DoneAll
|
import androidx.compose.material.icons.filled.DoneAll
|
||||||
import androidx.compose.material.icons.filled.Inventory2
|
import androidx.compose.material.icons.filled.Inventory2
|
||||||
@@ -1151,26 +1154,36 @@ private fun ChatRow(
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
) {
|
) {
|
||||||
if (!chat.avatarUrl.isNullOrBlank()) {
|
Box {
|
||||||
AsyncImage(
|
ChatAvatar(
|
||||||
model = chat.avatarUrl,
|
chat = chat,
|
||||||
contentDescription = "Avatar for ${chat.displayTitle}",
|
size = 52.dp,
|
||||||
modifier = Modifier
|
|
||||||
.size(52.dp)
|
|
||||||
.clip(CircleShape),
|
|
||||||
)
|
)
|
||||||
} else {
|
if (isSelecting) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(52.dp)
|
.align(Alignment.BottomStart)
|
||||||
.clip(CircleShape)
|
.size(18.dp)
|
||||||
.background(MaterialTheme.colorScheme.surfaceVariant),
|
.clip(CircleShape)
|
||||||
contentAlignment = Alignment.Center,
|
.border(
|
||||||
) {
|
width = 1.dp,
|
||||||
Text(
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.22f),
|
||||||
text = chat.displayTitle.firstOrNull()?.uppercase() ?: "?",
|
shape = CircleShape,
|
||||||
style = MaterialTheme.typography.titleMedium,
|
)
|
||||||
)
|
.background(
|
||||||
|
if (isSelected) MaterialTheme.colorScheme.tertiary else MaterialTheme.colorScheme.surface,
|
||||||
|
),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
) {
|
||||||
|
if (isSelected) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Check,
|
||||||
|
contentDescription = "Selected",
|
||||||
|
tint = Color.White,
|
||||||
|
modifier = Modifier.size(12.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user