diff options
| author | 2020-06-10 20:36:21 +0000 | |
|---|---|---|
| committer | 2020-06-10 20:36:21 +0000 | |
| commit | e20435387c9014cf72dc3f58358db8860fdf7841 (patch) | |
| tree | 5356cac7189d70e40c2096d3add962d5d3595450 | |
| parent | 0e9a9a9c44ab5359f881c1bd382c2acda7f0ae81 (diff) | |
| parent | e1448f064d9e9ff7a37fdc986fcb8ca647f170f6 (diff) | |
Merge "Update the manage education to be a cling" into rvc-dev
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 @@ <com.android.systemui.bubbles.BubbleManageEducationView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent"> - + android:layout_height="match_parent" + > <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" android:id="@+id/manage_education_view" + android:clickable="true" + android:paddingTop="28dp" + android:paddingBottom="16dp" + android:paddingStart="@dimen/bubble_expanded_view_padding" + android:paddingEnd="48dp" + android:layout_marginEnd="24dp" android:orientation="vertical" - android:layout_height="wrap_content" - android:layout_width="@dimen/bubbles_manage_education_width"> + android:background="@drawable/bubble_stack_user_education_bg" + android:alpha="0.9" + > + + <TextView + android:id="@+id/user_education_title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingStart="16dp" + android:paddingBottom="16dp" + android:fontFamily="@*android:string/config_bodyFontFamilyMedium" + android:maxLines="1" + android:text="@string/bubbles_user_education_manage_title" + android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Headline"/> <TextView android:id="@+id/user_education_description" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="8dp" + android:paddingStart="16dp" + android:paddingBottom="24dp" android:text="@string/bubbles_user_education_manage" android:fontFamily="@*android:string/config_bodyFontFamily" - android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2" - android:background="@drawable/bubble_manage_user_education_bg" - /> + android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"/> + + <LinearLayout + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:orientation="horizontal" > - <View - android:id="@+id/user_education_pointer" - android:layout_width="@dimen/bubble_pointer_width" - android:layout_height="@dimen/bubble_pointer_height" - /> + <com.android.systemui.statusbar.AlphaOptimizedButton + style="@android:style/Widget.Material.Button.Borderless" + android:id="@+id/manage" + android:layout_gravity="start" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:focusable="true" + android:clickable="false" + android:text="@string/manage_bubbles_text" + android:textColor="?attr/wallpaperTextColor" + android:alpha="0.89" + /> + <com.android.systemui.statusbar.AlphaOptimizedButton + style="@android:style/Widget.Material.Button.Borderless" + android:id="@+id/got_it" + android:layout_gravity="start" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:focusable="true" + android:text="@string/bubbles_user_education_got_it" + android:textColor="?attr/wallpaperTextColor" + /> + </LinearLayout> </LinearLayout> </com.android.systemui.bubbles.BubbleManageEducationView>
\ No newline at end of file diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 399099702a6a..abc560bed595 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1248,7 +1248,7 @@ <!-- Bubbles user education views --> <dimen name="bubbles_manage_education_width">160dp</dimen> <!-- The inset from the top bound of the manage button to place the user education. --> - <dimen name="bubbles_manage_education_top_inset">10dp</dimen> + <dimen name="bubbles_manage_education_top_inset">65dp</dimen> <!-- Size of padding for the user education cling, this should at minimum be larger than individual_bubble_size + some padding. --> <dimen name="bubble_stack_user_education_side_inset">72dp</dimen> 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 84f3ba5df917..0c1a370696d7 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -1621,12 +1621,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 @@ -1959,9 +1966,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(); } } |