summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java30
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java31
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java4
4 files changed, 58 insertions, 21 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
index e99509cb8365..93849dc5a373 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
@@ -110,6 +110,10 @@ public class TaskStackLayoutAlgorithm {
public static final float STATE_FOCUSED = 1f;
public static final float STATE_UNFOCUSED = 0f;
+ public interface TaskStackLayoutAlgorithmCallbacks {
+ void onFocusStateChanged(float prevFocusState, float curFocusState);
+ }
+
/**
* The various stack/freeform states.
*/
@@ -210,6 +214,7 @@ public class TaskStackLayoutAlgorithm {
Context mContext;
private Interpolator mLinearOutSlowInInterpolator;
private StackState mState = StackState.SPLIT;
+ private TaskStackLayoutAlgorithmCallbacks mCb;
// The task bounds (untransformed) for layout. This rect is anchored at mTaskRoot.
public Rect mTaskRect = new Rect();
@@ -279,8 +284,10 @@ public class TaskStackLayoutAlgorithm {
TaskViewTransform mBackOfStackTransform = new TaskViewTransform();
TaskViewTransform mFrontOfStackTransform = new TaskViewTransform();
- public TaskStackLayoutAlgorithm(Context context) {
+ public TaskStackLayoutAlgorithm(Context context, TaskStackLayoutAlgorithmCallbacks cb) {
Resources res = context.getResources();
+ mContext = context;
+ mCb = cb;
mFocusedRange = new Range(res.getFloat(R.integer.recents_layout_focused_range_min),
res.getFloat(R.integer.recents_layout_focused_range_max));
@@ -291,7 +298,6 @@ public class TaskStackLayoutAlgorithm {
mMinTranslationZ = res.getDimensionPixelSize(R.dimen.recents_task_view_z_min);
mMaxTranslationZ = res.getDimensionPixelSize(R.dimen.recents_task_view_z_max);
- mContext = context;
mFreeformLayoutAlgorithm = new FreeformWorkspaceLayoutAlgorithm(context);
mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.linear_out_slow_in);
@@ -315,8 +321,12 @@ public class TaskStackLayoutAlgorithm {
* Sets the focused state.
*/
public void setFocusState(float focusState) {
+ float prevFocusState = mFocusState;
mFocusState = focusState;
updateFrontBackTransforms();
+ if (mCb != null) {
+ mCb.onFocusStateChanged(prevFocusState, focusState);
+ }
}
/**
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 de045f46f9f9..fe9c68eaf239 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -88,6 +88,7 @@ import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
/* The visual representation of a task stack view */
public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCallbacks,
TaskView.TaskViewCallbacks, TaskStackViewScroller.TaskStackViewScrollerCallbacks,
+ TaskStackLayoutAlgorithm.TaskStackLayoutAlgorithmCallbacks,
ViewPool.ViewPoolConsumer<TaskView, Task> {
private final static String KEY_SAVED_STATE_SUPER = "saved_instance_state_super";
@@ -192,9 +193,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
setStack(stack);
mViewPool = new ViewPool<>(context, this);
mInflater = LayoutInflater.from(context);
- mLayoutAlgorithm = new TaskStackLayoutAlgorithm(context);
- mStackScroller = new TaskStackViewScroller(context, mLayoutAlgorithm);
- mStackScroller.setCallbacks(this);
+ mLayoutAlgorithm = new TaskStackLayoutAlgorithm(context, this);
+ mStackScroller = new TaskStackViewScroller(context, this, mLayoutAlgorithm);
mTouchHandler = new TaskStackViewTouchHandler(context, this, mStackScroller);
mAnimationHelper = new TaskStackAnimationHelper(context, this);
mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
@@ -623,7 +623,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
*/
void relayoutTaskViewsOnNextFrame(TaskViewAnimation animation) {
mDeferredTaskViewLayoutAnimation = animation;
- postInvalidateOnAnimation();
+ invalidate();
}
/**
@@ -852,17 +852,17 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
};
if (scrollToTask) {
+ // Cancel any running enter animations at this point when we scroll or change focus
+ if (!mEnterAnimationComplete) {
+ cancelAllTaskViewAnimations();
+ }
+
// TODO: Center the newly focused task view, only if not freeform
float newScroll = mLayoutAlgorithm.getStackScrollForTask(newFocusedTask);
if (Float.compare(newScroll, mStackScroller.getStackScroll()) != 0) {
mStackScroller.animateScroll(mStackScroller.getStackScroll(), newScroll,
focusTaskRunnable);
willScroll = true;
-
- // Cancel any running enter animations at this point when we scroll as well
- if (!mEnterAnimationComplete) {
- cancelAllTaskViewAnimations();
- }
} else {
focusTaskRunnable.run();
}
@@ -902,7 +902,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
*/
public void setRelativeFocusedTask(boolean forward, boolean stackTasksOnly, boolean animated,
boolean cancelWindowAnimations) {
- setRelativeFocusedTask(forward, stackTasksOnly, animated, false, false);
+ setRelativeFocusedTask(forward, stackTasksOnly, animated, cancelWindowAnimations, false);
}
/**
@@ -1448,6 +1448,16 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
}
+ /**** TaskStackLayoutAlgorithm.TaskStackLayoutAlgorithmCallbacks ****/
+
+ @Override
+ public void onFocusStateChanged(float prevFocusState, float curFocusState) {
+ if (mDeferredTaskViewLayoutAnimation == null) {
+ mUIDozeTrigger.poke();
+ relayoutTaskViewsOnNextFrame(TaskViewAnimation.IMMEDIATE);
+ }
+ }
+
/**** TaskStackViewScroller.TaskStackViewScrollerCallbacks ****/
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java
index 5335b14078dd..4ec051f6bf9a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java
@@ -20,7 +20,9 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
+import android.util.FloatProperty;
import android.util.Log;
+import android.util.Property;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.OverScroller;
@@ -37,6 +39,24 @@ public class TaskStackViewScroller {
void onScrollChanged(float prevScroll, float curScroll, TaskViewAnimation animation);
}
+ /**
+ * A Property wrapper around the <code>stackScroll</code> functionality handled by the
+ * {@link #setStackScroll(float)} and
+ * {@link #getStackScroll()} methods.
+ */
+ private static final Property<TaskStackViewScroller, Float> STACK_SCROLL =
+ new FloatProperty<TaskStackViewScroller>("stackScroll") {
+ @Override
+ public void setValue(TaskStackViewScroller object, float value) {
+ object.setStackScroll(value);
+ }
+
+ @Override
+ public Float get(TaskStackViewScroller object) {
+ return object.getStackScroll();
+ }
+ };
+
Context mContext;
TaskStackLayoutAlgorithm mLayoutAlgorithm;
TaskStackViewScrollerCallbacks mCb;
@@ -51,8 +71,10 @@ public class TaskStackViewScroller {
private Interpolator mLinearOutSlowInInterpolator;
- public TaskStackViewScroller(Context context, TaskStackLayoutAlgorithm layoutAlgorithm) {
+ public TaskStackViewScroller(Context context, TaskStackViewScrollerCallbacks cb,
+ TaskStackLayoutAlgorithm layoutAlgorithm) {
mContext = context;
+ mCb = cb;
mScroller = new OverScroller(context);
mLayoutAlgorithm = layoutAlgorithm;
mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
@@ -64,11 +86,6 @@ public class TaskStackViewScroller {
mStackScrollP = 0f;
}
- /** Sets the callbacks */
- void setCallbacks(TaskStackViewScrollerCallbacks cb) {
- mCb = cb;
- }
-
/** Gets the current stack scroll */
public float getStackScroll() {
return mStackScrollP;
@@ -172,7 +189,7 @@ public class TaskStackViewScroller {
stopBoundScrollAnimation();
mFinalAnimatedScroll = newScroll;
- mScrollAnimator = ObjectAnimator.ofFloat(this, "stackScroll", curScroll, newScroll);
+ mScrollAnimator = ObjectAnimator.ofFloat(this, STACK_SCROLL, curScroll, newScroll);
mScrollAnimator.setDuration(mContext.getResources().getInteger(
R.integer.recents_animate_task_stack_scroll_duration));
mScrollAnimator.setInterpolator(mLinearOutSlowInInterpolator);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 52e6a9c2caf7..93be009c29fd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -652,8 +652,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
@Override
public void setClipToActualHeight(boolean clipToActualHeight) {
- super.setClipToActualHeight(clipToActualHeight);
- getShowingLayout().setClipToActualHeight(clipToActualHeight);
+ super.setClipToActualHeight(clipToActualHeight || isUserLocked());
+ getShowingLayout().setClipToActualHeight(clipToActualHeight || isUserLocked());
}
/**