Merge "Fixing some Recents landscape issues."

This commit is contained in:
Winson Chung
2015-11-17 19:51:02 +00:00
committed by Android (Google) Code Review
4 changed files with 25 additions and 22 deletions

View File

@@ -154,7 +154,7 @@ public class RecentsConfiguration {
int swInset = getInsetToSmallestWidth(windowBounds.right - windowBounds.left);
int top = searchBarBounds.isEmpty() ? topInset : 0;
taskStackBounds.set(windowBounds.left + swInset, searchBarBounds.bottom + top,
windowBounds.right - swInset, windowBounds.bottom);
windowBounds.right - swInset - rightInset, windowBounds.bottom);
}
}

View File

@@ -201,7 +201,7 @@ public class TaskStackLayoutAlgorithm {
taskStackBounds.right - widthPadding,
taskStackBounds.bottom);
// Anchor the task rect to the top-center of the non-freeform stack rect
int size = Math.min(mStackRect.width(), mStackRect.height() - mStackBottomOffset);
int size = mStackRect.width();
mTaskRect.set(mStackRect.left, mStackRect.top,
mStackRect.left + size, mStackRect.top + size);
mCurrentStackRect = ssp.hasFreeformWorkspaceSupport() ? mFreeformStackRect : mStackRect;

View File

@@ -114,6 +114,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
HashMap<Task, TaskView> mTmpTaskViewMap = new HashMap<>();
ArrayList<TaskView> mTaskViews = new ArrayList<>();
List<TaskView> mImmutableTaskViews = new ArrayList<>();
List<TaskView> mTmpTaskViews = new ArrayList<>();
LayoutInflater mInflater;
boolean mLayersDisabled;
boolean mTouchExplorationEnabled;
@@ -279,14 +280,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
// Mark each task view for relayout
if (mViewPool != null) {
Iterator<TaskView> iter = mViewPool.poolViewIterator();
if (iter != null) {
while (iter.hasNext()) {
TaskView tv = iter.next();
tv.reset();
}
}
List<TaskView> poolViews = mViewPool.getViews();
for (TaskView tv : poolViews) {
tv.reset();
}
// Reset the stack state
@@ -862,10 +858,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
// Measure each of the TaskViews
List<TaskView> taskViews = getTaskViews();
int taskViewCount = taskViews.size();
mTmpTaskViews.clear();
mTmpTaskViews.addAll(getTaskViews());
mTmpTaskViews.addAll(mViewPool.getViews());
int taskViewCount = mTmpTaskViews.size();
for (int i = 0; i < taskViewCount; i++) {
TaskView tv = taskViews.get(i);
TaskView tv = mTmpTaskViews.get(i);
if (tv.getBackground() != null) {
tv.getBackground().getPadding(mTmpRect);
} else {
@@ -891,10 +889,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
// Layout each of the TaskViews
List<TaskView> taskViews = getTaskViews();
int taskViewCount = taskViews.size();
mTmpTaskViews.clear();
mTmpTaskViews.addAll(getTaskViews());
mTmpTaskViews.addAll(mViewPool.getViews());
int taskViewCount = mTmpTaskViews.size();
for (int i = 0; i < taskViewCount; i++) {
TaskView tv = taskViews.get(i);
TaskView tv = mTmpTaskViews.get(i);
if (tv.getBackground() != null) {
tv.getBackground().getPadding(mTmpRect);
} else {
@@ -911,6 +911,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
if (changed) {
if (mStackScroller.isScrollOutOfBounds()) {
mStackScroller.boundScroll();
}
requestSynchronizeStackViewsWithModel();
synchronizeStackViewsWithModel();
clipTaskViews(true /* forceUpdate */);

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
/* A view pool to manage more views than we can visibly handle */
@@ -76,11 +77,10 @@ public class ViewPool<V, T> {
return v;
}
/** Returns an iterator to the list of the views in the pool. */
Iterator<V> poolViewIterator() {
if (mPool != null) {
return mPool.iterator();
}
return null;
/**
* Returns the list of views in the pool.
*/
List<V> getViews() {
return mPool;
}
}