Merge branch 'patch-1' of https://github.com/Kandr0s/Conversations into Kandr0s-patch-1

This commit is contained in:
Daniel Gultsch 2017-11-13 14:51:56 +01:00
commit 8e4df80619
2 changed files with 20 additions and 3 deletions

View file

@ -58,6 +58,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
convName.setText(conversation.getJid().toBareJid().toString());
}
TextView mLastMessage = (TextView) view.findViewById(R.id.conversation_lastmsg);
ImageView mLastMessageImage = (ImageView) view.findViewById(R.id.conversation_lastmsg_img);
TextView mTimestamp = (TextView) view.findViewById(R.id.conversation_lastupdate);
TextView mSenderName = (TextView) view.findViewById(R.id.sender_name);
ImageView imagePreview = (ImageView) view.findViewById(R.id.conversation_lastimage);
@ -84,11 +85,13 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|| message.getTransferable().getStatus() != Transferable.STATUS_DELETED)) {
mSenderName.setVisibility(View.GONE);
mLastMessage.setVisibility(View.GONE);
mLastMessageImage.setVisibility(View.GONE);
imagePreview.setVisibility(View.VISIBLE);
activity.loadBitmap(message, imagePreview);
} else {
Pair<String,Boolean> preview = UIHelper.getMessagePreview(activity,message);
mLastMessage.setVisibility(View.VISIBLE);
mLastMessageImage.setVisibility(View.VISIBLE);
imagePreview.setVisibility(View.GONE);
mLastMessage.setText(preview.first);
if (preview.second) {
@ -121,6 +124,15 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
} else {
mSenderName.setVisibility(View.GONE);
}
if (message.getFileParams().runtime > 0) {
mLastMessageImage.setImageResource(activity.getThemeResource(R.attr.ic_attach_record, R.drawable.ic_attach_record));
} else if (message.getType() == Message.TYPE_FILE) {
mLastMessageImage.setImageResource(activity.getThemeResource(R.attr.ic_attach_document, R.drawable.ic_attach_document));
} else if (message.isGeoUri()) {
mLastMessageImage.setImageResource(activity.getThemeResource(R.attr.ic_attach_location, R.drawable.ic_attach_location));
} else {
mLastMessageImage.setVisibility(View.GONE);
}
}
long muted_till = conversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL,0);
@ -230,4 +242,4 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
return bitmapWorkerTaskReference.get();
}
}
}
}

View file

@ -74,11 +74,16 @@
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical"
android:orientation="horizontal"
android:layout_toRightOf="@id/sender_name"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/notification_status"
android:id="@+id/txt_img_wrapper">
<ImageView
android:id="@+id/conversation_lastmsg_img"
android:layout_width="?attr/IconSize"
android:layout_height="?attr/IconSize" />
<android.support.text.emoji.widget.EmojiTextView
android:id="@+id/conversation_lastmsg"
android:layout_width="match_parent"
@ -139,4 +144,4 @@
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
</FrameLayout>
</FrameLayout>