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

Commit 8cd63668 authored by Abhishek Aggarwal's avatar Abhishek Aggarwal Committed by Mohammed Althaf T
Browse files

redorder fixes

parent 9341970b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -595,6 +595,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
        if (!wobbleExpireAlarm.alarmPending()) {
            wobbleExpireAlarm.setAlarm(WOBBLE_EXPIRATION_TIMEOUT);
        }

        clearEmptyCell();
    }

    /**
@@ -2673,7 +2675,6 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>

    protected void manageReorderOnDragOver(DragObject d, float targetCellDistance,
            boolean nearestDropOccupied, int minSpanX, int minSpanY, int reorderX, int reorderY) {

        ItemInfo item = d.dragInfo;
        final View child = (mDragInfo == null) ? null : mDragInfo.cell;
        if (!nearestDropOccupied) {
@@ -3314,7 +3315,6 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
            cell.setVisibility(VISIBLE);
        }
        mDragInfo = null;
        clearEmptyCell();
    }

    private void clearEmptyCell() {
+18 −4
Original line number Diff line number Diff line
@@ -216,12 +216,15 @@ public class ReorderAlgorithm {
        //}

        // Ok, they couldn't move as a block, let's move them individually
        boolean success = false;
        for (View v : mIntersectingViews) {
            if (!addViewToTempLocation(v, mOccupiedRect, direction, solution)) {
                return false;
            } else {
                success = true;
            }
        }
        return true;
        return success;
    }

    private boolean addViewToTempLocation(View v, Rect rectOccupiedByPotentialDrop, int[] direction,
@@ -234,6 +237,15 @@ public class ReorderAlgorithm {
        int[] tmpLocation = findNearestArea(c.cellX, c.cellY, c.spanX, c.spanY, direction,
                mCellLayout.mTmpOccupied.cells, null, new int[2]);

        int[] vacantCell = new int[2];
        mCellLayout.mTmpOccupied.findVacantCell(vacantCell, c.spanX, c.spanY);
        if (vacantCell[0] >= 0 && vacantCell[1] >= 0) {
            if (!mCellLayout.mTmpOccupied.cells[vacantCell[0]][vacantCell[1]]) {
                tmpLocation[0] = vacantCell[0];
                tmpLocation[1] = vacantCell[1];
            }
        }

        if (tmpLocation[0] >= 0 && tmpLocation[1] >= 0) {
            c.cellX = tmpLocation[0];
            c.cellY = tmpLocation[1];
@@ -550,8 +562,10 @@ public class ReorderAlgorithm {
    public ItemConfiguration calculateReorder(ReorderParameters reorderParameters) {
        getDirectionVectorForDrop(reorderParameters, mCellLayout.mDirectionVector);

        if (!mCellLayout.isWidget() && !mCellLayout.findCellForSpan(null,
                reorderParameters.getMinSpanX(), reorderParameters.getMinSpanY())) {
        int[] vacantCell = new int[2];
        boolean isVacantCellAvailable = mCellLayout.findCellForSpan(vacantCell, reorderParameters.getMinSpanX(), reorderParameters.getMinSpanY());
        if (!mCellLayout.isWidget() && !isVacantCellAvailable &&
                !mCellLayout.isOccupied(vacantCell[0], vacantCell[1])) {
            ItemConfiguration solution = new ItemConfiguration();
            solution.cellX = solution.cellY = solution.spanX = solution.spanY = -1;
            solution.isSolution =  true;