mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Merge pull request #1260 from mcginty/message-layout-lint
Conversation item tweaks
This commit is contained in:
commit
9e2f82954f
@ -48,47 +48,37 @@
|
||||
android:background="?conversation_item_received_background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<TextView android:id="@+id/conversation_item_body"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:orientation="horizontal">
|
||||
<ImageView android:id="@+id/key_exchange_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_menu_login"
|
||||
android:contentDescription="Key Exchange Indicator"
|
||||
android:visibility="gone" />
|
||||
<TextView android:id="@+id/conversation_item_body"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?conversation_received_text_primary_color"
|
||||
android:textSize="16sp"
|
||||
android:autoLink="all"
|
||||
android:linksClickable="true" />
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout android:id="@+id/mms_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView android:id="@+id/image_view"
|
||||
android:layout_width="230dip"
|
||||
android:layout_height="174dip"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerInside"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="Message Media"
|
||||
android:contentDescription="@string/conversation_item__mms_image_description"
|
||||
android:visibility="gone" />
|
||||
<ImageButton android:id="@+id/play_slideshow_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/mms_play_btn"
|
||||
android:contentDescription="Play Button"
|
||||
android:contentDescription="@string/conversation_item__play_button_description"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
@ -130,7 +120,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="3dip"
|
||||
android:src="?conversation_delivered_indicator"
|
||||
android:contentDescription="Delivered Indicator"
|
||||
android:contentDescription="@string/conversation_item_sent__delivered_description"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView android:id="@+id/sms_secure_indicator"
|
||||
@ -140,7 +130,7 @@
|
||||
android:paddingRight="4dp"
|
||||
android:paddingTop="2dp"
|
||||
android:src="?menu_lock_icon_small"
|
||||
android:contentDescription="Secure Message Indicator"
|
||||
android:contentDescription="@string/conversation_item__secure_message_description"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView android:id="@+id/conversation_item_date"
|
||||
@ -168,7 +158,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_list_alert_sms_failed"
|
||||
android:contentDescription="Send Failed Indicator"
|
||||
android:contentDescription="@string/conversation_item_sent__send_failed_indicator_description"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_list_alert_sms_failed"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="Send Failed Indicator"/>
|
||||
android:contentDescription="@string/conversation_item_sent__send_failed_indicator_description"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pending_approval_indicator"
|
||||
@ -38,7 +38,7 @@
|
||||
android:src="@drawable/ic_dialog_info_holo_light"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:contentDescription="Pending Approval"/>
|
||||
android:contentDescription="@string/conversation_item_sent__pending_approval_description"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/conversation_item_parent"
|
||||
@ -52,31 +52,17 @@
|
||||
android:layout_marginRight="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dip">
|
||||
|
||||
<TextView android:id="@+id/conversation_item_body"
|
||||
android:autoLink="all"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:linksClickable="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:gravity="right"
|
||||
android:textColor="?conversation_sent_text_primary_color"
|
||||
android:textColorLink="?conversation_sent_text_primary_color"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/key_exchange_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_menu_login"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="Key Exchange Indicator"/>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/mms_view"
|
||||
android:layout_width="wrap_content"
|
||||
@ -91,7 +77,7 @@
|
||||
android:scaleType="centerInside"
|
||||
android:adjustViewBounds="true"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="Media Message"/>
|
||||
android:contentDescription="@string/conversation_item__mms_image_description"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/play_slideshow_button"
|
||||
@ -100,7 +86,7 @@
|
||||
android:src="@drawable/mms_play_btn"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="Play Button"/>
|
||||
android:contentDescription="@string/conversation_item__play_button_description"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@ -140,7 +126,7 @@
|
||||
android:paddingRight="3dip"
|
||||
android:src="?conversation_delivered_indicator"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="Delivered Indicator"/>
|
||||
android:contentDescription="@string/conversation_item_sent__delivered_description"/>
|
||||
|
||||
<TextView android:id="@+id/group_message_status"
|
||||
android:layout_width="wrap_content"
|
||||
@ -175,7 +161,7 @@
|
||||
android:visibility="gone"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:contentDescription="Secure Message Indicator" />
|
||||
android:contentDescription="@string/conversation_item__secure_message_description" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -189,17 +175,6 @@
|
||||
android:layout_alignParentRight="true"
|
||||
/>
|
||||
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@id/contact_photo"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:cropToPadding="true"
|
||||
android:layout_marginRight="0dip"
|
||||
android:padding="0dip"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView android:id="@+id/indicator_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -437,9 +437,17 @@
|
||||
<string name="conversation_activity__send">Send</string>
|
||||
<string name="conversation_activity__remove">Remove</string>
|
||||
|
||||
<!-- conversation_item -->
|
||||
<string name="conversation_item__mms_image_description">Media Message</string>
|
||||
<string name="conversation_item__play_button_description">Play Button</string>
|
||||
<string name="conversation_item__secure_message_description">Secure Message Indicator</string>
|
||||
|
||||
<!-- conversation_item_sent -->
|
||||
<string name="conversation_item_sent__download">Download</string>
|
||||
<string name="conversation_item_sent__downloading">Downloading</string>
|
||||
<string name="conversation_item_sent__send_failed_indicator_description">Send Failed Indicator</string>
|
||||
<string name="conversation_item_sent__pending_approval_description">Pending Approval</string>
|
||||
<string name="conversation_item_sent__delivered_description">Delivered Indicator</string>
|
||||
|
||||
<!-- conversation_item_received -->
|
||||
<string name="conversation_item_received__download">Download</string>
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user