aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java1
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java7
-rw-r--r--src/main/java/de/pixart/messenger/ui/MediaBrowserActivity.java9
-rw-r--r--src/main/res/layout/activity_media_browser.xml9
-rw-r--r--src/main/res/menu/fragment_conversation.xml6
-rw-r--r--src/main/res/values/strings.xml1
6 files changed, 30 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
diff --git a/src/main/res/layout/activity_media_browser.xml b/src/main/res/layout/activity_media_browser.xml
index 0a28968ed..e94fc97e6 100644
--- a/src/main/res/layout/activity_media_browser.xml
+++ b/src/main/res/layout/activity_media_browser.xml
@@ -20,5 +20,14 @@
android:padding="2dp"
android:scrollbars="vertical" />
+ <TextView
+ android:id="@+id/no_media"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:padding="8dp"
+ android:text="@string/no_attachments"
+ android:textAlignment="center"
+ android:textAppearance="@style/TextAppearance.Conversations.Body1" />
</LinearLayout>
</layout> \ No newline at end of file
diff --git a/src/main/res/menu/fragment_conversation.xml b/src/main/res/menu/fragment_conversation.xml
index 088501bcb..14a3ecbc6 100644
--- a/src/main/res/menu/fragment_conversation.xml
+++ b/src/main/res/menu/fragment_conversation.xml
@@ -95,4 +95,10 @@
android:orderInCategory="100"
android:title="@string/action_contact_details"
app:showAsAction="always" />
+ <item
+ android:id="@+id/action_mediabrowser"
+ android:icon="@drawable/ic_image_white_24dp"
+ android:orderInCategory="100"
+ android:title="@string/media_browser"
+ app:showAsAction="always" />
</menu> \ No newline at end of file
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 45f771e8a..062ab3766 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -880,4 +880,5 @@
<string name="destroy_channel_failed">Channel could not be destroyed</string>
<string name="action_end_conversation_channel">Leave channel</string>
<string name="autojoin_channel">Automatically join this channel</string>
+ <string name="no_attachments">There are no attachments</string>
</resources>