Show Drawable if Location/File/Voice
This commit is contained in:
parent
8f0cd86090
commit
308f451959
|
@ -58,6 +58,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
||||||
convName.setText(conversation.getJid().toBareJid().toString());
|
convName.setText(conversation.getJid().toBareJid().toString());
|
||||||
}
|
}
|
||||||
TextView mLastMessage = (TextView) view.findViewById(R.id.conversation_lastmsg);
|
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 mTimestamp = (TextView) view.findViewById(R.id.conversation_lastupdate);
|
||||||
TextView mSenderName = (TextView) view.findViewById(R.id.sender_name);
|
TextView mSenderName = (TextView) view.findViewById(R.id.sender_name);
|
||||||
ImageView imagePreview = (ImageView) view.findViewById(R.id.conversation_lastimage);
|
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)) {
|
|| message.getTransferable().getStatus() != Transferable.STATUS_DELETED)) {
|
||||||
mSenderName.setVisibility(View.GONE);
|
mSenderName.setVisibility(View.GONE);
|
||||||
mLastMessage.setVisibility(View.GONE);
|
mLastMessage.setVisibility(View.GONE);
|
||||||
|
mLastMessageImage.setVisibility(View.GONE);
|
||||||
imagePreview.setVisibility(View.VISIBLE);
|
imagePreview.setVisibility(View.VISIBLE);
|
||||||
activity.loadBitmap(message, imagePreview);
|
activity.loadBitmap(message, imagePreview);
|
||||||
} else {
|
} else {
|
||||||
Pair<String,Boolean> preview = UIHelper.getMessagePreview(activity,message);
|
Pair<String,Boolean> preview = UIHelper.getMessagePreview(activity,message);
|
||||||
mLastMessage.setVisibility(View.VISIBLE);
|
mLastMessage.setVisibility(View.VISIBLE);
|
||||||
|
mLastMessageImage.setVisibility(View.VISIBLE);
|
||||||
imagePreview.setVisibility(View.GONE);
|
imagePreview.setVisibility(View.GONE);
|
||||||
mLastMessage.setText(preview.first);
|
mLastMessage.setText(preview.first);
|
||||||
if (preview.second) {
|
if (preview.second) {
|
||||||
|
@ -120,6 +123,15 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
||||||
mSenderName.setText(activity.getString(R.string.me)+':');
|
mSenderName.setText(activity.getString(R.string.me)+':');
|
||||||
} else {
|
} else {
|
||||||
mSenderName.setVisibility(View.GONE);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,11 +74,16 @@
|
||||||
<LinearLayout android:layout_width="match_parent"
|
<LinearLayout android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:orientation="vertical"
|
android:orientation="horizontal"
|
||||||
android:layout_toRightOf="@id/sender_name"
|
android:layout_toRightOf="@id/sender_name"
|
||||||
android:layout_alignWithParentIfMissing="true"
|
android:layout_alignWithParentIfMissing="true"
|
||||||
android:layout_toLeftOf="@+id/notification_status"
|
android:layout_toLeftOf="@+id/notification_status"
|
||||||
android:id="@+id/txt_img_wrapper">
|
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.support.text.emoji.widget.EmojiTextView
|
||||||
android:id="@+id/conversation_lastmsg"
|
android:id="@+id/conversation_lastmsg"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue