reduce GPU overdraw

Closes #3305
// FREEBIE
This commit is contained in:
Jake McGinty
2015-06-01 16:51:14 -07:00
committed by Moxie Marlinspike
parent 9408579862
commit bd2e984963
17 changed files with 54 additions and 148 deletions

View File

@@ -17,7 +17,6 @@
package org.thoughtcrime.securesms;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.os.Handler;
import android.util.AttributeSet;
@@ -104,7 +103,7 @@ public class ConversationListItem extends RelativeLayout
dateView.setTypeface(read ? LIGHT_TYPEFACE : BOLD_TYPEFACE);
}
setBackground(read, batchMode);
setBatchState(batchMode);
this.contactPhotoImage.setAvatar(recipients.getPrimaryRecipient(), true);
}
@@ -117,22 +116,8 @@ public class ConversationListItem extends RelativeLayout
contactPhotoImage.setVisibility(View.VISIBLE);
}
private void setBackground(boolean read, boolean batch) {
int[] attributes = new int[]{R.attr.conversation_list_item_background_selected,
R.attr.conversation_list_item_background_read,
R.attr.conversation_list_item_background_unread};
TypedArray drawables = context.obtainStyledAttributes(attributes);
if (batch && selectedThreads.contains(threadId)) {
setBackgroundDrawable(drawables.getDrawable(0));
} else if (read) {
setBackgroundDrawable(drawables.getDrawable(1));
} else {
setBackgroundDrawable(drawables.getDrawable(2));
}
drawables.recycle();
private void setBatchState(boolean batch) {
setSelected(batch && selectedThreads.contains(threadId));
}
public Recipients getRecipients() {