Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2236f11 authored by Winson's avatar Winson Committed by Winson Chung
Browse files

Fixing some Recents landscape issues.

- Tasks were drawing under the navigation in landscape since we did 
  not account for the nav bar space
- Fixing issue with tiny tasks in landscape
- Fixing issue where pooled views were not being measured or laid out
  after resizing.
- Fixing issue where the stack scroll would have out of bounds when 
  tasks were resized (we animate them into bounds)

Change-Id: Id301dc6891e7ff2692cb040a7df1a5a854ac84a3
parent c742f973
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -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;
+17 −14
Original line number Diff line number Diff line
@@ -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,15 +280,10 @@ 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();
        List<TaskView> poolViews = mViewPool.getViews();
        for (TaskView tv : poolViews) {
            tv.reset();
        }
            }
        }

        // Reset the stack state
        mStack.reset();
@@ -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 */);
+6 −6
Original line number Diff line number Diff line
@@ -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;
    }
}