Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Adds visible contact id in the contact properties #2774

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ Isa Cichon <isa4 at posteo.net>

Nathan van Beelen <nathan at vanbeelen.org>
* PR #1742: Add a media previewer

Ville Ranki <ville.ranki at iki.fi>
* Display contact id with contact info

2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Features:
-

Improvements:
-
- Display contact id with other contact info

Other changes:
-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public class VectorMemberDetailsActivity extends MXCActionBarActivity implements
private static final int ITEM_ACTION_START_VIDEO_CALL = 13;
private static final int ITEM_ACTION_MENTION = 14;
private static final int ITEM_ACTION_DEVICES = 15;

private static final int VECTOR_ROOM_MODERATOR_LEVEL = 50;
private static final int VECTOR_ROOM_ADMIN_LEVEL = 100;

Expand All @@ -131,6 +130,8 @@ public class VectorMemberDetailsActivity extends MXCActionBarActivity implements
ImageView mMemberAvatarBadgeImageView;
@BindView(R.id.member_details_name)
TextView mMemberNameTextView;
@BindView(R.id.member_details_id)
TextView mMemberIdTextView;
@BindView(R.id.member_details_presence)
TextView mPresenceTextView;

Expand Down Expand Up @@ -1223,23 +1224,6 @@ public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition
});


// when clicking on the username
// switch member name <-> member id
mMemberNameTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
User user = mSession.getDataHandler().getUser(mMemberId);

if (TextUtils.equals(mMemberNameTextView.getText(), mMemberId)) {
if ((null != user) && !TextUtils.isEmpty(user.displayname)) {
mMemberNameTextView.setText(user.displayname);
}
} else {
mMemberNameTextView.setText(mMemberId);
}
}
});

// long tap : copy to the clipboard
mMemberNameTextView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
Expand All @@ -1249,6 +1233,14 @@ public boolean onLongClick(View v) {
}
});

// copy id to the clipboard on click
mMemberIdTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SystemUtilsKt.copyToClipboard(VectorMemberDetailsActivity.this, mMemberIdTextView.getText());
}
});

mMemberAvatarImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -1478,9 +1470,11 @@ private void updateUi() {
if (null != mMemberNameTextView) {
if ((null != mRoomMember) && !TextUtils.isEmpty(mRoomMember.displayname)) {
mMemberNameTextView.setText(mRoomMember.displayname);
mMemberIdTextView.setText(mRoomMember.getUserId());
} else {
refreshUser();
mMemberNameTextView.setText(mUser.displayname);
mMemberIdTextView.setText(mUser.user_id);
}

// do not display the activity name in the action bar
Expand Down
29 changes: 28 additions & 1 deletion vector/src/main/res/layout/activity_member_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,39 @@
android:textColor="@android:color/white"
android:textSize="20sp" />

<!-- member id -->
<TextView
android:id="@+id/member_details_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/member_details_name"
android:layout_marginBottom="16dp"
android:gravity="center_horizontal"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?attr/vctr_default_text_light_color"
android:textSize="18sp" />
<!-- member id copy button -->
<TextView
android:id="@+id/member_details_id_copy"
android:text="@string/copy_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/member_details_name"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:paddingRight="10dp"
android:paddingEnd="10dp"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="20sp" />

<!-- the member presence -->
<TextView
android:id="@+id/member_details_presence"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/member_details_name"
android:layout_below="@id/member_details_id"
android:layout_marginBottom="16dp"
android:ellipsize="end"
android:gravity="center_horizontal"
Expand Down
1 change: 1 addition & 0 deletions vector/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<string name="leave">Leave</string>
<string name="send">Send</string>
<string name="copy">Copy</string>
<string name="copy_icon">⎘</string>
<string name="resend">Resend</string>
<string name="redact">Redact</string>
<string name="quote">Quote</string>
Expand Down