mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-08 20:28:33 +00:00
Always display labels in contact search.
This commit is contained in:
parent
3bbf0741ee
commit
04a000a8a8
@ -115,52 +115,73 @@ public class ContactsCursorLoader extends CursorLoader {
|
|||||||
private List<Cursor> getUnfilteredResults() {
|
private List<Cursor> getUnfilteredResults() {
|
||||||
ArrayList<Cursor> cursorList = new ArrayList<>();
|
ArrayList<Cursor> cursorList = new ArrayList<>();
|
||||||
|
|
||||||
if (recents) {
|
addRecentsSection(cursorList);
|
||||||
Cursor recentConversations = getRecentConversationsCursor();
|
addContactsSection(cursorList);
|
||||||
if (recentConversations.getCount() > 0) {
|
|
||||||
cursorList.add(getRecentsHeaderCursor());
|
|
||||||
cursorList.add(recentConversations);
|
|
||||||
cursorList.add(getContactsHeaderCursor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cursorList.addAll(getContactsCursors());
|
|
||||||
return cursorList;
|
return cursorList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Cursor> getFilteredResults() {
|
private List<Cursor> getFilteredResults() {
|
||||||
ArrayList<Cursor> cursorList = new ArrayList<>();
|
ArrayList<Cursor> cursorList = new ArrayList<>();
|
||||||
|
|
||||||
if (groupsEnabled(mode)) {
|
addContactsSection(cursorList);
|
||||||
Cursor groups = getGroupsCursor();
|
addGroupsSection(cursorList);
|
||||||
if (groups.getCount() > 0) {
|
addNewNumberSection(cursorList);
|
||||||
List<Cursor> contacts = getContactsCursors();
|
addUsernameSearchSection(cursorList);
|
||||||
if (!isCursorListEmpty(contacts)) {
|
|
||||||
cursorList.add(getContactsHeaderCursor());
|
return cursorList;
|
||||||
cursorList.addAll(contacts);
|
}
|
||||||
cursorList.add(getGroupsHeaderCursor());
|
|
||||||
}
|
private void addRecentsSection(@NonNull List<Cursor> cursorList) {
|
||||||
cursorList.add(groups);
|
if (!recents) {
|
||||||
} else {
|
return;
|
||||||
cursorList.addAll(getContactsCursors());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cursorList.addAll(getContactsCursors());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cursor recentConversations = getRecentConversationsCursor();
|
||||||
|
|
||||||
|
if (recentConversations.getCount() > 0) {
|
||||||
|
cursorList.add(getRecentsHeaderCursor());
|
||||||
|
cursorList.add(recentConversations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addContactsSection(@NonNull List<Cursor> cursorList) {
|
||||||
|
List<Cursor> contacts = getContactsCursors();
|
||||||
|
|
||||||
|
if (!isCursorListEmpty(contacts)) {
|
||||||
|
cursorList.add(getContactsHeaderCursor());
|
||||||
|
cursorList.addAll(getContactsCursors());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addGroupsSection(@NonNull List<Cursor> cursorList) {
|
||||||
|
if (!groupsEnabled(mode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Cursor groups = getGroupsCursor();
|
||||||
|
|
||||||
|
if (groups.getCount() > 0) {
|
||||||
|
cursorList.add(getGroupsHeaderCursor());
|
||||||
|
cursorList.add(getGroupsCursor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addNewNumberSection(@NonNull List<Cursor> cursorList) {
|
||||||
if (FeatureFlags.usernames() && NumberUtil.isVisuallyValidNumberOrEmail(filter)) {
|
if (FeatureFlags.usernames() && NumberUtil.isVisuallyValidNumberOrEmail(filter)) {
|
||||||
cursorList.add(getPhoneNumberSearchHeaderCursor());
|
cursorList.add(getPhoneNumberSearchHeaderCursor());
|
||||||
cursorList.add(getNewNumberCursor());
|
cursorList.add(getNewNumberCursor());
|
||||||
} else if (!FeatureFlags.usernames() && NumberUtil.isValidSmsOrEmail(filter)){
|
} else if (!FeatureFlags.usernames() && NumberUtil.isValidSmsOrEmail(filter)){
|
||||||
cursorList.add(getContactsHeaderCursor());
|
cursorList.add(getPhoneNumberSearchHeaderCursor());
|
||||||
cursorList.add(getNewNumberCursor());
|
cursorList.add(getNewNumberCursor());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addUsernameSearchSection(@NonNull List<Cursor> cursorList) {
|
||||||
if (FeatureFlags.usernames() && UsernameUtil.isValidUsernameForSearch(filter)) {
|
if (FeatureFlags.usernames() && UsernameUtil.isValidUsernameForSearch(filter)) {
|
||||||
cursorList.add(getUsernameSearchHeaderCursor());
|
cursorList.add(getUsernameSearchHeaderCursor());
|
||||||
cursorList.add(getUsernameSearchCursor());
|
cursorList.add(getUsernameSearchCursor());
|
||||||
}
|
}
|
||||||
|
|
||||||
return cursorList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Cursor getRecentsHeaderCursor() {
|
private Cursor getRecentsHeaderCursor() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user