Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bbe564a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "jr-update" into rvc-dev

* changes:
  Update conversation launch point
  Add settings for apps that don't use full conversations
parents a2641574 cd237ccf
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -8385,6 +8385,12 @@
    <!-- [CHAR LIMIT=100] Header for an individual conversation-->
    <string name="conversation_category_title">Conversation</string>
    <!-- [CHAR LIMIT=100] Title for switch that says whether this app can appear in the conversation notification section-->
    <string name="conversation_section_switch_title">Conversation section</string>
    <!-- [CHAR LIMIT=100] Summary for switch that says whether this app can appear in the conversation notification section-->
    <string name="conversation_section_switch_summary">Allow <xliff:g id="app">%1$s</xliff:g> to appear in the conversation section</string>
    <!-- [CHAR LIMIT=NONE] Conversation preference summary, the parent channel this conversation was spawned from (separator) the parent channel group (e.g. an account name)-->
    <string name="notification_conversation_summary" translatable="false">"<xliff:g id="parent_category_name">%1$s</xliff:g> • <xliff:g id="parent_category_group_name">%2$s</xliff:g>"</string>
@@ -8403,6 +8409,15 @@
    <!-- [CHAR LIMIT=100] link to page listing all conversations -->
    <string name="manage_conversations">Manage conversations</string>
    <!-- [CHAR LIMIT=100] summary text on link to 'all conversations' page, no conversations are priority -->
    <string name="priority_conversation_count_zero">No priority conversations</string>
    <!-- [CHAR LIMIT=100] summary text on link to 'all conversations' page, some conversations are priority -->
    <plurals name="priority_conversation_count">
        <item quantity="one"><xliff:g id="count" example="1">%d</xliff:g> priority conversation</item>
        <item quantity="other"><xliff:g id="count" example="10">%d</xliff:g> priority conversations</item>
    </plurals>
    <!-- [CHAR LIMIT=100] preference category title -->
    <string name="important_conversations">Priority conversations</string>
+8 −0
Original line number Diff line number Diff line
@@ -46,6 +46,14 @@
        android:layout="@layout/preference_category_no_label"
        android:order="-997"/>

    <Preference
        android:key="conversations"
        android:title="@string/conversations_category_title"
        android:order="-550"
        settings:controller="com.android.settings.notification.ConversationListSummaryPreferenceController"
        android:fragment="com.android.settings.notification.app.ConversationListSettings"
    />

    <Preference
        android:key="configure_notification_settings"
        android:title="@string/configure_notification_settings"
+17 −9
Original line number Diff line number Diff line
@@ -29,13 +29,6 @@
    <com.android.settings.notification.app.NotificationFooterPreference
        android:key="block_desc" />

    <!--Bubbles -->
    <Preference
        android:key="bubble_pref_link"
        android:title="@string/notification_bubbles_title"
        android:icon="@drawable/ic_create_bubble"
        settings:controller="com.android.settings.notification.app.BubbleSummaryPreferenceController">
    </Preference>

    <!-- Conversations added here -->
    <PreferenceCategory
@@ -43,13 +36,28 @@
        android:key="conversations"
        android:visibility="gone"
        settings:allowDividerAbove="false"
        settings:allowDividerBelow="false" />
        settings:allowDividerBelow="false">
        <com.android.settingslib.RestrictedSwitchPreference
            android:key="invalid_conversation_switch"
            android:title="@string/conversation_section_switch_title" />
        <Preference
            android:key="invalid_conversation_info"/>
    </PreferenceCategory>

    <!--Bubbles -->
    <Preference
        android:key="bubble_pref_link"
        android:title="@string/notification_bubbles_title"
        android:icon="@drawable/ic_create_bubble"
        settings:allowDividerAbove="false"
        settings:controller="com.android.settings.notification.app.BubbleSummaryPreferenceController">
    </Preference>

    <!-- Channels/Channel groups added here -->
    <PreferenceCategory
        android:key="channels"
        android:layout="@layout/empty_view"
        settings:allowDividerAbove="false"
        settings:allowDividerAbove="true"
        settings:allowDividerBelow="false" />

    <!-- Importance toggle -->
+0 −8
Original line number Diff line number Diff line
@@ -38,14 +38,6 @@
            android:targetClass="com.android.settings.notification.history.NotificationHistoryActivity" />
    </Preference>

    <Preference
        android:key="conversations"
        android:title="@string/conversations_category_title"
        android:summary="@string/manage_conversations"
        android:order="3"
        android:fragment="com.android.settings.notification.app.ConversationListSettings"
    />

    <Preference
        android:key="notification_bubbles"
        android:title="@string/notification_bubbles_title"
+52 −0
Original line number Diff line number Diff line
/*
 * 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;

import android.content.Context;

import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;

public class ConversationListSummaryPreferenceController extends BasePreferenceController {

    private NotificationBackend mBackend;

    public ConversationListSummaryPreferenceController(Context context, String key) {
        super(context, key);
        mBackend = new NotificationBackend();
    }

    @Override
    public int getAvailabilityStatus() {
        return AVAILABLE;
    }

    @Override
    public CharSequence getSummary() {
        final int count = mBackend.getConversations(true).getList().size();
        if (count == 0) {
            return mContext.getText(R.string.priority_conversation_count_zero);
        }
        return mContext.getResources().getQuantityString(
                R.plurals.priority_conversation_count,
                count, count);
    }

    void setBackend(NotificationBackend backend) {
        mBackend = backend;
    }
}
Loading