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

Commit 2d880ae9 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Update the conversation priority flow" into sc-dev

parents 95c02780 7503b32d
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -254,7 +254,6 @@
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/notification_importance_button_description_top_margin"
                    android:visibility="gone"
                    android:text="@string/notification_channel_summary_priority"
                    android:clickable="false"
                    android:focusable="false"
                    android:ellipsize="end"
+0 −166
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
  -->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/onboarding_half_shell_container"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|bottom"
    android:paddingStart="4dp"
    android:paddingEnd="4dp"
    >

    <LinearLayout
        android:id="@+id/half_shell"
        android:layout_width="@dimen/qs_panel_width"
        android:layout_height="wrap_content"
        android:paddingTop="16dp"
        android:paddingStart="16dp"
        android:paddingEnd="16dp"
        android:orientation="vertical"
        android:gravity="bottom"
        android:layout_gravity="center_horizontal|bottom"
        android:background="@drawable/rounded_bg_full"
        >

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:padding="12dp"
        android:layout_gravity="center_horizontal"
    >

        <!-- Big icon: 52x52, 12dp padding left + top, 16dp padding right -->
        <ImageView
            android:id="@+id/conversation_icon"
            android:layout_width="@*android:dimen/conversation_avatar_size"
            android:layout_height="@*android:dimen/conversation_avatar_size"
            android:scaleType="centerCrop"
            android:importantForAccessibility="no"
        />

        <FrameLayout
            android:id="@+id/conversation_icon_badge"
            android:layout_width="@*android:dimen/conversation_icon_size_badged"
            android:layout_height="@*android:dimen/conversation_icon_size_badged"
            android:layout_marginLeft="@*android:dimen/conversation_badge_side_margin"
            android:layout_marginTop="@*android:dimen/conversation_badge_side_margin"
            android:clipChildren="false"
            android:clipToPadding="false"
        >
            <ImageView
                android:id="@+id/conversation_icon_badge_bg"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:src="@*android:drawable/conversation_badge_background"
                android:forceHasOverlappingRendering="false"
            />
            <ImageView
                android:id="@+id/icon"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="4dp"
                android:layout_gravity="center"
                android:forceHasOverlappingRendering="false"
            />
            <ImageView
                android:id="@+id/conversation_icon_badge_ring"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:src="@*android:drawable/conversation_badge_ring"
                android:forceHasOverlappingRendering="false"
                android:clipToPadding="false"
                android:scaleType="center"
            />
        </FrameLayout>
    </FrameLayout>

        <TextView
            android:id="@+id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:layout_marginTop="16dp"
            android:text="@string/priority_onboarding_title"
            style="@style/TextAppearance.NotificationImportanceChannel"
        />

        <View
            android:id="@+id/divider"
            android:layout_width="match_parent"
            android:layout_height="0.5dp"
            android:layout_marginTop="20dp"
            android:layout_marginBottom="20dp"
            android:background="@color/material_grey_300" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="start"
            android:text="@string/priority_onboarding_behavior"
            style="@style/TextAppearance.NotificationImportanceChannelGroup"
        />

        <TextView
            android:id="@+id/behaviors"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="start"
            android:layout_marginTop="8dp"
            style="@style/TextAppearance.NotificationImportanceChannelGroup"
        />

        <!-- Bottom button container -->
        <RelativeLayout
            android:id="@+id/button_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="32dp"
            android:orientation="horizontal"
            >
            <TextView
                android:id="@+id/settings_button"
                android:text="@string/priority_onboarding_settings_button_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:gravity="start|center_vertical"
                android:minWidth="@dimen/notification_importance_toggle_size"
                android:minHeight="@dimen/notification_importance_toggle_size"
                android:maxWidth="125dp"
                style="@style/TextAppearance.NotificationInfo.Button"/>
            <TextView
                android:id="@+id/done_button"
                android:text="@string/priority_onboarding_done_button_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:gravity="end|center_vertical"
                android:minWidth="@dimen/notification_importance_toggle_size"
                android:minHeight="@dimen/notification_importance_toggle_size"
                android:maxWidth="125dp"
                style="@style/TextAppearance.NotificationInfo.Button"/>

        </RelativeLayout>

    </LinearLayout>
</FrameLayout>
+5 −21
Original line number Diff line number Diff line
@@ -1897,13 +1897,16 @@
    <string name="notification_channel_summary_automatic_demoted">&lt;b>Status:&lt;/b> Ranked Lower</string>

    <!-- [CHAR LIMIT=150] Notification Importance title: important conversation level summary -->
    <string name="notification_channel_summary_priority">Always shown at the top of your notifications, even when Priority mode is on</string>
    <string name="notification_channel_summary_priority_baseline">Shows at the top of conversation notifications and as a profile picture on lock screen</string>
    <string name="notification_channel_summary_priority_bubble">Shows at the top of conversation notifications and as a profile picture on lock screen, appears as a bubble</string>
    <string name="notification_channel_summary_priority_dnd">Shows at the top of conversation notifications and as a profile picture on lock screen, interrupts Do Not Disturb</string>
    <string name="notification_channel_summary_priority_all">Shows at the top of conversation notifications and as a profile picture on lock screen, appears as a bubble, interrupts Do Not Disturb</string>

    <!--[CHAR LIMIT=30] Linkable text to Settings app -->
    <string name="notification_conversation_channel_settings">Settings</string>

    <!-- [CHAR LIMIT=150] Notification Importance title: important conversation level -->
    <string name="notification_priority_title">Priority conversations</string>
    <string name="notification_priority_title">Priority</string>

    <!-- Text shown in notification guts for conversation notifications that don't implement the full feature -->
    <string name="no_shortcut"><xliff:g id="app_name" example="YouTube">%1$s</xliff:g> doesn\u2019t support conversation features</string>
@@ -2667,25 +2670,6 @@
    <!-- Title of the overlay warning the user to interact with the device or it will go to sleep. [CHAR LIMIT=25] -->
    <string name="inattentive_sleep_warning_title">Standby</string>

    <!-- Priority conversation onboarding screen -->
    <!--  title of priority onboarding [CHAR LIMIT=75]  -->
    <string name="priority_onboarding_title">Conversation set to priority</string>
    <!--  Text explaining that the following actions are the behaviors of priority conversations.
    E.g. priority conversations will show at the top of the conversation section [CHAR LIMIT=75]  -->
    <string name="priority_onboarding_behavior">Priority conversations</string>
    <!--  Text explaining that priority conversations show at the top of the conversation section [CHAR LIMIT=120]  -->
    <string name="priority_onboarding_show_at_top_text">These conversations are shown at the top of your list and can always reach you when Priority mode is on</string>
    <!--  Text explaining that priority conversations show an avatar on the lock screen [CHAR LIMIT=120]  -->
    <string name="priority_onboarding_show_avatar_text">Profile pictures are shown on the lock screen</string>
    <!--  Text explaining that priority conversations will appear as a bubble [CHAR LIMIT=120]  -->
    <string name="priority_onboarding_appear_as_bubble_text">You can easily find these conversations in bubbles on your Home screen</string>
    <!--  Text explaining that priority conversations can interrupt DnD settings [CHAR LIMIT=120]  -->
    <string name="priority_onboarding_ignores_dnd_text">Interrupt Do Not Disturb</string>
    <!--  Title for the affirmative button [CHAR LIMIT=50]  -->
    <string name="priority_onboarding_done_button_title">Got it</string>
    <!--  Title for the settings button button [CHAR LIMIT=50]  -->
    <string name="priority_onboarding_settings_button_title">Settings</string>

    <!-- Window Magnification strings -->
    <!-- Title for Magnification Window [CHAR LIMIT=NONE] -->
    <string name="magnification_window_title">Magnification Window</string>
+1 −4
Original line number Diff line number Diff line
@@ -73,8 +73,7 @@ public final class Prefs {
            Key.TOUCHED_RINGER_TOGGLE,
            Key.HAS_SEEN_ODI_CAPTIONS_TOOLTIP,
            Key.HAS_SEEN_REVERSE_BOTTOM_SHEET,
            Key.CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT,
            Key.HAS_SEEN_PRIORITY_ONBOARDING_IN_S
            Key.CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT
    })
    // TODO: annotate these with their types so {@link PrefsCommandLine} can know how to set them
    public @interface Key {
@@ -123,8 +122,6 @@ public final class Prefs {
        String HAS_SEEN_ODI_CAPTIONS_TOOLTIP = "HasSeenODICaptionsTooltip";
        String HAS_SEEN_REVERSE_BOTTOM_SHEET = "HasSeenReverseBottomSheet";
        String CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT = "ControlsStructureSwipeTooltipCount";
        /** Tracks whether the user has seen the onboarding screen for priority conversations */
        String HAS_SEEN_PRIORITY_ONBOARDING_IN_S = "HasUserSeenPriorityOnboardingInS";
    }

    public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) {
+0 −22
Original line number Diff line number Diff line
@@ -168,7 +168,6 @@ private class PrefsCommand(val context: Context) : Command {

        when (topLevel) {
            "list-prefs" -> listPrefs(pw)
            "set-pref" -> setPref(pw, args.drop(1))
            else -> help(pw)
        }
    }
@@ -180,25 +179,4 @@ private class PrefsCommand(val context: Context) : Command {
            pw.println(field.get(Prefs.Key::class.java))
        }
    }

    /**
     * Sets a preference from [Prefs]
     */
    private fun setPref(pw: PrintWriter, args: List<String>) {
        if (args.isEmpty()) {
            pw.println("invalid arguments: $args")
            return
        }
        val pref = args[0]

        when (pref) {
            Prefs.Key.HAS_SEEN_PRIORITY_ONBOARDING_IN_S -> {
                val value = Integer.parseInt(args[1])
                Prefs.putBoolean(context, Prefs.Key.HAS_SEEN_PRIORITY_ONBOARDING_IN_S, value != 0)
            }
            else -> {
                pw.println("Cannot set pref ($pref)")
            }
        }
    }
}
Loading