Code improvement
This commit is contained in:
parent
4c394c9f1b
commit
79d0f17c09
4 changed files with 9 additions and 27 deletions
|
@ -119,7 +119,7 @@ class AsyncContactsLoader extends AsyncTask<Void, Void, AsyncContactsLoader.Asyn
|
||||||
// No refkey so it's a standalone contact
|
// No refkey so it's a standalone contact
|
||||||
contact = new LinphoneContact();
|
contact = new LinphoneContact();
|
||||||
contact.setFriend(friend);
|
contact.setFriend(friend);
|
||||||
contact.refresh();
|
contact.syncValuesFromFriend();
|
||||||
data.contacts.add(contact);
|
data.contacts.add(contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class ContactsAdapter extends SelectableAdapter<ContactViewHolder>
|
||||||
return mContacts.get(position);
|
return mContacts.get(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setmIsSearchMode(boolean set) {
|
public void setIsSearchMode(boolean set) {
|
||||||
mIsSearchMode = set;
|
mIsSearchMode = set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ public class ContactsFragment extends Fragment
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeContactsToggle();
|
changeContactsToggle();
|
||||||
mContactAdapter.setmIsSearchMode(true);
|
mContactAdapter.setIsSearchMode(true);
|
||||||
|
|
||||||
List<LinphoneContact> listContact;
|
List<LinphoneContact> listContact;
|
||||||
|
|
||||||
|
@ -239,7 +239,8 @@ public class ContactsFragment extends Fragment
|
||||||
mNoContact.setVisibility(View.GONE);
|
mNoContact.setVisibility(View.GONE);
|
||||||
mContactsList.setVisibility(View.VISIBLE);
|
mContactsList.setVisibility(View.VISIBLE);
|
||||||
boolean isEditionEnabled = false;
|
boolean isEditionEnabled = false;
|
||||||
if (mSearchView.getQuery().toString().equals("")) {
|
String query = mSearchView.getQuery().toString();
|
||||||
|
if (query.equals("")) {
|
||||||
if (mOnlyDisplayLinphoneContacts) {
|
if (mOnlyDisplayLinphoneContacts) {
|
||||||
listContact = ContactsManager.getInstance().getSIPContacts();
|
listContact = ContactsManager.getInstance().getSIPContacts();
|
||||||
} else {
|
} else {
|
||||||
|
@ -247,13 +248,9 @@ public class ContactsFragment extends Fragment
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mOnlyDisplayLinphoneContacts) {
|
if (mOnlyDisplayLinphoneContacts) {
|
||||||
listContact =
|
listContact = ContactsManager.getInstance().getSIPContacts(query);
|
||||||
ContactsManager.getInstance()
|
|
||||||
.getSIPContacts(mSearchView.getQuery().toString());
|
|
||||||
} else {
|
} else {
|
||||||
listContact =
|
listContact = ContactsManager.getInstance().getContacts(query);
|
||||||
ContactsManager.getInstance()
|
|
||||||
.getContacts(mSearchView.getQuery().toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -444,24 +444,9 @@ public class LinphoneContact extends AndroidContact
|
||||||
setPhotoUri(getContactPictureUri());
|
setPhotoUri(getContactPictureUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void syncValuesFromFriend() {
|
||||||
mAddresses = new ArrayList<>();
|
|
||||||
/*if (isAndroidContact()) {
|
|
||||||
Pair<String, String> names = getContactNames();
|
|
||||||
if (names != null) {
|
|
||||||
mFirstName = names.first;
|
|
||||||
mLastName = names.second;
|
|
||||||
}
|
|
||||||
|
|
||||||
mOrganization = getNativeContactOrganization();
|
|
||||||
getAndroidIds();
|
|
||||||
|
|
||||||
mHasSipAddress = false;
|
|
||||||
for (LinphoneNumberOrAddress noa : getAddressesAndNumbersForAndroidContact()) {
|
|
||||||
addNumberOrAddress(noa);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
if (isFriend()) {
|
if (isFriend()) {
|
||||||
|
mAddresses = new ArrayList<>();
|
||||||
mFullName = mFriend.getName();
|
mFullName = mFriend.getName();
|
||||||
mLastName = mFriend.getVcard().getFamilyName();
|
mLastName = mFriend.getVcard().getFamilyName();
|
||||||
mFirstName = mFriend.getVcard().getGivenName();
|
mFirstName = mFriend.getVcard().getGivenName();
|
||||||
|
|
Loading…
Reference in a new issue