Search in sources :

Example 6 with CellAndSpan

use of com.android.launcher3.util.CellAndSpan in project android_packages_apps_Launcher3 by crdroidandroid.

the class CellLayout method addViewToTempLocation.

private boolean addViewToTempLocation(View v, Rect rectOccupiedByPotentialDrop, int[] direction, ItemConfiguration currentState) {
    CellAndSpan c = currentState.map.get(v);
    boolean success = false;
    mTmpOccupied.markCells(c, false);
    mTmpOccupied.markCells(rectOccupiedByPotentialDrop, true);
    findNearestArea(c.cellX, c.cellY, c.spanX, c.spanY, direction, mTmpOccupied.cells, null, mTempLocation);
    if (mTempLocation[0] >= 0 && mTempLocation[1] >= 0) {
        c.cellX = mTempLocation[0];
        c.cellY = mTempLocation[1];
        success = true;
    }
    mTmpOccupied.markCells(c, true);
    return success;
}
Also used : CellAndSpan(com.android.launcher3.util.CellAndSpan)

Example 7 with CellAndSpan

use of com.android.launcher3.util.CellAndSpan in project android_packages_apps_Launcher3 by crdroidandroid.

the class CellLayout method animateItemsToSolution.

private void animateItemsToSolution(ItemConfiguration solution, View dragView, boolean commitDragView) {
    GridOccupancy occupied = DESTRUCTIVE_REORDER ? mOccupied : mTmpOccupied;
    occupied.clear();
    int childCount = mShortcutsAndWidgets.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = mShortcutsAndWidgets.getChildAt(i);
        if (child == dragView)
            continue;
        CellAndSpan c = solution.map.get(child);
        if (c != null) {
            animateChildToPosition(child, c.cellX, c.cellY, REORDER_ANIMATION_DURATION, 0, DESTRUCTIVE_REORDER, false);
            occupied.markCells(c, true);
        }
    }
    if (commitDragView) {
        occupied.markCells(solution, true);
    }
}
Also used : CellAndSpan(com.android.launcher3.util.CellAndSpan) GridOccupancy(com.android.launcher3.util.GridOccupancy) View(android.view.View) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 8 with CellAndSpan

use of com.android.launcher3.util.CellAndSpan in project android_packages_apps_Launcher3 by crdroidandroid.

the class CellLayout method copySolutionToTempState.

private void copySolutionToTempState(ItemConfiguration solution, View dragView) {
    mTmpOccupied.clear();
    int childCount = mShortcutsAndWidgets.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = mShortcutsAndWidgets.getChildAt(i);
        if (child == dragView)
            continue;
        LayoutParams lp = (LayoutParams) child.getLayoutParams();
        CellAndSpan c = solution.map.get(child);
        if (c != null) {
            lp.tmpCellX = c.cellX;
            lp.tmpCellY = c.cellY;
            lp.cellHSpan = c.spanX;
            lp.cellVSpan = c.spanY;
            mTmpOccupied.markCells(c, true);
        }
    }
    mTmpOccupied.markCells(solution, true);
}
Also used : CellAndSpan(com.android.launcher3.util.CellAndSpan) View(android.view.View) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Aggregations

CellAndSpan (com.android.launcher3.util.CellAndSpan)8 View (android.view.View)7 LauncherAppWidgetHostView (com.android.launcher3.widget.LauncherAppWidgetHostView)7 SuppressLint (android.annotation.SuppressLint)6 Paint (android.graphics.Paint)6 Point (android.graphics.Point)6 Rect (android.graphics.Rect)3 GridOccupancy (com.android.launcher3.util.GridOccupancy)2