Improve contact blocking UX via settings.

This commit is contained in:
Alex Hart
2020-11-09 10:26:21 -04:00
committed by Cody Henthorne
parent d6a230a235
commit e9c7b120a0
18 changed files with 755 additions and 223 deletions

View File

@@ -60,6 +60,7 @@ public class ContactsCursorLoader extends CursorLoader {
public static final int FLAG_ACTIVE_GROUPS = 1 << 2;
public static final int FLAG_INACTIVE_GROUPS = 1 << 3;
public static final int FLAG_SELF = 1 << 4;
public static final int FLAG_BLOCK = 1 << 5;
public static final int FLAG_ALL = FLAG_PUSH | FLAG_SMS | FLAG_ACTIVE_GROUPS | FLAG_INACTIVE_GROUPS | FLAG_SELF;
}
@@ -342,8 +343,13 @@ public class ContactsCursorLoader extends CursorLoader {
}
private String getUnknownContactTitle() {
return getContext().getString(newConversation(mode) ? R.string.contact_selection_list__unknown_contact
: R.string.contact_selection_list__unknown_contact_add_to_group);
if (blockUser(mode)) {
return getContext().getString(R.string.contact_selection_list__unknown_contact_block);
} else if (newConversation(mode)) {
return getContext().getString(R.string.contact_selection_list__unknown_contact);
} else {
return getContext().getString(R.string.contact_selection_list__unknown_contact_add_to_group);
}
}
private @NonNull Cursor filterNonPushContacts(@NonNull Cursor cursor) {
@@ -382,6 +388,10 @@ public class ContactsCursorLoader extends CursorLoader {
return flagSet(mode, DisplayMode.FLAG_SELF);
}
private static boolean blockUser(int mode) {
return flagSet(mode, DisplayMode.FLAG_BLOCK);
}
private static boolean newConversation(int mode) {
return groupsEnabled(mode);
}