style: align group creation list with conversations

This commit is contained in:
kris
2026-03-29 19:20:37 +08:00
parent e94e91a0f7
commit fe186ad8d5
2 changed files with 55 additions and 32 deletions

View File

@@ -114,11 +114,7 @@ public class GroupCreateActivity extends BossScreenActivity {
for (JSONObject item : selectableConversations) {
CandidateConversation candidate = new CandidateConversation(
item.optString("projectId", ""),
item.optString("projectTitle", item.optString("threadTitle", "未命名会话")),
item.optString("folderLabel", ""),
item.optString("lastMessagePreview", item.optString("preview", "")),
item.optString("latestReplyLabel", ""),
false
item
);
nextCandidates.add(candidate);
nextCandidateProjectIds.add(candidate.projectId);
@@ -191,20 +187,26 @@ public class GroupCreateActivity extends BossScreenActivity {
return result;
}
static WechatSurfaceMapper.ConversationRow toCandidateConversationRow(JSONObject item, boolean selected) {
return new WechatSurfaceMapper.ConversationRow(
item.optString("projectTitle", item.optString("threadTitle", "未命名会话")),
item.optString("folderLabel", ""),
item.optString("lastMessagePreview", item.optString("preview", "")),
item.optString("latestReplyLabel", ""),
0,
selected ? "已选" : "",
0,
false,
"",
"",
new WechatSurfaceMapper.GroupAvatarMember[0]
);
}
private LinearLayout buildCandidateRow(CandidateConversation candidate) {
boolean selected = selectedProjectIds.contains(candidate.projectId);
String badge = selected ? "已选" : "未选";
String subtitle = candidate.folderLabel.isEmpty() ? candidate.latestReplyLabel : candidate.folderLabel;
String meta = candidate.preview;
if (!candidate.latestReplyLabel.isEmpty() && !candidate.latestReplyLabel.equals(candidate.preview)) {
meta = candidate.latestReplyLabel + (meta.isEmpty() ? "" : " · " + meta);
}
return BossUi.buildListRow(
return BossUi.buildConversationRow(
this,
candidate.title,
subtitle,
meta,
badge,
toCandidateConversationRow(candidate.sourceItem, selectedProjectIds.contains(candidate.projectId)),
v -> toggleSelection(candidate.projectId)
);
}
@@ -369,26 +371,14 @@ public class GroupCreateActivity extends BossScreenActivity {
private static final class CandidateConversation {
private final String projectId;
private final String title;
private final String folderLabel;
private final String preview;
private final String latestReplyLabel;
private final boolean isGroup;
private final JSONObject sourceItem;
private CandidateConversation(
String projectId,
String title,
String folderLabel,
String preview,
String latestReplyLabel,
boolean isGroup
JSONObject sourceItem
) {
this.projectId = projectId;
this.title = title;
this.folderLabel = folderLabel;
this.preview = preview;
this.latestReplyLabel = latestReplyLabel;
this.isGroup = isGroup;
this.sourceItem = sourceItem;
}
}
}