Add conversation onboarding
Test: atest Fixes: 150791002 Change-Id: I51c27300acb8e18b28b5b5e5bf0d2623c65af909
This commit is contained in:
@@ -21,5 +21,5 @@
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,2H4c-1.1,0 -2,0.9 -2,2v18l4,-4h14c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2z"/>
|
||||
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"/>
|
||||
</vector>
|
||||
|
43
res/layout/conversation_onboarding.xml
Normal file
43
res/layout/conversation_onboarding.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginTop="143dp"
|
||||
android:src="@drawable/ic_promote_conversation"/>
|
||||
<TextView
|
||||
android:layout_width="316dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:layout_marginTop="47dp"
|
||||
android:text="@string/conversation_onboarding_title"/>
|
||||
<TextView
|
||||
android:layout_width="316dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/conversation_onboarding_summary"/>
|
||||
</LinearLayout>
|
@@ -8367,14 +8367,31 @@
|
||||
<!-- [CHAR LIMIT=100] preference category title -->
|
||||
<string name="important_conversations">Priority conversations</string>
|
||||
|
||||
<!-- preference category summary -->
|
||||
<string name="important_conversations_summary_bubbles">Show at top of conversation section and appear as floating bubbles</string>
|
||||
|
||||
<!-- preference category summary -->
|
||||
<string name="important_conversations_summary">Show at top of conversation section</string>
|
||||
|
||||
<!-- [CHAR LIMIT=100] preference category title -->
|
||||
<string name="other_conversations">Other conversations</string>
|
||||
<string name="other_conversations">Modified conversations</string>
|
||||
|
||||
<!-- summary for other conversations list -->
|
||||
<string name="other_conversations_summary">Conversations you\u2019ve made changes to</string>
|
||||
|
||||
<!-- [CHAR LIMIT=100] Setting to automatically bubble all notifications from favorite conversations -->
|
||||
<string name="important_bubble">Bubble important conversations</string>
|
||||
<string name="important_bubble">Bubble priority conversations</string>
|
||||
|
||||
<!-- [CHAR LIMIT=NONE] description of how notifications from important conversations behave -->
|
||||
<string name="important_conversation_behavior_summary">Important conversations show at the top of the pull-down shade. You can also set them to bubble and interrupt Do Not Disturb.</string>
|
||||
<string name="important_conversation_behavior_summary">Priority conversations show at the top of the pull-down shade. You can also set them to bubble and interrupt Do Not Disturb.</string>
|
||||
|
||||
<!-- title for conversation onboarding -->
|
||||
<string name="conversation_onboarding_title">Priority and modified conversations will appear here</string>
|
||||
|
||||
<!-- summary for conversation onboarding -->
|
||||
<string name="conversation_onboarding_summary">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.</string>
|
||||
|
||||
<!-- Importance title strings for the Importance page. Also the second part of the importance
|
||||
summary on the channel page-->
|
||||
|
@@ -20,6 +20,12 @@
|
||||
android:key="conversation_list"
|
||||
android:title="@string/zen_mode_conversations_title">
|
||||
|
||||
<com.android.settingslib.widget.LayoutPreference
|
||||
android:key="no_conversations"
|
||||
android:layout="@layout/conversation_onboarding"
|
||||
android:selectable="false"
|
||||
settings:isPreferenceVisible="false"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="important_conversations"
|
||||
android:title="@string/important_conversations"
|
||||
|
@@ -53,6 +53,7 @@ public class ConversationListSettings extends DashboardFragment {
|
||||
@Override
|
||||
protected List<AbstractPreferenceController> 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);
|
||||
|
@@ -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<ConversationChannelWrapper> 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<Void, Void, Void>() {
|
||||
@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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user