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

Commit f49e5ab2 authored by Yuri Lin's avatar Yuri Lin Committed by Android (Google) Code Review
Browse files

Merge "Visual updates to summary onboarding UI - adjusted padding - changed...

Merge "Visual updates to summary onboarding UI - adjusted padding - changed actions to buttons, using sysui button theming - updated call to action text - added speech bubble triangle" into main
parents a1ffd0d3 eadbd02a
Loading
Loading
Loading
Loading
+88 −65
Original line number Diff line number Diff line
@@ -19,10 +19,7 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="8dp"
    android:background="@drawable/rounded_bg_full"
    android:backgroundTint="@androidprv:color/materialColorTertiaryFixed">
    android:layout_height="wrap_content">

  <LinearLayout
      android:id="@+id/content"
@@ -32,8 +29,20 @@
      android:clipChildren="false"
      android:forceHasOverlappingRendering="false"
      android:gravity="center_vertical"
      android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipChildren="false"
        android:forceHasOverlappingRendering="false"
        android:gravity="center_vertical"
        android:orientation="vertical"
      android:padding="16dp">
        android:paddingTop="16dp"
        android:paddingBottom="12dp"
        android:paddingHorizontal="16dp"
        android:background="@drawable/rounded_bg_full"
        android:backgroundTint="@androidprv:color/materialColorTertiaryFixed">

      <LinearLayout
          android:id="@+id/row1"
@@ -59,6 +68,7 @@
                android:layout_height="wrap_content"
                android:focusable="true"
                android:forceHasOverlappingRendering="false"
                android:minHeight="40dp"
                android:text="@string/notification_onboarding_summaries_message"
                android:textColor="@androidprv:color/materialColorOnTertiaryFixed" />
      </LinearLayout>
@@ -71,23 +81,27 @@
          android:clipChildren="false"
          android:forceHasOverlappingRendering="false"
          android:gravity="end"
        android:orientation="horizontal">
          <TextView
              android:id="@+id/btn_turn_on"
          android:orientation="horizontal"
          android:layout_marginTop="12dp"
          android:theme="@style/Theme.SystemUI.Dialog">
            <Button
                android:id="@+id/btn_dismiss"
                android:fontFamily="variable-title-small"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="8dp"
                android:minWidth="48dp"
                android:minHeight="48dp"
                android:focusable="true"
                android:forceHasOverlappingRendering="false"
                android:paddingHorizontal="16dp"
                android:gravity="center"
              android:text="@string/notification_onboarding_summaries_turn_on"
              style="@androidprv:style/NotificationAction"
                android:text="@string/notification_inline_dismiss"
                style="@style/Widget.Dialog.Button.BorderButton"
                android:backgroundTint="@androidprv:color/materialColorOnTertiaryFixedVariant"
                android:textColor="@androidprv:color/materialColorOnTertiaryFixedVariant" />
          <TextView
              android:id="@+id/btn_dismiss"
            <Button
                android:id="@+id/btn_turn_on"
                android:fontFamily="variable-title-small"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
@@ -97,11 +111,20 @@
                android:forceHasOverlappingRendering="false"
                android:paddingHorizontal="16dp"
                android:gravity="center"
              android:text="@string/got_it"
              style="@androidprv:style/NotificationAction"
              android:textColor="@androidprv:color/materialColorOnTertiaryFixedVariant" />
                android:text="@string/notification_onboarding_summaries_turn_on"
                style="@style/Widget.Dialog.Button"
                android:backgroundTint="@androidprv:color/materialColorOnTertiaryFixedVariant"
                android:textColor="@androidprv:color/materialColorTertiaryFixed" />
      </LinearLayout>

    </LinearLayout>

  <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:tint="@androidprv:color/materialColorTertiaryFixed"
      android:src="@drawable/ic_notif_beak" />
</LinearLayout>

</com.android.systemui.statusbar.notification.stack.OnboardingAffordanceView>
+1 −1
Original line number Diff line number Diff line
@@ -2257,7 +2257,7 @@
    <string name="notification_guts_recs_summary">Newsletters, recommended media, and more</string>

    <!-- Notification summaries onboarding affordance turn on button [CHAR LIMIT=40]-->
    <string name="notification_onboarding_summaries_turn_on">Turn on</string>
    <string name="notification_onboarding_summaries_turn_on">Turn on in Settings</string>

    <!--  Notification summaries onboarding affordance message [CHAR LIMIT=NONE]-->
    <string name="notification_onboarding_summaries_message">Your longer conversations can now be summarized to give you quick recaps</string>
+18 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.notification.collection.render

import android.app.Notification
import com.android.app.tracing.traceSection
import com.android.systemui.statusbar.notification.Bundles
import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager
@@ -67,12 +68,7 @@ class NodeSpecBuilder(
            val sectionHeaders = mutableMapOf<NotifSection?, NodeController?>()
            val sectionCounts = mutableMapOf<NotifSection?, Int>()
            var seenBundle = false

            // If needed, the AI summaries onboarding affordance should be added above all
            // notifications.
            summaryOnboardingAffordanceManager.nodeController?.let { controller ->
                root.children.add(NodeSpecImpl(root, controller))
            }
            var seenMessage = false

            for (entry in notifList) {
                val section = entry.section!!
@@ -99,6 +95,15 @@ class NodeSpecBuilder(
                    }
                }

                // If needed, the AI summaries onboarding affordance should be added above the first
                // message notification. (It should not appear if there are no messages.)
                if (!seenMessage && isMessage(entry)) {
                    seenMessage = true
                    summaryOnboardingAffordanceManager.nodeController?.let { controller ->
                        root.children.add(NodeSpecImpl(root, controller))
                    }
                }

                // Include onboarding affordance for bundles above the first bundle, if needed.
                if (!seenBundle && entry is BundleEntry) {
                    seenBundle = true
@@ -134,4 +139,11 @@ class NodeSpecBuilder(
                }
            else -> throw RuntimeException("Unexpected entry: $entry")
        }

    private fun isMessage(entry: PipelineEntry): Boolean {
        return (entry as? NotificationEntry)
            ?.sbn
            ?.notification
            ?.isStyle(Notification.MessagingStyle::class.java) ?: false
    }
}
+7 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.systemui.statusbar.notification.dagger.SocialHeader
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.ExpandableView
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi
import com.android.systemui.statusbar.notification.shared.NotificationSummarizationOnboardingUi
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm.SectionProvider
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.util.foldToSparseArray
@@ -141,7 +142,7 @@ internal constructor(
    }

    override fun beginsSection(view: View, previous: View?): Boolean =
        view === silentHeaderView ||
        (view === silentHeaderView ||
            view === mediaControlsView ||
            view === peopleHeaderView ||
            view === alertingHeaderView ||
@@ -151,7 +152,11 @@ internal constructor(
                    view === socialHeaderView ||
                    view === recsHeaderView ||
                    view === promoHeaderView)) ||
            getBucket(view) != getBucket(previous)
            getBucket(view) != getBucket(previous)) &&
            // don't consider the first notification after onboarding to be a new section, so that
            // the onboarding affordance remains close to the notification
            !(NotificationSummarizationOnboardingUi.isEnabled &&
                previous is OnboardingAffordanceView)

    private fun getBucket(view: View?): Int? =
        when {