ポップアップメニューに変更

This commit is contained in:
r-ca 2024-01-29 05:12:29 +09:00
parent 8a64d84ff7
commit 6413ffae88
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -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 -> {
PopupMenu popupMenu = new PopupMenu(getContext(), v);
popupMenu.inflate(R.menu.viewer_tab_menu);
popupMenu.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.action_rename) {
renameCombinedDocument(
this.documentId,
viewerViewPagerAdapter.getFragmentTargetId(position),
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);