Adding qrcode decrypt

This commit is contained in:
Erwan Croze 2018-07-18 11:30:55 +02:00
parent e64d480565
commit fd9bb71ceb
19 changed files with 168 additions and 146 deletions

View file

@ -55,6 +55,7 @@
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center_horizontal"
android:layout_below="@id/avatar_layout"
android:orientation="horizontal">
<TextView
@ -76,27 +77,26 @@
<RelativeLayout
android:id="@+id/avatar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/active_call_info"
android:layout_height="100dp"
android:layout_margin="5dp"
android:paddingTop="10dp"
android:gravity="center_horizontal">
android:gravity="center_horizontal"
android:paddingTop="10dp">
<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: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>
@ -125,26 +125,35 @@
</LinearLayout>
<ImageView
android:id="@+id/encryption"
android:layout_width="70dp"
android:layout_height="60dp"
android:layout_alignParentTop="true"
android:contentDescription="@string/content_description_encryption"
android:padding="5dp"
android:layout_below="@+id/pause"
android:src="@drawable/security_button1_over"
android:visibility="visible"/>
<ImageView
android:id="@+id/pause"
android:src="@drawable/pause_big_default"
android:layout_width="70dp"
android:layout_height="60dp"
android:layout_alignParentRight="true"
android:contentDescription="@string/content_description_pause"
android:layout_width="80dp"
android:layout_height="80dp"
android:padding="10dp"
android:layout_below="@+id/active_call_info"
android:layout_alignParentRight="true"/>
android:src="@drawable/pause_big_default"/>
<ImageView
android:id="@+id/switchCamera"
android:src="@drawable/switch_camera"
android:layout_width="80dp"
android:layout_height="80dp"
android:padding="10dp"
android:contentDescription="@string/content_description_switch_camera"
android:visibility="invisible"
android:layout_width="70dp"
android:layout_height="60dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/active_call_info"
android:layout_alignParentLeft="true"/>
android:contentDescription="@string/content_description_switch_camera"
android:padding="5dp"
android:src="@drawable/switch_camera"
android:visibility="invisible"/>
</RelativeLayout>
@ -187,15 +196,15 @@
<org.linphone.ui.Numpad
android:id="@+id/numpad"
android:background="@color/colorF"
android:contentDescription="@string/content_description_numpad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_margin="10dp"
android:layout_above="@id/menu"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:background="#282727"
android:contentDescription="@string/content_description_numpad"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/menu"
@ -206,56 +215,56 @@
<LinearLayout
android:id="@+id/main_bar"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="1"
android:background="@color/colorB"
android:orientation="horizontal">
<ImageView
android:id="@+id/dialer"
android:src="@drawable/footer_dialer"
android:background="@color/colorC"
android:contentDescription="@string/content_description_numpad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="15dp" />
android:background="@color/colorB"
android:contentDescription="@string/content_description_numpad"
android:padding="15dp"
android:src="@drawable/footer_dialer"/>
<ImageView
android:id="@+id/hang_up"
android:src="@drawable/call_hangup"
android:background="@drawable/hangup"
android:contentDescription="@string/content_description_hang_up"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:padding="12dp"/>
android:background="@drawable/hangup"
android:contentDescription="@string/content_description_hang_up"
android:padding="12dp"
android:src="@drawable/call_hangup"/>
<RelativeLayout
android:background="@drawable/footer_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
android:layout_weight="1"
android:background="@drawable/footer_button">
<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"
style="@style/font18"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_margin="15dp"
android:background="@drawable/history_chat_indicator"
android:gravity="center"
android:textColor="#000000"
android:visibility="gone"/>
</RelativeLayout>
</LinearLayout>
@ -265,6 +274,7 @@
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="1"
android:background=" #595959 "
android:orientation="horizontal">
<RelativeLayout
@ -274,64 +284,59 @@
<ImageView
android:id="@+id/video"
android:src="@drawable/camera_default"
android:background="@drawable/button_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/content_description_switch_video"
android:padding="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
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:contentDescription="@string/content_description_toggle_micro"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
android:layout_weight="1"
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:contentDescription="@string/content_description_toggle_speaker"
android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
android:layout_weight="1"
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:contentDescription="@string/content_description_audio_route"
android:visibility="gone"
android:padding="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
android:layout_weight="1"
android:contentDescription="@string/content_description_audio_route"
android:padding="20dp"
android:src="@drawable/routes_default"
android:visibility="gone"/>
<ImageView
android:id="@+id/options"
android:src="@drawable/options_default"
android:background="@drawable/button_background"
android:contentDescription="@string/content_description_call_options"
android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
android:layout_weight="1"
android:contentDescription="@string/content_description_call_options"
android:padding="15dp"
android:src="@drawable/options_default"/>
</LinearLayout>
@ -370,14 +375,14 @@
<ImageView
android:id="@+id/add_call"
android:src="@drawable/options_add_call"
android:layout_width="70dp"
android:layout_height="60dp"
android:layout_weight="1.4"
android:background="@drawable/button_background"
android:contentDescription="@string/content_description_add_call"
android:padding="15dp"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.4" />
android:padding="5dp"
android:src="@drawable/options_add_call"
android:visibility="invisible"/>
</LinearLayout>

View file

@ -322,6 +322,7 @@
android:layout_margin="15dp"
android:background="@drawable/history_chat_indicator"
android:gravity="center"
android:textColor="#000000"
android:visibility="gone"/>
</RelativeLayout>
</LinearLayout>
@ -458,16 +459,16 @@
<org.linphone.ui.Numpad
android:id="@+id/numpad"
android:background="@color/colorF"
android:contentDescription="@string/content_description_numpad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginTop="50dp"
android:layout_marginBottom="10dp"
android:layout_above="@id/menu"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
android:layout_centerVertical="true"
android:layout_marginBottom="10dp"
android:layout_marginTop="50dp"
android:background="#282727"
android:contentDescription="@string/content_description_numpad"
android:visibility="gone"/>
</RelativeLayout>

View file

@ -116,7 +116,7 @@
<LinearLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#595959"
android:orientation="vertical">
@ -139,7 +139,7 @@
<LinearLayout
android:id="@+id/message_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="50dp"
android:gravity="center_vertical"
android:orientation="horizontal">

View file

@ -23,7 +23,6 @@
android:layout_weight="0.2"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_back_call"
android:padding="15dp"
android:src="@drawable/call_back"
android:visibility="invisible"/>

View file

@ -134,8 +134,8 @@
<TextView
android:id="@+id/lastMessage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="18dp"
android:layout_marginStart="5dp"
android:ellipsize="end"

View file

@ -114,6 +114,7 @@
android:id="@+id/controls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:paddingTop="10dp"
android:stretchColumns="*"/>

View file

@ -32,4 +32,38 @@ nxAxhUXBHgNrWdaCf/lassYmIDCkk+yeUwZKBesmoHFBGJtLHT7AtyVVBWzZJ3yH
GaMnP7s9WuhmFEFVK1lrQ/VRDacfQUh8KfV3goRdLb69FA/lrNCn2+1aNVBOCeGQ
n1N2bAvaw595UOLcVhRyuVXnlSgX9gtYuxYz+3SUXIU4eORXb4xhIUEMK8PS2C2f
iYY5TczBWGgvDQuxUXZy
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIF6TCCA9GgAwIBAgIJANLYkr+mc5rUMA0GCSqGSIb3DQEBCwUAMIGKMQswCQYD
VQQGEwJGUjEOMAwGA1UECAwFUGFyaXMxDjAMBgNVBAcMBVBhcmlzMQ8wDQYDVQQK
DAZPcmFuZ2UxDzANBgNVBAsMBk9yYW5nZTEVMBMGA1UEAwwMbXNpb3JhbmdlX2Nh
MSIwIAYJKoZIhvcNAQkBFhNhZG1pbkBtc2lvcmFuZ2UuY29tMB4XDTE4MDcwMzE0
NDkwMFoXDTIwMDcwMjE0NDkwMFowgYoxCzAJBgNVBAYTAkZSMQ4wDAYDVQQIDAVQ
YXJpczEOMAwGA1UEBwwFUGFyaXMxDzANBgNVBAoMBk9yYW5nZTEPMA0GA1UECwwG
T3JhbmdlMRUwEwYDVQQDDAxtc2lvcmFuZ2VfY2ExIjAgBgkqhkiG9w0BCQEWE2Fk
bWluQG1zaW9yYW5nZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
AQCcI6+wShADEtpFR2eBgtbAo8ENH2/ptFy9HRMAEPtNlkQ12seN+563UTnvx2vf
+YSDyt754NaKWpsLgZUuxK1ykBEJQ7DDMYMAtxOCUsyox5SE8S26FJW1tubeDnv0
idtulPLKPdydZxBdgalzEUuJUKo7Th3z9ImZTzoB9WaumSt3QRg0P74K70PiOD+c
ozJMqFpspSUnFG/ova4REKMyi8L/hbIpDIiTbQNah9ZDJQbjy/gqIWxyW4MavWJW
SDv2UMw7c1/+WmjA7rapUZfknAxzuYpJFOlR2B3YpQYNU9aXQrYr1FJ15+WDD+EV
Ig32h1iNAbq0aHTEDHPkE3x4U3eiiF0WzwQV56Fe+zvEztpDS02ZD3ucEFBjr3Om
gE50t8R43RDaqcMM0wbt19IFLOWyb1wMPr8TtTkNU1dHpTKCcjXGiPmgXffsS9bC
3TFnV9JPUjGLvD87fG1iMKBHRSFKnS2btsvt5rchO2817WqsdcmZ+uD8956yWDAu
NzrlqS/JF+VJJq5l7xUrPqNqmPNOUEgwAX632wBlBy3oD4B3kK1MPhDhgot5adNt
Yp6LkIHDgOdWDQsq6IZar85E7JofQ6UrKqYd6wSMBKM+mFeguAAyikuch4Gl7dBn
jcuiqHDEStdBWnYu06W9zW9l2G1YZq11A0CaQQds8r9p8wIDAQABo1AwTjAdBgNV
HQ4EFgQU58EXB5qMd3swbax0hPskQB8CWoIwHwYDVR0jBBgwFoAU58EXB5qMd3sw
bax0hPskQB8CWoIwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXcr0
yahuUjJ2GLNO8wgnzuNFlhpC/0SYdtfr3RQHwg2RrNFuTEySbb/TUWcDbg/efG52
mYPFbGplV4QF0LN1ekPtMgsH3IYlQZYDEPpTZktGXizbzPKgTFnFlR3NJGNu61Oh
s78+a8R4HSZuvIeBwmUz1V8i0VxfheSWA6uK2+qsw5JTsAXZT2w6mqHvYlcr401k
H1vAdZdwaVB+qUUgFS8qcXLB+FTzps8QFyfuXbjI3nTIbvU4ugPEET+kZuaeXFsK
fhzd7BpJmhZVnDTX3Jpy6dd5Ng5GSSTih1A7j34UMAd9abKhYGfTDdGXp8NWA/Bq
tPHzHNOvwfHixYl52bLuKD10ocGUXN4XynGyqcFA2ihZnWB0fx+DAonQJ9EtCch5
hlQqKEMmNKWpp3+3t8YceNghbjZ/WYqmsWOyrR8Y+um1yweYQU/irO+tHAjwqcu9
dTNceINEdf2tPjy4jYDWQoNRxUF5E7FSlz0uZp05NuPEAn5FTLWMQfESTV9sXDQE
/C1W/KayMrBDtbRp3WZmZqcwCyvJTbpFVmgkGGniIyRmEm7wjxVKglh7BhkwUMW2
fH0KjsF0C+9tkmY7G1gRVd/gThgIZJukj4esAaDMCRhFf4/nek3WALYujXVYGXQ0
i5nC4AV21JrkVePvpJvA53W5ygfm6iEuDmJna8M=
-----END CERTIFICATE-----

View file

@ -1602,6 +1602,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
LinphonePreferences prefs = LinphonePreferences.instance();
if (state == ConfiguringState.Successful) {
if (lc.getFriendsLists() != null) lc.removeFriendList(lc.getFriendsLists()[0]);
if (prefs.isProvisioningLoginViewEnabled()) {
ProxyConfig proxyConfig = lc.createProxyConfig();
Address addr = proxyConfig.getIdentityAddress();

View file

@ -357,53 +357,28 @@ 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[] contentToDecrypt = new byte[unBased64Data.length];
inputStream.read(contentToDecrypt);
BigInteger saltHex = new BigInteger(, 16);
BigInteger saltHex = new BigInteger("F000000000000000", 16);
BigInteger ivHex = new BigInteger("F58B8C9A49B321DBA000000000000000", 16);
byte[] saltByte = removeUselessByte(saltHex.toByteArray(), 8);
byte[] ivByte = removeUselessByte(ivHex.toByteArray(), 16);
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEwithMD5AND128BITAES-CBC-OPENSSL");
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
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/NoPadding");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, new IvParameterSpec(ivByte));
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);
remoteUrl = new String(cipher.doFinal(Base64.getDecoder().decode(contentToDecrypt)));
} catch (Exception ex) {
Toast.makeText(RemoteProvisioningLoginActivity.this, "Code mauvais", Toast.LENGTH_LONG).show();
Log.e("RemoteProvisioningLoginActivity: Decrypt problem: " + ex);
@ -413,13 +388,6 @@ 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

@ -232,7 +232,7 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
}
}
if (chatRoom.limeAvailable()) {
if (LinphoneManager.getLc().limeV2Enabled()) {
if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Safe) {
holder.contactPicture.setImageResource(R.drawable.avatar_small_secure2);
} else if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Unsafe) {
@ -245,7 +245,7 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
}
} else {
holder.displayName.setText(chatRoom.getSubject());
if (chatRoom.limeAvailable()) {
if (LinphoneManager.getLc().limeV2Enabled()) {
if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Safe) {
holder.contactPicture.setImageResource(R.drawable.avatar_group_small_secure2);
} else if (chatRoom.getSecurityLevel() == ChatRoomSecurityLevel.Unsafe) {
@ -279,6 +279,7 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
public void onClick(View v) {
ChatRoomViewHolder holder = (ChatRoomViewHolder)v.getTag();
holder.delete.setChecked(!holder.delete.isChecked());
notifyDataSetInvalidated();
}
});
holder.unreadMessages.setVisibility(View.GONE);

View file

@ -204,10 +204,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
mSendMessageButton.setEnabled(mMessageTextToSend.getText().length() > 0 || mFilesUploadLayout.getChildCount() > 0);
if (mChatRoom != null && mMessageTextToSend.getText().length() > 0) {
mAttachImageButton.setEnabled(false);
mChatRoom.compose();
} else {
mAttachImageButton.setEnabled(true);
}
}
@ -645,8 +642,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
mFilesUploadLayout.addView(pendingFile);
mAttachImageButton.setEnabled(false); // For now limit file per message to 1
mMessageTextToSend.setEnabled(false); // For now forbid to send both text and picture at the same time
mSendMessageButton.setEnabled(true);
}
@ -679,8 +674,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
mFilesUploadLayout.addView(pendingImage);
mAttachImageButton.setEnabled(false); // For now limit file per message to 1
mMessageTextToSend.setEnabled(false); // For now forbid to send both text and picture at the same time
mSendMessageButton.setEnabled(true);
}

View file

@ -145,11 +145,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
@Override
public void onClick(View view) {
if (mIsAlreadyCreatedGroup) {
if (LinphoneActivity.instance().isTablet()) {
LinphoneActivity.instance().goToChat(mGroupChatRoomAddress.asStringUriOnly(), mShareInfos);
} else {
getFragmentManager().popBackStack();
}
LinphoneActivity.instance().goToChat(mGroupChatRoomAddress.asStringUriOnly(), mShareInfos);
} else {
LinphoneActivity.instance().goToChatCreator(null, mParticipants, null, true, mShareInfos);
}

View file

@ -86,7 +86,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
mChatRoom.addListener(mChatRoomCreationListener);
Address participants[] = new Address[1];
participants[0] = participant;
mChatRoom.addParticipant(participant);
mChatRoom.addParticipants(participants);
} else {
room = lc.getChatRoom(participant);
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly(), null);

View file

@ -45,6 +45,10 @@ import android.widget.ProgressBar;
import android.widget.SectionIndexer;
import android.widget.TextView;
import org.linphone.core.Address;
import org.linphone.core.ChatRoomSecurityLevel;
import org.linphone.core.FriendList;
import org.linphone.core.ProxyConfig;
import org.linphone.fragments.FragmentsAvailable;
import org.linphone.LinphoneManager;
import org.linphone.LinphoneUtils;
@ -57,6 +61,8 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import static org.linphone.LinphoneUtils.getSecurityLevelForSipUri;
public class ContactsListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener {
private LayoutInflater mInflater;
private ListView contactsList;
@ -86,6 +92,8 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
onlyDisplayChatAddress = getArguments().getBoolean("ChatAddressOnly");
}
FriendList test[] = LinphoneManager.getLc().getFriendsLists();
noSipContact = (TextView) view.findViewById(R.id.noSipContact);
noContact = (TextView) view.findViewById(R.id.noContact);
@ -634,6 +642,19 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
}
}*/
ProxyConfig prx = LinphoneManager.getLc().getDefaultProxyConfig();
Address ourUri = (prx != null) ? prx.getIdentityAddress() : null;
ChatRoomSecurityLevel securityLevel = getSecurityLevelForSipUri(LinphoneManager.getLc(), ourUri, contact.getFriend().getAddress());
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);
}
return view;
}

View file

@ -203,8 +203,9 @@ public class DialerFragment extends Fragment {
mCall.setImageResource(R.drawable.call_transfer);
mCall.setExternalClickListener(transferListener);
} else {
mCall.setImageResource(R.drawable.call_add);
mCall.resetClickListener();
mCall.setImageResource(R.drawable.call_alt_start_selected);
//mCall.setImageResource(R.drawable.call_add);
//mCall.resetClickListener();
}
mAddContact.setEnabled(true);
mAddContact.setImageResource(R.drawable.call_alt_back);

View file

@ -138,6 +138,7 @@ public class ListSelectionHelper {
mSelectAllButton.setVisibility(View.VISIBLE);
mDeselectAllButton.setVisibility(View.GONE);
}
mAdapter.notifyDataSetInvalidated();
}
private void quitEditionMode() {

@ -1 +1 @@
Subproject commit 0f999ecc3d304923b6338d3f48d44ac8ddfd9be8
Subproject commit 9d1379872a6fead9f43d745ae8364d27ce3cf750

@ -1 +1 @@
Subproject commit 456993eddd5f4724ff2b59487fb57aa5a85d782a
Subproject commit f58510c8ce6cd89dadff2b29574d03b05c6efcc9

@ -1 +1 @@
Subproject commit 1ec7aa506501f5f7605939e361a0f066bde3e1e9
Subproject commit bdf6f37b10a9d8a8fe040a28816ac8c9374bd601