/** Adds a match to align the left edge with some other edge. */ private void addLeftSideMatch(int x1, List<GridMatch> columnMatches, int max) { int column = (mGrid.getViewCount() == 0) ? 0 : mGrid.getClosestColumn(x1); int columnX = mGrid.getColumnX(column); int distance = abs(columnX - x1); if (distance <= max) { columnMatches.add( new GridMatch(SegmentType.LEFT, distance, columnX, column, false, UNDEFINED)); } }
/** Adds a match to align the right edge with some other edge. */ private void addRightSideMatch(int x2, List<GridMatch> columnMatches, int max) { // TODO: Only match the right hand side if the drag bounds fit fully within the // cell! Ditto for match below. int columnRight = (mGrid.getViewCount() == 0) ? 0 : mGrid.getClosestColumn(x2); int rightDistance = mGrid.getColumnDistance(columnRight, x2); if (rightDistance < max) { int columnX = mGrid.getColumnX(columnRight); if (columnX > mGrid.layout.getBounds().x) { columnMatches.add( new GridMatch( SegmentType.RIGHT, rightDistance, columnX, columnRight, false, UNDEFINED)); } } }