fix: align android typography with wechat density

This commit is contained in:
AI Bot
2026-06-05 10:34:03 +08:00
parent a38b3a3093
commit eb8961fc3f
15 changed files with 246 additions and 245 deletions

View File

@@ -103,12 +103,12 @@ public final class BossUi {
if (style == TopActionButtonStyle.COMPACT_ICON) {
button.setBackgroundResource(R.drawable.bg_secondary_button);
button.setTextColor(context.getColor(R.color.boss_text_primary));
button.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
button.setMinWidth(dp(context, 38));
button.setMinimumWidth(dp(context, 38));
button.setMinHeight(dp(context, 36));
button.setMinimumHeight(dp(context, 36));
button.setPadding(dp(context, 12), dp(context, 6), dp(context, 12), dp(context, 6));
button.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
button.setMinWidth(dp(context, 34));
button.setMinimumWidth(dp(context, 34));
button.setMinHeight(dp(context, 34));
button.setMinimumHeight(dp(context, 34));
button.setPadding(dp(context, 10), dp(context, 5), dp(context, 10), dp(context, 5));
return;
}
@@ -119,19 +119,19 @@ public final class BossUi {
button.setBackgroundResource(R.drawable.bg_secondary_button);
button.setTextColor(context.getColor(R.color.boss_text_primary));
}
button.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
button.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
button.setMinWidth(0);
button.setMinimumWidth(0);
button.setMinHeight(0);
button.setMinimumHeight(0);
button.setPadding(dp(context, 12), dp(context, 8), dp(context, 12), dp(context, 8));
button.setPadding(dp(context, 10), dp(context, 7), dp(context, 10), dp(context, 7));
}
public static void applyTopIconButtonStyle(Context context, ImageButton button) {
button.setBackgroundResource(R.drawable.bg_top_icon_button);
button.setMinimumWidth(dp(context, 36));
button.setMinimumHeight(dp(context, 36));
button.setPadding(dp(context, 7), dp(context, 7), dp(context, 7), dp(context, 7));
button.setMinimumWidth(dp(context, 34));
button.setMinimumHeight(dp(context, 34));
button.setPadding(dp(context, 6), dp(context, 6), dp(context, 6), dp(context, 6));
ImageViewCompat.setImageTintList(button, ColorStateList.valueOf(context.getColor(R.color.boss_text_primary)));
}
@@ -237,7 +237,7 @@ public final class BossUi {
);
params.bottomMargin = dp(context, 1);
row.setLayoutParams(params);
row.setPadding(dp(context, 14), dp(context, 10), dp(context, 14), dp(context, 10));
row.setPadding(dp(context, 12), dp(context, 9), dp(context, 12), dp(context, 9));
row.setBackgroundResource(R.drawable.bg_list_row);
if (listener != null) {
row.setClickable(true);
@@ -256,7 +256,7 @@ public final class BossUi {
TextView titleView = new TextView(context);
titleView.setText(title);
titleView.setTextSize(16);
titleView.setTextSize(14);
titleView.setTypeface(Typeface.DEFAULT_BOLD);
titleView.setTextColor(context.getColor(R.color.boss_text_primary));
textWrap.addView(titleView);
@@ -264,7 +264,7 @@ public final class BossUi {
if (!TextUtils.isEmpty(subtitle)) {
TextView subtitleView = new TextView(context);
subtitleView.setText(subtitle);
subtitleView.setTextSize(13);
subtitleView.setTextSize(12);
subtitleView.setTextColor(context.getColor(R.color.boss_text_muted));
subtitleView.setPadding(0, dp(context, 4), 0, 0);
textWrap.addView(subtitleView);
@@ -288,7 +288,7 @@ public final class BossUi {
if (!TextUtils.isEmpty(badge)) {
TextView badgeView = new TextView(context);
badgeView.setText(badge);
badgeView.setTextSize(12);
badgeView.setTextSize(10);
badgeView.setTextColor(context.getColor(R.color.boss_green));
badgeView.setBackgroundResource(R.drawable.bg_tab_active);
badgeView.setPadding(dp(context, 8), dp(context, 2), dp(context, 8), dp(context, 2));
@@ -298,7 +298,7 @@ public final class BossUi {
if (listener != null) {
TextView arrowView = new TextView(context);
arrowView.setText("");
arrowView.setTextSize(18);
arrowView.setTextSize(14);
arrowView.setTextColor(context.getColor(R.color.boss_text_soft));
arrowView.setPadding(dp(context, 10), dp(context, 4), 0, 0);
accessoryWrap.addView(arrowView);
@@ -337,7 +337,7 @@ public final class BossUi {
TextView titleView = new TextView(context);
titleView.setText(title);
titleView.setTextSize(18);
titleView.setTextSize(14);
titleView.setTypeface(Typeface.DEFAULT_BOLD);
titleView.setTextColor(context.getColor(R.color.boss_text_primary));
@@ -349,7 +349,7 @@ public final class BossUi {
TextView metaView = new TextView(context);
metaView.setText(meta);
metaView.setTextSize(12);
metaView.setTextSize(11);
metaView.setTextColor(context.getColor(R.color.boss_text_muted));
metaView.setPadding(0, dp(context, 10), 0, 0);
@@ -380,7 +380,7 @@ public final class BossUi {
LinearLayout row = buildListRow(context, title, subtitle, meta, badge, listener);
row.setBackgroundColor(Color.WHITE);
row.setElevation(0f);
row.setPadding(dp(context, 14), dp(context, 10), dp(context, 14), dp(context, 10));
row.setPadding(dp(context, 12), dp(context, 9), dp(context, 12), dp(context, 9));
return row;
}
@@ -399,7 +399,7 @@ public final class BossUi {
);
row.setLayoutParams(params);
row.setBackgroundColor(Color.WHITE);
row.setPadding(dp(context, 14), dp(context, 10), dp(context, 14), dp(context, 10));
row.setPadding(dp(context, 12), dp(context, 9), dp(context, 12), dp(context, 9));
LinearLayout textWrap = new LinearLayout(context);
textWrap.setOrientation(LinearLayout.VERTICAL);
@@ -411,7 +411,7 @@ public final class BossUi {
TextView titleView = new TextView(context);
titleView.setText(title);
titleView.setTextSize(16);
titleView.setTextSize(14);
titleView.setTypeface(Typeface.DEFAULT_BOLD);
titleView.setTextColor(context.getColor(R.color.boss_text_primary));
textWrap.addView(titleView);
@@ -419,7 +419,7 @@ public final class BossUi {
if (!TextUtils.isEmpty(subtitle)) {
TextView subtitleView = new TextView(context);
subtitleView.setText(subtitle);
subtitleView.setTextSize(13);
subtitleView.setTextSize(12);
subtitleView.setTextColor(context.getColor(R.color.boss_text_muted));
subtitleView.setPadding(0, dp(context, 4), 0, 0);
textWrap.addView(subtitleView);
@@ -456,19 +456,19 @@ public final class BossUi {
);
params.bottomMargin = dp(context, 10);
card.setLayoutParams(params);
card.setPadding(dp(context, 16), dp(context, 14), dp(context, 16), dp(context, 14));
card.setPadding(dp(context, 14), dp(context, 12), dp(context, 14), dp(context, 12));
card.setBackgroundColor(Color.WHITE);
card.setElevation(0f);
TextView avatar = new TextView(context);
LinearLayout.LayoutParams avatarParams = new LinearLayout.LayoutParams(dp(context, 56), dp(context, 56));
LinearLayout.LayoutParams avatarParams = new LinearLayout.LayoutParams(dp(context, 52), dp(context, 52));
avatar.setLayoutParams(avatarParams);
avatar.setGravity(Gravity.CENTER);
avatar.setText(firstLetter(name));
avatar.setTextSize(24);
avatar.setTextSize(18);
avatar.setTypeface(Typeface.DEFAULT_BOLD);
avatar.setTextColor(context.getColor(R.color.boss_green));
avatar.setBackground(createRoundedBackground(Color.parseColor("#DFF3E8"), dp(context, 28)));
avatar.setBackground(createRoundedBackground(Color.parseColor("#DFF3E8"), dp(context, 26)));
card.addView(avatar);
LinearLayout textWrap = new LinearLayout(context);
@@ -483,14 +483,14 @@ public final class BossUi {
TextView titleView = new TextView(context);
titleView.setText(TextUtils.isEmpty(name) ? "我的" : name);
titleView.setTextSize(20);
titleView.setTextSize(18);
titleView.setTypeface(Typeface.DEFAULT_BOLD);
titleView.setTextColor(context.getColor(R.color.boss_text_primary));
textWrap.addView(titleView);
TextView subtitleView = new TextView(context);
subtitleView.setText(subtitle);
subtitleView.setTextSize(13);
subtitleView.setTextSize(12);
subtitleView.setTextColor(context.getColor(R.color.boss_text_muted));
subtitleView.setPadding(0, dp(context, 5), 0, 0);
textWrap.addView(subtitleView);
@@ -524,7 +524,7 @@ public final class BossUi {
params.rightMargin = dp(context, 12);
params.bottomMargin = dp(context, 10);
cell.setLayoutParams(params);
cell.setPadding(dp(context, 16), dp(context, 14), dp(context, 16), dp(context, 14));
cell.setPadding(dp(context, 14), dp(context, 12), dp(context, 14), dp(context, 12));
cell.setBackground(createRoundedBackground(Color.WHITE, dp(context, 18)));
TextView labelView = new TextView(context);
@@ -569,7 +569,7 @@ public final class BossUi {
params.rightMargin = dp(context, 12);
params.bottomMargin = dp(context, 1);
card.setLayoutParams(params);
card.setPadding(dp(context, 12), dp(context, 10), dp(context, 12), dp(context, 10));
card.setPadding(dp(context, 12), dp(context, 9), dp(context, 12), dp(context, 9));
card.setBackgroundColor(Color.WHITE);
card.setElevation(0f);
if (listener != null) {
@@ -582,15 +582,15 @@ public final class BossUi {
}
FrameLayout avatarWrap = new FrameLayout(context);
LinearLayout.LayoutParams avatarWrapParams = new LinearLayout.LayoutParams(dp(context, 48), dp(context, 48));
LinearLayout.LayoutParams avatarWrapParams = new LinearLayout.LayoutParams(dp(context, 44), dp(context, 44));
avatarWrap.setLayoutParams(avatarWrapParams);
TextView avatar = new TextView(context);
FrameLayout.LayoutParams avatarParams = new FrameLayout.LayoutParams(dp(context, 44), dp(context, 44));
FrameLayout.LayoutParams avatarParams = new FrameLayout.LayoutParams(dp(context, 40), dp(context, 40));
avatar.setLayoutParams(avatarParams);
avatar.setGravity(Gravity.CENTER);
avatar.setText(firstLetter(firstNonEmpty(row.avatarLabel, row.title, "")));
avatar.setTextSize(18);
avatar.setTextSize(16);
avatar.setTypeface(Typeface.DEFAULT_BOLD);
avatar.setTextColor(resolveDeviceAccentColor(row.statusKey));
avatar.setBackground(createRoundedBackground(resolveDeviceAvatarBackground(row.statusKey), dp(context, 18)));
@@ -617,7 +617,7 @@ public final class BossUi {
TextView titleView = new TextView(context);
titleView.setText(TextUtils.isEmpty(row.title) ? "设备" : row.title);
titleView.setTextSize(16);
titleView.setTextSize(14);
titleView.setTypeface(Typeface.DEFAULT_BOLD);
titleView.setTextColor(context.getColor(R.color.boss_text_primary));
titleView.setMaxLines(1);
@@ -647,7 +647,7 @@ public final class BossUi {
if (listener != null) {
TextView arrowView = new TextView(context);
arrowView.setText("");
arrowView.setTextSize(18);
arrowView.setTextSize(14);
arrowView.setTextColor(context.getColor(R.color.boss_text_soft));
arrowView.setPadding(dp(context, 8), 0, 0, 0);
card.addView(arrowView);
@@ -671,12 +671,12 @@ public final class BossUi {
params.rightMargin = dp(context, 12);
params.bottomMargin = dp(context, 12);
card.setLayoutParams(params);
card.setPadding(dp(context, 16), dp(context, 16), dp(context, 16), dp(context, 16));
card.setPadding(dp(context, 14), dp(context, 14), dp(context, 14), dp(context, 14));
card.setBackground(createRoundedBackground(Color.parseColor("#E7F5ED"), dp(context, 18)));
TextView titleView = new TextView(context);
titleView.setText(title);
titleView.setTextSize(16);
titleView.setTextSize(14);
titleView.setTypeface(Typeface.DEFAULT_BOLD);
titleView.setTextColor(context.getColor(R.color.boss_text_primary));
card.addView(titleView);
@@ -720,7 +720,7 @@ public final class BossUi {
1f
);
if (i > 0) {
buttonParams.leftMargin = dp(context, 8);
buttonParams.leftMargin = dp(context, 6);
}
button.setLayoutParams(buttonParams);
row.addView(button);
@@ -732,8 +732,8 @@ public final class BossUi {
Button button = new Button(context);
button.setText(label);
button.setAllCaps(false);
button.setTextSize(13);
button.setPadding(dp(context, 10), dp(context, 10), dp(context, 10), dp(context, 10));
button.setTextSize(12);
button.setPadding(dp(context, 9), dp(context, 8), dp(context, 9), dp(context, 8));
button.setTextColor(context.getColor(primary ? R.color.boss_surface : R.color.boss_green));
button.setBackgroundResource(primary ? R.drawable.bg_primary_button : R.drawable.bg_secondary_button);
return button;
@@ -774,7 +774,7 @@ public final class BossUi {
);
params.bottomMargin = dp(context, 1);
card.setLayoutParams(params);
card.setPadding(dp(context, 14), dp(context, 8), dp(context, 14), dp(context, 8));
card.setPadding(dp(context, 12), dp(context, 6), dp(context, 12), dp(context, 6));
card.setBackgroundColor(highlighted ? Color.parseColor("#EAF8F0") : row.pinnedConversation ? PINNED_ROW_BG : Color.WHITE);
card.setElevation(0f);
if (listener != null) {
@@ -795,13 +795,13 @@ public final class BossUi {
LinearLayout.LayoutParams.WRAP_CONTENT,
1f
);
centerParams.leftMargin = dp(context, 10);
centerParams.rightMargin = dp(context, 8);
centerParams.leftMargin = dp(context, 9);
centerParams.rightMargin = dp(context, 7);
centerColumn.setLayoutParams(centerParams);
TextView titleView = new TextView(context);
titleView.setText(TextUtils.isEmpty(row.threadTitle) ? "未命名会话" : row.threadTitle);
titleView.setTextSize(15);
titleView.setTextSize(14);
titleView.setIncludeFontPadding(false);
titleView.setGravity(Gravity.CENTER_VERTICAL);
titleView.setTypeface(Typeface.DEFAULT_BOLD);
@@ -810,13 +810,13 @@ public final class BossUi {
titleView.setEllipsize(TextUtils.TruncateAt.END);
titleView.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
dp(context, 22)
dp(context, 20)
));
centerColumn.addView(titleView);
TextView previewView = new TextView(context);
previewView.setText(buildConversationPreviewText(row.folderLabel, row.lastMessagePreview));
previewView.setTextSize(12);
previewView.setTextSize(11);
previewView.setIncludeFontPadding(false);
previewView.setGravity(Gravity.CENTER_VERTICAL);
previewView.setTextColor(context.getColor(R.color.boss_text_soft));
@@ -825,7 +825,7 @@ public final class BossUi {
previewView.setEllipsize(TextUtils.TruncateAt.END);
previewView.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
dp(context, 20)
dp(context, 18)
));
centerColumn.addView(previewView);
@@ -1090,7 +1090,7 @@ public final class BossUi {
TextView titleView = new TextView(context);
titleView.setText("暂无内容");
titleView.setTextSize(16);
titleView.setTextSize(14);
titleView.setTypeface(Typeface.DEFAULT_BOLD);
titleView.setTextColor(context.getColor(R.color.boss_text_primary));
card.addView(titleView);
@@ -1153,7 +1153,7 @@ public final class BossUi {
TextView bodyView = new TextView(context);
bodyView.setText(BossMarkdown.render(context, body, outgoing));
bodyView.setTextSize(15);
bodyView.setTextSize(14);
bodyView.setLineSpacing(0f, 1.34f);
bodyView.setTextColor(context.getColor(outgoing ? R.color.boss_surface : R.color.boss_text_primary));
bodyView.setMaxWidth(maxBubbleWidth);
@@ -1225,7 +1225,7 @@ public final class BossUi {
header.addView(titleView);
TextView arrowView = new TextView(context);
arrowView.setTextSize(16);
arrowView.setTextSize(14);
arrowView.setTypeface(Typeface.DEFAULT_BOLD);
arrowView.setTextColor(context.getColor(R.color.boss_text_muted));
arrowView.setPadding(dp(context, 8), 0, 0, 0);
@@ -1332,7 +1332,7 @@ public final class BossUi {
titleRow.addView(title);
TextView pin = new TextView(context);
pin.setText("");
pin.setTextSize(18);
pin.setTextSize(14);
pin.setTextColor(Color.parseColor("#9AA09D"));
titleRow.addView(pin);
card.addView(titleRow);
@@ -1940,7 +1940,7 @@ public final class BossUi {
check.setLayoutParams(checkParams);
check.setGravity(Gravity.CENTER);
check.setText("");
check.setTextSize(15);
check.setTextSize(12);
check.setTypeface(Typeface.DEFAULT_BOLD);
int color = "failed".equals(status) ? Color.parseColor("#E44B4B") :
"running".equals(status) ? Color.parseColor("#1EC76F") : Color.parseColor("#9AA09D");
@@ -1953,7 +1953,7 @@ public final class BossUi {
bodyParams.leftMargin = dp(context, 12);
body.setLayoutParams(bodyParams);
body.setText(text);
body.setTextSize(18);
body.setTextSize(14);
body.setLineSpacing(0f, 1.22f);
body.setTextColor(context.getColor(R.color.boss_text_primary));
row.addView(body);
@@ -1976,7 +1976,7 @@ public final class BossUi {
private static TextView sectionTitle(Context context, String text) {
TextView view = new TextView(context);
view.setText(text);
view.setTextSize(17);
view.setTextSize(14);
view.setTypeface(Typeface.DEFAULT_BOLD);
view.setTextColor(Color.parseColor("#8B918F"));
return view;
@@ -2003,20 +2003,20 @@ public final class BossUi {
TextView icon = new TextView(context);
icon.setText(iconText);
icon.setGravity(Gravity.CENTER);
icon.setTextSize(18);
icon.setTextSize(15);
icon.setTextColor(muted ? Color.parseColor("#9AA09D") : context.getColor(R.color.boss_text_primary));
row.addView(icon, new LinearLayout.LayoutParams(dp(context, 34), LinearLayout.LayoutParams.WRAP_CONTENT));
TextView labelView = new TextView(context);
labelView.setText(label);
labelView.setTextSize(17);
labelView.setTextSize(14);
labelView.setTextColor(muted ? Color.parseColor("#8B918F") : context.getColor(R.color.boss_text_primary));
row.addView(labelView, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1f));
if (!TextUtils.isEmpty(value)) {
TextView valueView = new TextView(context);
valueView.setText(value);
valueView.setTextSize(16);
valueView.setTextSize(13);
valueView.setTextColor(valueIsChange ? Color.parseColor("#00A94F") : context.getColor(R.color.boss_text_muted));
row.addView(valueView);
}
@@ -2032,13 +2032,13 @@ public final class BossUi {
TextView icon = new TextView(context);
icon.setText("");
icon.setGravity(Gravity.CENTER);
icon.setTextSize(18);
icon.setTextSize(15);
icon.setTextColor(context.getColor(R.color.boss_text_primary));
row.addView(icon, new LinearLayout.LayoutParams(dp(context, 34), LinearLayout.LayoutParams.WRAP_CONTENT));
TextView labelView = new TextView(context);
labelView.setText("变更");
labelView.setTextSize(17);
labelView.setTextSize(14);
labelView.setTextColor(context.getColor(R.color.boss_text_primary));
row.addView(labelView, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1f));
@@ -2046,7 +2046,7 @@ public final class BossUi {
if (additions > 0) {
TextView additionsView = new TextView(context);
additionsView.setText("+" + String.format(Locale.US, "%,d", additions));
additionsView.setTextSize(16);
additionsView.setTextSize(13);
additionsView.setTextColor(Color.parseColor("#00A94F"));
row.addView(additionsView);
}
@@ -2054,7 +2054,7 @@ public final class BossUi {
if (deletions > 0) {
TextView deletionsView = new TextView(context);
deletionsView.setText("-" + String.format(Locale.US, "%,d", deletions));
deletionsView.setTextSize(16);
deletionsView.setTextSize(13);
deletionsView.setTextColor(Color.parseColor("#C52828"));
LinearLayout.LayoutParams deletionParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
@@ -2148,7 +2148,7 @@ public final class BossUi {
icon.setLayoutParams(iconParams);
icon.setGravity(Gravity.CENTER);
icon.setText("");
icon.setTextSize(15);
icon.setTextSize(13);
icon.setTypeface(Typeface.DEFAULT_BOLD);
icon.setTextColor(context.getColor(R.color.boss_green));
icon.setBackground(createRoundedBackground(Color.parseColor("#E8F6ED"), dp(context, 12)));
@@ -2298,7 +2298,7 @@ public final class BossUi {
TextView titleView = new TextView(context);
titleView.setText(TextUtils.isEmpty(cardTitle) ? "聊天记录" : cardTitle);
titleView.setTextSize(15);
titleView.setTextSize(13);
titleView.setTypeface(Typeface.DEFAULT_BOLD);
titleView.setTextColor(context.getColor(R.color.boss_text_primary));
titleView.setPadding(0, dp(context, 6), 0, 0);
@@ -2495,7 +2495,7 @@ public final class BossUi {
private static TextView buildAttachmentPrimaryText(Context context, String text) {
TextView primary = new TextView(context);
primary.setText(TextUtils.isEmpty(text) ? "未命名附件" : text);
primary.setTextSize(15);
primary.setTextSize(13);
primary.setTypeface(Typeface.DEFAULT_BOLD);
primary.setTextColor(context.getColor(R.color.boss_text_primary));
primary.setMaxLines(2);
@@ -2506,7 +2506,7 @@ public final class BossUi {
private static TextView buildAttachmentSecondaryText(Context context, String text) {
TextView secondary = new TextView(context);
secondary.setText(TextUtils.isEmpty(text) ? "已发送" : text);
secondary.setTextSize(13);
secondary.setTextSize(11);
secondary.setTextColor(context.getColor(R.color.boss_text_muted));
secondary.setPadding(0, dp(context, 6), 0, 0);
return secondary;
@@ -2560,29 +2560,29 @@ public final class BossUi {
firstNonEmpty(row.avatarPrimary, row.threadTitle, ""),
AVATAR_BG_COLORS[0],
Color.WHITE,
44
40
);
}
FrameLayout groupWrap = new FrameLayout(context);
LinearLayout.LayoutParams wrapParams = new LinearLayout.LayoutParams(dp(context, 44), dp(context, 44));
LinearLayout.LayoutParams wrapParams = new LinearLayout.LayoutParams(dp(context, 40), dp(context, 40));
groupWrap.setLayoutParams(wrapParams);
GradientDrawable bg = createRoundedBackground(Color.parseColor("#F2F6F3"), dp(context, 15));
GradientDrawable bg = createRoundedBackground(Color.parseColor("#F2F6F3"), dp(context, 14));
bg.setStroke(dp(context, 1), Color.parseColor("#E5ECE7"));
groupWrap.setBackground(bg);
int visibleCount = Math.min(row.groupAvatarMembers.length, 4);
if (visibleCount == 0) {
groupWrap.addView(buildCenteredAvatarTile(context, "", AVATAR_BG_COLORS[1], 28, 8, 8));
groupWrap.addView(buildCenteredAvatarTile(context, "", AVATAR_BG_COLORS[1], 26, 7, 7));
return groupWrap;
}
int[][] offsets = {
{4, 4},
{22, 4},
{4, 22},
{22, 22}
{21, 4},
{4, 21},
{21, 21}
};
for (int i = 0; i < visibleCount; i++) {
WechatSurfaceMapper.GroupAvatarMember member = row.groupAvatarMembers[i];
@@ -2590,7 +2590,7 @@ public final class BossUi {
context,
firstNonEmpty(member.avatarLabel, member.title, ""),
AVATAR_BG_COLORS[(i + 1) % AVATAR_BG_COLORS.length],
18,
16,
offsets[i][0],
offsets[i][1]
));
@@ -2610,7 +2610,7 @@ public final class BossUi {
avatarView.setLayoutParams(avatarParams);
avatarView.setGravity(Gravity.CENTER);
avatarView.setText(firstLetter(labelSource));
avatarView.setTextSize(sizeDp >= 44 ? 18 : 10);
avatarView.setTextSize(sizeDp >= 40 ? 16 : 9);
avatarView.setTypeface(Typeface.DEFAULT_BOLD);
avatarView.setTextColor(textColor);
avatarView.setBackground(createRoundedBackground(backgroundColor, dp(context, sizeDp / 2)));

View File

@@ -1239,18 +1239,18 @@ public class MainActivity extends AppCompatActivity {
int color = getColor(active ? R.color.boss_green : R.color.boss_text_muted);
button.setBackgroundColor(Color.TRANSPARENT);
button.setTextColor(color);
button.setTextSize(11);
button.setTextSize(10);
button.setAllCaps(false);
button.setGravity(android.view.Gravity.CENTER);
Drawable topIcon = getDrawable(iconRes);
if (topIcon != null) {
int iconSize = BossUi.dp(this, 20);
int iconSize = BossUi.dp(this, 18);
topIcon.setBounds(0, 0, iconSize, iconSize);
}
button.setCompoundDrawables(null, topIcon, null, null);
button.setCompoundDrawablePadding(BossUi.dp(this, 2));
button.setCompoundDrawableTintList(ColorStateList.valueOf(color));
button.setPadding(0, BossUi.dp(this, 4), 0, BossUi.dp(this, 2));
button.setPadding(0, BossUi.dp(this, 3), 0, BossUi.dp(this, 1));
}
private void configureTopAction(WechatSurfaceMapper.RootTopAction action) {
@@ -1580,14 +1580,14 @@ public class MainActivity extends AppCompatActivity {
if (count > 0) {
TextView selectedView = new TextView(this);
selectedView.setText("已选 " + count + " 个线程");
selectedView.setTextSize(13);
selectedView.setTextSize(12);
selectedView.setTextColor(getColor(R.color.boss_text_primary));
summaryWrap.addView(selectedView);
}
if (count < 2) {
TextView hintView = new TextView(this);
hintView.setText("至少选择 2 个线程");
hintView.setTextSize(12);
hintView.setTextSize(11);
hintView.setTextColor(getColor(R.color.boss_text_muted));
if (count > 0) {
hintView.setPadding(0, BossUi.dp(this, 4), 0, 0);

View File

@@ -719,7 +719,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
private View buildDialogGuardInterventionView(JSONObject payload) {
LinearLayout card = new LinearLayout(this);
card.setOrientation(LinearLayout.VERTICAL);
int padding = BossUi.dp(this, 18);
int padding = BossUi.dp(this, 14);
card.setPadding(padding, padding, padding, padding);
TextView kicker = new TextView(this);
@@ -730,7 +730,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
TextView title = new TextView(this);
title.setText(dialogGuardTitle(payload));
title.setTextSize(18);
title.setTextSize(14);
title.setTypeface(Typeface.DEFAULT_BOLD);
title.setTextColor(getColor(R.color.boss_text_primary));
LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(
@@ -742,7 +742,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
TextView summary = new TextView(this);
summary.setText(payload.optString("summary", "绑定电脑上有一个弹窗需要你确认。"));
summary.setTextSize(15);
summary.setTextSize(13);
summary.setTextColor(getColor(R.color.boss_text_primary));
summary.setLineSpacing(BossUi.dp(this, 2), 1.0f);
LinearLayout.LayoutParams summaryParams = new LinearLayout.LayoutParams(
@@ -754,7 +754,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
TextView meta = new TextView(this);
meta.setText(dialogGuardMeta(payload));
meta.setTextSize(13);
meta.setTextSize(11);
meta.setTextColor(getColor(R.color.boss_text_muted));
LinearLayout.LayoutParams metaParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
@@ -777,7 +777,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
Button button = new Button(this);
button.setAllCaps(false);
button.setText(dialogGuardDecisionLabel(decision));
button.setTextSize(15);
button.setTextSize(13);
button.setTextColor(getColor("deny".equals(decision) || "cancel_task".equals(decision)
? android.R.color.holo_red_dark
: R.color.boss_text_primary));
@@ -1436,7 +1436,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
avatar.setLayoutParams(avatarParams);
avatar.setGravity(Gravity.CENTER);
avatar.setText(candidate.label.startsWith("") ? "" : "");
avatar.setTextSize(15);
avatar.setTextSize(13);
avatar.setTypeface(Typeface.DEFAULT_BOLD);
avatar.setTextColor(candidate.label.startsWith("") ? getColor(R.color.boss_green) : getColor(R.color.boss_text_primary));
GradientDrawable avatarBg = new GradientDrawable();
@@ -1451,7 +1451,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
TextView title = new TextView(this);
title.setText(candidate.label);
title.setTextSize(16);
title.setTextSize(14);
title.setTypeface(Typeface.DEFAULT_BOLD);
title.setTextColor(getColor(R.color.boss_text_primary));
textWrap.addView(title);
@@ -1564,7 +1564,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
TextView title = new TextView(this);
title.setText("发送附件");
title.setTextSize(16);
title.setTextSize(14);
title.setTypeface(android.graphics.Typeface.DEFAULT_BOLD);
title.setTextColor(getColor(R.color.boss_text_primary));
title.setPadding(0, 0, 0, BossUi.dp(this, 12));
@@ -1602,7 +1602,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
button.setGravity(Gravity.CENTER_VERTICAL | Gravity.START);
button.setPadding(BossUi.dp(this, 16), 0, BossUi.dp(this, 16), 0);
button.setText(label);
button.setTextSize(15);
button.setTextSize(13);
button.setTextColor(getColor(R.color.boss_text_primary));
button.setOnClickListener(v -> {
dialog.dismiss();

View File

@@ -242,7 +242,7 @@ public class ProjectGoalsActivity extends BossScreenActivity {
indicator.setLayoutParams(indicatorParams);
indicator.setGravity(Gravity.CENTER);
indicator.setText(completed ? "" : "");
indicator.setTextSize(18);
indicator.setTextSize(14);
indicator.setTextColor(getColor(completed ? R.color.boss_green : R.color.boss_text_muted));
row.addView(indicator);
@@ -257,14 +257,14 @@ public class ProjectGoalsActivity extends BossScreenActivity {
TextView title = new TextView(this);
title.setText(goal.optString("text", "未命名目标"));
title.setTextSize(16);
title.setTextSize(14);
title.setTextColor(getColor(R.color.boss_text_primary));
title.setLineSpacing(0f, 1.2f);
texts.addView(title);
TextView note = new TextView(this);
note.setText(goal.optString("note", "暂无备注"));
note.setTextSize(13);
note.setTextSize(12);
note.setTextColor(getColor(R.color.boss_text_muted));
note.setPadding(0, BossUi.dp(this, 8), 0, 0);
texts.addView(note);

View File

@@ -12,18 +12,18 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="18dp"
android:paddingTop="10dp"
android:paddingRight="18dp"
android:paddingBottom="8dp">
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
@@ -41,7 +41,7 @@
android:layout_height="wrap_content"
android:text="会话信息"
android:textColor="@color/boss_text_primary"
android:textSize="20sp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
@@ -51,29 +51,29 @@
android:layout_marginTop="3dp"
android:text="单线程会话信息页"
android:textColor="@color/boss_text_muted"
android:textSize="12sp" />
android:textSize="11sp" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>

View File

@@ -12,18 +12,18 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="18dp"
android:paddingTop="10dp"
android:paddingRight="18dp"
android:paddingBottom="8dp">
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
@@ -41,7 +41,7 @@
android:layout_height="wrap_content"
android:text="标题"
android:textColor="@color/boss_text_primary"
android:textSize="20sp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
@@ -51,29 +51,29 @@
android:layout_marginTop="3dp"
android:text="副标题"
android:textColor="@color/boss_text_muted"
android:textSize="12sp" />
android:textSize="11sp" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>

View File

@@ -12,18 +12,18 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="18dp"
android:paddingTop="10dp"
android:paddingRight="18dp"
android:paddingBottom="8dp">
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
@@ -41,7 +41,7 @@
android:layout_height="wrap_content"
android:text="发起群聊"
android:textColor="@color/boss_text_primary"
android:textSize="20sp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
@@ -51,29 +51,29 @@
android:layout_marginTop="3dp"
android:text="从当前会话选择其他线程"
android:textColor="@color/boss_text_muted"
android:textSize="12sp" />
android:textSize="11sp" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>

View File

@@ -12,18 +12,18 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="18dp"
android:paddingTop="10dp"
android:paddingRight="18dp"
android:paddingBottom="8dp">
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
@@ -41,7 +41,7 @@
android:layout_height="wrap_content"
android:text="群资料"
android:textColor="@color/boss_text_primary"
android:textSize="20sp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
@@ -51,29 +51,29 @@
android:layout_marginTop="3dp"
android:text="群聊资料页"
android:textColor="@color/boss_text_muted"
android:textSize="12sp" />
android:textSize="11sp" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>

View File

@@ -22,23 +22,23 @@
android:paddingBottom="40dp">
<TextView
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/bg_secondary_button"
android:gravity="center"
android:text="B"
android:textColor="@color/boss_green"
android:textSize="28sp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/login_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:layout_marginTop="18dp"
android:text=""
android:textColor="@color/boss_text_primary"
android:textSize="30sp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
@@ -50,12 +50,12 @@
android:lineSpacingExtra="4dp"
android:text=""
android:textColor="@color/boss_text_muted"
android:textSize="14sp" />
android:textSize="12sp" />
<EditText
android:id="@+id/login_account_input"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="44dp"
android:layout_marginTop="28dp"
android:background="@drawable/bg_secondary_button"
android:hint="账号"
@@ -66,12 +66,12 @@
android:singleLine="true"
android:textColor="@color/boss_text_primary"
android:textColorHint="@color/boss_text_muted"
android:textSize="16sp" />
android:textSize="14sp" />
<EditText
android:id="@+id/login_password_input"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="44dp"
android:layout_marginTop="12dp"
android:background="@drawable/bg_secondary_button"
android:hint="密码"
@@ -82,12 +82,12 @@
android:singleLine="true"
android:textColor="@color/boss_text_primary"
android:textColorHint="@color/boss_text_muted"
android:textSize="16sp" />
android:textSize="14sp" />
<EditText
android:id="@+id/login_confirm_password_input"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="44dp"
android:layout_marginTop="12dp"
android:background="@drawable/bg_secondary_button"
android:hint="确认密码"
@@ -98,13 +98,13 @@
android:singleLine="true"
android:textColor="@color/boss_text_primary"
android:textColorHint="@color/boss_text_muted"
android:textSize="16sp"
android:textSize="14sp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/login_code_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="44dp"
android:layout_marginTop="12dp"
android:orientation="horizontal"
android:visibility="gone">
@@ -123,7 +123,7 @@
android:singleLine="true"
android:textColor="@color/boss_text_primary"
android:textColorHint="@color/boss_text_muted"
android:textSize="16sp" />
android:textSize="14sp" />
<Button
android:id="@+id/login_send_code_button"
@@ -134,7 +134,7 @@
android:text="获取验证码"
android:textAllCaps="false"
android:textColor="@color/boss_text_primary"
android:textSize="14sp" />
android:textSize="12sp" />
</LinearLayout>
<ProgressBar
@@ -150,12 +150,12 @@
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:background="@drawable/bg_primary_button"
android:paddingTop="14dp"
android:paddingBottom="14dp"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:text=""
android:textAllCaps="false"
android:textColor="@color/boss_surface"
android:textSize="18sp"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
@@ -173,7 +173,7 @@
android:text="账号登录"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textSize="14sp" />
android:textSize="12sp" />
<Button
android:id="@+id/register_mode_button"
@@ -184,7 +184,7 @@
android:text="注册账号"
android:textAllCaps="false"
android:textColor="@color/boss_text_muted"
android:textSize="14sp" />
android:textSize="12sp" />
<Button
android:id="@+id/forgot_mode_button"
@@ -195,7 +195,7 @@
android:text="忘记密码"
android:textAllCaps="false"
android:textColor="@color/boss_text_muted"
android:textSize="14sp" />
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
@@ -214,19 +214,19 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="18dp"
android:paddingTop="10dp"
android:paddingRight="18dp"
android:paddingBottom="8dp">
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/back_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
@@ -246,7 +246,7 @@
android:maxLines="1"
android:text="会话"
android:textColor="@color/boss_text_primary"
android:textSize="20sp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
@@ -256,14 +256,14 @@
android:layout_marginTop="4dp"
android:text=""
android:textColor="@color/boss_text_muted"
android:textSize="12sp"
android:textSize="11sp"
android:visibility="gone" />
</LinearLayout>
<EditText
android:id="@+id/top_search_input"
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_height="34dp"
android:layout_weight="1"
android:background="@drawable/bg_secondary_button"
android:hint="搜索项目或线程"
@@ -275,27 +275,27 @@
android:paddingBottom="7dp"
android:textColor="@color/boss_text_primary"
android:textColorHint="@color/boss_text_muted"
android:textSize="15sp"
android:textSize="14sp"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/search_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="搜索"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_search"
android:tint="@color/boss_text_primary" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/refresh_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="快捷操作"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_add"
android:tint="@color/boss_text_primary" />
</LinearLayout>
@@ -313,7 +313,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="58dp"
android:layout_height="54dp"
android:background="@color/boss_surface"
android:elevation="10dp"
android:gravity="center"
@@ -332,7 +332,7 @@
android:text="会话"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textSize="11sp"
android:textSize="10sp"
android:textStyle="bold" />
<Button
@@ -344,7 +344,7 @@
android:text="设备"
android:textAllCaps="false"
android:textColor="@color/boss_text_muted"
android:textSize="11sp"
android:textSize="10sp"
android:textStyle="bold" />
<Button
@@ -356,7 +356,7 @@
android:text="我的"
android:textAllCaps="false"
android:textColor="@color/boss_text_muted"
android:textSize="11sp"
android:textSize="10sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
@@ -409,7 +409,7 @@
android:text="添加设备"
android:textAllCaps="false"
android:textColor="@color/boss_quick_actions_menu_text"
android:textSize="15sp" />
android:textSize="13sp" />
<Button
android:id="@+id/quick_action_scan"
@@ -423,7 +423,7 @@
android:text="扫一扫"
android:textAllCaps="false"
android:textColor="@color/boss_quick_actions_menu_text"
android:textSize="15sp" />
android:textSize="13sp" />
<Button
android:id="@+id/quick_action_group_chat"
@@ -437,7 +437,7 @@
android:text="发起群聊"
android:textAllCaps="false"
android:textColor="@color/boss_quick_actions_menu_text"
android:textSize="15sp" />
android:textSize="13sp" />
</LinearLayout>
</FrameLayout>
</FrameLayout>

View File

@@ -12,18 +12,18 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="18dp"
android:paddingTop="10dp"
android:paddingRight="18dp"
android:paddingBottom="8dp">
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
@@ -43,7 +43,7 @@
android:maxLines="1"
android:text="项目详情"
android:textColor="@color/boss_text_primary"
android:textSize="19sp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
@@ -53,29 +53,29 @@
android:layout_marginTop="3dp"
android:text="设备"
android:textColor="@color/boss_text_muted"
android:textSize="12sp" />
android:textSize="11sp" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>

View File

@@ -12,18 +12,18 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="18dp"
android:paddingTop="10dp"
android:paddingRight="18dp"
android:paddingBottom="8dp">
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
@@ -43,7 +43,7 @@
android:maxLines="1"
android:text="标题"
android:textColor="@color/boss_text_primary"
android:textSize="20sp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
@@ -55,29 +55,29 @@
android:maxLines="1"
android:text="副标题"
android:textColor="@color/boss_text_muted"
android:textSize="12sp" />
android:textSize="11sp" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="7dp"
android:padding="6dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>

View File

@@ -63,15 +63,16 @@ public class BossUiConversationRowTest {
previewView.getMeasuredWidth(),
previewView.getMeasuredHeight()
);
assertEquals("列表项应恢复成更紧凑的信息密度: " + metrics, BossUi.dp(context, 14), rowView.getPaddingLeft());
assertEquals("列表项应恢复成更紧凑的信息密度: " + metrics, BossUi.dp(context, 8), rowView.getPaddingTop());
assertEquals("列表项应恢复成更紧凑的信息密度: " + metrics, BossUi.dp(context, 14), rowView.getPaddingRight());
assertEquals("列表项应恢复成更紧凑的信息密度: " + metrics, BossUi.dp(context, 8), rowView.getPaddingBottom());
assertEquals("列表项应对标微信当前紧凑密度: " + metrics, BossUi.dp(context, 12), rowView.getPaddingLeft());
assertEquals("列表项应对标微信当前紧凑密度: " + metrics, BossUi.dp(context, 6), rowView.getPaddingTop());
assertEquals("列表项应对标微信当前紧凑密度: " + metrics, BossUi.dp(context, 12), rowView.getPaddingRight());
assertEquals("列表项应对标微信当前紧凑密度: " + metrics, BossUi.dp(context, 6), rowView.getPaddingBottom());
assertEquals("列表项不应保持卡片式浮层感: " + metrics, 0f, rowView.getElevation(), 0.01f);
assertTrue("单条会话行不应再撑到接近 90dp: " + metrics, rowView.getMeasuredHeight() <= BossUi.dp(context, 78));
assertEquals("会话头像应恢复到更克制的尺寸: " + metrics, BossUi.dp(context, 44), rowView.getChildAt(0).getLayoutParams().width);
assertEquals("会话头像应恢复到更克制的尺寸: " + metrics, BossUi.dp(context, 44), rowView.getChildAt(0).getLayoutParams().height);
assertEquals("标题字号应回到中等密度", 15f, titleView.getTextSize() / context.getResources().getDisplayMetrics().scaledDensity, 0.5f);
assertTrue("单条会话行应维持微信式有效信息面积: " + metrics, rowView.getMeasuredHeight() <= BossUi.dp(context, 68));
assertEquals("会话头像应回到微信列表的小尺寸: " + metrics, BossUi.dp(context, 40), rowView.getChildAt(0).getLayoutParams().width);
assertEquals("会话头像应回到微信列表的小尺寸: " + metrics, BossUi.dp(context, 40), rowView.getChildAt(0).getLayoutParams().height);
assertEquals("标题字号应对标微信列表主标题", 14f, titleView.getTextSize() / context.getResources().getDisplayMetrics().scaledDensity, 0.5f);
assertEquals("预览字号应对标微信列表辅助文字", 11f, previewView.getTextSize() / context.getResources().getDisplayMetrics().scaledDensity, 0.5f);
assertTrue("中间文字列不应被挤成 0 宽: " + metrics, centerColumn.getMeasuredWidth() > 0);
assertTrue("标题需要保留可见宽度: " + metrics, titleView.getMeasuredWidth() > 0);
assertTrue("预览需要保留可见宽度: " + metrics, previewView.getMeasuredWidth() > 0);

View File

@@ -50,8 +50,8 @@ public class BossUiRootSurfaceTest {
assertEquals("资料头不应保留浮层卡片感", 0f, header.getElevation(), 0.01f);
assertTrue("资料头应保持横向布局", header instanceof LinearLayout);
View avatar = ((LinearLayout) header).getChildAt(0);
assertEquals("我的页头像应恢复到中等尺寸", BossUi.dp(activity, 56), avatar.getLayoutParams().width);
assertEquals("我的页头像应恢复到中等尺寸", BossUi.dp(activity, 56), avatar.getLayoutParams().height);
assertEquals("我的页头像应对标微信资料入口尺寸", BossUi.dp(activity, 52), avatar.getLayoutParams().width);
assertEquals("我的页头像应对标微信资料入口尺寸", BossUi.dp(activity, 52), avatar.getLayoutParams().height);
assertTrue(viewTreeContainsText(header, "Kris"));
assertTrue(viewTreeContainsText(header, "krisolo"));
assertTrue(viewTreeContainsText(header, "最高管理员"));
@@ -105,12 +105,12 @@ public class BossUiRootSurfaceTest {
assertEquals("会话", conversations.getText().toString());
assertEquals("设备", devices.getText().toString());
assertEquals("我的", me.getText().toString());
assertEquals("顶部标题应恢复到更克制的字号", 20f, ((TextView) activity.findViewById(R.id.top_title)).getTextSize() / activity.getResources().getDisplayMetrics().scaledDensity, 0.5f);
assertEquals("底栏高度应恢复到更紧凑的有效面积", BossUi.dp(activity, 58), ((View) conversations.getParent()).getLayoutParams().height);
assertEquals("顶部标题应对标微信页面标题", 18f, ((TextView) activity.findViewById(R.id.top_title)).getTextSize() / activity.getResources().getDisplayMetrics().scaledDensity, 0.5f);
assertEquals("底栏高度应对标微信底栏有效面积", BossUi.dp(activity, 54), ((View) conversations.getParent()).getLayoutParams().height);
assertNotNull("会话 tab 应显示顶部图标", conversations.getCompoundDrawables()[1]);
assertNotNull("设备 tab 应显示顶部图标", devices.getCompoundDrawables()[1]);
assertNotNull("我的 tab 应显示顶部图标", me.getCompoundDrawables()[1]);
assertEquals("底栏文字应保持小字号", 11f, conversations.getTextSize() / activity.getResources().getDisplayMetrics().scaledDensity, 0.5f);
assertEquals("底栏文字应对标微信底栏标签", 10f, conversations.getTextSize() / activity.getResources().getDisplayMetrics().scaledDensity, 0.5f);
}
private static boolean viewTreeContainsText(View root, String expectedText) {

View File

@@ -21,9 +21,9 @@ public class BossUiTopActionStyleTest {
BossUi.applyTopIconButtonStyle(context, button);
assertEquals(BossUi.dp(context, 36), button.getMinimumWidth());
assertEquals(BossUi.dp(context, 36), button.getMinimumHeight());
assertEquals(BossUi.dp(context, 7), button.getPaddingLeft());
assertEquals(BossUi.dp(context, 7), button.getPaddingTop());
assertEquals(BossUi.dp(context, 34), button.getMinimumWidth());
assertEquals(BossUi.dp(context, 34), button.getMinimumHeight());
assertEquals(BossUi.dp(context, 6), button.getPaddingLeft());
assertEquals(BossUi.dp(context, 6), button.getPaddingTop());
}
}

View File

@@ -96,8 +96,8 @@ public class ConversationInfoActivityTest {
SwitchCompat takeoverSwitch = findFirstSwitch(takeoverRow);
assertEquals(LinearLayout.HORIZONTAL, takeoverRow.getOrientation());
assertEquals(BossUi.dp(activity, 14), takeoverRow.getPaddingLeft());
assertEquals(BossUi.dp(activity, 14), takeoverRow.getPaddingRight());
assertEquals(BossUi.dp(activity, 12), takeoverRow.getPaddingLeft());
assertEquals(BossUi.dp(activity, 12), takeoverRow.getPaddingRight());
assertNotNull(takeoverSwitch);
assertEquals("", String.valueOf(takeoverSwitch.getText()));
}