summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-05-27 18:02:52 -0700
committerWinson Chung <winsonc@google.com>2014-05-27 18:02:52 -0700
commit4f70dbbc656e0affd0b480c7eceb888449cb6348 (patch)
tree7187c7baaed3d4db366bd477f643bed9f9f94bf7 /packages
parentd30241541c3adcb126bb263ad8596e7902a6b5ae (diff)
downloadframeworks_base-4f70dbbc656e0affd0b480c7eceb888449cb6348.zip
frameworks_base-4f70dbbc656e0affd0b480c7eceb888449cb6348.tar.gz
frameworks_base-4f70dbbc656e0affd0b480c7eceb888449cb6348.tar.bz2
Ensuring that the second card is maximally visible when you go into recents.
Change-Id: Ia13c56941bfc47de341dd57501d156e925a3b2fc
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java28
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Constants.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsService.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java13
4 files changed, 45 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index ffd64d4..be1d47a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -62,12 +62,15 @@ public class AlternateRecentsComponent {
Bundle replyData = msg.getData().getParcelable(KEY_CONFIGURATION_DATA);
mSingleCountFirstTaskRect = replyData.getParcelable(KEY_SINGLE_TASK_STACK_RECT);
mSingleCountFirstTaskRect.offset(0, (int) statusBarHeight);
+ mTwoCountFirstTaskRect = replyData.getParcelable(KEY_TWO_TASK_STACK_RECT);
+ mTwoCountFirstTaskRect.offset(0, (int) statusBarHeight);
mMultipleCountFirstTaskRect = replyData.getParcelable(KEY_MULTIPLE_TASK_STACK_RECT);
mMultipleCountFirstTaskRect.offset(0, (int) statusBarHeight);
if (Console.Enabled) {
Console.log(Constants.Log.App.RecentsComponent,
"[RecentsComponent|RecentsMessageHandler|handleMessage]",
"singleTaskRect: " + mSingleCountFirstTaskRect +
+ " twoTaskRect: " + mTwoCountFirstTaskRect +
" multipleTaskRect: " + mMultipleCountFirstTaskRect);
}
@@ -130,6 +133,7 @@ public class AlternateRecentsComponent {
final public static String KEY_WINDOW_RECT = "recents.windowRect";
final public static String KEY_SYSTEM_INSETS = "recents.systemInsets";
final public static String KEY_SINGLE_TASK_STACK_RECT = "recents.singleCountTaskRect";
+ final public static String KEY_TWO_TASK_STACK_RECT = "recents.twoCountTaskRect";
final public static String KEY_MULTIPLE_TASK_STACK_RECT = "recents.multipleCountTaskRect";
@@ -155,6 +159,7 @@ public class AlternateRecentsComponent {
boolean mTriggeredFromAltTab;
Rect mSingleCountFirstTaskRect = new Rect();
+ Rect mTwoCountFirstTaskRect = new Rect();
Rect mMultipleCountFirstTaskRect = new Rect();
long mLastToggleTime;
@@ -261,8 +266,10 @@ public class AlternateRecentsComponent {
/** Returns whether we have valid task rects to animate to. */
boolean hasValidTaskRects() {
return mSingleCountFirstTaskRect != null && mSingleCountFirstTaskRect.width() > 0 &&
- mSingleCountFirstTaskRect.height() > 0 && mMultipleCountFirstTaskRect != null &&
- mMultipleCountFirstTaskRect.width() > 0 && mMultipleCountFirstTaskRect.height() > 0;
+ mSingleCountFirstTaskRect.height() > 0 && mTwoCountFirstTaskRect != null &&
+ mTwoCountFirstTaskRect.width() > 0 && mTwoCountFirstTaskRect.height() > 0 &&
+ mMultipleCountFirstTaskRect != null && mMultipleCountFirstTaskRect.width() > 0 &&
+ mMultipleCountFirstTaskRect.height() > 0;
}
/** Updates each of the task animation rects. */
@@ -303,8 +310,8 @@ public class AlternateRecentsComponent {
return null;
}
- /** Returns whether there is are multiple recents tasks */
- boolean hasMultipleRecentsTask(List<ActivityManager.RecentTaskInfo> tasks) {
+ /** Returns the proper rect to use for the animation, given the number of tasks. */
+ Rect getAnimationTaskRect(List<ActivityManager.RecentTaskInfo> tasks) {
// NOTE: Currently there's no method to get the number of non-home tasks, so we have to
// compute this ourselves
SystemServicesProxy ssp = mSystemServicesProxy;
@@ -318,7 +325,13 @@ public class AlternateRecentsComponent {
continue;
}
}
- return (tasks.size() > 1);
+ if (tasks.size() <= 1) {
+ return mSingleCountFirstTaskRect;
+ } else if (tasks.size() <= 2) {
+ return mTwoCountFirstTaskRect;
+ } else {
+ return mMultipleCountFirstTaskRect;
+ }
}
/** Converts from the device rotation to the degree */
@@ -472,9 +485,8 @@ public class AlternateRecentsComponent {
// which can differ depending on the number of items in the list.
SystemServicesProxy ssp = mSystemServicesProxy;
List<ActivityManager.RecentTaskInfo> recentTasks =
- ssp.getRecentTasks(2, UserHandle.CURRENT.getIdentifier());
- Rect taskRect = hasMultipleRecentsTask(recentTasks) ? mMultipleCountFirstTaskRect :
- mSingleCountFirstTaskRect;
+ ssp.getRecentTasks(3, UserHandle.CURRENT.getIdentifier());
+ Rect taskRect = getAnimationTaskRect(recentTasks);
boolean useThumbnailTransition = !isTopTaskHome &&
hasValidTaskRects();
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
index 57957a8..e979afd 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
@@ -102,7 +102,7 @@ public class Constants {
public static final int FilterStartDelay = 25;
// The padding will be applied to the smallest dimension, and then applied to all sides
- public static final float StackPaddingPct = 0.1f;
+ public static final float StackPaddingPct = 0.085f;
// The overlap height relative to the task height
public static final float StackOverlapPct = 0.65f;
// The height of the peek space relative to the stack height
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java
index 4bdbb20..c4c910b 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java
@@ -83,20 +83,29 @@ class SystemUIMessageHandler extends Handler {
stack.addTask(new Task());
tsv.computeRects(taskStackBounds.width(), taskStackBounds.height() -
systemInsets.top - systemInsets.bottom, 0, 0);
- tsv.boundScroll();
+ tsv.setStackScrollToInitialState();
transform = tsv.getStackTransform(0, tsv.getStackScroll());
transform.rect.offset(taskStackBounds.left, taskStackBounds.top);
replyData.putParcelable(AlternateRecentsComponent.KEY_SINGLE_TASK_STACK_RECT,
new Rect(transform.rect));
- // Also calculate the target task rect when there are multiple tasks.
+ // Also calculate the target task rect when there are two tasks.
stack.addTask(new Task());
tsv.computeRects(taskStackBounds.width(), taskStackBounds.height() -
systemInsets.top - systemInsets.bottom, 0, 0);
- tsv.setStackScrollRaw(Integer.MAX_VALUE);
- tsv.boundScroll();
+ tsv.setStackScrollToInitialState();
transform = tsv.getStackTransform(1, tsv.getStackScroll());
transform.rect.offset(taskStackBounds.left, taskStackBounds.top);
+ replyData.putParcelable(AlternateRecentsComponent.KEY_TWO_TASK_STACK_RECT,
+ new Rect(transform.rect));
+
+ // Also calculate the target task rect when there are two tasks.
+ stack.addTask(new Task());
+ tsv.computeRects(taskStackBounds.width(), taskStackBounds.height() -
+ systemInsets.top - systemInsets.bottom, 0, 0);
+ tsv.setStackScrollToInitialState();
+ transform = tsv.getStackTransform(2, tsv.getStackScroll());
+ transform.rect.offset(taskStackBounds.left, taskStackBounds.top);
replyData.putParcelable(AlternateRecentsComponent.KEY_MULTIPLE_TASK_STACK_RECT,
new Rect(transform.rect));
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 2b08b19..75893aa 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -172,7 +172,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
// Set the alphas
- transform.dismissAlpha = Math.max(-1f, Math.min(0f, t)) + 1f;
+ transform.dismissAlpha = Math.max(-1f, Math.min(0f, t + 1)) + 1f;
// Update the rect and visibility
transform.rect.set(mTaskRect);
@@ -300,6 +300,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
public void setStackScrollRaw(int value) {
mStackScroll = value;
}
+ /** Sets the current stack scroll to the initial state when you first enter recents */
+ public void setStackScrollToInitialState() {
+ if (mStack.getTaskCount() > 2) {
+ int initialScroll = mMaxScroll - mTaskRect.height() / 2;
+ setStackScroll(initialScroll);
+ } else {
+ setStackScroll(mMaxScroll);
+ }
+ }
/**
* Returns the scroll to such that the task transform at that index will have t=0. (If the scroll
@@ -700,7 +709,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// If this is the first layout, then scroll to the front of the stack and synchronize the
// stack views immediately
if (mAwaitingFirstLayout) {
- setStackScroll(mMaxScroll);
+ setStackScrollToInitialState();
requestSynchronizeStackViewsWithModel();
synchronizeStackViewsWithModel();