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

@ -12,15 +12,7 @@
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"--> <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"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:cropToPadding="true" android:cropToPadding="true"
@ -101,4 +93,3 @@
android:ellipsize="end" /> android:ellipsize="end" />
</org.thoughtcrime.securesms.ConversationHeaderView> </org.thoughtcrime.securesms.ConversationHeaderView>

View File

@ -29,15 +29,11 @@
/> />
<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:layout_weight="1"
android:drawSelectorOnTop="false" android:drawSelectorOnTop="false"
android:scrollbarStyle="insideOverlay" android:scrollbarStyle="insideOverlay"
android:fadingEdgeLength="16dip" android:fadingEdgeLength="16dip"
android:background="@android:color/white"
android:cacheColorHint="@android:color/white"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_above="@id/search_text" /> android:layout_above="@id/search_text" />

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;
@ -57,14 +55,13 @@ public class ConversationHeaderView extends RelativeLayout {
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,15 +114,11 @@ 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.setImageBitmap(message.getRecipients().getPrimaryRecipient().getContactPhoto());
contactPhoto.setBackgroundResource(R.drawable.light_border_background);
contactPhoto.setVisibility(View.VISIBLE); contactPhoto.setVisibility(View.VISIBLE);
} }
} }
}
private void intializeListeners() { private void intializeListeners() {
checkbox.setOnCheckedChangeListener(new CheckedChangedListener()); checkbox.setOnCheckedChangeListener(new CheckedChangedListener());