Merge "Assistive chip: Adding background scrim for chip." into ub-launcher3-rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2f04a9d271
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -42,6 +42,8 @@ import android.graphics.Outline;
|
||||
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 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
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 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user