aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-02-23 23:28:58 +0100
committerChristian Schneppe <christian@pix-art.de>2017-02-23 23:28:58 +0100
commitbbe6ec7a5af499b45ec5415b49ac372a886d9dcf (patch)
tree413b68727d7712d33fa4bdacfbf16c3ee08dd497 /src/main/java/de/pixart/messenger
parent9d7535d4f8ecfd54d00b869e731e0d9da4540d1e (diff)
separate date bubbles from status messsages
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 2212ad6b0..5f14187e7 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -168,6 +168,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
final int pxOffset = (v == null) ? 0 : v.getTop();
ConversationFragment.this.conversation.populateWithMessages(ConversationFragment.this.messageList);
try {
+ updateDateBubbles();
updateStatusMessages();
} catch (IllegalStateException e) {
Log.d(Config.LOGTAG, "caught illegal state exception while updating status messages");
@@ -1091,6 +1092,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
if (this.conversation != null) {
conversation.populateWithMessages(ConversationFragment.this.messageList);
updateSnackBar(conversation);
+ updateDateBubbles();
updateStatusMessages();
this.messageListAdapter.notifyDataSetChanged();
updateChatMsgHint();
@@ -1271,15 +1273,18 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
if (showLoadMoreMessages(conversation)) {
this.messageList.add(0, Message.createLoadMoreMessage(conversation));
}
+ }
+ }
- // show date in chat view
- int max = this.messageList.size();
+ protected void updateDateBubbles() {
+ synchronized (this.messageList) {
+ final int max = this.messageList.size();
if (max == 0 || (max <= 1 && showLoadMoreMessages(conversation))){
this.messageList.add(0, Message.createDateMessage(conversation, getString(R.string.start_chatting)));
} else if ((max > 0 && !showLoadMoreMessages(conversation)) || (max > 1 && showLoadMoreMessages(conversation))) {
- String date = first;
for (int i = (max - 1); i > 0; --i) {
String last = sdf.format(this.messageList.get(i).getTimeSent());
+ String date = first;
if (!last.equals(first)) {
if (i < (max - 1)) {
if (today.equals(first)) {
@@ -1290,6 +1295,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
first = last;
}
+ String date = first;
if (today.equals(first)) {
date = getString(R.string.today);
}