From d4d684b67025391b649993eaf38efa75a78f0fbf Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Thu, 27 Mar 2014 19:46:27 -0700 Subject: [PATCH] simplified layouts --- res/layout/conversation_item_received.xml | 34 ++++------- res/layout/conversation_item_sent.xml | 57 ++++++------------- res/values/strings.xml | 8 +++ .../securesms/ConversationItem.java | 33 ++--------- 4 files changed, 41 insertions(+), 91 deletions(-) diff --git a/res/layout/conversation_item_received.xml b/res/layout/conversation_item_received.xml index 055fb97784..dea9df932e 100644 --- a/res/layout/conversation_item_received.xml +++ b/res/layout/conversation_item_received.xml @@ -48,47 +48,37 @@ android:background="?conversation_item_received_background" android:orientation="vertical"> - - - - + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="?conversation_received_text_primary_color" + android:textSize="16sp" + android:autoLink="all" + android:linksClickable="true" /> + @@ -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" /> diff --git a/res/layout/conversation_item_sent.xml b/res/layout/conversation_item_sent.xml index c47b194d74..d7e3e312d2 100644 --- a/res/layout/conversation_item_sent.xml +++ b/res/layout/conversation_item_sent.xml @@ -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"/> + android:contentDescription="@string/conversation_item_sent__pending_approval_description"/> - - - - - - + + android:contentDescription="@string/conversation_item__mms_image_description"/> + android:contentDescription="@string/conversation_item__play_button_description"/> @@ -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"/> + android:contentDescription="@string/conversation_item__secure_message_description" /> @@ -189,17 +175,6 @@ android:layout_alignParentRight="true" /> - - Send Remove + + Media Message + Play Button + Secure Message Indicator + Download Downloading + Send Failed Indicator + Pending Approval + Delivered Indicator Download diff --git a/src/org/thoughtcrime/securesms/ConversationItem.java b/src/org/thoughtcrime/securesms/ConversationItem.java index 4399a3361f..ccb947fb10 100644 --- a/src/org/thoughtcrime/securesms/ConversationItem.java +++ b/src/org/thoughtcrime/securesms/ConversationItem.java @@ -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(); - } }