style: unify project detail top menu
This commit is contained in:
@@ -700,6 +700,24 @@ public class ProjectDetailActivity extends BossScreenActivity {
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showConversationMoreMenu() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setItems(new CharSequence[]{"会话信息", "刷新"}, (dialog, which) -> {
|
||||
switch (which) {
|
||||
case 0:
|
||||
openConversationInfo();
|
||||
break;
|
||||
case 1:
|
||||
reload(true);
|
||||
break;
|
||||
default:
|
||||
dialog.dismiss();
|
||||
break;
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showMasterAgentModelPicker() {
|
||||
if (!isMasterAgentConversation()) {
|
||||
return;
|
||||
@@ -1452,7 +1470,7 @@ public class ProjectDetailActivity extends BossScreenActivity {
|
||||
} else if (isMasterAgentConversation()) {
|
||||
setHeaderAction("...", v -> showMasterAgentMoreMenu());
|
||||
} else if (bindings.showHeaderAction) {
|
||||
setHeaderAction(WechatSurfaceMapper.conversationInfoActionLabel(), v -> openConversationInfo());
|
||||
setHeaderAction("...", v -> showConversationMoreMenu());
|
||||
} else {
|
||||
hideHeaderAction();
|
||||
}
|
||||
|
||||
@@ -50,6 +50,27 @@ public class ProjectDetailActivityMasterAgentMenuTest {
|
||||
assertMenuItem(listView, 5, "刷新");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void normalConversationMoreMenuShowsInfoAndRefresh() {
|
||||
Intent intent = new Intent()
|
||||
.putExtra(ProjectDetailActivity.EXTRA_PROJECT_ID, "project-1")
|
||||
.putExtra(ProjectDetailActivity.EXTRA_PROJECT_NAME, "Boss 移动控制台");
|
||||
ProjectDetailActivityUiTest.TestProjectDetailActivity activity = Robolectric
|
||||
.buildActivity(ProjectDetailActivityUiTest.TestProjectDetailActivity.class, intent)
|
||||
.setup()
|
||||
.get();
|
||||
|
||||
ReflectionHelpers.callInstanceMethod(activity, "showConversationMoreMenu");
|
||||
|
||||
android.app.Dialog latestDialog = ShadowDialog.getLatestDialog();
|
||||
assertTrue(latestDialog instanceof AlertDialog);
|
||||
AlertDialog actionDialog = (AlertDialog) latestDialog;
|
||||
ListView listView = actionDialog.getListView();
|
||||
|
||||
assertMenuItem(listView, 0, "会话信息");
|
||||
assertMenuItem(listView, 1, "刷新");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void masterAgentWaitingStateRendersThinkingPlaceholder() throws Exception {
|
||||
Intent intent = new Intent()
|
||||
|
||||
@@ -253,6 +253,27 @@ public class ProjectDetailActivityUiTest {
|
||||
assertEquals("...", headerAction.getText().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void normalConversationHeaderUsesWechatMoreMenuLabel() {
|
||||
Intent intent = new Intent()
|
||||
.putExtra(ProjectDetailActivity.EXTRA_PROJECT_ID, "project-1")
|
||||
.putExtra(ProjectDetailActivity.EXTRA_PROJECT_NAME, "Boss 移动控制台");
|
||||
TestProjectDetailActivity activity = Robolectric
|
||||
.buildActivity(TestProjectDetailActivity.class, intent)
|
||||
.setup()
|
||||
.get();
|
||||
|
||||
ReflectionHelpers.setField(activity, "conversationInfoReady", true);
|
||||
ReflectionHelpers.setField(activity, "currentScreenTitle", "Boss 移动控制台");
|
||||
ReflectionHelpers.setField(activity, "currentScreenSubtitle", "归档确认");
|
||||
|
||||
ReflectionHelpers.callInstanceMethod(activity, "updateSelectionUi");
|
||||
|
||||
Button headerAction = activity.findViewById(R.id.screen_header_action);
|
||||
assertEquals(View.VISIBLE, headerAction.getVisibility());
|
||||
assertEquals("...", headerAction.getText().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderProjectKeepsMasterAgentWaitingStateVisibleInMessageFlow() throws Exception {
|
||||
Intent intent = new Intent()
|
||||
|
||||
Reference in New Issue
Block a user