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,8 +482,9 @@ public class EditContactFragment extends Fragment {
}
public void delete() {
if(contact != null) {
if (isSipAddress) {
if(contact.hasFriends()) {
if (contact.hasFriends()) {
ContactsManager.getInstance().removeFriend(oldNumberOrAddress);
} else {
Compatibility.deleteSipAddressFromContact(ops, oldNumberOrAddress, String.valueOf(contactID));
@ -495,7 +496,7 @@ public class EditContactFragment extends Fragment {
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 };
String[] args = new String[]{String.valueOf(contactID), oldNumberOrAddress};
ops.add(ContentProviderOperation.newDelete(ContactsContract.Data.CONTENT_URI)
.withSelection(select, args)
@ -503,6 +504,7 @@ public class EditContactFragment extends Fragment {
);
}
}
}
private void addNewNumber() {
if (newNumberOrAddress == null || newNumberOrAddress.length() == 0) {

View file

@ -175,6 +175,7 @@ public class BubbleChat {
appData = "file://" + appData;
}
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) {
@ -182,7 +183,6 @@ public class BubbleChat {
bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false);
}
if (bm != null) {
imageView.setImageBitmap(bm);
imageView.setTag(appData);
imageView.setOnClickListener(new OnClickListener() {