Update all conversations screen
Update text, and filter the lower section to match the new header Test: atest Fixes: 151765526 Change-Id: I5bc052813745908df8602bf397434a76b294ba6c
This commit is contained in:
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
|
||||
public class AllConversationsPreferenceController extends ConversationListPreferenceController {
|
||||
|
||||
private static final String KEY = "all_conversations";
|
||||
private static final String KEY = "other_conversations";
|
||||
|
||||
private List<ConversationChannelWrapper> mConversations;
|
||||
|
||||
@@ -49,6 +49,11 @@ public class AllConversationsPreferenceController extends ConversationListPrefer
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean matchesFilter(ConversationChannelWrapper conversation) {
|
||||
return !conversation.getNotificationChannel().isImportantConversation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
PreferenceCategory pref = (PreferenceCategory) preference;
|
||||
@@ -66,7 +71,7 @@ public class AllConversationsPreferenceController extends ConversationListPrefer
|
||||
if (mContext == null) {
|
||||
return;
|
||||
}
|
||||
populateList(mConversations, pref, pref);
|
||||
populateList(mConversations, pref);
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
@@ -61,21 +61,25 @@ public abstract class ConversationListPreferenceController extends AbstractPrefe
|
||||
}
|
||||
|
||||
protected void populateList(List<ConversationChannelWrapper> conversations,
|
||||
PreferenceGroup outerContainer, PreferenceGroup innerContainer) {
|
||||
PreferenceGroup containerGroup) {
|
||||
// TODO: if preference has children, compare with newly loaded list
|
||||
if (conversations.isEmpty()) {
|
||||
outerContainer.setVisible(false);
|
||||
} else {
|
||||
outerContainer.setVisible(true);
|
||||
populateConversations(conversations, innerContainer);
|
||||
containerGroup.removeAll();
|
||||
if (conversations != null) {
|
||||
populateConversations(conversations, containerGroup);
|
||||
}
|
||||
|
||||
if (containerGroup.getPreferenceCount() == 0) {
|
||||
containerGroup.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
abstract boolean matchesFilter(ConversationChannelWrapper conversation);
|
||||
|
||||
protected void populateConversations(List<ConversationChannelWrapper> conversations,
|
||||
PreferenceGroup containerGroup) {
|
||||
containerGroup.removeAll();
|
||||
for (ConversationChannelWrapper conversation : conversations) {
|
||||
if (conversation.getNotificationChannel().isDemoted()) {
|
||||
if (conversation.getNotificationChannel().isDemoted()
|
||||
|| !matchesFilter(conversation)) {
|
||||
continue;
|
||||
}
|
||||
containerGroup.addPreference(createConversationPref(conversation));
|
||||
|
@@ -32,7 +32,6 @@ public class PriorityConversationsPreferenceController extends
|
||||
ConversationListPreferenceController {
|
||||
|
||||
private static final String KEY = "important_conversations";
|
||||
private static final String LIST_KEY = "important_conversations_list";
|
||||
private List<ConversationChannelWrapper> mConversations;
|
||||
|
||||
public PriorityConversationsPreferenceController(Context context,
|
||||
@@ -50,6 +49,11 @@ public class PriorityConversationsPreferenceController extends
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean matchesFilter(ConversationChannelWrapper conversation) {
|
||||
return conversation.getNotificationChannel().isImportantConversation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
PreferenceCategory pref = (PreferenceCategory) preference;
|
||||
@@ -67,7 +71,7 @@ public class PriorityConversationsPreferenceController extends
|
||||
if (mContext == null) {
|
||||
return;
|
||||
}
|
||||
populateList(mConversations, pref, pref.findPreference(LIST_KEY));
|
||||
populateList(mConversations, pref);
|
||||
}
|
||||
}.execute();
|
||||
|
||||
|
Reference in New Issue
Block a user