summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tony Wickham <twickham@google.com> 2018-01-22 18:40:05 -0800
committer Tony Wickham <twickham@google.com> 2018-01-23 16:03:46 -0800
commit0239d5fa74f84f1de7e415a7c0ac474e83c329c5 (patch)
tree462b1ffa13fc35fef4ffe11b85ae12d56cb7e49f
parentfb63fe85f28a94d6a8c88c64e91fb4565dfbed3e (diff)
Change swipe up onboarding color based on nav bar color
If the nav bar icons are dark, the onboarding content is also dark on a white background. Otherwise the onboarding content is white on a black background. Also updated a couple of visuals: - Added a divider to the top of onboarding - Increased text size to 16sp - Added ripple to dismiss "X" Test: manual Bug: 70180942 Change-Id: Ifc51143ba7e32015bc1519f9d79f9249849787a5
-rw-r--r--packages/SystemUI/res/layout/recents_swipe_up_onboarding.xml13
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/SwipeUpOnboarding.java49
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java3
3 files changed, 59 insertions, 6 deletions
diff --git a/packages/SystemUI/res/layout/recents_swipe_up_onboarding.xml b/packages/SystemUI/res/layout/recents_swipe_up_onboarding.xml
index b6bd3b32995e..b3d5c9008039 100644
--- a/packages/SystemUI/res/layout/recents_swipe_up_onboarding.xml
+++ b/packages/SystemUI/res/layout/recents_swipe_up_onboarding.xml
@@ -20,20 +20,27 @@
android:layout_width="match_parent"
android:background="@android:color/black"
android:layout_gravity="center">
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="?android:attr/listDivider"
+ android:gravity="top"/>
<TextView
+ android:id="@+id/onboarding_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/recents_swipe_up_onboarding"
android:textColor="@android:color/white"
+ android:textSize="16sp"
android:drawableBottom="@drawable/ic_chevron_up"/>
<ImageView
android:id="@+id/dismiss"
android:layout_width="48dp"
android:layout_height="48dp"
- android:paddingTop="12dp"
- android:paddingBottom="12dp"
- android:paddingEnd="18dp"
+ android:padding="12dp"
+ android:layout_marginEnd="6dp"
android:src="@drawable/ic_close_white"
+ android:background="?android:attr/selectableItemBackgroundBorderless"
android:layout_gravity="center_vertical|end"/>
</FrameLayout> \ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/recents/SwipeUpOnboarding.java b/packages/SystemUI/src/com/android/systemui/recents/SwipeUpOnboarding.java
index f065f48b20b5..3e2293f230e8 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/SwipeUpOnboarding.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/SwipeUpOnboarding.java
@@ -20,14 +20,16 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Configuration;
+import android.content.res.Resources;
import android.graphics.PixelFormat;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.RippleDrawable;
import android.os.Build;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -36,6 +38,8 @@ import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
+import android.widget.ImageView;
+import android.widget.TextView;
import com.android.systemui.Prefs;
import com.android.systemui.R;
@@ -58,10 +62,20 @@ public class SwipeUpOnboarding {
private final Context mContext;
private final WindowManager mWindowManager;
private final View mLayout;
+ private final TextView mTextView;
+ private final ImageView mDismissView;
+ private final ColorDrawable mBackgroundDrawable;
+ private final int mDarkBackgroundColor;
+ private final int mLightBackgroundColor;
+ private final int mDarkContentColor;
+ private final int mLightContentColor;
+ private final RippleDrawable mDarkRipple;
+ private final RippleDrawable mLightRipple;
private boolean mTaskListenerRegistered;
private ComponentName mLauncherComponent;
private boolean mLayoutAttachedToWindow;
+ private boolean mBackgroundIsLight;
private final SysUiTaskStackChangeListener mTaskListener = new SysUiTaskStackChangeListener() {
@Override
@@ -110,10 +124,24 @@ public class SwipeUpOnboarding {
public SwipeUpOnboarding(Context context) {
mContext = context;
+ final Resources res = context.getResources();
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
mLayout = LayoutInflater.from(mContext).inflate(R.layout.recents_swipe_up_onboarding, null);
+ mTextView = (TextView) mLayout.findViewById(R.id.onboarding_text);
+ mDismissView = (ImageView) mLayout.findViewById(R.id.dismiss);
+ mDarkBackgroundColor = res.getColor(android.R.color.background_dark);
+ mLightBackgroundColor = res.getColor(android.R.color.background_light);
+ mDarkContentColor = res.getColor(R.color.primary_text_default_material_light);
+ mLightContentColor = res.getColor(R.color.primary_text_default_material_dark);
+ mDarkRipple = new RippleDrawable(res.getColorStateList(R.color.ripple_material_light),
+ null, null);
+ mLightRipple = new RippleDrawable(res.getColorStateList(R.color.ripple_material_dark),
+ null, null);
+ mBackgroundDrawable = new ColorDrawable(mDarkBackgroundColor);
+
mLayout.addOnAttachStateChangeListener(mOnAttachStateChangeListener);
- mLayout.findViewById(R.id.dismiss).setOnClickListener(v -> hide(true));
+ mLayout.setBackground(mBackgroundDrawable);
+ mDismissView.setOnClickListener(v -> hide(true));
if (RESET_PREFS_FOR_DEBUG) {
Prefs.putBoolean(mContext, Prefs.Key.HAS_SWIPED_UP_FOR_RECENTS, false);
@@ -186,6 +214,21 @@ public class SwipeUpOnboarding {
}
}
+ public void setContentDarkIntensity(float contentDarkIntensity) {
+ boolean backgroundIsLight = contentDarkIntensity > 0.5f;
+ if (backgroundIsLight != mBackgroundIsLight) {
+ mBackgroundIsLight = backgroundIsLight;
+ mBackgroundDrawable.setColor(mBackgroundIsLight
+ ? mLightBackgroundColor : mDarkBackgroundColor);
+ int contentColor = mBackgroundIsLight ? mDarkContentColor : mLightContentColor;
+ mTextView.setTextColor(contentColor);
+ mTextView.getCompoundDrawables()[3].setColorFilter(contentColor,
+ PorterDuff.Mode.SRC_IN);
+ mDismissView.setColorFilter(contentColor);
+ mDismissView.setBackground(mBackgroundIsLight ? mDarkRipple : mLightRipple);
+ }
+ }
+
private WindowManager.LayoutParams getWindowLayoutParams() {
int flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 4b20a896982a..9bef0eecaa06 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -634,6 +634,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
if (mGestureHelper != null) {
mGestureHelper.onDarkIntensityChange(intensity);
}
+ if (mSwipeUpOnboarding != null) {
+ mSwipeUpOnboarding.setContentDarkIntensity(intensity);
+ }
}
@Override