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:
parent
1675c8ab79
commit
b1cb75d45f
|
@ -375,9 +375,11 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
view.findViewById(GlobalUserPreferences.replyLineAboveHeader ? R.id.reply_text_below : R.id.reply_text)
|
view.findViewById(GlobalUserPreferences.replyLineAboveHeader ? R.id.reply_text_below : R.id.reply_text)
|
||||||
.setVisibility(View.GONE);
|
.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (isPhotoPickerAvailable()) {
|
|
||||||
PopupMenu attachPopup = new PopupMenu(getContext(), mediaBtn);
|
PopupMenu attachPopup = new PopupMenu(getContext(), mediaBtn);
|
||||||
attachPopup.inflate(R.menu.attach);
|
attachPopup.inflate(R.menu.attach);
|
||||||
|
if(isPhotoPickerAvailable())
|
||||||
|
attachPopup.getMenu().findItem(R.id.media).setVisible(true);
|
||||||
|
|
||||||
attachPopup.setOnMenuItemClickListener(i -> {
|
attachPopup.setOnMenuItemClickListener(i -> {
|
||||||
if (i.getItemId() == R.id.camera){
|
if (i.getItemId() == R.id.camera){
|
||||||
if (getContext().checkSelfPermission(Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
|
if (getContext().checkSelfPermission(Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
@ -395,9 +397,6 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
UiUtils.enablePopupMenuIcons(getContext(), attachPopup);
|
UiUtils.enablePopupMenuIcons(getContext(), attachPopup);
|
||||||
mediaBtn.setOnClickListener(v->attachPopup.show());
|
mediaBtn.setOnClickListener(v->attachPopup.show());
|
||||||
mediaBtn.setOnTouchListener(attachPopup.getDragToOpenListener());
|
mediaBtn.setOnTouchListener(attachPopup.getDragToOpenListener());
|
||||||
} else {
|
|
||||||
mediaBtn.setOnClickListener(v -> openFilePicker(false));
|
|
||||||
}
|
|
||||||
if (isInstancePixelfed()) pollBtn.setVisibility(View.GONE);
|
if (isInstancePixelfed()) pollBtn.setVisibility(View.GONE);
|
||||||
pollBtn.setOnClickListener(v->togglePoll());
|
pollBtn.setOnClickListener(v->togglePoll());
|
||||||
emojiBtn.setOnClickListener(v->emojiKeyboard.toggleKeyboardPopup(mainEditText));
|
emojiBtn.setOnClickListener(v->emojiKeyboard.toggleKeyboardPopup(mainEditText));
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/media"
|
android:id="@+id/media"
|
||||||
android:title="@string/add_media"
|
android:title="@string/add_media"
|
||||||
|
android:visible="false"
|
||||||
android:icon="@drawable/ic_fluent_image_24_regular" />
|
android:icon="@drawable/ic_fluent_image_24_regular" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/file"
|
android:id="@+id/file"
|
||||||
|
|
Loading…
Reference in New Issue