diff --git a/res/drawable/ic_promote_conversation.xml b/res/drawable/ic_promote_conversation.xml index 39f7658b700..170f2baaaac 100644 --- a/res/drawable/ic_promote_conversation.xml +++ b/res/drawable/ic_promote_conversation.xml @@ -21,5 +21,5 @@ android:tint="?android:attr/colorControlNormal"> + android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM20,16L4,16L4,4h16v12zM6,12h8v2L6,14zM6,9h12v2L6,11zM6,6h12v2L6,8z"/> diff --git a/res/layout/conversation_onboarding.xml b/res/layout/conversation_onboarding.xml new file mode 100644 index 00000000000..bc180947831 --- /dev/null +++ b/res/layout/conversation_onboarding.xml @@ -0,0 +1,43 @@ + + + + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 1984b92b1db..cc9d7513749 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -8383,14 +8383,31 @@ Priority conversations + + Show at top of conversation section and appear as floating bubbles + + + Show at top of conversation section + - Other conversations + Modified conversations + + + Conversations you\u2019ve made changes to - Bubble important conversations + Bubble priority conversations - Important conversations show at the top of the pull-down shade. You can also set them to bubble and interrupt Do Not Disturb. + Priority conversations show at the top of the pull-down shade. You can also set them to bubble and interrupt Do Not Disturb. + + + Priority and modified conversations will appear here + + + Once you mark a conversation as priority, or make any other changes to conversations, they will appear here. + \n\nTo change conversation settings: + \nSwipe down from the top of the screen to open the pull-down shade, then touch & hold a conversation. diff --git a/res/xml/conversation_list_settings.xml b/res/xml/conversation_list_settings.xml index e18b4e57a42..d528bd7ac15 100644 --- a/res/xml/conversation_list_settings.xml +++ b/res/xml/conversation_list_settings.xml @@ -20,6 +20,12 @@ android:key="conversation_list" android:title="@string/zen_mode_conversations_title"> + + createPreferenceControllers(Context context) { mControllers = new ArrayList<>(); + mControllers.add(new NoConversationsPreferenceController(context, mBackend)); mControllers.add(new PriorityConversationsPreferenceController(context, mBackend)); mControllers.add(new AllConversationsPreferenceController(context, mBackend)); return new ArrayList<>(mControllers); diff --git a/src/com/android/settings/notification/app/NoConversationsPreferenceController.java b/src/com/android/settings/notification/app/NoConversationsPreferenceController.java new file mode 100644 index 00000000000..c5f0cb2c3dd --- /dev/null +++ b/src/com/android/settings/notification/app/NoConversationsPreferenceController.java @@ -0,0 +1,76 @@ +/* + * 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.os.AsyncTask; +import android.service.notification.ConversationChannelWrapper; + +import androidx.preference.Preference; +import androidx.preference.PreferenceCategory; + +import com.android.settings.notification.NotificationBackend; + +import java.util.Collections; +import java.util.List; + +public class NoConversationsPreferenceController extends ConversationListPreferenceController { + + private static final String KEY = "no_conversations"; + + private List mConversations; + + public NoConversationsPreferenceController(Context context, + NotificationBackend backend) { + super(context, backend); + } + + @Override + public String getPreferenceKey() { + return KEY; + } + + @Override + public boolean isAvailable() { + return true; + } + + @Override + boolean matchesFilter(ConversationChannelWrapper conversation) { + return false; + } + + @Override + public void updateState(Preference preference) { + // Load conversations + new AsyncTask() { + @Override + protected Void doInBackground(Void... unused) { + mConversations = mBackend.getConversations(false).getList(); + return null; + } + + @Override + protected void onPostExecute(Void unused) { + if (mContext == null) { + return; + } + preference.setVisible(mConversations.size() == 0); + } + }.execute(); + } +}