Merge "Assistive chip: Adding background scrim for chip." into ub-launcher3-rvc-dev
diff --git a/quickstep/recents_ui_overrides/res/drawable/chip_scrim_gradient.xml b/quickstep/recents_ui_overrides/res/drawable/chip_scrim_gradient.xml
new file mode 100644
index 0000000..5a2dfb7
--- /dev/null
+++ b/quickstep/recents_ui_overrides/res/drawable/chip_scrim_gradient.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient
+ android:angle="90"
+ android:endColor="@android:color/transparent"
+ android:startColor="@color/chip_scrim_start_color"
+ android:type="linear" />
+</shape>
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/res/values/colors.xml b/quickstep/recents_ui_overrides/res/values/colors.xml
index 361f5f7..f03f118 100644
--- a/quickstep/recents_ui_overrides/res/values/colors.xml
+++ b/quickstep/recents_ui_overrides/res/values/colors.xml
@@ -15,6 +15,7 @@
-->
<resources>
<color name="chip_hint_foreground_color">#fff</color>
+ <color name="chip_scrim_start_color">#39000000</color>
<color name="all_apps_label_text">#61000000</color>
<color name="all_apps_label_text_dark">#61FFFFFF</color>
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index ad49bfa..4275933 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -42,6 +42,8 @@
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable;
+import android.graphics.drawable.InsetDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Process;
@@ -256,14 +258,21 @@
footer.animateHide();
}
}
+ if (mContextualChipWrapper != null) {
+ mContextualChipWrapper.animate().alpha(0f).setDuration(300);
+ }
if (mContextualChip != null) {
mContextualChip.animate().scaleX(0f).scaleY(0f).setDuration(300);
}
+
mIconView.animate().alpha(0.0f);
} else {
if (mContextualChip != null) {
mContextualChip.animate().scaleX(1f).scaleY(1f).setDuration(300);
}
+ if (mContextualChipWrapper != null) {
+ mContextualChipWrapper.animate().alpha(1f).setDuration(300);
+ }
mIconView.animate().alpha(1.0f);
}
@@ -690,20 +699,33 @@
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
layoutParams.gravity = BOTTOM | CENTER_HORIZONTAL;
+ int expectedChipHeight = getExpectedViewHeight(view);
+ float chipOffset = getResources().getDimension(R.dimen.chip_hint_vertical_offset);
layoutParams.bottomMargin = (int)
(((MarginLayoutParams) mSnapshotView.getLayoutParams()).bottomMargin
- - getExpectedViewHeight(view) + getResources().getDimension(
- R.dimen.chip_hint_vertical_offset));
+ - expectedChipHeight + chipOffset);
mContextualChip = ((FrameLayout) mContextualChipWrapper).getChildAt(0);
mContextualChip.setScaleX(0f);
mContextualChip.setScaleY(0f);
+ GradientDrawable scrimDrawable = (GradientDrawable) getResources().getDrawable(
+ R.drawable.chip_scrim_gradient, mActivity.getTheme());
+ float cornerRadius = TaskCornerRadius.get(mActivity);
+ scrimDrawable.setCornerRadii(
+ new float[]{0, 0, 0, 0, cornerRadius, cornerRadius, cornerRadius,
+ cornerRadius});
+ InsetDrawable scrimDrawableInset = new InsetDrawable(scrimDrawable, 0, 0, 0,
+ (int) (expectedChipHeight - chipOffset));
+ mContextualChipWrapper.setBackground(scrimDrawableInset);
+ mContextualChipWrapper.setPadding(0, 0, 0, 0);
+ mContextualChipWrapper.setAlpha(0f);
addView(view, getChildCount(), layoutParams);
- view.setAlpha(mFooterAlpha);
if (mContextualChip != null) {
mContextualChip.animate().scaleX(1f).scaleY(1f).setDuration(50);
}
+ if (mContextualChipWrapper != null) {
+ mContextualChipWrapper.animate().alpha(1f).setDuration(50);
+ }
}
-
}
/**