Merge "Adding stack dimming."
This commit is contained in:
@@ -116,6 +116,8 @@
|
|||||||
<integer name="recents_animate_task_bar_enter_duration">200</integer>
|
<integer name="recents_animate_task_bar_enter_duration">200</integer>
|
||||||
<!-- The animation duration for animating in the info pane. -->
|
<!-- The animation duration for animating in the info pane. -->
|
||||||
<integer name="recents_animate_task_view_info_pane_duration">150</integer>
|
<integer name="recents_animate_task_view_info_pane_duration">150</integer>
|
||||||
|
<!-- The minimum alpha for the dim applied to cards that go deeper into the stack. -->
|
||||||
|
<integer name="recents_max_task_stack_view_dim">96</integer>
|
||||||
|
|
||||||
<!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow
|
<!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow
|
||||||
card. -->
|
card. -->
|
||||||
|
|||||||
@@ -239,6 +239,9 @@
|
|||||||
<!-- The size of the activity icon in the recents task view. -->
|
<!-- The size of the activity icon in the recents task view. -->
|
||||||
<dimen name="recents_task_view_activity_icon_size">60dp</dimen>
|
<dimen name="recents_task_view_activity_icon_size">60dp</dimen>
|
||||||
|
|
||||||
|
<!-- The radius of the rounded corners on a task view. -->
|
||||||
|
<dimen name="recents_task_view_rounded_corners_radius">2dp</dimen>
|
||||||
|
|
||||||
<!-- The amount of space a user has to scroll to dismiss any info panes. -->
|
<!-- The amount of space a user has to scroll to dismiss any info panes. -->
|
||||||
<dimen name="recents_task_stack_scroll_dismiss_info_pane_distance">50dp</dimen>
|
<dimen name="recents_task_stack_scroll_dismiss_info_pane_distance">50dp</dimen>
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,12 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
|
|||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||||
} else {
|
} else {
|
||||||
mEmptyView.setVisibility(View.GONE);
|
mEmptyView.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
// Un-dim the background
|
||||||
|
WindowManager.LayoutParams wlp = getWindow().getAttributes();
|
||||||
|
wlp.dimAmount = 0f;
|
||||||
|
getWindow().setAttributes(wlp);
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ public class RecentsConfiguration {
|
|||||||
public int filteringNewViewsMinAnimDuration;
|
public int filteringNewViewsMinAnimDuration;
|
||||||
public int taskBarEnterAnimDuration;
|
public int taskBarEnterAnimDuration;
|
||||||
public int taskStackScrollDismissInfoPaneDistance;
|
public int taskStackScrollDismissInfoPaneDistance;
|
||||||
|
public int taskStackMaxDim;
|
||||||
public int taskViewInfoPaneAnimDuration;
|
public int taskViewInfoPaneAnimDuration;
|
||||||
|
public int taskViewRoundedCornerRadiusPx;
|
||||||
|
|
||||||
public boolean launchedWithThumbnailAnimation;
|
public boolean launchedWithThumbnailAnimation;
|
||||||
|
|
||||||
@@ -85,8 +87,11 @@ public class RecentsConfiguration {
|
|||||||
res.getInteger(R.integer.recents_animate_task_bar_enter_duration);
|
res.getInteger(R.integer.recents_animate_task_bar_enter_duration);
|
||||||
taskStackScrollDismissInfoPaneDistance = res.getDimensionPixelSize(
|
taskStackScrollDismissInfoPaneDistance = res.getDimensionPixelSize(
|
||||||
R.dimen.recents_task_stack_scroll_dismiss_info_pane_distance);
|
R.dimen.recents_task_stack_scroll_dismiss_info_pane_distance);
|
||||||
|
taskStackMaxDim = res.getInteger(R.integer.recents_max_task_stack_view_dim);
|
||||||
taskViewInfoPaneAnimDuration =
|
taskViewInfoPaneAnimDuration =
|
||||||
res.getInteger(R.integer.recents_animate_task_view_info_pane_duration);
|
res.getInteger(R.integer.recents_animate_task_view_info_pane_duration);
|
||||||
|
taskViewRoundedCornerRadiusPx =
|
||||||
|
res.getDimensionPixelSize(R.dimen.recents_task_view_rounded_corners_radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Updates the system insets */
|
/** Updates the system insets */
|
||||||
|
|||||||
@@ -564,8 +564,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
|||||||
int minHeight = (int) (mStackRect.height() -
|
int minHeight = (int) (mStackRect.height() -
|
||||||
(Constants.Values.TaskStackView.StackPeekHeightPct * mStackRect.height()));
|
(Constants.Values.TaskStackView.StackPeekHeightPct * mStackRect.height()));
|
||||||
int size = Math.min(minHeight, Math.min(mStackRect.width(), mStackRect.height()));
|
int size = Math.min(minHeight, Math.min(mStackRect.width(), mStackRect.height()));
|
||||||
mTaskRect.set(mStackRect.left, mStackRectSansPeek.top,
|
int left = mStackRect.left + (mStackRect.width() - size) / 2;
|
||||||
mStackRect.right, mStackRectSansPeek.top + size);
|
mTaskRect.set(left, mStackRectSansPeek.top,
|
||||||
|
left + size, mStackRectSansPeek.top + size);
|
||||||
|
|
||||||
// Update the scroll bounds
|
// Update the scroll bounds
|
||||||
updateMinMaxScroll(false);
|
updateMinMaxScroll(false);
|
||||||
|
|||||||
@@ -16,15 +16,22 @@
|
|||||||
|
|
||||||
package com.android.systemui.recents.views;
|
package com.android.systemui.recents.views;
|
||||||
|
|
||||||
|
import android.animation.TimeInterpolator;
|
||||||
|
import android.animation.ValueAnimator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Path;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
|
import android.graphics.RectF;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.recents.BakedBezierInterpolator;
|
import com.android.systemui.recents.BakedBezierInterpolator;
|
||||||
|
import com.android.systemui.recents.Constants;
|
||||||
import com.android.systemui.recents.RecentsConfiguration;
|
import com.android.systemui.recents.RecentsConfiguration;
|
||||||
import com.android.systemui.recents.Utilities;
|
import com.android.systemui.recents.Utilities;
|
||||||
import com.android.systemui.recents.model.Task;
|
import com.android.systemui.recents.model.Task;
|
||||||
@@ -43,10 +50,15 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
|||||||
// public void onTaskViewReboundToTask(TaskView tv, Task t);
|
// public void onTaskViewReboundToTask(TaskView tv, Task t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mDim;
|
||||||
|
int mMaxDim;
|
||||||
|
TimeInterpolator mDimInterpolator = new AccelerateInterpolator();
|
||||||
|
|
||||||
Task mTask;
|
Task mTask;
|
||||||
boolean mTaskDataLoaded;
|
boolean mTaskDataLoaded;
|
||||||
boolean mTaskInfoPaneVisible;
|
boolean mTaskInfoPaneVisible;
|
||||||
Point mLastTouchDown = new Point();
|
Point mLastTouchDown = new Point();
|
||||||
|
Path mRoundedRectClipPath = new Path();
|
||||||
|
|
||||||
TaskThumbnailView mThumbnailView;
|
TaskThumbnailView mThumbnailView;
|
||||||
TaskBarView mBarView;
|
TaskBarView mBarView;
|
||||||
@@ -68,10 +80,14 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
|||||||
|
|
||||||
public TaskView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
public TaskView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
setWillNotDraw(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
|
RecentsConfiguration config = RecentsConfiguration.getInstance();
|
||||||
|
mMaxDim = config.taskStackMaxDim;
|
||||||
|
|
||||||
// Bind the views
|
// Bind the views
|
||||||
mThumbnailView = (TaskThumbnailView) findViewById(R.id.task_view_thumbnail);
|
mThumbnailView = (TaskThumbnailView) findViewById(R.id.task_view_thumbnail);
|
||||||
mBarView = (TaskBarView) findViewById(R.id.task_view_bar);
|
mBarView = (TaskBarView) findViewById(R.id.task_view_bar);
|
||||||
@@ -82,6 +98,18 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
|
// Update the rounded rect clip path
|
||||||
|
RecentsConfiguration config = RecentsConfiguration.getInstance();
|
||||||
|
float radius = config.taskViewRoundedCornerRadiusPx;
|
||||||
|
mRoundedRectClipPath.reset();
|
||||||
|
mRoundedRectClipPath.addRoundRect(new RectF(0, 0, getMeasuredWidth(), getMeasuredHeight()),
|
||||||
|
radius, radius, Path.Direction.CW);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||||
switch (ev.getAction()) {
|
switch (ev.getAction()) {
|
||||||
@@ -120,6 +148,12 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
|||||||
.setDuration(duration)
|
.setDuration(duration)
|
||||||
.setInterpolator(BakedBezierInterpolator.INSTANCE)
|
.setInterpolator(BakedBezierInterpolator.INSTANCE)
|
||||||
.withLayer()
|
.withLayer()
|
||||||
|
.setUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationUpdate(ValueAnimator animation) {
|
||||||
|
updateDimOverlayFromScale();
|
||||||
|
}
|
||||||
|
})
|
||||||
.start();
|
.start();
|
||||||
} else {
|
} else {
|
||||||
setTranslationY(toTransform.translationY);
|
setTranslationY(toTransform.translationY);
|
||||||
@@ -127,6 +161,8 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
|||||||
setScaleY(toTransform.scale);
|
setScaleY(toTransform.scale);
|
||||||
setAlpha(toTransform.alpha);
|
setAlpha(toTransform.alpha);
|
||||||
}
|
}
|
||||||
|
updateDimOverlayFromScale();
|
||||||
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Resets this view's properties */
|
/** Resets this view's properties */
|
||||||
@@ -136,6 +172,7 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
|||||||
setScaleX(1f);
|
setScaleX(1f);
|
||||||
setScaleY(1f);
|
setScaleY(1f);
|
||||||
setAlpha(1f);
|
setAlpha(1f);
|
||||||
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -278,6 +315,29 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
|
|||||||
mThumbnailView.setLayerType(View.LAYER_TYPE_NONE, null);
|
mThumbnailView.setLayerType(View.LAYER_TYPE_NONE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Update the dim as a function of the scale of this view. */
|
||||||
|
void updateDimOverlayFromScale() {
|
||||||
|
float minScale = Constants.Values.TaskStackView.StackPeekMinScale;
|
||||||
|
float scaleRange = 1f - minScale;
|
||||||
|
float dim = (1f - getScaleX()) / scaleRange;
|
||||||
|
dim = mDimInterpolator.getInterpolation(Math.min(dim, 1f));
|
||||||
|
mDim = Math.max(0, Math.min(mMaxDim, (int) (dim * 255)));
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Canvas canvas) {
|
||||||
|
// Apply the rounded rect clip path on the whole view
|
||||||
|
canvas.clipPath(mRoundedRectClipPath);
|
||||||
|
|
||||||
|
super.draw(canvas);
|
||||||
|
|
||||||
|
// Apply the dim if necessary
|
||||||
|
if (mDim > 0) {
|
||||||
|
canvas.drawColor(mDim << 24);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**** TaskCallbacks Implementation ****/
|
/**** TaskCallbacks Implementation ****/
|
||||||
|
|
||||||
/** Binds this task view to the task */
|
/** Binds this task view to the task */
|
||||||
|
|||||||
Reference in New Issue
Block a user