From e1448f064d9e9ff7a37fdc986fcb8ca647f170f6 Mon Sep 17 00:00:00 2001 From: Alex Mang Date: Thu, 4 Jun 2020 21:41:34 -0700 Subject: Update the manage education to be a cling Manage education is now a cling with a got it button next to it. Bug: 158222759 Test: Manually on device Change-Id: Id083c3d7c5d67c6914a632a586e7b826fa4431af --- .../res/layout/bubbles_manage_button_education.xml | 68 +++++++++++++++++----- packages/SystemUI/res/values/dimens.xml | 2 +- .../bubbles/BubbleManageEducationView.java | 24 +------- .../android/systemui/bubbles/BubbleStackView.java | 18 ++++-- 4 files changed, 70 insertions(+), 42 deletions(-) diff --git a/packages/SystemUI/res/layout/bubbles_manage_button_education.xml b/packages/SystemUI/res/layout/bubbles_manage_button_education.xml index 0cabc3245152..7313d54c599a 100644 --- a/packages/SystemUI/res/layout/bubbles_manage_button_education.xml +++ b/packages/SystemUI/res/layout/bubbles_manage_button_education.xml @@ -17,30 +17,72 @@ - + android:layout_height="match_parent" + > + android:background="@drawable/bubble_stack_user_education_bg" + android:alpha="0.9" + > + + + android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"/> + + - + + + \ No newline at end of file diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 73d8e9a0d8a7..8219e23ecb92 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1252,7 +1252,7 @@ 160dp - 10dp + 65dp 72dp diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleManageEducationView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleManageEducationView.java index f4d64322c7ff..47120124a55f 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleManageEducationView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleManageEducationView.java @@ -17,10 +17,8 @@ package com.android.systemui.bubbles; import android.content.Context; -import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; -import android.graphics.drawable.ShapeDrawable; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; @@ -28,7 +26,6 @@ import android.widget.TextView; import com.android.internal.util.ContrastColorUtil; import com.android.systemui.R; -import com.android.systemui.recents.TriangleShape; /** * Educational view to highlight the manage button that allows a user to configure the settings @@ -36,7 +33,6 @@ import com.android.systemui.recents.TriangleShape; */ public class BubbleManageEducationView extends LinearLayout { - private View mPointerView; private View mManageView; public BubbleManageEducationView(Context context) { @@ -70,26 +66,8 @@ public class BubbleManageEducationView extends LinearLayout { ta.recycle(); textColor = ContrastColorUtil.ensureTextContrast(textColor, bgColor, true); + ((TextView) findViewById(R.id.user_education_title)).setTextColor(textColor); ((TextView) findViewById(R.id.user_education_description)).setTextColor(textColor); - - final Resources res = getResources(); - final int pointerWidth = res.getDimensionPixelSize(R.dimen.bubble_pointer_width); - final int pointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height); - - ShapeDrawable triangleShape = - new ShapeDrawable(TriangleShape.create( - pointerWidth, pointerHeight, false /* isPointingUp */)); - triangleShape.setTint(bgColor); - - mPointerView = findViewById(R.id.user_education_pointer); - mPointerView.setBackground(triangleShape); - } - - /** - * Specifies the x value this pointer should point to. - */ - public void setPointerPosition(int x) { - mPointerView.setTranslationX(x - (mPointerView.getWidth() / 2)); } /** diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index ba563466ca4e..ab549e5961eb 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -1574,12 +1574,19 @@ public class BubbleStackView extends FrameLayout final int inset = getResources().getDimensionPixelSize( R.dimen.bubbles_manage_education_top_inset); mManageEducationView.bringToFront(); - mManageEducationView.setManageViewPosition(mTempRect.left, - mTempRect.top - viewHeight + inset); - mManageEducationView.setPointerPosition(mTempRect.centerX() - mTempRect.left); + mManageEducationView.setManageViewPosition(0, mTempRect.top - viewHeight + inset); mManageEducationView.animate() .setDuration(ANIMATE_STACK_USER_EDUCATION_DURATION) .setInterpolator(FAST_OUT_SLOW_IN).alpha(1); + mManageEducationView.findViewById(R.id.manage).setOnClickListener(view -> { + mExpandedBubble.getExpandedView().findViewById(R.id.settings_button) + .performClick(); + maybeShowManageEducation(false); + }); + mManageEducationView.findViewById(R.id.got_it).setOnClickListener(view -> + maybeShowManageEducation(false)); + mManageEducationView.setOnClickListener(view -> + maybeShowManageEducation(false)); }); Prefs.putBoolean(getContext(), HAS_SEEN_BUBBLES_MANAGE_EDUCATION, true); } else if (!show @@ -1780,9 +1787,10 @@ public class BubbleStackView extends FrameLayout */ @Override public void subtractObscuredTouchableRegion(Region touchableRegion, View view) { - // If the notification shade is expanded, or the manage menu is open, we shouldn't let the + // If the notification shade is expanded, or the manage menu is open, or we are showing + // manage bubbles user education, we shouldn't let the // ActivityView steal any touch events from any location. - if (!mIsExpanded || mShowingManage) { + if (!mIsExpanded || mShowingManage || mManageEducationView.getVisibility() == VISIBLE) { touchableRegion.setEmpty(); } } -- cgit v1.2.3-59-g8ed1b