diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-02-09 16:05:14 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-02-09 16:05:14 +0100 |
commit | 12aa31da8a5f2b1e24b441733d0af8adf2584b1b (patch) | |
tree | 3a7ee0e08b1d8f300d01eb892ed90a9f5ea42754 /src/main/java/de/pixart/messenger/ui | |
parent | 163f5ae6229c99d72a73215ce1ba72827eefd93b (diff) |
show MediaBrowser icon in chat view
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
3 files changed, 14 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index cee5c20e1..b9b8e9e0c 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -437,7 +437,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers final int limit = GridManager.getCurrentColumnCount(this.binding.media); xmppConnectionService.getAttachments(this.mConversation, limit, this); this.binding.showMedia.setOnClickListener((v) -> MediaBrowserActivity.launch(this, mConversation)); - final boolean groupChat = mConversation != null && mConversation.isPrivateAndNonAnonymous(); this.binding.destroy.setText(groupChat ? R.string.destroy_room : R.string.destroy_channel); this.binding.leaveMuc.setText(groupChat ? R.string.action_end_conversation_muc : R.string.action_end_conversation_channel); diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 94ddc3f8e..12b1a5059 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -94,6 +94,7 @@ import de.pixart.messenger.services.MessageArchiveService; import de.pixart.messenger.services.XmppConnectionService; import de.pixart.messenger.ui.adapter.MediaPreviewAdapter; import de.pixart.messenger.ui.adapter.MessageAdapter; +import de.pixart.messenger.ui.interfaces.OnMediaLoaded; import de.pixart.messenger.ui.util.ActivityResult; import de.pixart.messenger.ui.util.Attachment; import de.pixart.messenger.ui.util.ConversationMenuConfigurator; @@ -1126,6 +1127,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke final MenuItem menuArchiveChat = menu.findItem(R.id.action_archive_chat); final MenuItem menuGroupDetails = menu.findItem(R.id.action_group_details); final MenuItem menuContactDetails = menu.findItem(R.id.action_contact_details); + final MenuItem menuMediaBrowser = menu.findItem(R.id.action_mediabrowser); if (conversation != null) { if (conversation.getMode() == Conversation.MODE_MULTI) { @@ -1147,6 +1149,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke menuGroupDetails.setVisible(false); menuContactDetails.setVisible(false); } + menuMediaBrowser.setVisible(true); menuNeedHelp.setVisible(true); menuSearchUpdates.setVisible(false); ConversationMenuConfigurator.configureAttachmentMenu(conversation, menu, activity.xmppConnectionService.getAttachmentChoicePreference(), hasAttachments); @@ -1157,6 +1160,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke menuInviteContact.setVisible(false); menuGroupDetails.setVisible(false); menuContactDetails.setVisible(false); + menuMediaBrowser.setVisible(false); } super.onCreateOptionsMenu(menu, menuInflater); } @@ -1446,6 +1450,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke case R.id.action_contact_details: activity.switchToContactDetails(conversation.getContact()); break; + case R.id.action_mediabrowser: + MediaBrowserActivity.launch(activity, conversation); + break; case R.id.action_block: case R.id.action_unblock: final Activity activity = getActivity(); diff --git a/src/main/java/de/pixart/messenger/ui/MediaBrowserActivity.java b/src/main/java/de/pixart/messenger/ui/MediaBrowserActivity.java index 4b32b42ab..ce5291466 100644 --- a/src/main/java/de/pixart/messenger/ui/MediaBrowserActivity.java +++ b/src/main/java/de/pixart/messenger/ui/MediaBrowserActivity.java @@ -5,6 +5,7 @@ import android.content.Intent; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.v7.widget.Toolbar; +import android.view.View; import java.util.List; @@ -50,7 +51,6 @@ public class MediaBrowserActivity extends XmppActivity implements OnMediaLoaded mMediaAdapter = new MediaAdapter(this, R.dimen.media_size); this.binding.media.setAdapter(mMediaAdapter); GridManager.setupLayoutManager(this, this.binding.media, R.dimen.browser_media_size); - } @Override @@ -71,7 +71,12 @@ public class MediaBrowserActivity extends XmppActivity implements OnMediaLoaded @Override public void onMediaLoaded(List<Attachment> attachments) { runOnUiThread(() -> { - mMediaAdapter.setAttachments(attachments); + if (attachments.size() > 0) { + mMediaAdapter.setAttachments(attachments); + this.binding.noMedia.setVisibility(View.GONE); + } else { + this.binding.noMedia.setVisibility(View.VISIBLE); + } }); } }
\ No newline at end of file |