Switch to QuickContactBadge.

This commit is contained in:
Moxie Marlinspike 2012-07-16 20:20:13 -07:00
parent 44c221c9f1
commit 63250b33a8
7 changed files with 39 additions and 59 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -2,7 +2,7 @@
<org.thoughtcrime.securesms.ConversationHeaderView xmlns:android="http://schemas.android.com/apk/res/android" <org.thoughtcrime.securesms.ConversationHeaderView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight" android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingRight="10dip" android:paddingRight="10dip"
> >
<ImageView android:id="@+id/unread_indicator" <ImageView android:id="@+id/unread_indicator"
@ -11,22 +11,14 @@
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:visibility="invisible" android:visibility="invisible"
android:src="@drawable/ic_sms_unread_msg_indicator" /> android:src="@drawable/ic_sms_unread_msg_indicator" />
<!-- <android.widget.QuickContactBadge android:id="@+id/contact_photo"-->
<!-- android:layout_width="60dp"-->
<!-- android:layout_height="60dp"-->
<!-- android:cropToPadding="true"-->
<!-- android:scaleType="centerCrop"-->
<!-- android:layout_toRightOf="@id/unread_indicator"-->
<!-- android:visibility="gone" />-->
<ImageView android:id="@+id/contact_photo" <QuickContactBadge android:id="@+id/contact_photo"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:cropToPadding="true" android:cropToPadding="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:layout_toRightOf="@id/unread_indicator" android:layout_toRightOf="@id/unread_indicator"
android:visibility="gone" /> android:visibility="gone" />
<ImageView android:id="@+id/key_indicator" <ImageView android:id="@+id/key_indicator"
@ -35,13 +27,13 @@
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:visibility="invisible" android:visibility="invisible"
android:src="@drawable/key_exchange_indicator" /> android:src="@drawable/key_exchange_indicator" />
<CheckBox android:id="@+id/checkbox" <CheckBox android:id="@+id/checkbox"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:visibility="gone" /> android:visibility="gone" />
<TextView android:id="@+id/from" <TextView android:id="@+id/from"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -55,10 +47,10 @@
android:layout_toRightOf="@id/contact_photo" android:layout_toRightOf="@id/contact_photo"
android:layout_toLeftOf="@id/checkbox" android:layout_toLeftOf="@id/checkbox"
android:layout_alignWithParentIfMissing="true" android:layout_alignWithParentIfMissing="true"
android:ellipsize="marquee" android:ellipsize="marquee"
android:textColor="#000000"/> android:textColor="#000000"/>
<TextView android:id="@+id/date" <TextView android:id="@+id/date"
android:layout_marginBottom="10dip" android:layout_marginBottom="10dip"
android:layout_marginLeft="5dip" android:layout_marginLeft="5dip"
@ -101,4 +93,3 @@
android:ellipsize="end" /> android:ellipsize="end" />
</org.thoughtcrime.securesms.ConversationHeaderView> </org.thoughtcrime.securesms.ConversationHeaderView>

View File

@ -29,17 +29,13 @@
/> />
<ListView android:id="@android:id/list" <ListView android:id="@android:id/list"
style="?android:attr/listViewWhiteStyle" android:layout_width="fill_parent"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:drawSelectorOnTop="false"
android:layout_weight="1" android:scrollbarStyle="insideOverlay"
android:drawSelectorOnTop="false" android:fadingEdgeLength="16dip"
android:scrollbarStyle="insideOverlay" android:layout_alignParentTop="true"
android:fadingEdgeLength="16dip" android:layout_above="@id/search_text" />
android:background="@android:color/white"
android:cacheColorHint="@android:color/white"
android:layout_alignParentTop="true"
android:layout_above="@id/search_text" />
<ProgressBar android:id="@+id/search_progress" <ProgressBar android:id="@+id/search_progress"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -17,8 +17,6 @@
package org.thoughtcrime.securesms; package org.thoughtcrime.securesms;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.preference.PreferenceManager;
import android.text.Spannable; import android.text.Spannable;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
@ -27,7 +25,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.QuickContactBadge;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
@ -48,23 +46,22 @@ public class ConversationHeaderView extends RelativeLayout {
private final Context context; private final Context context;
private Set<Long> selectedThreads; private Set<Long> selectedThreads;
private Recipients recipients; private Recipients recipients;
private long threadId; private long threadId;
private boolean first; private boolean first;
private TextView subjectView; private TextView subjectView;
private TextView fromView; private TextView fromView;
private TextView dateView; private TextView dateView;
private View unreadIndicator; private View unreadIndicator;
private View keyIndicator; private View keyIndicator;
private CheckBox checkbox; private CheckBox checkbox;
private ImageView contactPhoto; private QuickContactBadge contactPhoto;
public ConversationHeaderView(Context context, boolean first) { public ConversationHeaderView(Context context, boolean first) {
this(context, (Set<Long>)null); this(context, (Set<Long>)null);
this.first = true; this.first = true;
contactPhoto.setVisibility(View.GONE); contactPhoto.setVisibility(View.GONE);
this.setBackgroundColor(Color.TRANSPARENT);
} }
public ConversationHeaderView(Context context, Set<Long> selectedThreads) { public ConversationHeaderView(Context context, Set<Long> selectedThreads) {
@ -80,7 +77,7 @@ public class ConversationHeaderView extends RelativeLayout {
this.dateView = (TextView)findViewById(R.id.date); this.dateView = (TextView)findViewById(R.id.date);
this.unreadIndicator = findViewById(R.id.unread_indicator); this.unreadIndicator = findViewById(R.id.unread_indicator);
this.keyIndicator = findViewById(R.id.key_indicator); this.keyIndicator = findViewById(R.id.key_indicator);
this.contactPhoto = (ImageView)findViewById(R.id.contact_photo); this.contactPhoto = (QuickContactBadge)findViewById(R.id.contact_photo);
this.checkbox = (CheckBox)findViewById(R.id.checkbox); this.checkbox = (CheckBox)findViewById(R.id.checkbox);
intializeListeners(); intializeListeners();
@ -117,13 +114,9 @@ public class ConversationHeaderView extends RelativeLayout {
if (batchMode) checkbox.setVisibility(View.VISIBLE); if (batchMode) checkbox.setVisibility(View.VISIBLE);
else checkbox.setVisibility(View.GONE); else checkbox.setVisibility(View.GONE);
if (!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(ApplicationPreferencesActivity.CONVERSATION_ICONS_LIST_PREF, ApplicationPreferencesActivity.showIcon())) { contactPhoto.setImageBitmap(this.recipients.getPrimaryRecipient().getContactPhoto());
contactPhoto.setVisibility(View.GONE); contactPhoto.assignContactFromPhone(this.recipients.getPrimaryRecipient().getNumber(), true);
} else { contactPhoto.setVisibility(View.VISIBLE);
contactPhoto.setImageBitmap(message.getRecipients().getPrimaryRecipient().getContactPhoto());
contactPhoto.setBackgroundResource(R.drawable.light_border_background);
contactPhoto.setVisibility(View.VISIBLE);
}
} }
} }