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

Commit 387aac6a authored by Winson's avatar Winson Committed by Winson Chung
Browse files

Fixing task view heights in paging tasks

- Now, all task views will be bounded by the stack rect, and the 
  thumbnail bitmaps will be scaled accordingly to fit either by width
  (when stacked) or to the view rect (when freeform)
- Fixing issue where the history button was not offset in freeform
- Tweaking thumbnail sizes of fullscreen screenshots
- Still requires changes to fix clipping to the correct aspect ratio in
  freeform.

Change-Id: I678b87c2f06947d32f3bb7c60a35f28eb36b5a68
parent 250608a5
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -21,11 +21,6 @@
    public <init>(android.os.Bundle);
}

-keep class com.android.systemui.recents.views.TaskStackLayoutAlgorithm {
    public float getFocusState();
    public void setFocusState(float);
}

-keep class com.android.systemui.recents.views.TaskView {
    public int getDim();
    public void setDim(int);
+1 −1
Original line number Diff line number Diff line
@@ -688,7 +688,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
            ArrayList<Task> tasks = stack.getStackTasks();
            for (int i = tasks.size() - 1; i >= 0; i--) {
                Task task = tasks.get(i);
                if (SystemServicesProxy.isFreeformStack(task.key.stackId)) {
                if (task.isFreeformTask()) {
                    mTmpTransform = stackView.getStackAlgorithm().getStackTransform(task,
                            stackView.getScroller().getStackScroll(), mTmpTransform, null);
                    Rect toTaskRect = new Rect();
+1 −1
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ public class RecentsHistoryAdapter extends RecyclerView.Adapter<RecentsHistoryAd
        int prevDayKey = -1;
        mRows.clear();
        for (Task task : tasksMostRecent) {
            if (SystemServicesProxy.isFreeformStack(task.key.stackId)) {
            if (task.isFreeformTask()) {
                continue;
            }

+54 −11
Original line number Diff line number Diff line
@@ -16,27 +16,53 @@

package com.android.systemui.recents.views;

import android.animation.ObjectAnimator;
import android.graphics.Outline;
import android.graphics.Rect;
import android.util.IntProperty;
import android.util.Property;
import android.view.View;
import android.view.ViewOutlineProvider;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsConfiguration;

/* An outline provider that has a clip and outline that can be animated. */
public class AnimateableViewBounds extends ViewOutlineProvider {

    TaskView mSourceView;
    View mSourceView;
    Rect mClipRect = new Rect();
    Rect mClipBounds = new Rect();
    int mCornerRadius;
    float mAlpha = 1f;
    final float mMinAlpha = 0.25f;

    public AnimateableViewBounds(TaskView source, int cornerRadius) {
    public static final Property<AnimateableViewBounds, Integer> CLIP_BOTTOM =
            new IntProperty<AnimateableViewBounds>("clipBottom") {
                @Override
                public void setValue(AnimateableViewBounds object, int clip) {
                    object.setClipBottom(clip, false /* force */);
                }

                @Override
                public Integer get(AnimateableViewBounds object) {
                    return object.getClipBottom();
                }
            };

    public static final Property<AnimateableViewBounds, Integer> CLIP_RIGHT =
            new IntProperty<AnimateableViewBounds>("clipRight") {
                @Override
                public void setValue(AnimateableViewBounds object, int clip) {
                    object.setClipRight(clip, false /* force */);
                }

                @Override
                public Integer get(AnimateableViewBounds object) {
                    return object.getClipRight();
                }
            };

    public AnimateableViewBounds(View source, int cornerRadius) {
        mSourceView = source;
        mCornerRadius = cornerRadius;
        setClipBottom(getClipBottom(), false /* force */);
    }

    @Override
@@ -56,18 +82,21 @@ public class AnimateableViewBounds extends ViewOutlineProvider {
        }
    }

    /**
     * Animates the bottom clip.
     */
    public void animateClipBottom(int bottom) {
        ObjectAnimator animator = ObjectAnimator.ofInt(this, CLIP_BOTTOM, getClipBottom(), bottom);
        animator.setDuration(150);
        animator.start();
    }

    /** Sets the bottom clip. */
    public void setClipBottom(int bottom, boolean force) {
        if (bottom != mClipRect.bottom || force) {
            mClipRect.bottom = bottom;
            mSourceView.invalidateOutline();
            updateClipBounds();

            RecentsConfiguration config = Recents.getConfiguration();
            if (!config.useHardwareLayers) {
                mSourceView.mThumbnailView.updateThumbnailVisibility(
                        bottom - mSourceView.getPaddingBottom());
            }
        }
    }

@@ -76,6 +105,20 @@ public class AnimateableViewBounds extends ViewOutlineProvider {
        return mClipRect.bottom;
    }

    /** Sets the right clip. */
    public void setClipRight(int right, boolean force) {
        if (right != mClipRect.right || force) {
            mClipRect.right = right;
            mSourceView.invalidateOutline();
            updateClipBounds();
        }
    }

    /** Returns the right clip. */
    public int getClipRight() {
        return mClipRect.right;
    }

    private void updateClipBounds() {
        mClipBounds.set(mClipRect.left, mClipRect.top,
                mSourceView.getWidth() - mClipRect.right,
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public class FreeformWorkspaceLayoutAlgorithm {
            transformOut.rect.offset(transformOut.translationX, transformOut.translationY);
            Utilities.scaleRectAboutCenter(transformOut.rect, transformOut.scale);
            transformOut.visible = true;
            transformOut.p = 0;
            transformOut.p = 1f;

            if (DEBUG) {
                Log.d(TAG, "getTransform: " + task.key + ", " + transformOut);
Loading