mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 13:49:53 +01:00
Merge branch '293-remove-avatar-from-conversation' into 'master'
Remove avatar code and layout from ConversationActivity and ConversationAdapter Please note that I have not been able to test this MR on an actual device as I have none at the moment :( Closes #293 See merge request !148
This commit is contained in:
@@ -1,51 +1,32 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/msgLayout"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:layout_marginLeft="@dimen/message_bubble_margin_tail"
|
||||||
|
android:layout_marginRight="@dimen/message_bubble_margin_non_tail"
|
||||||
|
android:background="@drawable/msg_in"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
<TextView
|
||||||
android:id="@+id/msgAvatar"
|
android:id="@+id/msgBody"
|
||||||
android:layout_width="@dimen/listitem_picture_size"
|
|
||||||
android:layout_height="@dimen/listitem_picture_size"
|
|
||||||
android:layout_marginLeft="@dimen/margin_medium"
|
|
||||||
android:layout_marginStart="@dimen/margin_medium"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:civ_border_color="@color/briar_text_primary"
|
|
||||||
app:civ_border_width="@dimen/avatar_border_width"
|
|
||||||
tools:src="@drawable/ic_launcher"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/msgLayout"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/msg_in"
|
android:textIsSelectable="true"
|
||||||
android:orientation="vertical"
|
android:textSize="@dimen/text_size_medium"
|
||||||
android:layout_marginLeft="@dimen/message_bubble_margin_tail"
|
tools:text="Short message"/>
|
||||||
android:layout_marginRight="@dimen/message_bubble_margin_non_tail">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/msgBody"
|
android:id="@+id/msgTime"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textIsSelectable="true"
|
android:layout_gravity="right|end"
|
||||||
android:textSize="@dimen/text_size_medium"
|
android:layout_marginTop="@dimen/message_bubble_timestamp_margin"
|
||||||
tools:text="Short message"/>
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/private_message_date"
|
||||||
|
android:textSize="@dimen/text_size_tiny"
|
||||||
|
tools:text="Dec 24, 13:37"/>
|
||||||
|
|
||||||
<TextView
|
</LinearLayout>
|
||||||
android:id="@+id/msgTime"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="right|end"
|
|
||||||
android:layout_marginTop="@dimen/message_bubble_timestamp_margin"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textColor="@color/private_message_date"
|
|
||||||
android:textSize="@dimen/text_size_tiny"
|
|
||||||
tools:text="Dec 24, 13:37"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ public class ConversationActivity extends BriarActivity
|
|||||||
toolbarStatus
|
toolbarStatus
|
||||||
.setContentDescription(getString(R.string.offline));
|
.setContentDescription(getString(R.string.offline));
|
||||||
}
|
}
|
||||||
adapter.setContactInformation(contactIdenticonKey, contactName);
|
adapter.setContactName(contactName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import org.briarproject.util.StringUtils;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import im.delight.android.identicons.IdenticonDrawable;
|
|
||||||
|
|
||||||
import static android.support.v7.util.SortedList.INVALID_POSITION;
|
import static android.support.v7.util.SortedList.INVALID_POSITION;
|
||||||
import static android.support.v7.widget.RecyclerView.ViewHolder;
|
import static android.support.v7.widget.RecyclerView.ViewHolder;
|
||||||
import static org.briarproject.android.contact.ConversationItem.INTRODUCTION_IN;
|
import static org.briarproject.android.contact.ConversationItem.INTRODUCTION_IN;
|
||||||
@@ -83,7 +81,6 @@ class ConversationAdapter extends RecyclerView.Adapter {
|
|||||||
});
|
});
|
||||||
private Context ctx;
|
private Context ctx;
|
||||||
private IntroductionHandler intro;
|
private IntroductionHandler intro;
|
||||||
private byte[] identiconKey;
|
|
||||||
private String contactName;
|
private String contactName;
|
||||||
|
|
||||||
public ConversationAdapter(Context context,
|
public ConversationAdapter(Context context,
|
||||||
@@ -92,8 +89,7 @@ class ConversationAdapter extends RecyclerView.Adapter {
|
|||||||
intro = introductionHandler;
|
intro = introductionHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContactInformation(byte[] identiconKey, String contactName) {
|
public void setContactName(String contactName) {
|
||||||
this.identiconKey = identiconKey;
|
|
||||||
this.contactName = contactName;
|
this.contactName = contactName;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
@@ -174,8 +170,6 @@ class ConversationAdapter extends RecyclerView.Adapter {
|
|||||||
ui.status.setImageResource(R.drawable.message_stored_white);
|
ui.status.setImageResource(R.drawable.message_stored_white);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (identiconKey != null)
|
|
||||||
ui.avatar.setImageDrawable(new IdenticonDrawable(identiconKey));
|
|
||||||
if (item.getType() == MSG_IN_UNREAD) {
|
if (item.getType() == MSG_IN_UNREAD) {
|
||||||
// TODO implement new unread message highlight according to #232
|
// TODO implement new unread message highlight according to #232
|
||||||
/* int left = ui.layout.getPaddingLeft();
|
/* int left = ui.layout.getPaddingLeft();
|
||||||
@@ -215,10 +209,6 @@ class ConversationAdapter extends RecyclerView.Adapter {
|
|||||||
ui.messageLayout.setVisibility(View.GONE);
|
ui.messageLayout.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
ui.messageLayout.setVisibility(View.VISIBLE);
|
ui.messageLayout.setVisibility(View.VISIBLE);
|
||||||
if (item.getType() == INTRODUCTION_IN && identiconKey != null) {
|
|
||||||
ui.message.avatar.setImageDrawable(
|
|
||||||
new IdenticonDrawable(identiconKey));
|
|
||||||
}
|
|
||||||
ui.message.body.setText(message);
|
ui.message.body.setText(message);
|
||||||
ui.message.date.setText(
|
ui.message.date.setText(
|
||||||
DateUtils.getRelativeTimeSpanString(ctx, item.getTime()));
|
DateUtils.getRelativeTimeSpanString(ctx, item.getTime()));
|
||||||
@@ -387,7 +377,6 @@ class ConversationAdapter extends RecyclerView.Adapter {
|
|||||||
public TextView body;
|
public TextView body;
|
||||||
public TextView date;
|
public TextView date;
|
||||||
public ImageView status;
|
public ImageView status;
|
||||||
public ImageView avatar;
|
|
||||||
|
|
||||||
public MessageHolder(View v, int type) {
|
public MessageHolder(View v, int type) {
|
||||||
super(v);
|
super(v);
|
||||||
@@ -399,8 +388,6 @@ class ConversationAdapter extends RecyclerView.Adapter {
|
|||||||
// outgoing message (local)
|
// outgoing message (local)
|
||||||
if (type == MSG_OUT) {
|
if (type == MSG_OUT) {
|
||||||
status = (ImageView) v.findViewById(R.id.msgStatus);
|
status = (ImageView) v.findViewById(R.id.msgStatus);
|
||||||
} else {
|
|
||||||
avatar = (ImageView) v.findViewById(R.id.msgAvatar);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user