2014-07-22 13:31:54 +00:00
|
|
|
package eu.siacs.conversations.ui.adapter;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
2014-11-15 14:16:40 +00:00
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.content.pm.ResolveInfo;
|
2014-07-22 13:31:54 +00:00
|
|
|
import android.graphics.Typeface;
|
2014-11-13 20:04:05 +00:00
|
|
|
import android.net.Uri;
|
2014-08-22 11:22:07 +00:00
|
|
|
import android.text.Spannable;
|
|
|
|
import android.text.SpannableString;
|
2015-05-10 01:12:44 +00:00
|
|
|
import android.text.Spanned;
|
2014-08-22 11:22:07 +00:00
|
|
|
import android.text.style.ForegroundColorSpan;
|
2015-05-10 01:12:44 +00:00
|
|
|
import android.text.style.RelativeSizeSpan;
|
2014-08-22 11:22:07 +00:00
|
|
|
import android.text.style.StyleSpan;
|
2014-07-22 13:31:54 +00:00
|
|
|
import android.util.DisplayMetrics;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View.OnClickListener;
|
|
|
|
import android.view.View.OnLongClickListener;
|
2014-11-07 14:38:20 +00:00
|
|
|
import android.view.ViewGroup;
|
2014-07-22 13:31:54 +00:00
|
|
|
import android.widget.ArrayAdapter;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
2014-11-07 14:38:20 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import eu.siacs.conversations.R;
|
2015-08-01 16:27:52 +00:00
|
|
|
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
|
2014-12-03 09:35:30 +00:00
|
|
|
import eu.siacs.conversations.entities.Account;
|
2014-11-07 14:38:20 +00:00
|
|
|
import eu.siacs.conversations.entities.Contact;
|
|
|
|
import eu.siacs.conversations.entities.Conversation;
|
2014-11-13 20:04:05 +00:00
|
|
|
import eu.siacs.conversations.entities.DownloadableFile;
|
2014-11-07 14:38:20 +00:00
|
|
|
import eu.siacs.conversations.entities.Message;
|
2015-06-30 15:15:02 +00:00
|
|
|
import eu.siacs.conversations.entities.Message.FileParams;
|
2015-07-20 12:26:29 +00:00
|
|
|
import eu.siacs.conversations.entities.Transferable;
|
2014-11-07 14:38:20 +00:00
|
|
|
import eu.siacs.conversations.ui.ConversationActivity;
|
2015-03-07 13:15:38 +00:00
|
|
|
import eu.siacs.conversations.utils.GeoHelper;
|
2014-11-07 14:38:20 +00:00
|
|
|
import eu.siacs.conversations.utils.UIHelper;
|
|
|
|
|
2014-07-22 13:31:54 +00:00
|
|
|
public class MessageAdapter extends ArrayAdapter<Message> {
|
|
|
|
|
|
|
|
private static final int SENT = 0;
|
2014-08-28 14:49:52 +00:00
|
|
|
private static final int RECEIVED = 1;
|
2014-07-22 13:31:54 +00:00
|
|
|
private static final int STATUS = 2;
|
|
|
|
|
|
|
|
private ConversationActivity activity;
|
|
|
|
|
|
|
|
private DisplayMetrics metrics;
|
|
|
|
|
|
|
|
private OnContactPictureClicked mOnContactPictureClickedListener;
|
2014-08-10 13:27:44 +00:00
|
|
|
private OnContactPictureLongClicked mOnContactPictureLongClickedListener;
|
2014-07-22 13:31:54 +00:00
|
|
|
|
2014-10-23 19:27:41 +00:00
|
|
|
private OnLongClickListener openContextMenu = new OnLongClickListener() {
|
2015-01-11 15:22:29 +00:00
|
|
|
|
2014-10-23 19:27:41 +00:00
|
|
|
@Override
|
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
v.showContextMenu();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
2015-08-24 18:56:25 +00:00
|
|
|
private boolean mIndicateReceived = false;
|
|
|
|
private boolean mUseWhiteBackground = false;
|
2015-01-11 15:22:29 +00:00
|
|
|
|
2014-07-22 13:31:54 +00:00
|
|
|
public MessageAdapter(ConversationActivity activity, List<Message> messages) {
|
|
|
|
super(activity, 0, messages);
|
|
|
|
this.activity = activity;
|
|
|
|
metrics = getContext().getResources().getDisplayMetrics();
|
2015-08-24 18:56:25 +00:00
|
|
|
updatePreferences();
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setOnContactPictureClicked(OnContactPictureClicked listener) {
|
|
|
|
this.mOnContactPictureClickedListener = listener;
|
|
|
|
}
|
2014-08-31 14:28:21 +00:00
|
|
|
|
|
|
|
public void setOnContactPictureLongClicked(
|
|
|
|
OnContactPictureLongClicked listener) {
|
2014-08-10 13:27:44 +00:00
|
|
|
this.mOnContactPictureLongClickedListener = listener;
|
2015-01-11 15:22:29 +00:00
|
|
|
}
|
2014-07-22 13:31:54 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getViewTypeCount() {
|
2015-05-11 05:57:52 +00:00
|
|
|
return 3;
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
|
2015-07-19 12:26:03 +00:00
|
|
|
public int getItemViewType(Message message) {
|
|
|
|
if (message.getType() == Message.TYPE_STATUS) {
|
2014-07-22 13:31:54 +00:00
|
|
|
return STATUS;
|
2015-07-19 12:26:03 +00:00
|
|
|
} else if (message.getStatus() <= Message.STATUS_RECEIVED) {
|
2014-08-28 14:49:52 +00:00
|
|
|
return RECEIVED;
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
2015-07-19 12:26:03 +00:00
|
|
|
|
|
|
|
return SENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getItemViewType(int position) {
|
|
|
|
return this.getItemViewType(getItem(position));
|
|
|
|
}
|
|
|
|
|
2015-08-24 18:56:25 +00:00
|
|
|
private int getMessageTextColor(boolean onDark, boolean primary) {
|
|
|
|
if (onDark) {
|
2015-07-30 10:40:50 +00:00
|
|
|
return activity.getResources().getColor(primary ? R.color.white : R.color.white70);
|
2015-08-24 18:56:25 +00:00
|
|
|
} else {
|
|
|
|
return activity.getResources().getColor(primary ? R.color.black87 : R.color.black54);
|
2015-07-19 12:26:03 +00:00
|
|
|
}
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
|
2015-08-24 18:56:25 +00:00
|
|
|
private void displayStatus(ViewHolder viewHolder, Message message, int type, boolean darkBackground) {
|
2014-07-22 13:31:54 +00:00
|
|
|
String filesize = null;
|
|
|
|
String info = null;
|
|
|
|
boolean error = false;
|
2014-09-20 13:49:25 +00:00
|
|
|
if (viewHolder.indicatorReceived != null) {
|
|
|
|
viewHolder.indicatorReceived.setVisibility(View.GONE);
|
|
|
|
}
|
2014-07-22 13:31:54 +00:00
|
|
|
boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI
|
2015-01-11 15:22:29 +00:00
|
|
|
&& message.getMergedStatus() <= Message.STATUS_RECEIVED;
|
2015-07-10 13:11:03 +00:00
|
|
|
if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE || message.getTransferable() != null) {
|
2015-06-30 15:15:02 +00:00
|
|
|
FileParams params = message.getFileParams();
|
2014-11-13 21:59:00 +00:00
|
|
|
if (params.size > (1.5 * 1024 * 1024)) {
|
2015-01-04 16:53:06 +00:00
|
|
|
filesize = params.size / (1024 * 1024)+ " MiB";
|
2014-11-13 21:59:00 +00:00
|
|
|
} else if (params.size > 0) {
|
2015-01-04 16:53:06 +00:00
|
|
|
filesize = params.size / 1024 + " KiB";
|
2014-10-14 17:33:35 +00:00
|
|
|
}
|
2015-07-10 13:11:03 +00:00
|
|
|
if (message.getTransferable() != null && message.getTransferable().getStatus() == Transferable.STATUS_FAILED) {
|
2014-10-29 10:31:03 +00:00
|
|
|
error = true;
|
|
|
|
}
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
2014-08-31 16:55:15 +00:00
|
|
|
switch (message.getMergedStatus()) {
|
2015-01-11 15:22:29 +00:00
|
|
|
case Message.STATUS_WAITING:
|
|
|
|
info = getContext().getString(R.string.waiting);
|
|
|
|
break;
|
|
|
|
case Message.STATUS_UNSEND:
|
2015-07-10 13:11:03 +00:00
|
|
|
Transferable d = message.getTransferable();
|
2015-01-11 15:22:29 +00:00
|
|
|
if (d!=null) {
|
|
|
|
info = getContext().getString(R.string.sending_file,d.getProgress());
|
2014-07-29 12:42:17 +00:00
|
|
|
} else {
|
2015-01-11 15:22:29 +00:00
|
|
|
info = getContext().getString(R.string.sending);
|
2014-07-29 12:42:17 +00:00
|
|
|
}
|
2015-01-11 15:22:29 +00:00
|
|
|
break;
|
|
|
|
case Message.STATUS_OFFERED:
|
|
|
|
info = getContext().getString(R.string.offering);
|
|
|
|
break;
|
|
|
|
case Message.STATUS_SEND_RECEIVED:
|
2015-08-24 18:56:25 +00:00
|
|
|
if (mIndicateReceived) {
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.indicatorReceived.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Message.STATUS_SEND_DISPLAYED:
|
2015-08-24 18:56:25 +00:00
|
|
|
if (mIndicateReceived) {
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.indicatorReceived.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Message.STATUS_SEND_FAILED:
|
|
|
|
info = getContext().getString(R.string.send_failed);
|
|
|
|
error = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (multiReceived) {
|
2015-01-12 15:09:39 +00:00
|
|
|
info = UIHelper.getMessageDisplayName(message);
|
2015-01-11 15:22:29 +00:00
|
|
|
}
|
|
|
|
break;
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
2015-07-30 10:40:50 +00:00
|
|
|
if (error && type == SENT) {
|
2014-09-11 12:24:10 +00:00
|
|
|
viewHolder.time.setTextColor(activity.getWarningTextColor());
|
2014-07-22 13:31:54 +00:00
|
|
|
} else {
|
2015-08-24 18:56:25 +00:00
|
|
|
viewHolder.time.setTextColor(this.getMessageTextColor(darkBackground,false));
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
if (message.getEncryption() == Message.ENCRYPTION_NONE) {
|
|
|
|
viewHolder.indicator.setVisibility(View.GONE);
|
|
|
|
} else {
|
2015-08-24 18:56:25 +00:00
|
|
|
viewHolder.indicator.setImageResource(darkBackground ? R.drawable.ic_secure_indicator_white : R.drawable.ic_secure_indicator);
|
2014-07-22 13:31:54 +00:00
|
|
|
viewHolder.indicator.setVisibility(View.VISIBLE);
|
2015-07-15 14:32:42 +00:00
|
|
|
if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL) {
|
2015-08-01 16:27:52 +00:00
|
|
|
XmppAxolotlSession.Trust trust = message.getConversation()
|
2015-07-10 01:00:40 +00:00
|
|
|
.getAccount().getAxolotlService().getFingerprintTrust(
|
|
|
|
message.getAxolotlFingerprint());
|
|
|
|
|
2015-08-01 16:27:52 +00:00
|
|
|
if(trust == null || trust != XmppAxolotlSession.Trust.TRUSTED) {
|
2015-07-30 10:40:50 +00:00
|
|
|
viewHolder.indicator.setColorFilter(activity.getWarningTextColor());
|
|
|
|
viewHolder.indicator.setAlpha(1.0f);
|
2015-07-15 14:32:42 +00:00
|
|
|
} else {
|
|
|
|
viewHolder.indicator.clearColorFilter();
|
2015-08-24 18:56:25 +00:00
|
|
|
if (darkBackground) {
|
2015-07-30 10:40:50 +00:00
|
|
|
viewHolder.indicator.setAlpha(0.7f);
|
2015-08-24 18:56:25 +00:00
|
|
|
} else {
|
|
|
|
viewHolder.indicator.setAlpha(0.57f);
|
2015-07-30 10:40:50 +00:00
|
|
|
}
|
2015-07-10 01:00:40 +00:00
|
|
|
}
|
2015-07-29 18:25:14 +00:00
|
|
|
} else {
|
|
|
|
viewHolder.indicator.clearColorFilter();
|
2015-08-24 18:56:25 +00:00
|
|
|
if (darkBackground) {
|
2015-07-30 10:40:50 +00:00
|
|
|
viewHolder.indicator.setAlpha(0.7f);
|
2015-08-24 18:56:25 +00:00
|
|
|
} else {
|
|
|
|
viewHolder.indicator.setAlpha(0.57f);
|
2015-07-30 10:40:50 +00:00
|
|
|
}
|
2015-07-10 01:00:40 +00:00
|
|
|
}
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
|
2014-09-21 21:16:23 +00:00
|
|
|
String formatedTime = UIHelper.readableTimeDifferenceFull(getContext(),
|
2014-08-31 16:55:15 +00:00
|
|
|
message.getMergedTimeSent());
|
2014-08-28 09:01:24 +00:00
|
|
|
if (message.getStatus() <= Message.STATUS_RECEIVED) {
|
2014-07-22 13:31:54 +00:00
|
|
|
if ((filesize != null) && (info != null)) {
|
2015-07-10 10:42:41 +00:00
|
|
|
viewHolder.time.setText(formatedTime + " \u00B7 " + filesize +" \u00B7 " + info);
|
2014-07-22 13:31:54 +00:00
|
|
|
} else if ((filesize == null) && (info != null)) {
|
|
|
|
viewHolder.time.setText(formatedTime + " \u00B7 " + info);
|
|
|
|
} else if ((filesize != null) && (info == null)) {
|
|
|
|
viewHolder.time.setText(formatedTime + " \u00B7 " + filesize);
|
|
|
|
} else {
|
|
|
|
viewHolder.time.setText(formatedTime);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((filesize != null) && (info != null)) {
|
|
|
|
viewHolder.time.setText(filesize + " \u00B7 " + info);
|
|
|
|
} else if ((filesize == null) && (info != null)) {
|
|
|
|
if (error) {
|
|
|
|
viewHolder.time.setText(info + " \u00B7 " + formatedTime);
|
|
|
|
} else {
|
|
|
|
viewHolder.time.setText(info);
|
|
|
|
}
|
|
|
|
} else if ((filesize != null) && (info == null)) {
|
|
|
|
viewHolder.time.setText(filesize + " \u00B7 " + formatedTime);
|
|
|
|
} else {
|
|
|
|
viewHolder.time.setText(formatedTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-24 18:56:25 +00:00
|
|
|
private void displayInfoMessage(ViewHolder viewHolder, String text, boolean darkBackground) {
|
2014-07-22 13:31:54 +00:00
|
|
|
if (viewHolder.download_button != null) {
|
|
|
|
viewHolder.download_button.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
viewHolder.image.setVisibility(View.GONE);
|
|
|
|
viewHolder.messageBody.setVisibility(View.VISIBLE);
|
2014-11-13 20:04:05 +00:00
|
|
|
viewHolder.messageBody.setText(text);
|
2015-08-24 18:56:25 +00:00
|
|
|
viewHolder.messageBody.setTextColor(getMessageTextColor(darkBackground, false));
|
2014-07-22 13:31:54 +00:00
|
|
|
viewHolder.messageBody.setTypeface(null, Typeface.ITALIC);
|
|
|
|
viewHolder.messageBody.setTextIsSelectable(false);
|
|
|
|
}
|
|
|
|
|
2015-08-24 18:56:25 +00:00
|
|
|
private void displayDecryptionFailed(ViewHolder viewHolder, boolean darkBackground) {
|
2014-07-22 13:31:54 +00:00
|
|
|
if (viewHolder.download_button != null) {
|
|
|
|
viewHolder.download_button.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
viewHolder.image.setVisibility(View.GONE);
|
|
|
|
viewHolder.messageBody.setVisibility(View.VISIBLE);
|
|
|
|
viewHolder.messageBody.setText(getContext().getString(
|
2015-05-10 01:12:44 +00:00
|
|
|
R.string.decryption_failed));
|
2015-08-24 18:56:25 +00:00
|
|
|
viewHolder.messageBody.setTextColor(getMessageTextColor(darkBackground, false));
|
2014-07-22 13:31:54 +00:00
|
|
|
viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
|
|
|
|
viewHolder.messageBody.setTextIsSelectable(false);
|
|
|
|
}
|
|
|
|
|
2015-05-11 06:45:38 +00:00
|
|
|
private void displayHeartMessage(final ViewHolder viewHolder, final String body) {
|
2015-05-10 01:12:44 +00:00
|
|
|
if (viewHolder.download_button != null) {
|
|
|
|
viewHolder.download_button.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
viewHolder.image.setVisibility(View.GONE);
|
|
|
|
viewHolder.messageBody.setVisibility(View.VISIBLE);
|
2015-05-11 06:45:38 +00:00
|
|
|
viewHolder.messageBody.setIncludeFontPadding(false);
|
2015-05-10 01:12:44 +00:00
|
|
|
Spannable span = new SpannableString(body);
|
2015-05-11 05:57:52 +00:00
|
|
|
span.setSpan(new RelativeSizeSpan(4.0f), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
|
span.setSpan(new ForegroundColorSpan(activity.getWarningTextColor()), 0, body.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
2015-05-10 01:12:44 +00:00
|
|
|
viewHolder.messageBody.setText(span);
|
|
|
|
}
|
|
|
|
|
2015-08-24 18:56:25 +00:00
|
|
|
private void displayTextMessage(final ViewHolder viewHolder, final Message message, boolean darkBackground) {
|
2014-07-22 13:31:54 +00:00
|
|
|
if (viewHolder.download_button != null) {
|
|
|
|
viewHolder.download_button.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
viewHolder.image.setVisibility(View.GONE);
|
|
|
|
viewHolder.messageBody.setVisibility(View.VISIBLE);
|
2015-05-11 06:45:38 +00:00
|
|
|
viewHolder.messageBody.setIncludeFontPadding(true);
|
2014-08-10 13:27:44 +00:00
|
|
|
if (message.getBody() != null) {
|
2015-01-12 15:09:39 +00:00
|
|
|
final String nick = UIHelper.getMessageDisplayName(message);
|
2015-05-11 07:08:56 +00:00
|
|
|
final String body = message.getMergedBody().replaceAll("^" + Message.ME_COMMAND,nick + " ");
|
|
|
|
final SpannableString formattedBody = new SpannableString(body);
|
2015-05-11 12:18:30 +00:00
|
|
|
int i = body.indexOf(Message.MERGE_SEPARATOR);
|
2015-05-11 07:08:56 +00:00
|
|
|
while(i >= 0) {
|
2015-05-11 12:18:30 +00:00
|
|
|
final int end = i + Message.MERGE_SEPARATOR.length();
|
|
|
|
formattedBody.setSpan(new RelativeSizeSpan(0.3f),i,end,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
|
i = body.indexOf(Message.MERGE_SEPARATOR,end);
|
2015-05-11 07:08:56 +00:00
|
|
|
}
|
2014-08-10 13:27:44 +00:00
|
|
|
if (message.getType() != Message.TYPE_PRIVATE) {
|
2015-01-11 15:22:29 +00:00
|
|
|
if (message.hasMeCommand()) {
|
|
|
|
final Spannable span = new SpannableString(formattedBody);
|
|
|
|
span.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), 0, nick.length(),
|
|
|
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
|
viewHolder.messageBody.setText(span);
|
|
|
|
} else {
|
2015-05-11 05:57:52 +00:00
|
|
|
viewHolder.messageBody.setText(formattedBody);
|
2015-01-11 15:22:29 +00:00
|
|
|
}
|
2014-08-10 13:27:44 +00:00
|
|
|
} else {
|
2014-08-22 11:22:07 +00:00
|
|
|
String privateMarker;
|
2014-08-28 09:01:24 +00:00
|
|
|
if (message.getStatus() <= Message.STATUS_RECEIVED) {
|
2014-08-31 14:28:21 +00:00
|
|
|
privateMarker = activity
|
2015-01-11 15:22:29 +00:00
|
|
|
.getString(R.string.private_message);
|
2014-08-10 13:27:44 +00:00
|
|
|
} else {
|
2014-11-09 15:21:13 +00:00
|
|
|
final String to;
|
|
|
|
if (message.getCounterpart() != null) {
|
|
|
|
to = message.getCounterpart().getResourcepart();
|
2014-08-10 13:27:44 +00:00
|
|
|
} else {
|
2014-11-09 15:21:13 +00:00
|
|
|
to = "";
|
2014-08-10 13:27:44 +00:00
|
|
|
}
|
2014-11-07 14:09:28 +00:00
|
|
|
privateMarker = activity.getString(R.string.private_message_to, to);
|
2014-08-10 13:27:44 +00:00
|
|
|
}
|
2015-01-11 15:22:29 +00:00
|
|
|
final Spannable span = new SpannableString(privateMarker + " "
|
|
|
|
+ formattedBody);
|
2015-08-24 18:56:25 +00:00
|
|
|
span.setSpan(new ForegroundColorSpan(getMessageTextColor(darkBackground,false)), 0, privateMarker
|
2015-01-11 15:22:29 +00:00
|
|
|
.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
|
span.setSpan(new StyleSpan(Typeface.BOLD), 0,
|
2014-08-31 14:28:21 +00:00
|
|
|
privateMarker.length(),
|
|
|
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
2015-01-11 15:22:29 +00:00
|
|
|
if (message.hasMeCommand()) {
|
|
|
|
span.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), privateMarker.length() + 1,
|
|
|
|
privateMarker.length() + 1 + nick.length(),
|
|
|
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
|
}
|
2014-08-22 11:22:07 +00:00
|
|
|
viewHolder.messageBody.setText(span);
|
2014-08-10 13:27:44 +00:00
|
|
|
}
|
2014-07-22 13:31:54 +00:00
|
|
|
} else {
|
|
|
|
viewHolder.messageBody.setText("");
|
|
|
|
}
|
2015-08-24 18:56:25 +00:00
|
|
|
viewHolder.messageBody.setTextColor(this.getMessageTextColor(darkBackground, true));
|
|
|
|
viewHolder.messageBody.setLinkTextColor(this.getMessageTextColor(darkBackground,true));
|
2015-08-26 19:12:19 +00:00
|
|
|
viewHolder.messageBody.setHighlightColor(activity.getResources().getColor(darkBackground ? R.color.grey800 : R.color.grey500));
|
2014-07-22 13:31:54 +00:00
|
|
|
viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
|
|
|
|
viewHolder.messageBody.setTextIsSelectable(true);
|
|
|
|
}
|
|
|
|
|
2014-10-17 11:09:02 +00:00
|
|
|
private void displayDownloadableMessage(ViewHolder viewHolder,
|
2014-11-13 20:04:05 +00:00
|
|
|
final Message message, String text) {
|
2014-10-17 11:09:02 +00:00
|
|
|
viewHolder.image.setVisibility(View.GONE);
|
|
|
|
viewHolder.messageBody.setVisibility(View.GONE);
|
|
|
|
viewHolder.download_button.setVisibility(View.VISIBLE);
|
2014-11-13 20:04:05 +00:00
|
|
|
viewHolder.download_button.setText(text);
|
2014-10-17 11:09:02 +00:00
|
|
|
viewHolder.download_button.setOnClickListener(new OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
2014-12-15 15:55:38 +00:00
|
|
|
startDownloadable(message);
|
2014-10-17 11:09:02 +00:00
|
|
|
}
|
|
|
|
});
|
2014-10-23 19:27:41 +00:00
|
|
|
viewHolder.download_button.setOnLongClickListener(openContextMenu);
|
2014-10-17 11:09:02 +00:00
|
|
|
}
|
|
|
|
|
2014-11-13 20:04:05 +00:00
|
|
|
private void displayOpenableMessage(ViewHolder viewHolder,final Message message) {
|
|
|
|
viewHolder.image.setVisibility(View.GONE);
|
|
|
|
viewHolder.messageBody.setVisibility(View.GONE);
|
|
|
|
viewHolder.download_button.setVisibility(View.VISIBLE);
|
2015-05-10 01:12:44 +00:00
|
|
|
viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message)));
|
2014-11-13 20:04:05 +00:00
|
|
|
viewHolder.download_button.setOnClickListener(new OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
2015-01-12 15:09:39 +00:00
|
|
|
openDownloadable(message);
|
2014-11-13 20:04:05 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
viewHolder.download_button.setOnLongClickListener(openContextMenu);
|
|
|
|
}
|
|
|
|
|
2015-03-07 13:15:38 +00:00
|
|
|
private void displayLocationMessage(ViewHolder viewHolder, final Message message) {
|
|
|
|
viewHolder.image.setVisibility(View.GONE);
|
|
|
|
viewHolder.messageBody.setVisibility(View.GONE);
|
|
|
|
viewHolder.download_button.setVisibility(View.VISIBLE);
|
|
|
|
viewHolder.download_button.setText(R.string.show_location);
|
|
|
|
viewHolder.download_button.setOnClickListener(new OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
showLocation(message);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
viewHolder.download_button.setOnLongClickListener(openContextMenu);
|
|
|
|
}
|
|
|
|
|
2014-07-22 13:31:54 +00:00
|
|
|
private void displayImageMessage(ViewHolder viewHolder,
|
|
|
|
final Message message) {
|
|
|
|
if (viewHolder.download_button != null) {
|
|
|
|
viewHolder.download_button.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
viewHolder.messageBody.setVisibility(View.GONE);
|
|
|
|
viewHolder.image.setVisibility(View.VISIBLE);
|
2015-06-30 15:15:02 +00:00
|
|
|
FileParams params = message.getFileParams();
|
2014-10-14 16:16:03 +00:00
|
|
|
double target = metrics.density * 288;
|
|
|
|
int scalledW;
|
|
|
|
int scalledH;
|
|
|
|
if (params.width <= params.height) {
|
|
|
|
scalledW = (int) (params.width / ((double) params.height / target));
|
|
|
|
scalledH = (int) target;
|
|
|
|
} else {
|
|
|
|
scalledW = (int) target;
|
|
|
|
scalledH = (int) (params.height / ((double) params.width / target));
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
2015-07-19 12:26:03 +00:00
|
|
|
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(scalledW, scalledH);
|
2015-08-24 18:56:25 +00:00
|
|
|
layoutParams.setMargins(0, (int) (metrics.density * 4), 0, (int) (metrics.density * 4));
|
2015-07-19 12:26:03 +00:00
|
|
|
viewHolder.image.setLayoutParams(layoutParams);
|
2014-07-22 13:31:54 +00:00
|
|
|
activity.loadBitmap(message, viewHolder.image);
|
|
|
|
viewHolder.image.setOnClickListener(new OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
2015-08-11 13:23:52 +00:00
|
|
|
openDownloadable(message);
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
});
|
2014-10-23 19:27:41 +00:00
|
|
|
viewHolder.image.setOnLongClickListener(openContextMenu);
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public View getView(int position, View view, ViewGroup parent) {
|
2014-12-03 09:35:30 +00:00
|
|
|
final Message message = getItem(position);
|
2015-08-24 18:56:25 +00:00
|
|
|
final boolean isInValidSession = message.isValidInSession();
|
2014-12-03 09:35:30 +00:00
|
|
|
final Conversation conversation = message.getConversation();
|
|
|
|
final Account account = conversation.getAccount();
|
2014-12-07 20:14:13 +00:00
|
|
|
final int type = getItemViewType(position);
|
2014-07-22 13:31:54 +00:00
|
|
|
ViewHolder viewHolder;
|
|
|
|
if (view == null) {
|
|
|
|
viewHolder = new ViewHolder();
|
|
|
|
switch (type) {
|
2015-01-11 15:22:29 +00:00
|
|
|
case SENT:
|
|
|
|
view = activity.getLayoutInflater().inflate(
|
|
|
|
R.layout.message_sent, parent, false);
|
|
|
|
viewHolder.message_box = (LinearLayout) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.message_box);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.contact_picture = (ImageView) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.message_photo);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.download_button = (Button) view
|
2014-10-15 17:32:12 +00:00
|
|
|
.findViewById(R.id.download_button);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.indicator = (ImageView) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.security_indicator);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.image = (ImageView) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.message_image);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.messageBody = (TextView) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.message_body);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.time = (TextView) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.message_time);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.indicatorReceived = (ImageView) view
|
2014-09-20 13:49:25 +00:00
|
|
|
.findViewById(R.id.indicator_received);
|
2015-01-11 15:22:29 +00:00
|
|
|
break;
|
|
|
|
case RECEIVED:
|
|
|
|
view = activity.getLayoutInflater().inflate(
|
|
|
|
R.layout.message_received, parent, false);
|
|
|
|
viewHolder.message_box = (LinearLayout) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.message_box);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.contact_picture = (ImageView) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.message_photo);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.download_button = (Button) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.download_button);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.indicator = (ImageView) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.security_indicator);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.image = (ImageView) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.message_image);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.messageBody = (TextView) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.message_body);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.time = (TextView) view
|
2014-07-22 13:31:54 +00:00
|
|
|
.findViewById(R.id.message_time);
|
2015-01-11 15:22:29 +00:00
|
|
|
viewHolder.indicatorReceived = (ImageView) view
|
2014-11-07 14:38:20 +00:00
|
|
|
.findViewById(R.id.indicator_received);
|
2015-01-11 15:22:29 +00:00
|
|
|
break;
|
|
|
|
case STATUS:
|
2015-01-18 12:44:18 +00:00
|
|
|
view = activity.getLayoutInflater().inflate(R.layout.message_status, parent, false);
|
|
|
|
viewHolder.contact_picture = (ImageView) view.findViewById(R.id.message_photo);
|
|
|
|
viewHolder.status_message = (TextView) view.findViewById(R.id.status_message);
|
2015-01-11 15:22:29 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
viewHolder = null;
|
|
|
|
break;
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
2014-12-07 20:14:13 +00:00
|
|
|
view.setTag(viewHolder);
|
2014-07-22 13:31:54 +00:00
|
|
|
} else {
|
|
|
|
viewHolder = (ViewHolder) view.getTag();
|
2014-12-07 20:14:13 +00:00
|
|
|
if (viewHolder == null) {
|
|
|
|
return view;
|
|
|
|
}
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
|
2015-08-24 18:56:25 +00:00
|
|
|
boolean darkBackground = (type == RECEIVED && (!isInValidSession || !mUseWhiteBackground));
|
|
|
|
|
2014-10-07 09:51:16 +00:00
|
|
|
if (type == STATUS) {
|
2014-12-03 09:35:30 +00:00
|
|
|
if (conversation.getMode() == Conversation.MODE_SINGLE) {
|
2014-11-07 14:38:20 +00:00
|
|
|
viewHolder.contact_picture.setImageBitmap(activity
|
2014-12-03 09:35:30 +00:00
|
|
|
.avatarService().get(conversation.getContact(),
|
2015-01-11 15:22:29 +00:00
|
|
|
activity.getPixel(32)));
|
2014-11-07 14:38:20 +00:00
|
|
|
viewHolder.contact_picture.setAlpha(0.5f);
|
2015-02-21 10:06:52 +00:00
|
|
|
viewHolder.status_message.setText(message.getBody());
|
2014-11-07 14:38:20 +00:00
|
|
|
}
|
2014-10-07 09:51:16 +00:00
|
|
|
return view;
|
2014-11-07 14:38:20 +00:00
|
|
|
} else if (type == RECEIVED) {
|
2014-12-03 09:35:30 +00:00
|
|
|
Contact contact = message.getContact();
|
2014-11-07 14:38:20 +00:00
|
|
|
if (contact != null) {
|
|
|
|
viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(contact, activity.getPixel(48)));
|
2014-12-03 09:35:30 +00:00
|
|
|
} else if (conversation.getMode() == Conversation.MODE_MULTI) {
|
2015-01-12 15:09:39 +00:00
|
|
|
viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(
|
|
|
|
UIHelper.getMessageDisplayName(message),
|
|
|
|
activity.getPixel(48)));
|
2014-11-07 14:38:20 +00:00
|
|
|
}
|
2014-12-15 15:55:38 +00:00
|
|
|
} else if (type == SENT) {
|
2014-12-03 09:35:30 +00:00
|
|
|
viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(account, activity.getPixel(48)));
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
|
2014-12-15 15:55:38 +00:00
|
|
|
viewHolder.contact_picture
|
2015-01-11 15:22:29 +00:00
|
|
|
.setOnClickListener(new OnClickListener() {
|
2014-12-15 15:55:38 +00:00
|
|
|
|
2015-01-11 15:22:29 +00:00
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
if (MessageAdapter.this.mOnContactPictureClickedListener != null) {
|
|
|
|
MessageAdapter.this.mOnContactPictureClickedListener
|
2015-08-24 18:56:25 +00:00
|
|
|
.onContactPictureClicked(message);
|
2014-12-15 15:55:38 +00:00
|
|
|
}
|
2015-01-11 15:22:29 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
});
|
2014-12-15 15:55:38 +00:00
|
|
|
viewHolder.contact_picture
|
2015-01-11 15:22:29 +00:00
|
|
|
.setOnLongClickListener(new OnLongClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
if (MessageAdapter.this.mOnContactPictureLongClickedListener != null) {
|
|
|
|
MessageAdapter.this.mOnContactPictureLongClickedListener
|
2015-08-24 18:56:25 +00:00
|
|
|
.onContactPictureLongClicked(message);
|
2015-01-11 15:22:29 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
2014-12-15 15:55:38 +00:00
|
|
|
}
|
2015-01-11 15:22:29 +00:00
|
|
|
}
|
|
|
|
});
|
2014-09-20 14:02:49 +00:00
|
|
|
|
2015-07-10 13:11:03 +00:00
|
|
|
final Transferable transferable = message.getTransferable();
|
|
|
|
if (transferable != null && transferable.getStatus() != Transferable.STATUS_UPLOADING) {
|
|
|
|
if (transferable.getStatus() == Transferable.STATUS_OFFER) {
|
2015-01-18 12:00:57 +00:00
|
|
|
displayDownloadableMessage(viewHolder,message,activity.getString(R.string.download_x_file, UIHelper.getFileDescriptionString(activity, message)));
|
2015-07-10 13:11:03 +00:00
|
|
|
} else if (transferable.getStatus() == Transferable.STATUS_OFFER_CHECK_FILESIZE) {
|
2015-07-02 21:13:00 +00:00
|
|
|
displayDownloadableMessage(viewHolder, message, activity.getString(R.string.check_x_filesize, UIHelper.getFileDescriptionString(activity, message)));
|
2015-01-18 12:00:57 +00:00
|
|
|
} else {
|
2015-08-24 18:56:25 +00:00
|
|
|
displayInfoMessage(viewHolder, UIHelper.getMessagePreview(activity, message).first,darkBackground);
|
2014-11-13 20:04:05 +00:00
|
|
|
}
|
2014-12-03 09:35:30 +00:00
|
|
|
} else if (message.getType() == Message.TYPE_IMAGE && message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED) {
|
|
|
|
displayImageMessage(viewHolder, message);
|
|
|
|
} else if (message.getType() == Message.TYPE_FILE && message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED) {
|
2015-06-30 15:15:02 +00:00
|
|
|
if (message.getFileParams().width > 0) {
|
2014-12-03 09:35:30 +00:00
|
|
|
displayImageMessage(viewHolder,message);
|
2014-11-13 21:59:00 +00:00
|
|
|
} else {
|
2014-12-03 09:35:30 +00:00
|
|
|
displayOpenableMessage(viewHolder, message);
|
2014-11-13 21:59:00 +00:00
|
|
|
}
|
2014-12-03 09:35:30 +00:00
|
|
|
} else if (message.getEncryption() == Message.ENCRYPTION_PGP) {
|
2014-11-14 11:31:57 +00:00
|
|
|
if (activity.hasPgp()) {
|
2015-08-24 18:56:25 +00:00
|
|
|
displayInfoMessage(viewHolder,activity.getString(R.string.encrypted_message),darkBackground);
|
2014-07-22 13:31:54 +00:00
|
|
|
} else {
|
2015-08-24 18:56:25 +00:00
|
|
|
displayInfoMessage(viewHolder,activity.getString(R.string.install_openkeychain),darkBackground);
|
2014-11-14 11:31:57 +00:00
|
|
|
if (viewHolder != null) {
|
|
|
|
viewHolder.message_box
|
2015-01-11 15:22:29 +00:00
|
|
|
.setOnClickListener(new OnClickListener() {
|
2014-11-14 11:31:57 +00:00
|
|
|
|
2015-01-11 15:22:29 +00:00
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
activity.showInstallPgpDialog();
|
|
|
|
}
|
|
|
|
});
|
2014-11-14 11:31:57 +00:00
|
|
|
}
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
2014-12-03 09:35:30 +00:00
|
|
|
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
|
2015-08-24 18:56:25 +00:00
|
|
|
displayDecryptionFailed(viewHolder,darkBackground);
|
2014-11-14 11:31:57 +00:00
|
|
|
} else {
|
2015-03-07 13:15:38 +00:00
|
|
|
if (GeoHelper.isGeoUri(message.getBody())) {
|
|
|
|
displayLocationMessage(viewHolder,message);
|
2015-07-02 21:13:00 +00:00
|
|
|
} else if (message.bodyIsHeart()) {
|
|
|
|
displayHeartMessage(viewHolder, message.getBody().trim());
|
|
|
|
} else if (message.treatAsDownloadable() == Message.Decision.MUST) {
|
|
|
|
displayDownloadableMessage(viewHolder, message, activity.getString(R.string.check_x_filesize, UIHelper.getFileDescriptionString(activity, message)));
|
2015-03-07 13:15:38 +00:00
|
|
|
} else {
|
2015-08-24 18:56:25 +00:00
|
|
|
displayTextMessage(viewHolder, message, darkBackground);
|
2015-03-07 13:15:38 +00:00
|
|
|
}
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
|
2015-07-29 00:49:14 +00:00
|
|
|
if (type == RECEIVED) {
|
2015-08-24 18:56:25 +00:00
|
|
|
if(isInValidSession) {
|
|
|
|
if (mUseWhiteBackground) {
|
|
|
|
viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_white);
|
|
|
|
} else {
|
|
|
|
viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received);
|
|
|
|
}
|
2015-07-30 17:16:58 +00:00
|
|
|
} else {
|
|
|
|
viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_warning);
|
2015-07-29 00:49:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-24 18:56:25 +00:00
|
|
|
displayStatus(viewHolder, message, type, darkBackground);
|
2014-07-22 13:31:54 +00:00
|
|
|
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
2014-12-15 15:55:38 +00:00
|
|
|
public void startDownloadable(Message message) {
|
2015-07-10 13:11:03 +00:00
|
|
|
Transferable transferable = message.getTransferable();
|
|
|
|
if (transferable != null) {
|
|
|
|
if (!transferable.start()) {
|
2014-10-17 11:09:02 +00:00
|
|
|
Toast.makeText(activity, R.string.not_connected_try_again,
|
|
|
|
Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
2015-07-10 11:28:50 +00:00
|
|
|
} else if (message.treatAsDownloadable() != Message.Decision.NEVER) {
|
2015-07-22 10:15:09 +00:00
|
|
|
activity.xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message,true);
|
2014-10-14 17:27:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-12 15:09:39 +00:00
|
|
|
public void openDownloadable(Message message) {
|
|
|
|
DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
|
2014-11-15 14:16:40 +00:00
|
|
|
if (!file.exists()) {
|
|
|
|
Toast.makeText(activity,R.string.file_deleted,Toast.LENGTH_SHORT).show();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Intent openIntent = new Intent(Intent.ACTION_VIEW);
|
|
|
|
openIntent.setDataAndType(Uri.fromFile(file), file.getMimeType());
|
|
|
|
PackageManager manager = activity.getPackageManager();
|
|
|
|
List<ResolveInfo> infos = manager.queryIntentActivities(openIntent, 0);
|
|
|
|
if (infos.size() > 0) {
|
|
|
|
getContext().startActivity(openIntent);
|
|
|
|
} else {
|
|
|
|
Toast.makeText(activity,R.string.no_application_found_to_open_file,Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
2014-11-13 20:04:05 +00:00
|
|
|
}
|
|
|
|
|
2015-03-07 13:15:38 +00:00
|
|
|
public void showLocation(Message message) {
|
|
|
|
for(Intent intent : GeoHelper.createGeoIntentsFromMessage(message)) {
|
|
|
|
if (intent.resolveActivity(getContext().getPackageManager()) != null) {
|
|
|
|
getContext().startActivity(intent);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Toast.makeText(activity,R.string.no_application_found_to_display_location,Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
|
2015-08-24 18:56:25 +00:00
|
|
|
public void updatePreferences() {
|
|
|
|
this.mIndicateReceived = activity.indicateReceived();
|
|
|
|
this.mUseWhiteBackground = activity.useWhiteBackground();
|
|
|
|
}
|
|
|
|
|
2014-11-07 14:38:20 +00:00
|
|
|
public interface OnContactPictureClicked {
|
2015-08-24 18:56:25 +00:00
|
|
|
void onContactPictureClicked(Message message);
|
2014-11-07 14:38:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public interface OnContactPictureLongClicked {
|
2015-08-24 18:56:25 +00:00
|
|
|
void onContactPictureLongClicked(Message message);
|
2014-11-07 14:38:20 +00:00
|
|
|
}
|
|
|
|
|
2014-07-22 13:31:54 +00:00
|
|
|
private static class ViewHolder {
|
|
|
|
|
|
|
|
protected LinearLayout message_box;
|
|
|
|
protected Button download_button;
|
|
|
|
protected ImageView image;
|
|
|
|
protected ImageView indicator;
|
2014-09-20 13:49:25 +00:00
|
|
|
protected ImageView indicatorReceived;
|
2014-07-22 13:31:54 +00:00
|
|
|
protected TextView time;
|
|
|
|
protected TextView messageBody;
|
|
|
|
protected ImageView contact_picture;
|
2015-01-18 12:44:18 +00:00
|
|
|
protected TextView status_message;
|
2014-07-22 13:31:54 +00:00
|
|
|
}
|
|
|
|
}
|