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

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