rx-contacts
rx-contacts copied to clipboard
How to make a search request ?
Hi. I need to filter "phoneNumbers" array. The code can take only the first element, but other skips. How to change my code to get expected result ? Thank you
public void loadContacts(Context context, String phoneField) {
RxContacts
.fetch(context)
.filter(contact -> contact.inVisibleGroup == 1)
.filter(contact -> !contact.phoneNumbers.isEmpty())
.filter(contact -> contact.phoneNumbers.iterator().next().contains(phoneField) || contact.displayName.toLowerCase().contains(phoneField.toLowerCase()))
.toSortedList((lhs, rhs) -> lhs.displayName.compareToIgnoreCase(rhs.displayName))
.compose(RxUtils.async())
.compose(mRxLoaderManager.restart(CONTACTS_LOADER))
.subscribe(this::handleResponse, this::handleError, this::onCompleted);
}