Fix delete contact and bubble chat
This commit is contained in:
parent
d9cea544df
commit
3bf5905bc0
2 changed files with 26 additions and 24 deletions
|
@ -482,25 +482,27 @@ public class EditContactFragment extends Fragment {
|
|||
}
|
||||
|
||||
public void delete() {
|
||||
if (isSipAddress) {
|
||||
if(contact.hasFriends()) {
|
||||
ContactsManager.getInstance().removeFriend(oldNumberOrAddress);
|
||||
if(contact != null) {
|
||||
if (isSipAddress) {
|
||||
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 {
|
||||
Compatibility.deleteSipAddressFromContact(ops, oldNumberOrAddress, String.valueOf(contactID));
|
||||
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)
|
||||
.withSelection(select, args)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
if (getResources().getBoolean(R.bool.use_linphone_tag)) {
|
||||
Compatibility.deleteLinphoneContactTag(ops, oldNumberOrAddress, contactsManager.findRawLinphoneContactID(String.valueOf(contactID)));
|
||||
}
|
||||
} 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)
|
||||
.withSelection(select, args)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -174,15 +174,15 @@ public class BubbleChat {
|
|||
bm = BitmapFactory.decodeFile(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.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.setTag(appData);
|
||||
imageView.setOnClickListener(new OnClickListener() {
|
||||
|
|
Loading…
Reference in a new issue