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

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

Inline Notification Controls to full spec

Based off redline spec
Support bundled notifications when long-press on summary
Hide banned text when sent from the default channel

Test: runtest systemui
Change-Id: I9315b4dc12cafbdf37ba9896879bfbe23c8d6921
parent 37ecda0e
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -20,17 +20,17 @@
    android:id="@+id/notification_header"
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="48dp"
    android:layout_height="@dimen/notification_header_height"
    android:clipChildren="false"
    android:paddingTop="10dp"
    android:paddingBottom="11dp"
    android:paddingTop="@dimen/notification_header_padding_top"
    android:paddingBottom="@dimen/notification_header_padding_bottom"
    android:layout_marginBottom="5dp"
    android:paddingStart="@dimen/notification_content_margin_start"
    android:paddingEnd="16dp">
    <com.android.internal.widget.CachingIconView
        android:id="@+id/icon"
        android:layout_width="18dp"
        android:layout_height="18dp"
        android:layout_width="@dimen/notification_header_icon_size"
        android:layout_height="@dimen/notification_header_icon_size"
        android:layout_marginEnd="3dp"
        />
    <TextView
+11 −0
Original line number Diff line number Diff line
@@ -174,9 +174,20 @@
    <!-- height of the content margin on the bottom -->
    <dimen name="notification_content_margin_bottom">16dp</dimen>

    <!-- height of the notification header (for icon and package name) -->
    <dimen name="notification_header_height">48dp</dimen>

    <!-- The height of the background for a notification header on a group -->
    <dimen name="notification_header_background_height">45.5dp</dimen>

    <!-- The top padding for the notification header -->
    <dimen name="notification_header_padding_top">10dp</dimen>
    <!-- The bottom padding for the notification header -->
    <dimen name="notification_header_padding_bottom">11dp</dimen>

    <!-- size (width and height) of the icon in the notification header -->
    <dimen name="notification_header_icon_size">18dp</dimen>

    <!-- Height of a small notification in the status bar -->
    <dimen name="notification_min_height">92dp</dimen>

+55 −52
Original line number Diff line number Diff line
@@ -21,110 +21,113 @@
        android:layout_height="wrap_content"
        android:id="@+id/notification_guts"
        android:clickable="true"
        android:gravity="top|start"
        android:orientation="vertical"
        android:paddingStart="@*android:dimen/notification_content_margin_start"
        android:paddingEnd="8dp"
        android:background="@color/notification_guts_bg_color"
        android:theme="@*android:style/Theme.DeviceDefault.Light">

    <!-- Package Info -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingTop="16dp"
        android:paddingBottom="16dp" >
        android:layout_height="@*android:dimen/notification_header_height"
        android:clipChildren="false"
        android:paddingTop="@*android:dimen/notification_header_padding_top"
        android:paddingBottom="@*android:dimen/notification_header_padding_bottom"
        android:gravity="center_vertical"
        android:orientation="horizontal" >
        <ImageView
            android:id="@+id/pkgicon"
            android:layout_width="18dp"
            android:layout_height="18dp"
            android:layout_marginEnd="6dp"
            android:contentDescription="@null"
            android:scaleType="fitCenter" />
            android:layout_width="@*android:dimen/notification_header_icon_size"
            android:layout_height="@*android:dimen/notification_header_icon_size"
            android:layout_marginEnd="3dp"/>
        <TextView
            android:id="@+id/pkgname"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/TextAppearance.NotificationGuts.Secondary" />
            android:textAppearance="@*android:style/TextAppearance.Material.Notification.Info"
            android:layout_marginStart="3dp"
            android:layout_marginEnd="2dp"
            android:singleLine="true"/>
        <TextView
            android:id="@+id/pkg_group_divider"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="@*android:style/TextAppearance.Material.Notification.Info"
            android:layout_marginStart="2dp"
            android:layout_marginEnd="2dp"
            android:text="@string/notification_header_divider_symbol_with_spaces"/>
            android:text="@*android:string/notification_header_divider_symbol"/>
        <TextView
            android:id="@+id/group_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/TextAppearance.NotificationGuts.Secondary" />
            android:textAppearance="@*android:style/TextAppearance.Material.Notification.Info"
            android:layout_marginStart="2dp"
            android:layout_marginEnd="2dp"/>
    </LinearLayout>

    <!-- Channel Info -->
    <!-- Channel Info Block -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="8dp"
        android:layout_marginBottom="20dp"
        android:layout_marginEnd="@*android:dimen/notification_content_margin_end"
        android:orientation="horizontal">
        <TextView
            android:id="@+id/channel_name"
        <!-- Channel Text -->
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/pkgname"
            style="@style/TextAppearance.NotificationGuts.Header" />
        <Switch
            android:id="@+id/channel_enabled_switch"
            android:orientation="vertical">
            <!-- Channel Name -->
            <TextView
                android:id="@+id/channel_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:layout_weight="1"
            android:background="@null" />
    </LinearLayout>

                android:layout_marginBottom="6dp"
                style="@style/TextAppearance.NotificationInfo.Primary" />
            <!-- Secondary Text - only one shows at a time -->
            <TextView
                android:id="@+id/channel_disabled"
        android:layout_width="match_parent"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/notification_channel_disabled"
        style="@style/TextAppearance.NotificationGuts.SecondaryWarning" />
                style="@style/TextAppearance.NotificationInfo.Secondary.Warning" />
            <TextView
                android:id="@+id/num_channels_desc"
        android:layout_width="match_parent"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/notification_channel_disabled"
                style="@style/TextAppearance.NotificationInfo.Secondary" />
        </LinearLayout>
        <!-- Ban Channel Switch -->
        <Switch
            android:id="@+id/channel_enabled_switch"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
        style="@style/TextAppearance.NotificationGuts.Secondary" />
            android:layout_gravity="end|center_vertical"
            android:layout_weight="1"
            android:background="@null" />
    </LinearLayout>

    <!-- Settings and Done buttons -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_height="48dp"
        android:orientation="horizontal"
        android:gravity="end"
        android:paddingTop="16dp"
        android:paddingBottom="8dp" >

        android:layout_marginBottom="8dp" >
        <TextView
            android:id="@+id/more_settings"
            android:text="@string/notification_more_settings"
            android:layout_width="wrap_content"
            android:layout_height="36dp"
            style="@style/TextAppearance.NotificationGuts.Button"
            android:background="@drawable/btn_borderless_rect"
            android:gravity="center"
            android:paddingEnd="8dp"
            android:paddingStart="8dp"
            android:focusable="true" />

            android:layout_height="match_parent"
            android:layout_marginEnd="8dp"
            style="@style/TextAppearance.NotificationInfo.Button"/>
        <TextView
            android:id="@+id/done"
            android:text="@string/notification_done"
            android:layout_width="wrap_content"
            android:layout_height="36dp"
            style="@style/TextAppearance.NotificationGuts.Button"
            android:background="@drawable/btn_borderless_rect"
            android:gravity="center"
            android:layout_marginStart="8dp"
            android:layout_height="match_parent"
            android:layout_marginEnd="8dp"
            android:focusable="true"/>
            style="@style/TextAppearance.NotificationInfo.Button"/>
    </LinearLayout>
</com.android.systemui.statusbar.NotificationInfo>
+19 −4
Original line number Diff line number Diff line
@@ -1340,18 +1340,33 @@
    <!-- Notification Inline Controls: Header for apps that are not yet using notification channels. -->
    <string name="notification_header_default_channel">Notifications</string>

    <!-- The divider symbol between different parts of the notification header including spaces. not translatable [CHAR LIMIT=3] -->
    <string name="notification_header_divider_symbol_with_spaces" translatable="false">" • "</string>

    <!-- Notification Inline Controls: Shown when a channel's notifications are currently blocked -->
    <string name="notification_channel_disabled">You won\'t get these notifications anymore.</string>

    <!-- Notification: Control panel: Label that shows how many channels are included in this bundle
        of notifications.  Replaces the channel name and only appears when there is more than one channel. -->
    <string name="notification_num_channels"> <xliff:g id="number">%d</xliff:g> notification categories</string>

    <!-- Notification: Control panel: Label that shows how many channels this application has
        defined, describing the current notification channel as "1 out of n". -->
        defined, describing the current notification channel as "1 out of n categories from this app". -->
    <plurals name="notification_num_channels_desc">
        <item quantity="one">1 out of <xliff:g id="number">%d</xliff:g> category from this app</item>
        <item quantity="other">1 out of <xliff:g id="number">%d</xliff:g> categories from this app</item>
    </plurals>

    <!-- Notification: Control panel: For bundles of notifications, this label that lists the
        channels used by the contained notifications.  The first two channels are listed by name,
        followed by "and N others"
        Example: "Friend requests, Friend confirmations"
        Example: "Friend requests, Friend confirmations, and 1 other"
        Example: "Friend requests, Friend confirmations, and 2 others"
    -->
    <string name="notification_channels_list_desc_2"><xliff:g id="channel_name_1">%1$s</xliff:g>, <xliff:g id="channel_name_2">%2$s</xliff:g></string>
    <plurals name="notification_channels_list_desc_2_and_others">
        <item quantity="one"><xliff:g id="channel_name_1">%1$s</xliff:g>, <xliff:g id="channel_name_2">%2$s</xliff:g>, and <xliff:g id="number">%3$d</xliff:g> other</item>
        <item quantity="other"><xliff:g id="channel_name_1">%1$s</xliff:g>, <xliff:g id="channel_name_2">%2$s</xliff:g>, and <xliff:g id="number">%3$d</xliff:g> others</item>
    </plurals>

    <!-- Notification: Control panel: Label for button that launches notification settings. Used
        when this app has defined more than a single channel for notifications. -->
    <string name="notification_all_categories">All Categories</string>
+17 −13
Original line number Diff line number Diff line
@@ -349,38 +349,42 @@
        <item name="dropdownPreferenceStyle">@style/Preference.DropDown.Material</item>
    </style>

    <style name="TextAppearance.NotificationGuts">
        <item name="android:textSize">14sp</item>
        <item name="android:fontFamily">roboto-regular</item>
    <style name="TextAppearance.NotificationInfo">
        <item name="android:fontFamily">sans-serif</item>
        <item name="android:textColor">@android:color/black</item>
    </style>

    <style name="TextAppearance.NotificationGuts.Header">
    <style name="TextAppearance.NotificationInfo.Primary">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:textSize">20sp</item>
        <item name="android:textSize">16sp</item>
        <item name="android:alpha">0.87</item>
    </style>

    <style name="TextAppearance.NotificationGuts.Secondary">
    <style name="TextAppearance.NotificationInfo.Secondary">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:textSize">12sp</item>
        <item name="android:textSize">14sp</item>
        <item name="android:alpha">0.54</item>
    </style>

    <style name="TextAppearance.NotificationGuts.SecondaryWarning">
    <style name="TextAppearance.NotificationInfo.Secondary.Warning">
        <item name="android:textColor">?android:attr/colorError</item>
        <item name="android:textSize">12sp</item>
    </style>

    <style name="TextAppearance.NotificationGuts.Button">
    <style name="TextAppearance.NotificationInfo.Button">
        <item name="android:fontFamily">sans-serif-medium</item>
        <item name="android:textSize">14sp</item>
        <item name="android:textAllCaps">true</item>
        <item name="android:fontFamily">sans-serif-medium</item>
        <item name="android:gravity">center</item>
        <item name="android:textColor">?android:attr/colorAccent</item>
        <item name="android:background">@drawable/btn_borderless_rect</item>
        <item name="android:gravity">center</item>
        <item name="android:focusable">true</item>
        <item name="android:paddingStart">8dp</item>
        <item name="android:paddingEnd">8dp</item>
    </style>

    <style name="TextAppearance.SnoozeSnackBar">
        <item name="android:textSize">14sp</item>
        <item name="android:fontFamily">roboto-regular</item>
        <item name="android:fontFamily">sans-serif</item>
        <item name="android:textColor">@android:color/white</item>
    </style>

Loading