From 6413ffae88bed89eb30e632d919e4cac475eea72 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 29 Jan 2024 05:12:29 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=9D=E3=83=83=E3=83=97=E3=82=A2=E3=83=83?= =?UTF-8?q?=E3=83=97=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ViewerContainerFragment.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 6152d199..98ff5f4b 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -10,6 +10,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; +import android.widget.PopupMenu; import android.widget.TextView; import android.widget.Toast; @@ -148,11 +149,24 @@ public class ViewerContainerFragment extends Fragment { ImageButton imageButton = customView.findViewById(R.id.tab_modify); imageButton.setOnClickListener(v -> { - renameCombinedDocument( - this.documentId, - viewerViewPagerAdapter.getFragmentTargetId(position), - viewerViewPagerAdapter.getFragmentTitle(position), - position); + PopupMenu popupMenu = new PopupMenu(getContext(), v); + popupMenu.inflate(R.menu.viewer_tab_menu); + popupMenu.setOnMenuItemClickListener(item -> { + if (item.getItemId() == R.id.action_rename) { + renameCombinedDocument( + documentId, + viewerViewPagerAdapter.getFragmentTargetIdList().get(position), + viewerViewPagerAdapter.getFragmentTitle(position), + position); + return true; + } else if (item.getItemId() == R.id.action_delete) { + Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); + return true; + } else { + return false; + } + }); + popupMenu.show(); }); tab.setCustomView(customView);