style: align native top bar icons with wechat chrome

This commit is contained in:
kris
2026-04-04 04:13:37 +08:00
parent 2f741c327f
commit 9c53e583ba
30 changed files with 488 additions and 351 deletions

View File

@@ -2,7 +2,7 @@ package com.hyzq.boss;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
@@ -18,9 +18,9 @@ public abstract class BossScreenActivity extends AppCompatActivity {
protected final ExecutorService executor = Executors.newSingleThreadExecutor();
protected BossApiClient apiClient;
protected Button backButton;
protected Button refreshButton;
protected Button headerActionButton;
protected ImageButton backButton;
protected ImageButton refreshButton;
protected ImageButton headerActionButton;
protected View topBarView;
protected TextView titleView;
protected TextView subtitleView;
@@ -45,8 +45,9 @@ public abstract class BossScreenActivity extends AppCompatActivity {
BossWindowInsets.applyStatusBarInset(topBarView);
backButton.setOnClickListener(v -> finish());
BossUi.applyTopActionButtonStyle(this, refreshButton, BossUi.TopActionButtonStyle.SECONDARY_TEXT);
BossUi.applyTopActionButtonStyle(this, headerActionButton, BossUi.TopActionButtonStyle.SECONDARY_TEXT);
BossUi.bindTopIconButton(this, backButton, BossUi.TopActionIcon.BACK, "返回");
BossUi.bindTopIconButton(this, refreshButton, BossUi.TopActionIcon.REFRESH, "刷新");
BossUi.bindTopIconButton(this, headerActionButton, BossUi.TopActionIcon.MORE, "更多");
refreshButton.setOnClickListener(v -> reload());
refreshLayout.setOnRefreshListener(this::reload);
}
@@ -68,8 +69,7 @@ public abstract class BossScreenActivity extends AppCompatActivity {
protected void setHeaderAction(String label, android.view.View.OnClickListener listener) {
headerActionButton.setVisibility(android.view.View.VISIBLE);
headerActionButton.setText(label);
BossUi.applyTopActionButtonStyle(this, headerActionButton, BossUi.TopActionButtonStyle.SECONDARY_TEXT);
BossUi.bindTopIconButton(this, headerActionButton, BossUi.topActionIconForLabel(label), label);
headerActionButton.setOnClickListener(listener);
}
@@ -81,7 +81,8 @@ public abstract class BossScreenActivity extends AppCompatActivity {
protected void setRefreshing(boolean refreshing) {
refreshLayout.setRefreshing(refreshing);
refreshButton.setEnabled(!refreshing);
refreshButton.setText(refreshing ? "同步中" : "刷新");
refreshButton.setAlpha(refreshing ? 0.45f : 1f);
refreshButton.setContentDescription(refreshing ? "同步中" : "刷新");
}
protected void replaceContent(android.view.View... views) {

View File

@@ -9,6 +9,7 @@ import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.GradientDrawable;
import android.widget.ImageButton;
import android.text.Layout;
import android.text.TextUtils;
import android.util.TypedValue;
@@ -22,6 +23,8 @@ import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.core.widget.ImageViewCompat;
import android.content.res.ColorStateList;
public final class BossUi {
private static final int[] AVATAR_BG_COLORS = {
@@ -51,6 +54,18 @@ public final class BossUi {
COMPACT_ICON
}
public enum TopActionIcon {
BACK,
CLOSE,
MORE,
ADD,
SEARCH,
REFRESH,
EDIT,
SAVE,
INFO
}
public static String formatRoleLabel(@Nullable String rawRole) {
if (TextUtils.isEmpty(rawRole)) {
return "";
@@ -101,6 +116,99 @@ public final class BossUi {
button.setPadding(dp(context, 12), dp(context, 8), dp(context, 12), dp(context, 8));
}
public static void applyTopIconButtonStyle(Context context, ImageButton button) {
button.setBackgroundResource(R.drawable.bg_top_icon_button);
button.setMinimumWidth(dp(context, 40));
button.setMinimumHeight(dp(context, 40));
button.setPadding(dp(context, 8), dp(context, 8), dp(context, 8), dp(context, 8));
ImageViewCompat.setImageTintList(button, ColorStateList.valueOf(context.getColor(R.color.boss_text_primary)));
}
public static void bindTopIconButton(Context context, ImageButton button, TopActionIcon icon, String contentDescription) {
applyTopIconButtonStyle(context, button);
button.setImageResource(resolveTopActionIconRes(icon));
button.setContentDescription(normalizeTopActionContentDescription(contentDescription, icon));
}
public static String normalizeTopActionContentDescription(@Nullable String raw, TopActionIcon icon) {
if (!TextUtils.isEmpty(raw)) {
if ("...".contentEquals(raw)) {
return "更多";
}
return raw;
}
switch (icon) {
case BACK:
return "返回";
case CLOSE:
return "关闭";
case ADD:
return "新增";
case SEARCH:
return "搜索";
case REFRESH:
return "刷新";
case EDIT:
return "编辑";
case SAVE:
return "保存";
case INFO:
return "信息";
case MORE:
default:
return "更多";
}
}
public static TopActionIcon topActionIconForLabel(@Nullable String label) {
if (TextUtils.isEmpty(label)) {
return TopActionIcon.MORE;
}
if ("...".contentEquals(label)) {
return TopActionIcon.MORE;
}
if ("保存".contentEquals(label)) {
return TopActionIcon.SAVE;
}
if ("刷新".contentEquals(label)) {
return TopActionIcon.REFRESH;
}
if ("新增".contentEquals(label)) {
return TopActionIcon.ADD;
}
if ("编辑".contentEquals(label) || "编辑目标".contentEquals(label)) {
return TopActionIcon.EDIT;
}
if ("只读".contentEquals(label)) {
return TopActionIcon.INFO;
}
return TopActionIcon.MORE;
}
private static int resolveTopActionIconRes(TopActionIcon icon) {
switch (icon) {
case BACK:
return R.drawable.ic_boss_back;
case CLOSE:
return R.drawable.ic_boss_close;
case ADD:
return R.drawable.ic_boss_add;
case SEARCH:
return R.drawable.ic_boss_search;
case REFRESH:
return R.drawable.ic_boss_refresh;
case EDIT:
return R.drawable.ic_boss_edit;
case SAVE:
return R.drawable.ic_boss_check;
case INFO:
return R.drawable.ic_boss_info;
case MORE:
default:
return R.drawable.ic_boss_more;
}
}
public static LinearLayout buildListRow(
Context context,
String title,

View File

@@ -14,6 +14,7 @@ import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.ScrollView;
@@ -59,13 +60,13 @@ public class MainActivity extends AppCompatActivity {
private Button loginButton;
private ProgressBar loginProgress;
private Button backButton;
private ImageButton backButton;
private TextView topTitle;
private TextView topSubtitle;
private LinearLayout topTitleGroup;
private EditText topSearchInput;
private Button searchButton;
private Button refreshButton;
private ImageButton searchButton;
private ImageButton refreshButton;
private View conversationQuickActionsOverlay;
private View conversationQuickActionsScrim;
private View conversationQuickActionsMenu;
@@ -574,15 +575,11 @@ public class MainActivity extends AppCompatActivity {
}
private void configureTopAction(WechatSurfaceMapper.RootTopAction action) {
refreshButton.setText(action.label);
BossUi.applyTopActionButtonStyle(
BossUi.bindTopIconButton(
this,
refreshButton,
action.compactStyle
? BossUi.TopActionButtonStyle.COMPACT_ICON
: action.primaryStyle
? BossUi.TopActionButtonStyle.PRIMARY_TEXT
: BossUi.TopActionButtonStyle.SECONDARY_TEXT
resolveRootTopActionIcon(action.iconKey),
action.label
);
}
@@ -605,7 +602,7 @@ public class MainActivity extends AppCompatActivity {
topTitleGroup.setVisibility(View.GONE);
topSearchInput.setVisibility(View.VISIBLE);
backButton.setVisibility(View.VISIBLE);
backButton.setText("取消");
BossUi.bindTopIconButton(this, backButton, BossUi.TopActionIcon.CLOSE, "取消");
searchButton.setVisibility(View.GONE);
refreshButton.setVisibility(View.GONE);
if (!conversationSearchQuery.equals(topSearchInput.getText().toString())) {
@@ -619,7 +616,7 @@ public class MainActivity extends AppCompatActivity {
backButton.setVisibility(View.GONE);
searchButton.setVisibility(conversationSelectionMode ? View.GONE : View.VISIBLE);
refreshButton.setVisibility(View.VISIBLE);
BossUi.applyTopActionButtonStyle(this, searchButton, BossUi.TopActionButtonStyle.COMPACT_ICON);
BossUi.bindTopIconButton(this, searchButton, BossUi.TopActionIcon.SEARCH, "搜索");
WechatSurfaceMapper.RootTopAction action = WechatSurfaceMapper.rootTopAction(activeTab, false, conversationSelectionMode);
configureTopAction(action);
}
@@ -633,6 +630,20 @@ public class MainActivity extends AppCompatActivity {
WechatSurfaceMapper.RootTopAction action = WechatSurfaceMapper.rootTopAction(activeTab, refreshing, conversationSelectionMode);
configureTopAction(action);
refreshButton.setEnabled(!"refresh".equals(action.actionKey) || !refreshing);
refreshButton.setAlpha(refreshing && "refresh".equals(action.actionKey) ? 0.45f : 1f);
}
private BossUi.TopActionIcon resolveRootTopActionIcon(String iconKey) {
if ("search".equals(iconKey)) {
return BossUi.TopActionIcon.SEARCH;
}
if ("refresh".equals(iconKey)) {
return BossUi.TopActionIcon.REFRESH;
}
if ("close".equals(iconKey)) {
return BossUi.TopActionIcon.CLOSE;
}
return BossUi.TopActionIcon.ADD;
}
private void handleTopAction() {

View File

@@ -1463,7 +1463,12 @@ public class ProjectDetailActivity extends BossScreenActivity {
if (refreshLayout != null) {
refreshLayout.setEnabled(bindings.enablePullRefresh);
}
backButton.setText(bindings.backLabel);
BossUi.bindTopIconButton(
this,
backButton,
bindings.multiSelecting ? BossUi.TopActionIcon.CLOSE : BossUi.TopActionIcon.BACK,
bindings.backLabel
);
backButton.setOnClickListener(v -> {
if (bindings.multiSelecting) {
exitMultiSelect();

View File

@@ -229,15 +229,15 @@ public final class WechatSurfaceMapper {
public static RootTopAction rootTopAction(String activeTab, boolean refreshing, boolean selectionMode) {
if ("devices".equals(activeTab)) {
return new RootTopAction("+添加", true, false, "add_device");
return new RootTopAction("添加设备", false, true, "add", "add_device");
}
if ("conversations".equals(activeTab)) {
if (selectionMode) {
return new RootTopAction("取消", false, false, "cancel_select_conversations");
return new RootTopAction("取消选择", false, true, "close", "cancel_select_conversations");
}
return new RootTopAction("+", false, true, "open_conversation_quick_actions");
return new RootTopAction("快捷操作", false, true, "add", "open_conversation_quick_actions");
}
return new RootTopAction(refreshing ? "同步中" : "刷新", false, false, "refresh");
return new RootTopAction("刷新", false, true, "refresh", "refresh");
}
public static <T> T resolveRefreshValue(T cachedValue, T freshValue, boolean requestSucceeded) {
@@ -251,12 +251,14 @@ public final class WechatSurfaceMapper {
public final String label;
public final boolean primaryStyle;
public final boolean compactStyle;
public final String iconKey;
public final String actionKey;
RootTopAction(String label, boolean primaryStyle, boolean compactStyle, String actionKey) {
RootTopAction(String label, boolean primaryStyle, boolean compactStyle, String iconKey, String actionKey) {
this.label = label;
this.primaryStyle = primaryStyle;
this.compactStyle = compactStyle;
this.iconKey = iconKey;
this.actionKey = actionKey;
}
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/boss_text_soft">
<item>
<shape android:shape="oval">
<solid android:color="@android:color/transparent" />
</shape>
</item>
</ripple>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF111111"
android:pathData="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF111111"
android:pathData="M15.41,7.41L14,6L8,12L14,18L15.41,16.59L10.83,12L15.41,7.41Z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF111111"
android:pathData="M9,16.17L4.83,12L3.41,13.41L9,19L21,7L19.59,5.59L9,16.17Z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF111111"
android:pathData="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF111111"
android:pathData="M3,17.25V21H6.75L17.81,9.94L14.06,6.19L3,17.25ZM20.71,7.04C21.1,6.65 21.1,6.02 20.71,5.63L18.37,3.29C17.98,2.9 17.35,2.9 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04Z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF111111"
android:pathData="M11,7H13V9H11V7ZM11,11H13V17H11V11ZM12,2C6.48,2 2,6.48 2,12C2,17.52 6.48,22 12,22C17.52,22 22,17.52 22,12C22,6.48 17.52,2 12,2Z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF111111"
android:pathData="M6,10A2,2 0 1,0 6,14A2,2 0 1,0 6,10ZM12,10A2,2 0 1,0 12,14A2,2 0 1,0 12,10ZM18,10A2,2 0 1,0 18,14A2,2 0 1,0 18,10Z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF111111"
android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4C7.58,4 4,7.58 4,12C4,16.42 7.58,20 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18C8.69,18 6,15.31 6,12C6,8.69 8.69,6 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF111111"
android:pathData="M15.5,14H14.71L14.43,13.73C15.41,12.59 16,11.11 16,9.5C16,5.91 13.09,3 9.5,3C5.91,3 3,5.91 3,9.5C3,13.09 5.91,16 9.5,16C11.11,16 12.59,15.41 13.73,14.43L14,14.71V15.5L19,20.49L20.49,19L15.5,14ZM9.5,14C7.01,14 5,11.99 5,9.5C5,7.01 7.01,5 9.5,5C11.99,5 14,7.01 14,9.5C14,11.99 11.99,14 9.5,14Z" />
</vector>

View File

@@ -12,23 +12,20 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="28dp"
android:paddingBottom="14dp">
android:paddingLeft="20dp"
android:paddingTop="14dp"
android:paddingRight="20dp"
android:paddingBottom="12dp">
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="返回"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="8dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
<LinearLayout
android:layout_width="0dp"
@@ -57,34 +54,28 @@
android:textSize="12sp" />
</LinearLayout>
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="操作"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="8dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="刷新"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="8dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout

View File

@@ -12,23 +12,20 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="28dp"
android:paddingBottom="14dp">
android:paddingLeft="20dp"
android:paddingTop="14dp"
android:paddingRight="20dp"
android:paddingBottom="12dp">
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="返回"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="8dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
<LinearLayout
android:layout_width="0dp"
@@ -57,34 +54,28 @@
android:textSize="12sp" />
</LinearLayout>
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="操作"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="8dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="刷新"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="8dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout

View File

@@ -12,23 +12,20 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="28dp"
android:paddingBottom="14dp">
android:paddingLeft="20dp"
android:paddingTop="14dp"
android:paddingRight="20dp"
android:paddingBottom="12dp">
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="返回"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="8dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
<LinearLayout
android:layout_width="0dp"
@@ -57,34 +54,28 @@
android:textSize="12sp" />
</LinearLayout>
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="操作"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="8dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="刷新"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="8dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout

View File

@@ -12,23 +12,20 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="28dp"
android:paddingBottom="14dp">
android:paddingLeft="20dp"
android:paddingTop="14dp"
android:paddingRight="20dp"
android:paddingBottom="12dp">
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="返回"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="8dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
<LinearLayout
android:layout_width="0dp"
@@ -57,34 +54,28 @@
android:textSize="12sp" />
</LinearLayout>
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="操作"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="8dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="刷新"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="8dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout

View File

@@ -94,20 +94,16 @@
android:paddingRight="20dp"
android:paddingBottom="12dp">
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="12dp"
android:background="@drawable/bg_secondary_button"
android:paddingLeft="14dp"
android:paddingTop="10dp"
android:paddingRight="14dp"
android:paddingBottom="10dp"
android:text="返回"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="8dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<LinearLayout
@@ -157,36 +153,26 @@
android:textSize="15sp"
android:visibility="gone" />
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/search_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_secondary_button"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:minWidth="0dp"
android:paddingLeft="12dp"
android:paddingTop="8dp"
android:paddingRight="12dp"
android:paddingBottom="8dp"
android:text="⌕"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:background="@drawable/bg_top_icon_button"
android:contentDescription="搜索"
android:padding="8dp"
android:src="@drawable/ic_boss_search"
android:tint="@color/boss_text_primary" />
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/refresh_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="12dp"
android:paddingTop="8dp"
android:paddingRight="12dp"
android:paddingBottom="8dp"
android:text="+"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="快捷操作"
android:padding="8dp"
android:src="@drawable/ic_boss_add"
android:tint="@color/boss_text_primary" />
</LinearLayout>
<FrameLayout

View File

@@ -12,23 +12,20 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingLeft="20dp"
android:paddingTop="14dp"
android:paddingRight="28dp"
android:paddingRight="20dp"
android:paddingBottom="12dp">
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="返回"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="8dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
<LinearLayout
android:layout_width="0dp"
@@ -59,34 +56,28 @@
android:textSize="12sp" />
</LinearLayout>
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="操作"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="8dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="刷新"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="8dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout

View File

@@ -12,23 +12,20 @@
android:background="@color/boss_surface"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="28dp"
android:paddingBottom="14dp">
android:paddingLeft="20dp"
android:paddingTop="14dp"
android:paddingRight="20dp"
android:paddingBottom="12dp">
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_back_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="返回"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:background="@drawable/bg_top_icon_button"
android:contentDescription="返回"
android:padding="8dp"
android:src="@drawable/ic_boss_back"
android:tint="@color/boss_text_primary" />
<LinearLayout
android:layout_width="0dp"
@@ -57,34 +54,28 @@
android:textSize="12sp" />
</LinearLayout>
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_header_action"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="操作"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="更多"
android:padding="8dp"
android:src="@drawable/ic_boss_more"
android:tint="@color/boss_text_primary"
android:visibility="gone" />
<Button
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/screen_refresh_button"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_secondary_button"
android:minWidth="0dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:text="刷新"
android:textAllCaps="false"
android:textColor="@color/boss_green"
android:textStyle="bold" />
android:layout_marginLeft="8dp"
android:background="@drawable/bg_top_icon_button"
android:contentDescription="刷新"
android:padding="8dp"
android:src="@drawable/ic_boss_refresh"
android:tint="@color/boss_text_primary" />
</LinearLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout

View File

@@ -3,8 +3,7 @@ package com.hyzq.boss;
import static org.junit.Assert.assertEquals;
import android.content.Context;
import android.util.TypedValue;
import android.widget.Button;
import android.widget.ImageButton;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -18,38 +17,13 @@ public class BossUiTopActionStyleTest {
@Test
public void applyCompactTopActionStyle_usesWechatLikeIconSizing() {
Context context = RuntimeEnvironment.getApplication();
Button button = new Button(context);
ImageButton button = new ImageButton(context);
BossUi.applyTopActionButtonStyle(context, button, BossUi.TopActionButtonStyle.COMPACT_ICON);
BossUi.applyTopIconButtonStyle(context, button);
assertEquals(context.getColor(R.color.boss_text_primary), button.getCurrentTextColor());
assertEquals(BossUi.dp(context, 38), button.getMinWidth());
assertEquals(BossUi.dp(context, 36), button.getMinHeight());
assertEquals(BossUi.dp(context, 12), button.getPaddingLeft());
assertEquals(BossUi.dp(context, 6), button.getPaddingTop());
assertEquals(
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, context.getResources().getDisplayMetrics()),
button.getTextSize(),
0.01f
);
}
@Test
public void applySecondaryTopActionStyle_usesDarkTextAndTightPadding() {
Context context = RuntimeEnvironment.getApplication();
Button button = new Button(context);
BossUi.applyTopActionButtonStyle(context, button, BossUi.TopActionButtonStyle.SECONDARY_TEXT);
assertEquals(context.getColor(R.color.boss_text_primary), button.getCurrentTextColor());
assertEquals(0, button.getMinWidth());
assertEquals(0, button.getMinHeight());
assertEquals(BossUi.dp(context, 12), button.getPaddingLeft());
assertEquals(BossUi.dp(context, 40), button.getMinimumWidth());
assertEquals(BossUi.dp(context, 40), button.getMinimumHeight());
assertEquals(BossUi.dp(context, 8), button.getPaddingLeft());
assertEquals(BossUi.dp(context, 8), button.getPaddingTop());
assertEquals(
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 14, context.getResources().getDisplayMetrics()),
button.getTextSize(),
0.01f
);
}
}

View File

@@ -6,7 +6,7 @@ import static org.junit.Assert.assertTrue;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
@@ -42,11 +42,11 @@ public class ConversationFolderActivityTest {
ReflectionHelpers.ClassParameter.from(JSONObject.class, buildFolderPayload())
);
Button headerAction = activity.findViewById(R.id.screen_header_action);
Button refreshButton = activity.findViewById(R.id.screen_refresh_button);
ImageButton headerAction = activity.findViewById(R.id.screen_header_action);
ImageButton refreshButton = activity.findViewById(R.id.screen_refresh_button);
LinearLayout content = activity.findViewById(R.id.screen_content);
assertEquals("...", headerAction.getText().toString());
assertEquals("更多", String.valueOf(headerAction.getContentDescription()));
assertEquals(View.GONE, refreshButton.getVisibility());
assertTrue(viewTreeContainsText(content, "Talking"));
assertTrue(viewTreeContainsText(content, "查询腾讯HAI GPU服务器"));

View File

@@ -8,7 +8,7 @@ import static org.junit.Assert.assertTrue;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
@@ -110,10 +110,10 @@ public class ConversationInfoActivityTest {
.setup()
.get();
Button headerAction = activity.findViewById(R.id.screen_header_action);
Button refreshButton = activity.findViewById(R.id.screen_refresh_button);
ImageButton headerAction = activity.findViewById(R.id.screen_header_action);
ImageButton refreshButton = activity.findViewById(R.id.screen_refresh_button);
assertEquals("...", headerAction.getText().toString());
assertEquals("更多", String.valueOf(headerAction.getContentDescription()));
assertEquals(View.GONE, refreshButton.getVisibility());
ReflectionHelpers.callInstanceMethod(activity, "showMoreMenu");

View File

@@ -9,7 +9,7 @@ import android.content.Intent;
import android.os.Looper;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
@@ -217,10 +217,10 @@ public class GroupInfoActivityTest {
.setup()
.get();
Button headerAction = activity.findViewById(R.id.screen_header_action);
Button refreshButton = activity.findViewById(R.id.screen_refresh_button);
ImageButton headerAction = activity.findViewById(R.id.screen_header_action);
ImageButton refreshButton = activity.findViewById(R.id.screen_refresh_button);
assertEquals("...", headerAction.getText().toString());
assertEquals("更多", String.valueOf(headerAction.getContentDescription()));
assertEquals(View.GONE, refreshButton.getVisibility());
ReflectionHelpers.callInstanceMethod(activity, "showMoreMenu");

View File

@@ -5,8 +5,8 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import org.json.JSONArray;
@@ -53,13 +53,13 @@ public class MainActivityConversationSearchTest {
Shadows.shadowOf(activity.getMainLooper()).idle();
ReflectionHelpers.callInstanceMethod(activity, "renderCurrentTab");
Button searchButton = activity.findViewById(R.id.search_button);
Button actionButton = activity.findViewById(R.id.refresh_button);
ImageButton searchButton = activity.findViewById(R.id.search_button);
ImageButton actionButton = activity.findViewById(R.id.refresh_button);
LinearLayout titleGroup = activity.findViewById(R.id.top_title_group);
EditText searchInput = activity.findViewById(R.id.top_search_input);
assertEquals("", String.valueOf(searchButton.getText()));
assertEquals("+", String.valueOf(actionButton.getText()));
assertEquals("搜索", String.valueOf(searchButton.getContentDescription()));
assertEquals("快捷操作", String.valueOf(actionButton.getContentDescription()));
assertEquals(LinearLayout.VISIBLE, titleGroup.getVisibility());
assertEquals(EditText.GONE, searchInput.getVisibility());
}
@@ -71,7 +71,7 @@ public class MainActivityConversationSearchTest {
ReflectionHelpers.callInstanceMethod(activity, "showContent");
Shadows.shadowOf(activity.getMainLooper()).idle();
Button searchButton = activity.findViewById(R.id.search_button);
ImageButton searchButton = activity.findViewById(R.id.search_button);
searchButton.performClick();
Shadows.shadowOf(activity.getMainLooper()).idle();
@@ -89,8 +89,8 @@ public class MainActivityConversationSearchTest {
assertEquals("树莓派", searchInputAfter.getText().toString());
assertTrue(searchInputAfter.isFocused());
Button actionButton = activity.findViewById(R.id.refresh_button);
assertEquals(Button.GONE, actionButton.getVisibility());
ImageButton actionButton = activity.findViewById(R.id.refresh_button);
assertEquals(ImageButton.GONE, actionButton.getVisibility());
assertFalse(activity.findViewById(R.id.search_button).isShown());
}

View File

@@ -5,8 +5,8 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -32,7 +32,7 @@ public class MainActivityConversationSelectionTest {
ReflectionHelpers.callInstanceMethod(activity, "showContent");
Shadows.shadowOf(activity.getMainLooper()).idle();
Button actionButton = activity.findViewById(R.id.refresh_button);
ImageButton actionButton = activity.findViewById(R.id.refresh_button);
actionButton.performClick();
Shadows.shadowOf(activity.getMainLooper()).idle();
assertEquals(View.VISIBLE, activity.findViewById(R.id.conversation_quick_actions_overlay).getVisibility());
@@ -93,7 +93,7 @@ public class MainActivityConversationSelectionTest {
ReflectionHelpers.callInstanceMethod(activity, "showContent");
Shadows.shadowOf(activity.getMainLooper()).idle();
Button actionButton = activity.findViewById(R.id.refresh_button);
ImageButton actionButton = activity.findViewById(R.id.refresh_button);
actionButton.performClick();
Shadows.shadowOf(activity.getMainLooper()).idle();

View File

@@ -11,6 +11,7 @@ import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
@@ -65,13 +66,13 @@ public class ProjectDetailActivityUiTest {
LinearLayout composerRow = activity.findViewById(R.id.project_chat_composer_row);
LinearLayout multiSelectActions = activity.findViewById(R.id.project_chat_multi_select_actions);
Button backButton = activity.findViewById(R.id.screen_back_button);
Button refreshButton = activity.findViewById(R.id.screen_refresh_button);
ImageButton backButton = activity.findViewById(R.id.screen_back_button);
ImageButton refreshButton = activity.findViewById(R.id.screen_refresh_button);
Button forwardButton = activity.findViewById(R.id.project_chat_multi_forward);
assertEquals(View.GONE, composerRow.getVisibility());
assertEquals(View.VISIBLE, multiSelectActions.getVisibility());
assertEquals("取消", backButton.getText().toString());
assertEquals("取消", String.valueOf(backButton.getContentDescription()));
assertEquals(View.GONE, refreshButton.getVisibility());
assertEquals(false, forwardButton.isEnabled());
@@ -82,7 +83,7 @@ public class ProjectDetailActivityUiTest {
assertEquals(View.VISIBLE, composerRow.getVisibility());
assertEquals(View.GONE, multiSelectActions.getVisibility());
assertEquals("返回", backButton.getText().toString());
assertEquals("返回", String.valueOf(backButton.getContentDescription()));
assertEquals(View.GONE, refreshButton.getVisibility());
}
@@ -248,9 +249,9 @@ public class ProjectDetailActivityUiTest {
ReflectionHelpers.callInstanceMethod(activity, "updateSelectionUi");
Button headerAction = activity.findViewById(R.id.screen_header_action);
ImageButton headerAction = activity.findViewById(R.id.screen_header_action);
assertEquals(View.VISIBLE, headerAction.getVisibility());
assertEquals("...", headerAction.getText().toString());
assertEquals("更多", String.valueOf(headerAction.getContentDescription()));
}
@Test
@@ -269,9 +270,9 @@ public class ProjectDetailActivityUiTest {
ReflectionHelpers.callInstanceMethod(activity, "updateSelectionUi");
Button headerAction = activity.findViewById(R.id.screen_header_action);
ImageButton headerAction = activity.findViewById(R.id.screen_header_action);
assertEquals(View.VISIBLE, headerAction.getVisibility());
assertEquals("...", headerAction.getText().toString());
assertEquals("更多", String.valueOf(headerAction.getContentDescription()));
}
@Test

View File

@@ -11,7 +11,8 @@ public class WechatSurfaceMapperTopActionTest {
public void rootTopAction_usesSelectionForConversations() {
WechatSurfaceMapper.RootTopAction action = WechatSurfaceMapper.rootTopAction("conversations", false, false);
assertEquals("+", action.label);
assertEquals("快捷操作", action.label);
assertEquals("add", action.iconKey);
assertFalse(action.primaryStyle);
assertTrue(action.compactStyle);
assertEquals("open_conversation_quick_actions", action.actionKey);
@@ -21,9 +22,10 @@ public class WechatSurfaceMapperTopActionTest {
public void rootTopAction_usesCancelDuringConversationSelection() {
WechatSurfaceMapper.RootTopAction action = WechatSurfaceMapper.rootTopAction("conversations", false, true);
assertEquals("取消", action.label);
assertEquals("取消选择", action.label);
assertEquals("close", action.iconKey);
assertFalse(action.primaryStyle);
assertFalse(action.compactStyle);
assertTrue(action.compactStyle);
assertEquals("cancel_select_conversations", action.actionKey);
}
@@ -31,9 +33,10 @@ public class WechatSurfaceMapperTopActionTest {
public void rootTopAction_keepsAddDeviceOnDevicesTab() {
WechatSurfaceMapper.RootTopAction action = WechatSurfaceMapper.rootTopAction("devices", false);
assertEquals("+添加", action.label);
assertTrue(action.primaryStyle);
assertFalse(action.compactStyle);
assertEquals("添加设备", action.label);
assertEquals("add", action.iconKey);
assertFalse(action.primaryStyle);
assertTrue(action.compactStyle);
assertEquals("add_device", action.actionKey);
}
@@ -41,9 +44,10 @@ public class WechatSurfaceMapperTopActionTest {
public void rootTopAction_keepsRefreshOnMeTab() {
WechatSurfaceMapper.RootTopAction action = WechatSurfaceMapper.rootTopAction("me", true);
assertEquals("同步中", action.label);
assertEquals("刷新", action.label);
assertEquals("refresh", action.iconKey);
assertFalse(action.primaryStyle);
assertFalse(action.compactStyle);
assertTrue(action.compactStyle);
assertEquals("refresh", action.actionKey);
}
}