Finished IMDN view
This commit is contained in:
parent
fef81f3057
commit
c0359eabd8
4 changed files with 72 additions and 25 deletions
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
[sip]
|
[sip]
|
||||||
contact="Linphone Android" <sip:linphone.android@unknown-host>
|
contact="Linphone Android" <sip:linphone.android@unknown-host>
|
||||||
use_info=0
|
use_info=0
|
||||||
|
|
|
@ -40,6 +40,7 @@ ec_calibrator_cool_tones=1
|
||||||
max_calls=10
|
max_calls=10
|
||||||
history_max_size=100
|
history_max_size=100
|
||||||
enable_basic_to_client_group_chat_room_migration=0
|
enable_basic_to_client_group_chat_room_migration=0
|
||||||
|
enable_simple_group_chat_message_state=0
|
||||||
|
|
||||||
[app]
|
[app]
|
||||||
activation_code_length=4
|
activation_code_length=4
|
||||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
package org.linphone.chat;
|
package org.linphone.chat;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
import android.media.Image;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
@ -43,10 +44,11 @@ import org.linphone.core.Address;
|
||||||
import org.linphone.core.ChatMessage;
|
import org.linphone.core.ChatMessage;
|
||||||
import org.linphone.core.ChatRoom;
|
import org.linphone.core.ChatRoom;
|
||||||
import org.linphone.core.Core;
|
import org.linphone.core.Core;
|
||||||
|
import org.linphone.core.ParticipantImdnState;
|
||||||
|
|
||||||
public class ImdnFragment extends Fragment {
|
public class ImdnFragment extends Fragment {
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private LinearLayout mRead, mDelivered, mUndelivered;
|
private LinearLayout mRead, mReadHeader, mDelivered, mDeliveredHeader, mUndelivered, mUndeliveredHeader;
|
||||||
private ImageView mBackButton;
|
private ImageView mBackButton;
|
||||||
private ChatBubbleViewHolder mBubble;
|
private ChatBubbleViewHolder mBubble;
|
||||||
|
|
||||||
|
@ -59,7 +61,6 @@ public class ImdnFragment extends Fragment {
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
String roomUri;
|
|
||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
mRoomUri = getArguments().getString("SipUri");
|
mRoomUri = getArguments().getString("SipUri");
|
||||||
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
|
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
|
||||||
|
@ -92,6 +93,9 @@ public class ImdnFragment extends Fragment {
|
||||||
mRead = view.findViewById(R.id.read_layout);
|
mRead = view.findViewById(R.id.read_layout);
|
||||||
mDelivered = view.findViewById(R.id.delivered_layout);
|
mDelivered = view.findViewById(R.id.delivered_layout);
|
||||||
mUndelivered = view.findViewById(R.id.undelivered_layout);
|
mUndelivered = view.findViewById(R.id.undelivered_layout);
|
||||||
|
mReadHeader = view.findViewById(R.id.read_layout_header);
|
||||||
|
mDeliveredHeader = view.findViewById(R.id.delivered_layout_header);
|
||||||
|
mUndeliveredHeader = view.findViewById(R.id.undelivered_layout_header);
|
||||||
|
|
||||||
mBubble = new ChatBubbleViewHolder(view.findViewById(R.id.bubble));
|
mBubble = new ChatBubbleViewHolder(view.findViewById(R.id.bubble));
|
||||||
mBubble.eventLayout.setVisibility(View.GONE);
|
mBubble.eventLayout.setVisibility(View.GONE);
|
||||||
|
@ -153,26 +157,70 @@ public class ImdnFragment extends Fragment {
|
||||||
// We purposely chose not to display the image
|
// We purposely chose not to display the image
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: real values
|
ParticipantImdnState[] participants = message.getParticipantsThatHaveDisplayed();
|
||||||
|
mReadHeader.setVisibility(participants.length == 0 ? View.GONE : View.VISIBLE);
|
||||||
|
boolean first = true;
|
||||||
|
for (ParticipantImdnState participant : participants) {
|
||||||
|
Address address = participant.getParticipant().getAddress();
|
||||||
|
LinphoneContact participantContact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||||
|
String participantDisplayName = participantContact != null ? participantContact.getFullName() : LinphoneUtils.getAddressDisplayName(address);
|
||||||
|
|
||||||
View v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
View v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
||||||
v.findViewById(R.id.separator).setVisibility(View.GONE);
|
v.findViewById(R.id.separator).setVisibility(first ? View.GONE : View.VISIBLE);
|
||||||
((TextView)v.findViewById(R.id.time)).setText("Aujourd'hui - 17h58");
|
((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(LinphoneActivity.instance(), participant.getStateChangeTime(), R.string.messages_date_format));
|
||||||
((TextView)v.findViewById(R.id.name)).setText("Albert");
|
((TextView)v.findViewById(R.id.name)).setText(participantDisplayName);
|
||||||
|
if (participantContact.hasPhoto()) {
|
||||||
|
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), ((ImageView)v.findViewById(R.id.contact_picture)), participantContact.getThumbnailUri());
|
||||||
|
} else {
|
||||||
|
((ImageView)v.findViewById(R.id.contact_picture)).setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||||
|
}
|
||||||
|
|
||||||
mRead.addView(v);
|
mRead.addView(v);
|
||||||
v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
first = false;
|
||||||
((TextView)v.findViewById(R.id.time)).setText("Aujourd'hui - 17h52");
|
}
|
||||||
((TextView)v.findViewById(R.id.name)).setText("Charlotte");
|
|
||||||
mRead.addView(v);
|
participants = message.getParticipantsThatHaveReceived();
|
||||||
v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
mDeliveredHeader.setVisibility(participants.length == 0 ? View.GONE : View.VISIBLE);
|
||||||
v.findViewById(R.id.separator).setVisibility(View.GONE);
|
first = true;
|
||||||
((TextView)v.findViewById(R.id.time)).setText("Aujourd'hui - 17h36");
|
for (ParticipantImdnState participant : participants) {
|
||||||
((TextView)v.findViewById(R.id.name)).setText("Fabrice");
|
Address address = participant.getParticipant().getAddress();
|
||||||
|
LinphoneContact participantContact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||||
|
String participantDisplayName = participantContact != null ? participantContact.getFullName() : LinphoneUtils.getAddressDisplayName(address);
|
||||||
|
|
||||||
|
View v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
||||||
|
v.findViewById(R.id.separator).setVisibility(first ? View.GONE : View.VISIBLE);
|
||||||
|
((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(LinphoneActivity.instance(), participant.getStateChangeTime(), R.string.messages_date_format));
|
||||||
|
((TextView)v.findViewById(R.id.name)).setText(participantDisplayName);
|
||||||
|
if (participantContact.hasPhoto()) {
|
||||||
|
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), ((ImageView)v.findViewById(R.id.contact_picture)), participantContact.getThumbnailUri());
|
||||||
|
} else {
|
||||||
|
((ImageView)v.findViewById(R.id.contact_picture)).setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||||
|
}
|
||||||
|
|
||||||
mDelivered.addView(v);
|
mDelivered.addView(v);
|
||||||
v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
first = false;
|
||||||
v.findViewById(R.id.separator).setVisibility(View.GONE);
|
}
|
||||||
((TextView)v.findViewById(R.id.name)).setText("Heloïse");
|
|
||||||
|
participants = message.getParticipantsThatHaveNotReceived();
|
||||||
|
mUndeliveredHeader.setVisibility(participants.length == 0 ? View.GONE : View.VISIBLE);
|
||||||
|
first = true;
|
||||||
|
for (ParticipantImdnState participant : participants) {
|
||||||
|
Address address = participant.getParticipant().getAddress();
|
||||||
|
LinphoneContact participantContact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||||
|
String participantDisplayName = participantContact != null ? participantContact.getFullName() : LinphoneUtils.getAddressDisplayName(address);
|
||||||
|
|
||||||
|
View v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
||||||
|
v.findViewById(R.id.separator).setVisibility(first ? View.GONE : View.VISIBLE);
|
||||||
|
((TextView)v.findViewById(R.id.name)).setText(participantDisplayName);
|
||||||
|
if (participantContact.hasPhoto()) {
|
||||||
|
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), ((ImageView)v.findViewById(R.id.contact_picture)), participantContact.getThumbnailUri());
|
||||||
|
} else {
|
||||||
|
((ImageView)v.findViewById(R.id.contact_picture)).setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||||
|
}
|
||||||
|
|
||||||
mUndelivered.addView(v);
|
mUndelivered.addView(v);
|
||||||
// End of todo
|
first = false;
|
||||||
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f75c58bbef21318b8427fb7337c714b8badd7b88
|
Subproject commit c8ca90cbe263653cedddae01e2c5f5c1c9db8d39
|
Loading…
Reference in a new issue