In this page, 3 conversation lists are implemented by the ConversationListPreferenceController, these lists updates its contents in updateState(), which is after the preference screen view created. So when the first time this page is showed, animations of added contents will be shown. The improvement is when the first time, update the list in the onCreate(), which is called before view creation, instead of the updateState(). And also do the same thing for RecentConversationsPreferenceController. Also, to reduce latency, 1. Because currently there are duplicated calls in NoConversationsPreferenceController to check whether conversations are exists or not, by removing the duplicated calls and reuse the result from other controllers, the latency could be reduced. 2. Currently, there are seperated api calls, the mBackend.getConversations(false) in AllConversationsPreferenceController and the mBackend.getConversations(true) in PriorityConversationsPreferenceController, use one mBackend.getConversations(false) in ConversationListSettings to improve, this does not change the behavior because the result is filtered in matchesFilter() both before and after. 3. Currently, we sort conversations first then filter them, change to filter first then sort to reduce latency. Fix: 215073227 Test: visual check & robo tests Change-Id: I028a7fabbbf64cf5627e6615372282a36eb784e5
54 lines
1.7 KiB
Java
54 lines
1.7 KiB
Java
/*
|
|
* Copyright (C) 2020 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.android.settings.notification.app;
|
|
|
|
import android.content.Context;
|
|
import android.service.notification.ConversationChannelWrapper;
|
|
|
|
import androidx.preference.Preference;
|
|
|
|
import com.android.settings.R;
|
|
import com.android.settings.notification.NotificationBackend;
|
|
|
|
public class AllConversationsPreferenceController extends ConversationListPreferenceController {
|
|
|
|
private static final String KEY = "other_conversations";
|
|
|
|
public AllConversationsPreferenceController(Context context, NotificationBackend backend) {
|
|
super(context, backend);
|
|
}
|
|
|
|
@Override
|
|
public String getPreferenceKey() {
|
|
return KEY;
|
|
}
|
|
|
|
@Override
|
|
Preference getSummaryPreference() {
|
|
Preference pref = new Preference(mContext);
|
|
pref.setOrder(1);
|
|
pref.setSummary(R.string.other_conversations_summary);
|
|
pref.setSelectable(false);
|
|
return pref;
|
|
}
|
|
|
|
@Override
|
|
boolean matchesFilter(ConversationChannelWrapper conversation) {
|
|
return !conversation.getNotificationChannel().isImportantConversation();
|
|
}
|
|
}
|