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

Commit bdd65226 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Update recents child views RTL handling" into ub-launcher3-rvc-dev

parents 26cdf42c 08a8327b
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
    private final SingleAxisSwipeDetector mDetector;
    private final RecentsView mRecentsView;
    private final int[] mTempCords = new int[2];
    private final boolean mIsRtl;

    private PendingAnimation mPendingAnimation;
    private AnimatorPlaybackController mCurrentAnimation;
@@ -75,6 +76,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
    public TaskViewTouchController(T activity) {
        mActivity = activity;
        mRecentsView = activity.getOverviewPanel();
        mIsRtl = Utilities.isRtl(activity.getResources());
        SingleAxisSwipeDetector.Direction dir =
            mRecentsView.getPagedOrientationHandler().getOppositeSwipeDirection();
        mDetector = new SingleAxisSwipeDetector(activity, this, dir);
@@ -201,8 +203,8 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
        mCurrentAnimationIsGoingUp = goingUp;
        BaseDragLayer dl = mActivity.getDragLayer();
        final int secondaryLayerDimension = orientationHandler.getSecondaryDimension(dl);
        long maxDuration = (long) (2 * secondaryLayerDimension);
        int verticalFactor = -orientationHandler.getTaskDismissDirectionFactor();
        long maxDuration = 2 * secondaryLayerDimension;
        int verticalFactor = orientationHandler.getTaskDragDisplacementFactor(mIsRtl);
        int secondaryTaskDimension = orientationHandler.getSecondaryDimension(mTaskBeingDragged);
        if (goingUp) {
            mPendingAnimation = mRecentsView.createTaskDismissAnimation(mTaskBeingDragged,
@@ -236,7 +238,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
    public void onDragStart(boolean start, float startDisplacement) {
        PagedOrientationHandler orientationHandler = mRecentsView.getPagedOrientationHandler();
        if (mCurrentAnimation == null) {
            reInitAnimationController(orientationHandler.isGoingUp(startDisplacement));
            reInitAnimationController(orientationHandler.isGoingUp(startDisplacement, mIsRtl));
            mDisplacementShift = 0;
        } else {
            mDisplacementShift = mCurrentAnimation.getProgressFraction() / mProgressMultiplier;
@@ -250,7 +252,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
        PagedOrientationHandler orientationHandler = mRecentsView.getPagedOrientationHandler();
        float totalDisplacement = displacement + mDisplacementShift;
        boolean isGoingUp = totalDisplacement == 0 ? mCurrentAnimationIsGoingUp :
                orientationHandler.isGoingUp(totalDisplacement);
                orientationHandler.isGoingUp(totalDisplacement, mIsRtl);
        if (isGoingUp != mCurrentAnimationIsGoingUp) {
            reInitAnimationController(isGoingUp);
            mFlingBlockCheck.blockFling();
@@ -282,7 +284,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
        float interpolatedProgress = mCurrentAnimation.getInterpolatedProgress();
        if (fling) {
            logAction = Touch.FLING;
            boolean goingUp = orientationHandler.isGoingUp(velocity);
            boolean goingUp = orientationHandler.isGoingUp(velocity, mIsRtl);
            goingToEnd = goingUp == mCurrentAnimationIsGoingUp;
        } else {
            logAction = Touch.SWIPE;
+7 −1
Original line number Diff line number Diff line
@@ -64,7 +64,13 @@ public class ClearAllButton extends Button implements PageCallbacks {
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        mParent = (RecentsView) getParent();
        mIsRtl = !mParent.getPagedOrientationHandler().getRecentsRtlSetting(getResources());
        mIsRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
    }

    @Override
    public void onRtlPropertiesChanged(int layoutDirection) {
        super.onRtlPropertiesChanged(layoutDirection);
        mIsRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
    }

    @Override
+6 −1
Original line number Diff line number Diff line
@@ -1608,7 +1608,12 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        if (mOrientationState.update(touchRotation, displayRotation)) {
            mOrientationHandler = mOrientationState.getOrientationHandler();
            mIsRtl = mOrientationHandler.getRecentsRtlSetting(getResources());
            setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
            setLayoutDirection(mIsRtl
                    ? View.LAYOUT_DIRECTION_RTL
                    : View.LAYOUT_DIRECTION_LTR);
            mClearAllButton.setLayoutDirection(mIsRtl
                    ? View.LAYOUT_DIRECTION_LTR
                    : View.LAYOUT_DIRECTION_RTL);
            mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated());
            mActivity.getDragLayer().recreateControllers();
            mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION,
+2 −2
Original line number Diff line number Diff line
@@ -449,13 +449,13 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {

    public void setOrientationState(RecentsOrientedState orientationState) {
        PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
        boolean isRtl = orientationHandler.getRecentsRtlSetting(getResources());
        boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
        LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
        int thumbnailPadding = (int) getResources().getDimension(R.dimen.task_thumbnail_top_margin);
        LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams();
        switch (orientationHandler.getRotation()) {
            case Surface.ROTATION_90:
                iconParams.gravity = (isRtl ? END : START) | CENTER_VERTICAL;
                iconParams.gravity = (isRtl ? START : END) | CENTER_VERTICAL;
                iconParams.rightMargin = -thumbnailPadding;
                iconParams.leftMargin = 0;
                iconParams.topMargin = snapshotParams.topMargin / 2;
+6 −7
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.widget.LinearLayout;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.PagedView;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.OverScroller;
@@ -74,8 +73,8 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
    }

    @Override
    public boolean isGoingUp(float displacement) {
        return displacement > 0;
    public boolean isGoingUp(float displacement, boolean isRtl) {
        return isRtl ? displacement < 0 : displacement > 0;
    }

    @Override
@@ -226,13 +225,13 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
    }

    @Override
    public int getShortEdgeLength(DeviceProfile dp) {
        return dp.heightPx;
    public int getTaskDismissDirectionFactor() {
        return 1;
    }

    @Override
    public int getTaskDismissDirectionFactor() {
        return 1;
    public int getTaskDragDisplacementFactor(boolean isRtl) {
        return isRtl ? 1 : -1;
    }

    @Override
Loading