summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-05-21 20:24:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-21 20:24:05 +0000
commit451e964f2cad7b29d7dc653a436283ba11dd48fc (patch)
treee16d116bed1891d0a328679ed7e1856273c71e0c /packages/SystemUI/src/com
parentae241f99783d5fad3167d00f3b747228cdfa8b8e (diff)
parent5a9b0b0c7d220a91d540609fc36ba5998417a73f (diff)
downloadframeworks_base-451e964f2cad7b29d7dc653a436283ba11dd48fc.zip
frameworks_base-451e964f2cad7b29d7dc653a436283ba11dd48fc.tar.gz
frameworks_base-451e964f2cad7b29d7dc653a436283ba11dd48fc.tar.bz2
Merge "Enabling clipping on task views."
Diffstat (limited to 'packages/SystemUI/src/com')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Constants.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java37
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java30
3 files changed, 60 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
index fcbd0f4..57957a8 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
@@ -28,7 +28,7 @@ public class Constants {
// Enables the filtering of tasks according to their grouping
public static final boolean EnableTaskFiltering = false;
// Enables clipping of tasks against each other
- public static final boolean EnableTaskStackClipping = false;
+ public static final boolean EnableTaskStackClipping = true;
// Enables the use of theme colors as the task bar background
public static final boolean EnableTaskBarThemeColors = true;
// Enables app-info pane on long-pressing the icon
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 3e418ca..60c442a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -592,18 +592,27 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
if (Constants.DebugFlags.App.EnableTaskStackClipping) {
+ RecentsConfiguration config = RecentsConfiguration.getInstance();
TaskView tv = (TaskView) child;
TaskView nextTv = null;
- int curIndex = indexOfChild(tv);
- if ((curIndex > -1) && (curIndex < (getChildCount() - 1))) {
+ TaskView tmpTv = null;
+ if (tv.shouldClipViewInStack()) {
+ int curIndex = indexOfChild(tv);
+
+ // Find the next view to clip against
+ while (nextTv == null && curIndex < getChildCount()) {
+ tmpTv = (TaskView) getChildAt(++curIndex);
+ if (tmpTv != null && tmpTv.shouldClipViewInStack()) {
+ nextTv = tmpTv;
+ }
+ }
+
// Clip against the next view (if we aren't animating its alpha)
- nextTv = (TaskView) getChildAt(curIndex + 1);
- if (nextTv.getAlpha() == 1f) {
+ if (nextTv != null && nextTv.getAlpha() == 1f) {
Rect curRect = tv.getClippingRect(mTmpRect);
Rect nextRect = nextTv.getClippingRect(mTmpRect2);
- RecentsConfiguration config = RecentsConfiguration.getInstance();
- // The hit rects are relative to the task view, which needs to be offset by the
- // system bar height
+ // The hit rects are relative to the task view, which needs to be offset by
+ // the system bar height
curRect.offset(0, config.systemInsets.top);
nextRect.offset(0, config.systemInsets.top);
// Compute the clip region
@@ -1048,6 +1057,10 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
}
+ // Sanity check, the task view should always be clipping against the stack at this point,
+ // but just in case, re-enable it here
+ tv.setClipViewInStack(true);
+
// Add/attach the view to the hierarchy
if (Console.Enabled) {
Console.log(Constants.Log.ViewPool.PoolCallbacks, " [TaskStackView|insertIndex]",
@@ -1500,6 +1513,9 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
public void onBeginDrag(View v) {
// Enable HW layers
mSv.addHwLayersRefCount("swipeBegin");
+ // Disable clipping with the stack while we are swiping
+ TaskView tv = (TaskView) v;
+ tv.setClipViewInStack(false);
// Disallow parents from intercepting touch events
final ViewParent parent = mSv.getParent();
if (parent != null) {
@@ -1512,13 +1528,18 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
TaskView tv = (TaskView) v;
mSv.onTaskDismissed(tv);
+ // Re-enable clipping with the stack (we will reuse this view)
+ tv.setClipViewInStack(true);
+
// Disable HW layers
mSv.decHwLayersRefCount("swipeComplete");
}
@Override
public void onSnapBackCompleted(View v) {
- // Do Nothing
+ // Re-enable clipping with the stack
+ TaskView tv = (TaskView) v;
+ tv.setClipViewInStack(true);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index 16a3f45..b423a3c 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -57,6 +57,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
Task mTask;
boolean mTaskDataLoaded;
boolean mIsFocused;
+ boolean mClipViewInStack;
Point mLastTouchDown = new Point();
Path mRoundedRectClipPath = new Path();
@@ -87,6 +88,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
RecentsConfiguration config = RecentsConfiguration.getInstance();
mMaxDim = config.taskStackMaxDim;
+ // By default, all views are clipped to other views in their stack
+ mClipViewInStack = true;
+
// Bind the views
mThumbnailView = (TaskThumbnailView) findViewById(R.id.task_view_thumbnail);
mBarView = (TaskBarView) findViewById(R.id.task_view_bar);
@@ -250,6 +254,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
/** Animates the deletion of this task view */
public void animateRemoval(final Runnable r) {
+ // Disabling clipping with the stack while the view is animating away
+ setClipViewInStack(false);
+
RecentsConfiguration config = RecentsConfiguration.getInstance();
animate().translationX(config.taskViewRemoveAnimTranslationXPx)
.alpha(0f)
@@ -261,6 +268,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
@Override
public void run() {
post(r);
+
+ // Re-enable clipping with the stack (we will reuse this view)
+ setClipViewInStack(false);
}
})
.start();
@@ -285,6 +295,26 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
mThumbnailView.setLayerType(View.LAYER_TYPE_NONE, null);
}
+ /**
+ * Returns whether this view should be clipped, or any views below should clip against this
+ * view.
+ */
+ boolean shouldClipViewInStack() {
+ return mClipViewInStack;
+ }
+
+ /** Sets whether this view should be clipped, or clipped against. */
+ void setClipViewInStack(boolean clip) {
+ if (clip != mClipViewInStack) {
+ mClipViewInStack = clip;
+ if (getParent() instanceof View) {
+ Rect r = new Rect();
+ getHitRect(r);
+ ((View) getParent()).invalidate(r);
+ }
+ }
+ }
+
/** Update the dim as a function of the scale of this view. */
void updateDimOverlayFromScale() {
float minScale = Constants.Values.TaskStackView.StackPeekMinScale;