fix ConversationItem recipients listener

Fixes #4420
Closes #5615
// FREEBIE
This commit is contained in:
Christian Ascheberg 2016-08-14 07:55:43 +02:00 committed by Moxie Marlinspike
parent 5bf1707d60
commit e7ad77398f

View File

@ -39,10 +39,10 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.thoughtcrime.securesms.components.AlertView;
import org.thoughtcrime.securesms.components.AudioView; import org.thoughtcrime.securesms.components.AudioView;
import org.thoughtcrime.securesms.components.AvatarImageView; import org.thoughtcrime.securesms.components.AvatarImageView;
import org.thoughtcrime.securesms.components.DeliveryStatusView; import org.thoughtcrime.securesms.components.DeliveryStatusView;
import org.thoughtcrime.securesms.components.AlertView;
import org.thoughtcrime.securesms.components.ExpirationTimerView; import org.thoughtcrime.securesms.components.ExpirationTimerView;
import org.thoughtcrime.securesms.components.ThumbnailView; import org.thoughtcrime.securesms.components.ThumbnailView;
import org.thoughtcrime.securesms.crypto.MasterSecret; import org.thoughtcrime.securesms.crypto.MasterSecret;
@ -231,12 +231,7 @@ public class ConversationItem extends LinearLayout
if (messageRecord.isOutgoing()) { if (messageRecord.isOutgoing()) {
bodyBubble.getBackground().setColorFilter(defaultBubbleColor, PorterDuff.Mode.MULTIPLY); bodyBubble.getBackground().setColorFilter(defaultBubbleColor, PorterDuff.Mode.MULTIPLY);
mediaThumbnail.setBackgroundColorHint(defaultBubbleColor); mediaThumbnail.setBackgroundColorHint(defaultBubbleColor);
setAudioViewTint(messageRecord, conversationRecipients);
if (DynamicTheme.LIGHT.equals(TextSecurePreferences.getTheme(context))) {
audioView.setTint(conversationRecipients.getColor().toConversationColor(context));
} else {
audioView.setTint(Color.WHITE);
}
} else { } else {
int color = recipient.getColor().toConversationColor(context); int color = recipient.getColor().toConversationColor(context);
bodyBubble.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY); bodyBubble.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
@ -244,6 +239,16 @@ public class ConversationItem extends LinearLayout
} }
} }
private void setAudioViewTint(MessageRecord messageRecord, Recipients recipients) {
if (messageRecord.isOutgoing()) {
if (DynamicTheme.LIGHT.equals(TextSecurePreferences.getTheme(context))) {
audioView.setTint(recipients.getColor().toConversationColor(context));
} else {
audioView.setTint(Color.WHITE);
}
}
}
private void setInteractionState(MessageRecord messageRecord) { private void setInteractionState(MessageRecord messageRecord) {
setSelected(batchSelected.contains(messageRecord)); setSelected(batchSelected.contains(messageRecord));
mediaThumbnail.setFocusable(!shouldInterceptClicks(messageRecord) && batchSelected.isEmpty()); mediaThumbnail.setFocusable(!shouldInterceptClicks(messageRecord) && batchSelected.isEmpty());
@ -493,8 +498,13 @@ public class ConversationItem extends LinearLayout
} }
@Override @Override
public void onModified(Recipients recipient) { public void onModified(final Recipients recipients) {
onModified(recipient.getPrimaryRecipient()); Util.runOnMain(new Runnable() {
@Override
public void run() {
setAudioViewTint(messageRecord, recipients);
}
});
} }
private class AttachmentDownloadClickListener implements SlideClickListener { private class AttachmentDownloadClickListener implements SlideClickListener {