feat: still show the attach menu even if no PhotoPicker is avaiable

This is due to the newly added camera shortcut, which makes the menu necessary even if no PhotoPicker is available
This commit is contained in:
LucasGGamerM 2023-06-11 18:12:30 -03:00
parent 1675c8ab79
commit b1cb75d45f
2 changed files with 20 additions and 20 deletions

View File

@ -375,9 +375,11 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
view.findViewById(GlobalUserPreferences.replyLineAboveHeader ? R.id.reply_text_below : R.id.reply_text)
.setVisibility(View.GONE);
if (isPhotoPickerAvailable()) {
PopupMenu attachPopup = new PopupMenu(getContext(), mediaBtn);
attachPopup.inflate(R.menu.attach);
if(isPhotoPickerAvailable())
attachPopup.getMenu().findItem(R.id.media).setVisible(true);
attachPopup.setOnMenuItemClickListener(i -> {
if (i.getItemId() == R.id.camera){
if (getContext().checkSelfPermission(Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
@ -395,9 +397,6 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
UiUtils.enablePopupMenuIcons(getContext(), attachPopup);
mediaBtn.setOnClickListener(v->attachPopup.show());
mediaBtn.setOnTouchListener(attachPopup.getDragToOpenListener());
} else {
mediaBtn.setOnClickListener(v -> openFilePicker(false));
}
if (isInstancePixelfed()) pollBtn.setVisibility(View.GONE);
pollBtn.setOnClickListener(v->togglePoll());
emojiBtn.setOnClickListener(v->emojiKeyboard.toggleKeyboardPopup(mainEditText));

View File

@ -3,6 +3,7 @@
<item
android:id="@+id/media"
android:title="@string/add_media"
android:visible="false"
android:icon="@drawable/ic_fluent_image_24_regular" />
<item
android:id="@+id/file"