Merge "Improve entrance animations on convo page" into sc-dev am: a5b242ec3d

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14702666

Change-Id: Ie1a1df7b7e1d7b3a62d07754256f63424b1a495c
diff --git a/res/xml/conversation_list_settings.xml b/res/xml/conversation_list_settings.xml
index 040a968..f61d201 100644
--- a/res/xml/conversation_list_settings.xml
+++ b/res/xml/conversation_list_settings.xml
@@ -29,7 +29,7 @@
     <PreferenceCategory
         android:key="important_conversations"
         android:title="@string/important_conversations"
-        android:visibility="gone"
+        settings:isPreferenceVisible="false"
         settings:allowDividerAbove="false"
         settings:allowDividerBelow="true" >
         <Preference
@@ -48,6 +48,7 @@
     <PreferenceCategory
         android:title="@string/other_conversations"
         android:key="other_conversations"
+        settings:isPreferenceVisible="false"
         settings:allowDividerAbove="true"
         settings:allowDividerBelow="false" />
 
@@ -55,6 +56,7 @@
     <PreferenceCategory
         android:title="@string/recent_conversations"
         android:key="recent_conversations"
+        settings:isPreferenceVisible="false"
         settings:allowDividerAbove="true"
         settings:allowDividerBelow="false" />
 
diff --git a/src/com/android/settings/notification/app/AllConversationsPreferenceController.java b/src/com/android/settings/notification/app/AllConversationsPreferenceController.java
index 03e321b..f61e167 100644
--- a/src/com/android/settings/notification/app/AllConversationsPreferenceController.java
+++ b/src/com/android/settings/notification/app/AllConversationsPreferenceController.java
@@ -68,21 +68,10 @@
     public void updateState(Preference preference) {
         PreferenceCategory pref = (PreferenceCategory) preference;
         // Load conversations
-        new AsyncTask<Void, Void, Void>() {
-            @Override
-            protected Void doInBackground(Void... unused) {
-                mConversations = mBackend.getConversations(false).getList();
-                Collections.sort(mConversations, mConversationComparator);
-                return null;
-            }
 
-            @Override
-            protected void onPostExecute(Void unused) {
-                if (mContext == null) {
-                    return;
-                }
-                populateList(mConversations, pref);
-            }
-        }.execute();
+        mConversations = mBackend.getConversations(false).getList();
+        Collections.sort(mConversations, mConversationComparator);
+
+        populateList(mConversations, pref);
     }
 }
diff --git a/src/com/android/settings/notification/app/ConversationListPreferenceController.java b/src/com/android/settings/notification/app/ConversationListPreferenceController.java
index 948a361..0c4f227 100644
--- a/src/com/android/settings/notification/app/ConversationListPreferenceController.java
+++ b/src/com/android/settings/notification/app/ConversationListPreferenceController.java
@@ -63,7 +63,7 @@
 
     protected void populateList(List<ConversationChannelWrapper> conversations,
             PreferenceGroup containerGroup) {
-        // TODO: if preference has children, compare with newly loaded list
+        containerGroup.setVisible(false);
         containerGroup.removeAll();
         if (conversations != null) {
             populateConversations(conversations, containerGroup);
@@ -72,11 +72,11 @@
         if (containerGroup.getPreferenceCount() == 0) {
             containerGroup.setVisible(false);
         } else {
-            containerGroup.setVisible(true);
             Preference summaryPref = getSummaryPreference();
             if (summaryPref != null) {
                 containerGroup.addPreference(summaryPref);
             }
+            containerGroup.setVisible(true);
         }
     }
 
diff --git a/src/com/android/settings/notification/app/PriorityConversationsPreferenceController.java b/src/com/android/settings/notification/app/PriorityConversationsPreferenceController.java
index 5533912..3888a0a 100644
--- a/src/com/android/settings/notification/app/PriorityConversationsPreferenceController.java
+++ b/src/com/android/settings/notification/app/PriorityConversationsPreferenceController.java
@@ -67,22 +67,9 @@
     public void updateState(Preference preference) {
         PreferenceCategory pref = (PreferenceCategory) preference;
         // Load conversations
-        new AsyncTask<Void, Void, Void>() {
-            @Override
-            protected Void doInBackground(Void... unused) {
-                mConversations = mBackend.getConversations(true).getList();
-                Collections.sort(mConversations, mConversationComparator);
-                return null;
-            }
+        mConversations = mBackend.getConversations(true).getList();
+        Collections.sort(mConversations, mConversationComparator);
 
-            @Override
-            protected void onPostExecute(Void unused) {
-                if (mContext == null) {
-                    return;
-                }
-                populateList(mConversations, pref);
-            }
-        }.execute();
-
+        populateList(mConversations, pref);
     }
 }
diff --git a/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java b/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java
index 8bb64e2..5b2cdb9 100644
--- a/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java
+++ b/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java
@@ -104,26 +104,14 @@
     public void updateState(Preference preference) {
         PreferenceCategory pref = (PreferenceCategory) preference;
         // Load conversations
-        new AsyncTask<Void, Void, Void>() {
-            @Override
-            protected Void doInBackground(Void... unused) {
-                try {
-                    mConversations = mPs.getRecentConversations().getList();
-                } catch (RemoteException e) {
-                    Slog.w(TAG, "Could get recents", e);
-                }
-                Collections.sort(mConversations, mConversationComparator);
-                return null;
-            }
+        try {
+            mConversations = mPs.getRecentConversations().getList();
+        } catch (RemoteException e) {
+            Slog.w(TAG, "Could get recents", e);
+        }
+        Collections.sort(mConversations, mConversationComparator);
 
-            @Override
-            protected void onPostExecute(Void unused) {
-                if (mContext == null) {
-                    return;
-                }
-                populateList(mConversations, pref);
-            }
-        }.execute();
+        populateList(mConversations, pref);
 
     }