Fix delete contact and bubble chat

This commit is contained in:
Margaux Clerc 2015-05-12 17:33:43 +02:00
parent d9cea544df
commit 3bf5905bc0
2 changed files with 26 additions and 24 deletions

View file

@ -482,25 +482,27 @@ public class EditContactFragment extends Fragment {
} }
public void delete() { public void delete() {
if (isSipAddress) { if(contact != null) {
if(contact.hasFriends()) { if (isSipAddress) {
ContactsManager.getInstance().removeFriend(oldNumberOrAddress); if (contact.hasFriends()) {
ContactsManager.getInstance().removeFriend(oldNumberOrAddress);
} else {
Compatibility.deleteSipAddressFromContact(ops, oldNumberOrAddress, String.valueOf(contactID));
}
if (getResources().getBoolean(R.bool.use_linphone_tag)) {
Compatibility.deleteLinphoneContactTag(ops, oldNumberOrAddress, contactsManager.findRawLinphoneContactID(String.valueOf(contactID)));
}
} else { } else {
Compatibility.deleteSipAddressFromContact(ops, oldNumberOrAddress, String.valueOf(contactID)); String select = ContactsContract.Data.CONTACT_ID + "=? AND "
} + ContactsContract.Data.MIMETYPE + "='" + ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE + "' AND "
if (getResources().getBoolean(R.bool.use_linphone_tag)) { + ContactsContract.CommonDataKinds.Phone.NUMBER + "=?";
Compatibility.deleteLinphoneContactTag(ops, oldNumberOrAddress, contactsManager.findRawLinphoneContactID(String.valueOf(contactID))); String[] args = new String[]{String.valueOf(contactID), oldNumberOrAddress};
}
} else {
String select = ContactsContract.Data.CONTACT_ID + "=? AND "
+ ContactsContract.Data.MIMETYPE + "='" + ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE + "' AND "
+ ContactsContract.CommonDataKinds.Phone.NUMBER + "=?";
String[] args = new String[] { String.valueOf(contactID), oldNumberOrAddress };
ops.add(ContentProviderOperation.newDelete(ContactsContract.Data.CONTENT_URI) ops.add(ContentProviderOperation.newDelete(ContactsContract.Data.CONTENT_URI)
.withSelection(select, args) .withSelection(select, args)
.build() .build()
); );
}
} }
} }

View file

@ -175,14 +175,14 @@ public class BubbleChat {
appData = "file://" + appData; appData = "file://" + appData;
} }
if (bm.getWidth() > bm.getHeight() && bm.getWidth() > SIZE_MAX) {
bm = Bitmap.createScaledBitmap(bm, SIZE_MAX, (SIZE_MAX * bm.getHeight()) / bm.getWidth(), false);
} else if (bm.getHeight() > bm.getWidth() && bm.getHeight() > SIZE_MAX) {
bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false);
}
if (bm != null) { if (bm != null) {
if (bm.getWidth() > bm.getHeight() && bm.getWidth() > SIZE_MAX) {
bm = Bitmap.createScaledBitmap(bm, SIZE_MAX, (SIZE_MAX * bm.getHeight()) / bm.getWidth(), false);
} else if (bm.getHeight() > bm.getWidth() && bm.getHeight() > SIZE_MAX) {
bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false);
}
imageView.setImageBitmap(bm); imageView.setImageBitmap(bm);
imageView.setTag(appData); imageView.setTag(appData);
imageView.setOnClickListener(new OnClickListener() { imageView.setOnClickListener(new OnClickListener() {