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

Commit df44b606 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch
Browse files

Updated Inline Notification Controls

Removed old xml resources, strings, dimens, etc
Different behavior when sent from the default channel.
Display how many notification categories are used by the app.
Group label when channel is associated with group.
Add package icon.
Fix tap-away-to-save behavior

Test: runtest systemui
Change-Id: Ib41a536a5c4e7c7747a2453eddc3b4b4b99ffa7a
parent b23cd8ec
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ package android.app;
import android.app.ITransientNotification;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
import android.app.NotificationManager;
import android.content.ComponentName;
import android.content.Intent;
@@ -57,12 +58,14 @@ interface INotificationManager
    void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList);
    void createNotificationChannels(String pkg, in ParceledListSlice channelsList);
    ParceledListSlice getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted);
    NotificationChannelGroup getNotificationChannelGroupForPackage(String groupId, String pkg, int uid);
    void updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel);
    NotificationChannel getNotificationChannel(String pkg, String channelId);
    NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, boolean includeDeleted);
    void deleteNotificationChannel(String pkg, String channelId);
    ParceledListSlice getNotificationChannels(String pkg);
    ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
    int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);

    // TODO: Remove this when callers have been migrated to the equivalent
    // INotificationListener method.
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public interface NotificationMenuRowProvider extends Plugin {

        public View getContentView();

        public boolean handleCloseControls();
        public boolean handleCloseControls(boolean save);
    }

    public interface SnoozeGutsContent extends GutsContent {
+0 −38
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright 2016, 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="@dimen/notification_inline_importance_height"
    android:paddingTop="4dp"
    android:orientation="vertical">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:textAlignment="viewStart"
        android:singleLine="true"
        android:text="@string/high_importance"
        android:textAppearance="@style/TextAppearance.NotificationGuts.Primary" />
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:textAlignment="viewStart"
        android:singleLine="true"
        android:text="@string/notification_importance_high"
        android:textAppearance="@style/TextAppearance.NotificationGuts.Secondary" />
</LinearLayout>
+41 −57
Original line number Diff line number Diff line
@@ -28,89 +28,73 @@
        android:background="@color/notification_guts_bg_color"
        android:theme="@*android:style/Theme.DeviceDefault.Light">

    <!-- header -->
    <RelativeLayout
    <!-- Package Info -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="20dp"
        android:paddingEnd="8dp"
        android:paddingBottom="15dp"
        android:id="@+id/notification_guts_header">
        android:orientation="horizontal"
        android:paddingTop="16dp"
        android:paddingBottom="16dp" >
        <ImageView
            android:id="@+id/pkgicon"
            android:layout_width="18dp"
            android:layout_height="18dp"
            android:layout_marginEnd="6dp"
            android:contentDescription="@null"
            android:scaleType="fitCenter" />
        <TextView
            android:id="@+id/pkgname"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            style="@style/TextAppearance.NotificationGuts.Secondary" />
        <TextView
            android:id="@+id/channel_name"
            android:id="@+id/pkg_group_divider"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:layout_below="@id/pkgname"
            style="@style/TextAppearance.NotificationGuts.Header" />
        <Switch
            android:id="@+id/channel_enabled_switch"
            android:layout_marginStart="2dp"
            android:layout_marginEnd="2dp"
            android:text="@string/notification_header_divider_symbol_with_spaces"/>
        <TextView
            android:id="@+id/group_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:background="@null" />
    </RelativeLayout>
    <!-- Importance radio buttons -->
            style="@style/TextAppearance.NotificationGuts.Secondary" />
    </LinearLayout>

    <!-- Channel Info -->
    <LinearLayout
        android:id="@+id/importance"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="8dp"
        android:orientation="horizontal">
        <RadioGroup
            android:id="@+id/importance_buttons"
        <TextView
            android:id="@+id/channel_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingEnd="@*android:dimen/notification_content_margin_end">
            <RadioButton
                android:id="@+id/high_importance"
                android:layout_width="wrap_content"
                android:layout_height="@dimen/notification_inline_importance_height"
                style="@style/TextAppearance.NotificationGuts.Radio"
                android:buttonTint="@color/notification_guts_buttons" />
            <RadioButton
                android:id="@+id/default_importance"
                android:layout_width="wrap_content"
                android:layout_height="@dimen/notification_inline_importance_height"
                style="@style/TextAppearance.NotificationGuts.Radio"
                android:buttonTint="@color/notification_guts_buttons" />
            <RadioButton
                android:id="@+id/low_importance"
                android:layout_width="wrap_content"
                android:layout_height="@dimen/notification_inline_importance_height"
                style="@style/TextAppearance.NotificationGuts.Radio"
                android:buttonTint="@color/notification_guts_buttons" />
            <RadioButton
                android:id="@+id/min_importance"
            android:layout_below="@id/pkgname"
            style="@style/TextAppearance.NotificationGuts.Header" />
        <Switch
            android:id="@+id/channel_enabled_switch"
            android:layout_width="wrap_content"
                android:layout_height="@dimen/notification_inline_importance_height"
                style="@style/TextAppearance.NotificationGuts.Radio"
                android:buttonTint="@color/notification_guts_buttons" />
        </RadioGroup>
        <LinearLayout
            android:id="@+id/importance_buttons_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <include layout="@layout/notification_guts_importance_text"/>
            <include layout="@layout/notification_guts_importance_text"/>
            <include layout="@layout/notification_guts_importance_text"/>
            <include layout="@layout/notification_guts_importance_text"/>
        </LinearLayout>
            android:layout_gravity="end"
            android:layout_weight="1"
            android:background="@null" />
    </LinearLayout>
    <!-- Channel Disabled Text -->

    <!-- Secondary Text - only one shows at a time -->
    <TextView
        android:id="@+id/channel_disabled"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/notification_channel_disabled"
        style="@style/TextAppearance.NotificationGuts.SecondaryWarning" />
    <TextView
        android:id="@+id/num_channels_desc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        style="@style/TextAppearance.NotificationGuts.Secondary" />

    <!-- Settings and Done buttons -->
    <LinearLayout
        android:layout_width="match_parent"
+0 −4
Original line number Diff line number Diff line
@@ -96,10 +96,6 @@

    <!-- The "inside" of a notification, reached via longpress -->
    <color name="notification_guts_bg_color">#eeeeee</color>
    <color name="notification_guts_disabled_slider_color">@*android:color/material_grey_300</color>
    <color name="notification_guts_secondary_slider_color">#858383</color>
    <color name="notification_guts_icon_tint">#8a000000</color>
    <color name="notification_guts_disabled_icon_tint">#4d000000</color>

    <!-- Colors of the snooze menu reached via snooze icon behind a notification -->
    <color name="snooze_snackbar_bg">#FF4A4A4A</color>
Loading