Update obiane

This commit is contained in:
Erwan Croze 2018-07-11 09:12:15 +02:00
parent be5c222aee
commit ee392013c4
19 changed files with 242 additions and 116 deletions

View file

@ -18,3 +18,6 @@
-DENABLE_VPX=ON
-DENABLE_X264=OFF
-DENABLE_CODEC2=OFF
-DENABLE_QRCODE=ON
-DENABLE_LIME=OFF
-DENABLE_LIME_X3DH=ON

View file

@ -92,19 +92,20 @@
<ImageView
android:id="@+id/contact_picture"
android:src="@drawable/avatar"
android:contentDescription="@string/content_description_contact_picture"
android:layout_width="150dp"
android:layout_height="150dp"
android:adjustViewBounds="true"/>
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_contact_picture"
android:src="@drawable/avatar_big_secure1"/>
<ImageView
android:id="@+id/mask"
android:src="@drawable/avatar_mask_border"
android:contentDescription="@string/content_description_contact_picture"
android:layout_width="150dp"
android:layout_height="150dp"
android:adjustViewBounds="true"/>
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_contact_picture"
android:src="@drawable/avatar_mask_border"
android:visibility="gone"/>
</RelativeLayout>
@ -223,13 +224,13 @@
<ImageView
android:id="@+id/dialer"
android:src="@drawable/footer_dialer"
android:background="@color/colorC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/colorB"
android:contentDescription="@string/content_description_numpad"
android:padding="15dp"
android:contentDescription="@string/content_description_numpad"/>
android:src="@drawable/footer_dialer"/>
<ImageView
android:id="@+id/hang_up"
@ -246,17 +247,17 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/chat"
android:src="@drawable/footer_chat"
android:background="@color/colorC"
android:contentDescription="@string/content_description_chat_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@color/colorB"
android:contentDescription="@string/content_description_chat_button"
android:padding="15dp"
android:layout_centerInParent="true"/>
android:src="@drawable/footer_chat"/>
<TextView
android:id="@+id/missed_chats"
android:background="@drawable/history_chat_indicator"
@ -274,74 +275,70 @@
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="1"
android:background=" #595959 "
android:orientation="horizontal">
<RelativeLayout
android:background="@drawable/button_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
android:layout_weight="1"
>
<ImageView
android:id="@+id/video"
android:src="@drawable/camera_default"
android:background="@drawable/button_background"
android:padding="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/content_description_switch_video"/>
android:contentDescription="@string/content_description_switch_video"
android:padding="20dp"
android:src="@drawable/camera_default"/>
<ProgressBar
android:id="@+id/video_in_progress"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:visibility="gone"/>
</RelativeLayout>
<ImageView
android:id="@+id/micro"
android:src="@drawable/micro_default"
android:background="@drawable/button_background"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/content_description_toggle_micro"/>
android:contentDescription="@string/content_description_toggle_micro"
android:padding="10dp"
android:src="@drawable/micro_default"/>
<ImageView
android:id="@+id/speaker"
android:src="@drawable/speaker_default"
android:background="@drawable/button_background"
android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:contentDescription="@string/content_description_toggle_speaker"/>
android:contentDescription="@string/content_description_toggle_speaker"
android:padding="15dp"
android:src="@drawable/speaker_default"/>
<ImageView
android:id="@+id/audio_route"
android:src="@drawable/routes_default"
android:background="@drawable/button_background"
android:visibility="gone"
android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:contentDescription="@string/content_description_audio_route"/>
android:contentDescription="@string/content_description_audio_route"
android:padding="15dp"
android:src="@drawable/routes_default"
android:visibility="gone"/>
<ImageView
android:id="@+id/options"
android:src="@drawable/options_default"
android:background="@drawable/button_background"
android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/content_description_call_options"/>
android:contentDescription="@string/content_description_call_options"
android:padding="15dp"
android:src="@drawable/options_default"/>
</LinearLayout>

View file

@ -7,7 +7,9 @@
<ImageView
android:layout_width="400dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="22dp"
android:src="@drawable/linphone_logo"/>
<RelativeLayout
@ -86,7 +88,6 @@
android:layout_alignParentBottom="true"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_add_contact"
android:padding="15dp"
android:src="@drawable/contact_add_button"/>
</RelativeLayout>

View file

@ -9,8 +9,8 @@
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
android:layout_height="30dp"
tools:layout="@layout/status"/>
<android.support.v4.widget.DrawerLayout
android:id="@+id/side_menu"
@ -244,23 +244,21 @@
<ListView
android:id="@+id/accounts_list"
android:background="@color/colorB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:choiceMode="singleChoice"
android:background="@color/colorB"
android:cacheColorHint="@color/transparent"
android:divider="@android:color/transparent"
android:choiceMode="singleChoice"
android:dividerHeight="0dp"/>
<ListView
android:id="@+id/item_list"
android:background="@color/colorH"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorH"
android:choiceMode="singleChoice"
android:divider="@color/colorE"
android:listSelector="@color/colorH"
android:dividerHeight="1dp"/>
android:dividerHeight="1dp"
android:listSelector="@color/colorH"/>
</LinearLayout>
<RelativeLayout

View file

@ -1,18 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorH">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorH"
android:orientation="vertical" >
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/colorG"
android:background="@color/colorH"
android:orientation="horizontal">
<ImageView
@ -22,7 +23,6 @@
android:layout_weight="0.2"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_back"
android:padding="18dp"
android:src="@drawable/back"/>
<View
@ -38,7 +38,8 @@
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_delete"
android:padding="15dp"
android:src="@drawable/delete"/>
android:src="@drawable/delete"
android:visibility="invisible"/>
<ImageView
android:id="@+id/editContact"
@ -48,7 +49,8 @@
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_edit"
android:padding="15dp"
android:src="@drawable/edit"/>
android:src="@drawable/edit"
android:visibility="invisible"/>
</LinearLayout>
@ -59,9 +61,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:gravity="center"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="20dp">
<RelativeLayout
android:id="@+id/avatar_layout"
@ -71,45 +73,45 @@
<ImageView
android:id="@+id/contact_picture"
android:src="@drawable/avatar"
android:contentDescription="@string/content_description_contact_picture"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:layout_alignParentLeft="true"/>
android:contentDescription="@string/content_description_contact_picture"
android:src="@drawable/avatar"/>
<ImageView
android:id="@+id/mask"
android:src="@drawable/avatar_mask"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:layout_alignParentLeft="true"/>
android:src="@drawable/avatar_mask"/>
</RelativeLayout>
<TextView
android:id="@+id/contact_name"
style="@style/font5"
android:maxLines="1"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"/>
<TextView
android:id="@+id/contactOrganization"
style="@style/font9"
android:maxLines="1"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"/>
<TableLayout
android:id="@+id/controls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*"
android:paddingTop="10dp"/>
android:paddingTop="10dp"
android:stretchColumns="*"/>
</LinearLayout>
@ -117,6 +119,8 @@
</LinearLayout>
<include layout="@layout/wait_layout" android:id="@+id/waitScreen"/>
<include
android:id="@+id/waitScreen"
layout="@layout/wait_layout"/>
</RelativeLayout>

View file

@ -7,9 +7,9 @@
android:background="@color/colorH">
<LinearLayout
android:orientation="horizontal"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp"/>
android:layout_height="60dp"
android:background="@color/colorH"
android:orientation="horizontal"/>
</RelativeLayout>

View file

@ -24,30 +24,30 @@
<RelativeLayout
android:id="@+id/top_bar"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp"
android:visibility="gone"
android:layout_alignParentTop="true">
android:layout_alignParentTop="true"
android:background="@color/colorH"
android:visibility="gone">
<TextView
android:id="@+id/menu_name"
android:text="@string/settings"
style="@style/font1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center_vertical"/>
android:gravity="center_vertical"
android:text="@string/settings"/>
<ImageView
android:id="@+id/cancel"
android:src="@drawable/dialer_back"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="15dp"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"/>
android:contentDescription="@string/content_description_dialer_back"
android:padding="15dp"
android:src="@drawable/dialer_back"/>
</RelativeLayout>

View file

@ -47,7 +47,7 @@ debug=1
[app]
activation_code_length=4
prefer_basic_chat_room=1
prefer_basic_chat_room=0
show_login_view=1
debug_popup_magic=#1234
debug=1

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isTablet">true</bool>
</resources>

View file

@ -772,6 +772,8 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
accountCreator.setListener(this);
callGsmON = false;
//lc.enableLimeV2(true);
updateMissedChatCount();
}

View file

@ -55,6 +55,8 @@ import org.linphone.core.AccountCreator;
import org.linphone.core.Address;
import org.linphone.core.Call;
import org.linphone.core.Call.State;
import org.linphone.core.ChatRoom;
import org.linphone.core.ChatRoomSecurityLevel;
import org.linphone.core.Core;
import org.linphone.core.Factory;
import org.linphone.core.Friend;
@ -903,5 +905,13 @@ public final class LinphoneUtils {
}
return null;
}
public static ChatRoomSecurityLevel getSecurityLevelForSipUri(Core lc, String sipUri) {
ChatRoom cr = lc.getChatRoomFromUri(sipUri);
if (cr != null) return cr.getSecurityLevel();
return ChatRoomSecurityLevel.ClearText;
}
}

View file

@ -57,7 +57,11 @@ import android.widget.Toast;
import java.io.ByteArrayInputStream;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.spec.KeySpec;
import java.util.Arrays;
import java.util.Base64;
import javax.crypto.Cipher;
@ -353,34 +357,53 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
private boolean decryptQrcode() {
try {
byte[] unBased64Data = qrcodeString.getBytes();
/*byte[] unBased64Data = qrcodeString.getBytes();
ByteArrayInputStream inputStream = new ByteArrayInputStream(unBased64Data);
byte[] salt = new byte[16];
byte[] iv = new byte[256 / 8];
byte[] contentToDecrypt = new byte[unBased64Data.length - 48];
byte[] contentToDecrypt = new byte[unBased64Data.length];
inputStream.read(salt);
inputStream.read(iv);
inputStream.read(contentToDecrypt);
String saltString = new String(salt);
BigInteger saltHex = new BigInteger(saltString, 16);
String ivString = new String(iv);
BigInteger ivHex = new BigInteger(ivString, 16);
BigInteger saltHex = new BigInteger(, 16);
BigInteger ivHex = new BigInteger("F58B8C9A49B321DBA000000000000000", 16);
byte[] saltByte = removeUselessByte(saltHex.toByteArray(), 8);
byte[] ivByte = removeUselessByte(ivHex.toByteArray(), 16);
SecretKeyFactory factory = SecretKeyFactory.getInstance("AES/CBC/PKCS5Padding");
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEwithMD5AND128BITAES-CBC-OPENSSL");
KeySpec keySpec = new PBEKeySpec(code_sms.getText().toString().toCharArray(), saltByte, 10000, 128);
SecretKey tmpSecretKey = factory.generateSecret(keySpec);
SecretKeySpec secretKeySpec = new SecretKeySpec(tmpSecretKey.getEncoded(), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, new IvParameterSpec(ivByte));
remoteUrl = new String(cipher.doFinal(Base64.getDecoder().decode(contentToDecrypt)));
remoteUrl = new String(cipher.doFinal(Base64.getDecoder().decode(contentToDecrypt)));*/
final byte[] pass = code_sms.getText().toString().getBytes(StandardCharsets.US_ASCII);
final Base64.Decoder decoder = Base64.getDecoder();
final byte[] inBytes = decoder.decode(qrcodeString.getBytes());
final byte[] salt = "F000000000000000".getBytes(StandardCharsets.US_ASCII);
final byte[] passAndSalt = concat(pass, salt);
byte[] hash = new byte[0];
byte[] keyAndIv = new byte[0];
for (int i = 0; i < 3; i++) {
final byte[] data = concat(hash, passAndSalt);
final MessageDigest md = MessageDigest.getInstance("MD5");
hash = md.digest(data);
keyAndIv = concat(keyAndIv, hash);
}
final byte[] keyValue = Arrays.copyOfRange(keyAndIv, 0, 32);
final byte[] iv = Arrays.copyOfRange(keyAndIv, 32, 48);
final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
final SecretKeySpec key = new SecretKeySpec(keyValue, "AES");
cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv));
final byte[] clear = cipher.doFinal(inBytes, 16, inBytes.length - 16);
remoteUrl = new String(clear, StandardCharsets.ISO_8859_1);
} catch (Exception ex) {
Toast.makeText(RemoteProvisioningLoginActivity.this, "Code mauvais", Toast.LENGTH_LONG).show();
Log.e("RemoteProvisioningLoginActivity: Decrypt problem: " + ex);
@ -390,6 +413,13 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
return true;
}
private static byte[] concat(final byte[] a, final byte[] b) {
final byte[] c = new byte[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
return c;
}
private boolean storeAccount(String url) {
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
//TODO

View file

@ -41,6 +41,7 @@ import org.linphone.core.ChatMessage;
import org.linphone.core.ChatRoom;
import org.linphone.core.ChatRoomCapabilities;
import org.linphone.core.ChatRoomListenerStub;
import org.linphone.core.ChatRoomSecurityLevel;
import org.linphone.core.EventLog;
import org.linphone.ui.ListSelectionAdapter;
import org.linphone.ui.ListSelectionHelper;
@ -230,12 +231,28 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
}
if (chatRoom.limeAvailable()) {
holder.contactPicture.setImageResource(R.drawable.avatar_big_secure2);
if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Safe) {
holder.contactPicture.setImageResource(R.drawable.avatar_big_secure2);
} else if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Unsafe) {
holder.contactPicture.setImageResource(R.drawable.avatar_big_unsecure);
} else if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Encrypted) {
holder.contactPicture.setImageResource(R.drawable.avatar_big_secure1);
} else {
holder.contactPicture.setImageResource(R.drawable.avatar_medium_unregistered);
}
}
} else {
holder.displayName.setText(chatRoom.getSubject());
if (chatRoom.limeAvailable()) {
holder.contactPicture.setImageResource(R.drawable.avatar_group_small_secure2);
if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Safe) {
holder.contactPicture.setImageResource(R.drawable.avatar_group_small_secure2);
} else if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Unsafe) {
holder.contactPicture.setImageResource(R.drawable.avatar_group_small_unsecure);
} else if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Encrypted) {
holder.contactPicture.setImageResource(R.drawable.avatar_group_small_secure1);
} else {
holder.contactPicture.setImageResource(R.drawable.avatar_group_small_unregistered);
}
} else {
holder.contactPicture.setImageBitmap(mDefaultGroupBitmap);
}

View file

@ -27,17 +27,21 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.linphone.LinphoneManager;
import org.linphone.LinphoneUtils;
import org.linphone.R;
import org.linphone.activities.LinphoneActivity;
import org.linphone.contacts.ContactAddress;
import org.linphone.contacts.LinphoneContact;
import org.linphone.core.ChatRoom;
import org.linphone.core.ChatRoomSecurityLevel;
import org.linphone.core.Participant;
import java.util.ArrayList;
import java.util.List;
import static org.linphone.LinphoneUtils.getSecurityLevelForSipUri;
public class GroupInfoAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private List<ContactAddress> mItems;
@ -88,9 +92,20 @@ public class GroupInfoAdapter extends BaseAdapter {
name.setText((c.getFullName() != null) ? c.getFullName() :
(ca.getDisplayName() != null) ? ca.getDisplayName() : ca.getUsername());
if (c.hasPhoto()) {
/*if (c.hasPhoto()) {
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), avatar, c.getThumbnailUri());
}
}*/
//Spec Obiane
ChatRoomSecurityLevel securityLevel = getSecurityLevelForSipUri(LinphoneManager.getLc(), ca.getAddress().asStringUriOnly());
if (securityLevel == ChatRoomSecurityLevel.Safe) {
avatar.setImageResource(R.drawable.avatar_big_secure2);
} else if (securityLevel == ChatRoomSecurityLevel.Unsafe) {
avatar.setImageResource(R.drawable.avatar_big_unsecure);
} else if (securityLevel == ChatRoomSecurityLevel.Encrypted) {
avatar.setImageResource(R.drawable.avatar_big_secure1);
} else {
avatar.setImageResource(R.drawable.avatar_medium_unregistered);
}
delete.setOnClickListener(new View.OnClickListener() {
@Override
@ -115,6 +130,17 @@ public class GroupInfoAdapter extends BaseAdapter {
}
});
if (securityLevel == ChatRoomSecurityLevel.Safe) {
secure.setImageResource(R.drawable.security_ok);
} else if (securityLevel == ChatRoomSecurityLevel.Unsafe) {
secure.setImageResource(R.drawable.security_ko);
} else if (securityLevel == ChatRoomSecurityLevel.Encrypted) {
secure.setImageResource(R.drawable.security_pending);
} else {
secure.setOnClickListener(null);
secure.setVisibility(View.INVISIBLE);
}
isAdmin.setVisibility(ca.isAdmin() ? View.VISIBLE : View.GONE);
isNotAdmin.setVisibility(ca.isAdmin() ? View.GONE : View.VISIBLE);

View file

@ -44,10 +44,13 @@ import org.linphone.core.Address;
import org.linphone.core.ChatMessage;
import org.linphone.core.ChatMessageListenerStub;
import org.linphone.core.ChatRoom;
import org.linphone.core.ChatRoomSecurityLevel;
import org.linphone.core.Core;
import org.linphone.core.ParticipantImdnState;
import org.linphone.fragments.FragmentsAvailable;
import static org.linphone.LinphoneUtils.getSecurityLevelForSipUri;
public class ImdnFragment extends Fragment {
private LayoutInflater mInflater;
private LinearLayout mRead, mReadHeader, mDelivered, mDeliveredHeader, mSent, mSentHeader, mUndelivered, mUndeliveredHeader;
@ -157,6 +160,19 @@ public class ImdnFragment extends Fragment {
refreshInfo();
}
private void setPictureForContact(ImageView img, String sipUri) {
ChatRoomSecurityLevel securityLevel = getSecurityLevelForSipUri(LinphoneManager.getLc(), sipUri);
if (securityLevel == ChatRoomSecurityLevel.Safe) {
img.setImageResource(R.drawable.avatar_big_secure2);
} else if (securityLevel == ChatRoomSecurityLevel.Unsafe) {
img.setImageResource(R.drawable.avatar_big_unsecure);
} else if (securityLevel == ChatRoomSecurityLevel.Encrypted) {
img.setImageResource(R.drawable.avatar_big_secure1);
} else {
img.setImageResource(R.drawable.avatar_medium_unregistered);
}
}
private void refreshInfo() {
Address remoteSender = mMessage.getFromAddress();
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(remoteSender);
@ -212,11 +228,12 @@ public class ImdnFragment extends Fragment {
v.findViewById(R.id.separator).setVisibility(first ? View.GONE : View.VISIBLE);
((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(getActivity(), participant.getStateChangeTime(), R.string.messages_date_format));
((TextView)v.findViewById(R.id.name)).setText(participantDisplayName);
if (participantContact != null && participantContact.hasPhoto()) {
/*if (participantContact != null && participantContact.hasPhoto()) {
LinphoneUtils.setThumbnailPictureFromUri(getActivity(), ((ImageView)v.findViewById(R.id.contact_picture)), participantContact.getThumbnailUri());
} else {
((ImageView)v.findViewById(R.id.contact_picture)).setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
}
}*/
setPictureForContact(((ImageView)v.findViewById(R.id.contact_picture)), address.asStringUriOnly());
mRead.addView(v);
first = false;
@ -235,11 +252,12 @@ public class ImdnFragment extends Fragment {
v.findViewById(R.id.separator).setVisibility(first ? View.GONE : View.VISIBLE);
((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(getActivity(), participant.getStateChangeTime(), R.string.messages_date_format));
((TextView)v.findViewById(R.id.name)).setText(participantDisplayName);
if (participantContact != null && participantContact.hasPhoto()) {
/*if (participantContact != null && participantContact.hasPhoto()) {
LinphoneUtils.setThumbnailPictureFromUri(getActivity(), ((ImageView)v.findViewById(R.id.contact_picture)), participantContact.getThumbnailUri());
} else {
((ImageView)v.findViewById(R.id.contact_picture)).setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
}
}*/
setPictureForContact(((ImageView)v.findViewById(R.id.contact_picture)), address.asStringUriOnly());
mDelivered.addView(v);
first = false;
@ -258,11 +276,12 @@ public class ImdnFragment extends Fragment {
v.findViewById(R.id.separator).setVisibility(first ? View.GONE : View.VISIBLE);
((TextView)v.findViewById(R.id.time)).setText(LinphoneUtils.timestampToHumanDate(getActivity(), participant.getStateChangeTime(), R.string.messages_date_format));
((TextView)v.findViewById(R.id.name)).setText(participantDisplayName);
if (participantContact != null && participantContact.hasPhoto()) {
/*if (participantContact != null && participantContact.hasPhoto()) {
LinphoneUtils.setThumbnailPictureFromUri(getActivity(), ((ImageView)v.findViewById(R.id.contact_picture)), participantContact.getThumbnailUri());
} else {
((ImageView)v.findViewById(R.id.contact_picture)).setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
}
}*/
setPictureForContact(((ImageView)v.findViewById(R.id.contact_picture)), address.asStringUriOnly());
mSent.addView(v);
first = false;
@ -280,11 +299,12 @@ 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);
if (participantContact != null && participantContact.hasPhoto()) {
/*if (participantContact != null && participantContact.hasPhoto()) {
LinphoneUtils.setThumbnailPictureFromUri(getActivity(), ((ImageView)v.findViewById(R.id.contact_picture)), participantContact.getThumbnailUri());
} else {
((ImageView)v.findViewById(R.id.contact_picture)).setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
}
}*/
setPictureForContact(((ImageView)v.findViewById(R.id.contact_picture)), address.asStringUriOnly());
mUndelivered.addView(v);
first = false;

View file

@ -392,7 +392,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
}*/
// Obiane spec
if (LinphoneActivity.isInstanciated() && contact.getFriend() != null && contact.getFriend().getAddress() != null) {
LinphoneActivity.instance().displayHistoryDetail(contact.getFriend().getAddress().asStringUriOnly(), null);
LinphoneActivity.instance().displayContact(contact, false);
}
}

View file

@ -36,6 +36,7 @@ import org.linphone.core.Call;
import org.linphone.core.Address;
import org.linphone.core.CallLog;
import org.linphone.core.Call.Status;
import org.linphone.core.ChatRoomSecurityLevel;
import android.annotation.SuppressLint;
import android.app.Dialog;
@ -59,6 +60,8 @@ import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import static org.linphone.LinphoneUtils.getSecurityLevelForSipUri;
public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener {
private ListView historyList;
private LayoutInflater mInflater;
@ -480,11 +483,22 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(address);
String displayName = null;
final String sipUri = (address != null) ? address.asString() : "";
if (c != null) {
/*if (c != null) {
displayName = c.getFullName();
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.contactPicture, c.getThumbnailUri());
} else {
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
}*/
//Spec Obiane
ChatRoomSecurityLevel securityLevel = getSecurityLevelForSipUri(LinphoneManager.getLc(), sipUri);
if (securityLevel == ChatRoomSecurityLevel.Safe) {
holder.contactPicture.setImageResource(R.drawable.avatar_big_secure2);
} else if (securityLevel == ChatRoomSecurityLevel.Unsafe) {
holder.contactPicture.setImageResource(R.drawable.avatar_big_unsecure);
} else if (securityLevel == ChatRoomSecurityLevel.Encrypted) {
holder.contactPicture.setImageResource(R.drawable.avatar_big_secure1);
} else {
holder.contactPicture.setImageResource(R.drawable.avatar_medium_unregistered);
}
if (displayName == null) {

@ -1 +1 @@
Subproject commit 619bb91077cdbf3e2e3922588b80a1b053bc2809
Subproject commit 547a58b195ed92def2cc5be327529128fc6e537d

@ -1 +1 @@
Subproject commit db95e67bef9084b5ea7cd8ff53ff717299933223
Subproject commit d05ff1f27f0ce9fd9612c2adcb02c203f49d5230