|
|
|
@ -57,7 +57,6 @@ import org.thoughtcrime.securesms.util.DateUtils;
|
|
|
|
|
import org.thoughtcrime.securesms.util.Emoji;
|
|
|
|
|
import org.thoughtcrime.securesms.util.Dialogs;
|
|
|
|
|
import org.whispersystems.textsecure.crypto.MasterSecret;
|
|
|
|
|
import org.whispersystems.textsecure.storage.Session;
|
|
|
|
|
import org.whispersystems.textsecure.util.FutureTaskListener;
|
|
|
|
|
import org.whispersystems.textsecure.util.ListenableFutureTask;
|
|
|
|
|
|
|
|
|
@ -109,7 +108,6 @@ public class ConversationItem extends LinearLayout {
|
|
|
|
|
private TextView groupStatusText;
|
|
|
|
|
private ImageView secureImage;
|
|
|
|
|
private ImageView failedImage;
|
|
|
|
|
private ImageView keyImage;
|
|
|
|
|
private ImageView contactPhoto;
|
|
|
|
|
private ImageView deliveredImage;
|
|
|
|
|
private View triangleTick;
|
|
|
|
@ -149,14 +147,13 @@ public class ConversationItem extends LinearLayout {
|
|
|
|
|
this.groupStatusText = (TextView) findViewById(R.id.group_message_status);
|
|
|
|
|
this.secureImage = (ImageView)findViewById(R.id.sms_secure_indicator);
|
|
|
|
|
this.failedImage = (ImageView)findViewById(R.id.sms_failed_indicator);
|
|
|
|
|
this.keyImage = (ImageView)findViewById(R.id.key_exchange_indicator);
|
|
|
|
|
this.mmsContainer = findViewById(R.id.mms_view);
|
|
|
|
|
this.mmsThumbnail = (ImageView)findViewById(R.id.image_view);
|
|
|
|
|
this.mmsDownloadButton = (Button) findViewById(R.id.mms_download_button);
|
|
|
|
|
this.mmsDownloadingLabel = (TextView) findViewById(R.id.mms_label_downloading);
|
|
|
|
|
this.contactPhoto = (ImageView)findViewById(R.id.contact_photo);
|
|
|
|
|
this.deliveredImage = (ImageView)findViewById(R.id.delivered_indicator);
|
|
|
|
|
this.conversationParent = (View) findViewById(R.id.conversation_item_parent);
|
|
|
|
|
this.conversationParent = findViewById(R.id.conversation_item_parent);
|
|
|
|
|
this.triangleTick = findViewById(R.id.triangle_tick);
|
|
|
|
|
this.pendingIndicator = (ImageView)findViewById(R.id.pending_approval_indicator);
|
|
|
|
|
this.backgroundDrawables = context.obtainStyledAttributes(STYLE_ATTRIBUTES);
|
|
|
|
@ -265,7 +262,7 @@ public class ConversationItem extends LinearLayout {
|
|
|
|
|
indicatorText.setVisibility(messageRecord.isPendingSmsFallback() ? View.VISIBLE : View.GONE);
|
|
|
|
|
}
|
|
|
|
|
secureImage.setVisibility(messageRecord.isSecure() ? View.VISIBLE : View.GONE);
|
|
|
|
|
keyImage.setVisibility(messageRecord.isKeyExchange() ? View.VISIBLE : View.GONE);
|
|
|
|
|
bodyText.setCompoundDrawablesWithIntrinsicBounds(0, 0, messageRecord.isKeyExchange() ? R.drawable.ic_menu_login : 0, 0);
|
|
|
|
|
deliveredImage.setVisibility(!messageRecord.isKeyExchange() && messageRecord.isDelivered() ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
mmsThumbnail.setVisibility(View.GONE);
|
|
|
|
@ -409,6 +406,7 @@ public class ConversationItem extends LinearLayout {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setContactPhotoForRecipient(final Recipient recipient) {
|
|
|
|
|
if (contactPhoto == null) return;
|
|
|
|
|
contactPhoto.setImageBitmap(BitmapUtil.getCircleCroppedBitmap(recipient.getContactPhoto()));
|
|
|
|
|
contactPhoto.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
@ -480,7 +478,7 @@ public class ConversationItem extends LinearLayout {
|
|
|
|
|
mediaScannerConnection = new MediaScannerConnection(context, this);
|
|
|
|
|
mediaScannerConnection.connect();
|
|
|
|
|
} catch (IOException ioe) {
|
|
|
|
|
Log.w("ConversationItem", ioe);
|
|
|
|
|
Log.w(TAG, ioe);
|
|
|
|
|
this.obtainMessage(FAILURE).sendToTarget();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -571,7 +569,7 @@ public class ConversationItem extends LinearLayout {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void fireIntent() {
|
|
|
|
|
Log.w("ConversationItem", "Clicked: " + slide.getUri() + " , " + slide.getContentType());
|
|
|
|
|
Log.w(TAG, "Clicked: " + slide.getUri() + " , " + slide.getContentType());
|
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
|
|
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
|
|
|
intent.setDataAndType(slide.getUri(), slide.getContentType());
|
|
|
|
@ -693,25 +691,4 @@ public class ConversationItem extends LinearLayout {
|
|
|
|
|
});
|
|
|
|
|
builder.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void handleAbortSecureSession() {
|
|
|
|
|
if (!messageRecord.isSecure()) return;
|
|
|
|
|
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
|
|
|
|
builder.setTitle(R.string.ConversationActivity_abort_secure_session_confirmation);
|
|
|
|
|
builder.setIcon(Dialogs.resolveIcon(context, R.attr.dialog_alert_icon));
|
|
|
|
|
builder.setCancelable(true);
|
|
|
|
|
builder.setMessage(R.string.ConversationActivity_are_you_sure_that_you_want_to_abort_this_secure_session_question);
|
|
|
|
|
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
if (messageRecord.getRecipients().isSingleRecipient()) {
|
|
|
|
|
Recipient recipient = messageRecord.getRecipients().getPrimaryRecipient();
|
|
|
|
|
Session.abortSessionFor(context, recipient);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
builder.setNegativeButton(R.string.no, null);
|
|
|
|
|
builder.show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|