Added option to show SIP URI in chat, if disabled (by default) will show upon clicking on name only
This commit is contained in:
parent
31480fb009
commit
be16c91ad4
19 changed files with 218 additions and 32 deletions
|
@ -105,7 +105,7 @@ public class ChatMessagesFragment extends Fragment
|
|||
private final Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
private ImageView mBackButton, mCallButton, mBackToCallButton, mGroupInfosButton;
|
||||
private ImageView mAttachImageButton, mSendMessageButton;
|
||||
private TextView mRoomLabel, mParticipantsLabel, mRemoteComposing;
|
||||
private TextView mRoomLabel, mParticipantsLabel, mSipUriLabel, mRemoteComposing;
|
||||
private RichEditText mMessageTextToSend;
|
||||
private LayoutInflater mInflater;
|
||||
private RecyclerView mChatEventsList;
|
||||
|
@ -252,6 +252,7 @@ public class ChatMessagesFragment extends Fragment
|
|||
|
||||
mRoomLabel = view.findViewById(R.id.subject);
|
||||
mParticipantsLabel = view.findViewById(R.id.participants);
|
||||
mSipUriLabel = view.findViewById(R.id.sipUri);
|
||||
|
||||
mFilesUploadLayout = view.findViewById(R.id.file_upload_layout);
|
||||
|
||||
|
@ -768,6 +769,22 @@ public class ChatMessagesFragment extends Fragment
|
|||
mGroupInfosButton.setVisibility(View.GONE);
|
||||
mParticipantsLabel.setVisibility(View.GONE);
|
||||
|
||||
if (mContext.getResources().getBoolean(R.bool.show_sip_uri_in_chat)) {
|
||||
mSipUriLabel.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mSipUriLabel.setVisibility(View.GONE);
|
||||
mRoomLabel.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mSipUriLabel.setVisibility(
|
||||
mSipUriLabel.getVisibility() == View.VISIBLE
|
||||
? View.GONE
|
||||
: View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (mParticipants.size() == 0) {
|
||||
// Contact not found
|
||||
String displayName = LinphoneUtils.getAddressDisplayName(mRemoteParticipantAddress);
|
||||
|
@ -775,11 +792,13 @@ public class ChatMessagesFragment extends Fragment
|
|||
} else {
|
||||
mRoomLabel.setText(mParticipants.get(0).getFullName());
|
||||
}
|
||||
mSipUriLabel.setText(mRemoteParticipantAddress.asStringUriOnly());
|
||||
} else {
|
||||
mCallButton.setVisibility(View.GONE);
|
||||
mGroupInfosButton.setVisibility(View.VISIBLE);
|
||||
mRoomLabel.setText(mChatRoom.getSubject());
|
||||
mParticipantsLabel.setVisibility(View.VISIBLE);
|
||||
mSipUriLabel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mBackToCallButton.setVisibility(View.GONE);
|
||||
|
|
|
@ -27,12 +27,13 @@ import org.linphone.R;
|
|||
|
||||
class DeviceGroupViewHolder {
|
||||
public final RelativeLayout avatarLayout;
|
||||
public final TextView participantName;
|
||||
public final TextView participantName, sipUri;
|
||||
public final ImageView groupExpander;
|
||||
|
||||
public DeviceGroupViewHolder(View v) {
|
||||
avatarLayout = v.findViewById(R.id.avatar_layout);
|
||||
participantName = v.findViewById(R.id.name);
|
||||
sipUri = v.findViewById(R.id.sipUri);
|
||||
groupExpander = v.findViewById(R.id.dropdown);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,6 +122,11 @@ class DevicesAdapter extends BaseExpandableListAdapter {
|
|||
holder.participantName.setText(displayName);
|
||||
}
|
||||
|
||||
holder.sipUri.setText(participantAddress.asStringUriOnly());
|
||||
if (!mContext.getResources().getBoolean(R.bool.show_sip_uri_in_chat)) {
|
||||
holder.sipUri.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
holder.groupExpander.setImageResource(
|
||||
isExpanded ? R.drawable.chevron_list_open : R.drawable.chevron_list_close);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.R;
|
||||
import org.linphone.contacts.ContactAddress;
|
||||
import org.linphone.contacts.LinphoneContact;
|
||||
|
@ -70,6 +71,22 @@ class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoViewHolder> {
|
|||
ContactAvatar.displayAvatar(holder.name.getText().toString(), holder.avatarLayout);
|
||||
}
|
||||
|
||||
holder.sipUri.setText(ca.getAddressAsDisplayableString());
|
||||
|
||||
if (!LinphoneActivity.instance().getResources().getBoolean(R.bool.show_sip_uri_in_chat)) {
|
||||
holder.sipUri.setVisibility(View.GONE);
|
||||
holder.name.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
holder.sipUri.setVisibility(
|
||||
holder.sipUri.getVisibility() == View.VISIBLE
|
||||
? View.GONE
|
||||
: View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
holder.delete.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import org.linphone.R;
|
||||
|
||||
public class GroupInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
public final TextView name;
|
||||
public final TextView name, sipUri;
|
||||
public final RelativeLayout avatarLayout;
|
||||
public final ImageView delete;
|
||||
public final LinearLayout isAdmin;
|
||||
|
@ -37,6 +37,7 @@ public class GroupInfoViewHolder extends RecyclerView.ViewHolder {
|
|||
public GroupInfoViewHolder(View view) {
|
||||
super(view);
|
||||
name = view.findViewById(R.id.name);
|
||||
sipUri = view.findViewById(R.id.sipUri);
|
||||
avatarLayout = view.findViewById(R.id.avatar_layout);
|
||||
delete = view.findViewById(R.id.delete);
|
||||
isAdmin = view.findViewById(R.id.isAdminLayout);
|
||||
|
|
|
@ -186,7 +186,8 @@ public class ImdnFragment extends Fragment {
|
|||
getActivity(),
|
||||
participant.getStateChangeTime(),
|
||||
R.string.messages_date_format));
|
||||
((TextView) v.findViewById(R.id.name)).setText(participantDisplayName);
|
||||
TextView name = v.findViewById(R.id.name);
|
||||
name.setText(participantDisplayName);
|
||||
if (participantContact != null) {
|
||||
ContactAvatar.displayAvatar(participantContact, v.findViewById(R.id.avatar_layout));
|
||||
} else {
|
||||
|
@ -194,6 +195,24 @@ public class ImdnFragment extends Fragment {
|
|||
participantDisplayName, v.findViewById(R.id.avatar_layout));
|
||||
}
|
||||
|
||||
final TextView sipUri = v.findViewById(R.id.sipUri);
|
||||
sipUri.setText(address.asStringUriOnly());
|
||||
if (!LinphoneActivity.instance()
|
||||
.getResources()
|
||||
.getBoolean(R.bool.show_sip_uri_in_chat)) {
|
||||
sipUri.setVisibility(View.GONE);
|
||||
name.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sipUri.setVisibility(
|
||||
sipUri.getVisibility() == View.VISIBLE
|
||||
? View.GONE
|
||||
: View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mRead.addView(v);
|
||||
first = false;
|
||||
}
|
||||
|
@ -219,7 +238,8 @@ public class ImdnFragment extends Fragment {
|
|||
getActivity(),
|
||||
participant.getStateChangeTime(),
|
||||
R.string.messages_date_format));
|
||||
((TextView) v.findViewById(R.id.name)).setText(participantDisplayName);
|
||||
TextView name = v.findViewById(R.id.name);
|
||||
name.setText(participantDisplayName);
|
||||
if (participantContact != null) {
|
||||
ContactAvatar.displayAvatar(participantContact, v.findViewById(R.id.avatar_layout));
|
||||
} else {
|
||||
|
@ -227,6 +247,24 @@ public class ImdnFragment extends Fragment {
|
|||
participantDisplayName, v.findViewById(R.id.avatar_layout));
|
||||
}
|
||||
|
||||
final TextView sipUri = v.findViewById(R.id.sipUri);
|
||||
sipUri.setText(address.asStringUriOnly());
|
||||
if (!LinphoneActivity.instance()
|
||||
.getResources()
|
||||
.getBoolean(R.bool.show_sip_uri_in_chat)) {
|
||||
sipUri.setVisibility(View.GONE);
|
||||
name.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sipUri.setVisibility(
|
||||
sipUri.getVisibility() == View.VISIBLE
|
||||
? View.GONE
|
||||
: View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mDelivered.addView(v);
|
||||
first = false;
|
||||
}
|
||||
|
@ -252,7 +290,8 @@ public class ImdnFragment extends Fragment {
|
|||
getActivity(),
|
||||
participant.getStateChangeTime(),
|
||||
R.string.messages_date_format));
|
||||
((TextView) v.findViewById(R.id.name)).setText(participantDisplayName);
|
||||
TextView name = v.findViewById(R.id.name);
|
||||
name.setText(participantDisplayName);
|
||||
if (participantContact != null) {
|
||||
ContactAvatar.displayAvatar(participantContact, v.findViewById(R.id.avatar_layout));
|
||||
} else {
|
||||
|
@ -260,6 +299,24 @@ public class ImdnFragment extends Fragment {
|
|||
participantDisplayName, v.findViewById(R.id.avatar_layout));
|
||||
}
|
||||
|
||||
final TextView sipUri = v.findViewById(R.id.sipUri);
|
||||
sipUri.setText(address.asStringUriOnly());
|
||||
if (!LinphoneActivity.instance()
|
||||
.getResources()
|
||||
.getBoolean(R.bool.show_sip_uri_in_chat)) {
|
||||
sipUri.setVisibility(View.GONE);
|
||||
name.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sipUri.setVisibility(
|
||||
sipUri.getVisibility() == View.VISIBLE
|
||||
? View.GONE
|
||||
: View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mSent.addView(v);
|
||||
first = false;
|
||||
}
|
||||
|
@ -279,7 +336,8 @@ public class ImdnFragment extends Fragment {
|
|||
|
||||
View v = mInflater.inflate(R.layout.chat_imdn_cell, mContainer, false);
|
||||
v.findViewById(R.id.separator).setVisibility(first ? View.GONE : View.VISIBLE);
|
||||
((TextView) v.findViewById(R.id.name)).setText(participantDisplayName);
|
||||
TextView name = v.findViewById(R.id.name);
|
||||
name.setText(participantDisplayName);
|
||||
if (participantContact != null) {
|
||||
ContactAvatar.displayAvatar(participantContact, v.findViewById(R.id.avatar_layout));
|
||||
} else {
|
||||
|
@ -287,6 +345,24 @@ public class ImdnFragment extends Fragment {
|
|||
participantDisplayName, v.findViewById(R.id.avatar_layout));
|
||||
}
|
||||
|
||||
final TextView sipUri = v.findViewById(R.id.sipUri);
|
||||
sipUri.setText(address.asStringUriOnly());
|
||||
if (!LinphoneActivity.instance()
|
||||
.getResources()
|
||||
.getBoolean(R.bool.show_sip_uri_in_chat)) {
|
||||
sipUri.setVisibility(View.GONE);
|
||||
name.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sipUri.setVisibility(
|
||||
sipUri.getVisibility() == View.VISIBLE
|
||||
? View.GONE
|
||||
: View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mUndelivered.addView(v);
|
||||
first = false;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
<Chronometer
|
||||
android:id="@+id/current_call_timer"
|
||||
style="@style/font2"
|
||||
style="@style/sip_uri_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
<Chronometer
|
||||
android:id="@+id/current_call_timer"
|
||||
style="@style/font2"
|
||||
style="@style/sip_uri_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/contact_number"
|
||||
style="@style/font2"
|
||||
style="@style/sip_uri_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/contact_name"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/contact_number"
|
||||
style="@style/font2"
|
||||
style="@style/sip_uri_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/contact_name"
|
||||
|
|
|
@ -51,6 +51,14 @@
|
|||
android:ellipsize="end"
|
||||
android:maxLines="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sipUri"
|
||||
style="@style/sip_uri_small_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/contact_name_list_cell_font"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
|
@ -33,9 +31,27 @@
|
|||
android:layout_marginRight="5dp"
|
||||
android:layout_toLeftOf="@+id/dropdown"
|
||||
android:layout_toRightOf="@id/avatar"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/contact_name_list_cell_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sipUri"
|
||||
style="@style/sip_uri_small_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@id/dropdown"
|
||||
|
|
|
@ -44,9 +44,7 @@
|
|||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/contact_name_list_cell_font"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
|
@ -54,9 +52,27 @@
|
|||
android:layout_marginRight="5dp"
|
||||
android:layout_toLeftOf="@id/time"
|
||||
android:layout_toRightOf="@id/avatar"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/contact_name_list_cell_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sipUri"
|
||||
style="@style/sip_uri_small_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -100,15 +100,31 @@
|
|||
android:layout_toLeftOf="@id/adminLayout"
|
||||
android:layout_toRightOf="@id/avatar">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/contact_name_list_cell_font"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/contact_name_list_cell_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sipUri"
|
||||
style="@style/sip_uri_small_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/contact_address"
|
||||
style="@style/font2"
|
||||
style="@style/sip_uri_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/contact_address"
|
||||
style="@style/font2"
|
||||
style="@style/sip_uri_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/main_account_address"
|
||||
style="@style/font3"
|
||||
style="@style/sip_uri_small_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
<bool name="send_multiple_images_as_different_messages">true</bool>
|
||||
<bool name="use_new_chat_bubbles_layout">true</bool>
|
||||
<bool name="use_big_pictures_to_preview_images_file_transfers">true</bool>
|
||||
<bool name="show_sip_uri_in_chat">false</bool>
|
||||
|
||||
<!-- Contacts -->
|
||||
<bool name="hide_contact_phone_numbers">false</bool>
|
||||
|
|
|
@ -89,11 +89,21 @@
|
|||
<item name="android:textSize">24sp</item>
|
||||
</style>
|
||||
|
||||
<style name="sip_uri_font" parent="@android:style/TextAppearance.Medium">
|
||||
<item name="android:textColor">?attr/accentColor</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
<style name="font2" parent="@android:style/TextAppearance.Medium">
|
||||
<item name="android:textColor">?attr/accentColor</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
<style name="sip_uri_small_font" parent="@android:style/TextAppearance.Medium">
|
||||
<item name="android:textColor">?attr/accentColor</item>
|
||||
<item name="android:textSize">13sp</item>
|
||||
</style>
|
||||
|
||||
<style name="font3" parent="@android:style/TextAppearance.Small">
|
||||
<item name="android:textColor">?attr/accentColor</item>
|
||||
<item name="android:textSize">13sp</item>
|
||||
|
|
Loading…
Reference in a new issue