タブからも選択できるようにした(はずだけど動かないのでとりあえず見なかったことに)

This commit is contained in:
ろむねこ 2024-01-29 11:51:22 +09:00
parent f7a71c70ed
commit b7232d2723
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -205,7 +205,10 @@ public class ViewerContainerFragment extends Fragment {
PopupMenu popupMenu = new PopupMenu(getContext(), v);
popupMenu.inflate(R.menu.viewer_tab_menu);
popupMenu.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.action_rename) {
if (item.getItemId() == R.id.action_open_vcs_rev_list) {
showRevList(viewerViewPagerAdapter.getFragmentTargetId(position), viewerViewPagerAdapter.getFragmentTitle(position));
return true;
} else if (item.getItemId() == R.id.action_rename) {
renameCombinedDocument(
documentId,
viewerViewPagerAdapter.getFragmentTargetIdList().get(position),
@ -289,7 +292,7 @@ public class ViewerContainerFragment extends Fragment {
toolbar.inflateMenu(R.menu.viewer_menu);
toolbar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.action_open_vcs_rev_list) {
showRevList();
showRevList(this.documentId, this.documentName);
return true;
} else if (item.getItemId() == R.id.action_rename) {
renameDocument();
@ -313,15 +316,15 @@ public class ViewerContainerFragment extends Fragment {
});
}
private void showRevList() {
private void showRevList(String targetId, String targetName) {
LacertaSelectRevDialog lacertaSelectRevDialog = new LacertaSelectRevDialog();
lacertaSelectRevDialog.setDocumentId(this.documentId).setTitle("リビジョンの選択").setMessage("リビジョンを選択してください。").setNegativeButtonText("キャンセル");
lacertaSelectRevDialog.setDocumentId(targetId).setTitle("リビジョンの選択").setMessage("リビジョンを選択してください。").setNegativeButtonText("キャンセル");
lacertaSelectRevDialog.setListener(new LacertaSelectRevDialogListener() {
@Override
public void onItemSelected(String revId) {
logger.debug("ViewerContainerFragment", "Dialog Result: revId: " + revId);
getParentFragmentManager().beginTransaction()
.replace(R.id.nav_host_fragment, ViewerContainerFragment.newInstance(documentId, documentName, revId))
.replace(R.id.nav_host_fragment, ViewerContainerFragment.newInstance(targetId, targetName, revId))
.commit();
}