Added new customization options regarding contacts & presence
This commit is contained in:
parent
83fcd779c1
commit
99ad1dc6b7
3 changed files with 22 additions and 9 deletions
|
@ -95,6 +95,8 @@
|
||||||
<bool name="allow_only_one_phone_number">false</bool>
|
<bool name="allow_only_one_phone_number">false</bool>
|
||||||
<bool name="allow_only_one_sip_address">false</bool>
|
<bool name="allow_only_one_sip_address">false</bool>
|
||||||
<bool name="display_contact_organization">true</bool>
|
<bool name="display_contact_organization">true</bool>
|
||||||
|
<bool name="hide_numbers_and_addresses_without_presence">false</bool>
|
||||||
|
<bool name="hide_non_linphone_contacts">false</bool>
|
||||||
|
|
||||||
<!-- Side Menu -->
|
<!-- Side Menu -->
|
||||||
<bool name="hide_assistant_from_side_menu">false</bool>
|
<bool name="hide_assistant_from_side_menu">false</bool>
|
||||||
|
|
|
@ -212,6 +212,10 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
||||||
PresenceModel pm = contact.getFriend().getPresenceModelForUriOrTel(noa.getValue());
|
PresenceModel pm = contact.getFriend().getPresenceModelForUriOrTel(noa.getValue());
|
||||||
if (pm != null && pm.getBasicStatus().equals(PresenceBasicStatus.Open)) {
|
if (pm != null && pm.getBasicStatus().equals(PresenceBasicStatus.Open)) {
|
||||||
v.findViewById(R.id.friendLinphone).setVisibility(View.VISIBLE);
|
v.findViewById(R.id.friendLinphone).setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
if (getResources().getBoolean(R.bool.hide_numbers_and_addresses_without_presence)) {
|
||||||
|
skip = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,9 +125,19 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
newContact.setEnabled(LinphoneManager.getLc().getCallsNb() == 0);
|
if (getResources().getBoolean(R.bool.hide_non_linphone_contacts)) {
|
||||||
|
allContacts.setEnabled(false);
|
||||||
|
linphoneContacts.setEnabled(false);
|
||||||
|
onlyDisplayLinphoneContacts = true;
|
||||||
|
allContacts.setOnClickListener(null);
|
||||||
|
linphoneContacts.setOnClickListener(null);
|
||||||
|
linphoneContacts.setVisibility(View.INVISIBLE);
|
||||||
|
linphoneContactsSelected.setVisibility(View.INVISIBLE);
|
||||||
|
} else {
|
||||||
allContacts.setEnabled(onlyDisplayLinphoneContacts);
|
allContacts.setEnabled(onlyDisplayLinphoneContacts);
|
||||||
linphoneContacts.setEnabled(!allContacts.isEnabled());
|
linphoneContacts.setEnabled(!allContacts.isEnabled());
|
||||||
|
}
|
||||||
|
newContact.setEnabled(LinphoneManager.getLc().getCallsNb() == 0);
|
||||||
|
|
||||||
if (!ContactsManager.getInstance().contactsFetchedOnce()) {
|
if (!ContactsManager.getInstance().contactsFetchedOnce()) {
|
||||||
contactsFetchInProgress.setVisibility(View.VISIBLE);
|
contactsFetchInProgress.setVisibility(View.VISIBLE);
|
||||||
|
@ -151,13 +161,10 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
||||||
searchField.addTextChangedListener(new TextWatcher() {
|
searchField.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
int after) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -265,7 +272,7 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeContactsToggle() {
|
private void changeContactsToggle() {
|
||||||
if (onlyDisplayLinphoneContacts) {
|
if (onlyDisplayLinphoneContacts && !getResources().getBoolean(R.bool.hide_non_linphone_contacts)) {
|
||||||
allContacts.setEnabled(true);
|
allContacts.setEnabled(true);
|
||||||
allContactsSelected.setVisibility(View.INVISIBLE);
|
allContactsSelected.setVisibility(View.INVISIBLE);
|
||||||
linphoneContacts.setEnabled(false);
|
linphoneContacts.setEnabled(false);
|
||||||
|
@ -328,7 +335,7 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
||||||
if (LinphoneActivity.isInstanciated()) {
|
if (LinphoneActivity.isInstanciated()) {
|
||||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACTS_LIST);
|
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACTS_LIST);
|
||||||
LinphoneActivity.instance().hideTabBar(false);
|
LinphoneActivity.instance().hideTabBar(false);
|
||||||
onlyDisplayLinphoneContacts = ContactsManager.getInstance().isLinphoneContactsPrefered();
|
onlyDisplayLinphoneContacts = ContactsManager.getInstance().isLinphoneContactsPrefered() || getResources().getBoolean(R.bool.hide_non_linphone_contacts);
|
||||||
}
|
}
|
||||||
changeContactsToggle();
|
changeContactsToggle();
|
||||||
invalidate();
|
invalidate();
|
||||||
|
@ -362,7 +369,7 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDeleteSelection(Object[] objectsToDelete) {
|
public void onDeleteSelection(Object[] objectsToDelete) {
|
||||||
ArrayList<String> ids = new ArrayList<String>();
|
ArrayList<String> ids = new ArrayList<>();
|
||||||
int size = mContactAdapter.getSelectedItemCount();
|
int size = mContactAdapter.getSelectedItemCount();
|
||||||
for (int i = size - 1; i >= 0; i--) {
|
for (int i = size - 1; i >= 0; i--) {
|
||||||
LinphoneContact contact = (LinphoneContact) objectsToDelete[i];
|
LinphoneContact contact = (LinphoneContact) objectsToDelete[i];
|
||||||
|
|
Loading…
Reference in a new issue