aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui/adapter
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-08-31 14:29:12 +0200
committeriNPUTmice <daniel@gultsch.de>2014-08-31 14:29:12 +0200
commit8f8d4e320da81ef34dc7e2af840e280f112eeb4a (patch)
tree6a83d7889773ccaffa4dc369b2851bb89dc31e02 /src/eu/siacs/conversations/ui/adapter
parent9eafb1008676747a3ff315fb820178641c7b09f3 (diff)
experimental message merging
Diffstat (limited to 'src/eu/siacs/conversations/ui/adapter')
-rw-r--r--src/eu/siacs/conversations/ui/adapter/MessageAdapter.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 2452a555..5e113042 100644
--- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -36,6 +36,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
private static final int SENT = 0;
private static final int RECIEVED = 1;
private static final int STATUS = 2;
+ private static final int NULL = 3;
private ConversationActivity activity;
@@ -74,12 +75,14 @@ public class MessageAdapter extends ArrayAdapter<Message> {
@Override
public int getViewTypeCount() {
- return 3;
+ return 4;
}
@Override
public int getItemViewType(int position) {
- if (getItem(position).getType() == Message.TYPE_STATUS) {
+ if (getItem(position).wasMergedIntoPrevious()) {
+ return NULL;
+ } else if (getItem(position).getType() == Message.TYPE_STATUS) {
return STATUS;
} else if (getItem(position).getStatus() <= Message.STATUS_RECEIVED) {
return RECIEVED;
@@ -212,7 +215,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.messageBody.setVisibility(View.VISIBLE);
if (message.getBody() != null) {
if (message.getType() != Message.TYPE_PRIVATE) {
- viewHolder.messageBody.setText(message.getBody().trim());
+ viewHolder.messageBody.setText(message.getMergedBody());
} else {
String privateMarker;
if (message.getStatus() <= Message.STATUS_RECEIVED) {
@@ -301,6 +304,10 @@ public class MessageAdapter extends ArrayAdapter<Message> {
if (view == null) {
viewHolder = new ViewHolder();
switch (type) {
+ case NULL:
+ view = (View) activity.getLayoutInflater().inflate(
+ R.layout.message_null, parent, false);
+ break;
case SENT:
view = (View) activity.getLayoutInflater().inflate(
R.layout.message_sent, parent, false);
@@ -382,7 +389,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder = (ViewHolder) view.getTag();
}
- if (type == STATUS) {
+ if (type == STATUS || type == NULL) {
return view;
}