OSDN Git Service

am b82cc0cc: am 1fd2c158: am 32271c3d: Tweak calculation for number of columns and...
authorMichael Jurka <mikejurka@google.com>
Fri, 3 Jun 2011 21:43:36 +0000 (14:43 -0700)
committerAndroid Git Automerger <android-git-automerger@android.com>
Fri, 3 Jun 2011 21:43:36 +0000 (14:43 -0700)
* commit 'b82cc0cc9b61eef0670dc7fddc53813455ca2f4d':
  Tweak calculation for number of columns and rows

1  2 
src/com/android/launcher2/CellLayout.java

@@@ -271,72 -273,28 +271,65 @@@ public class CellLayout extends ViewGro
          // We use this method from Workspace to figure out how many rows/columns Launcher should
          // have. We ignore the left/right padding on CellLayout because it turns out in our design
          // the padding extends outside the visible screen size, but it looked fine anyway.
-         // However, we make sure there's at least enough space for the crosshairs at either
-         // edge to be rendered (half the crosshair is sticking out on either side)
          int cellWidth = r.getDimensionPixelSize(R.dimen.workspace_cell_width);
          int widthGap = r.getDimensionPixelSize(R.dimen.workspace_width_gap_port);
-         int crosshairsSize = r.getDrawable(R.drawable.gardening_crosshairs).getIntrinsicWidth();
  
-         return  widthGap * (numCells - 1) + cellWidth * numCells + crosshairsSize;
+         return  widthGap * (numCells - 1) + cellWidth * numCells;
      }
  
 +    static int widthInLandscape(Resources r, int numCells) {
 +        // We use this method from Workspace to figure out how many rows/columns Launcher should
 +        // have. We ignore the left/right padding on CellLayout because it turns out in our design
 +        // the padding extends outside the visible screen size, but it looked fine anyway.
 +        // However, we make sure there's at least enough space for the crosshairs at either
 +        // edge to be rendered (half the crosshair is sticking out on either side)
 +        int cellWidth = r.getDimensionPixelSize(R.dimen.workspace_cell_width);
 +        int widthGap = r.getDimensionPixelSize(R.dimen.workspace_width_gap_land);
 +        int crosshairsSize = r.getDrawable(R.drawable.gardening_crosshairs).getIntrinsicWidth();
 +
 +        return widthGap * (numCells - 1) + cellWidth * numCells + crosshairsSize;
 +    }
 +
 +    static int heightInPortrait(Resources r, int numCells) {
 +        // We use this method from Workspace to figure out how many rows/columns Launcher should
 +        // have. We ignore the left/right padding on CellLayout because it turns out in our design
 +        // the padding extends outside the visible screen size, but it looked fine anyway.
 +        // However, we make sure there's at least enough space for the crosshairs at the bottom
 +        // to be rendered (half the crosshair is sticking out); we don't worry about the top
 +        // crosshair since it can bleed into the action bar space
 +        int cellHeight = r.getDimensionPixelSize(R.dimen.workspace_cell_height);
 +        int heightGap = r.getDimensionPixelSize(R.dimen.workspace_height_gap_port);
 +        int crosshairsSize = r.getDrawable(R.drawable.gardening_crosshairs).getIntrinsicHeight();
 +
 +        return heightGap * (numCells - 1) + cellHeight * numCells + (crosshairsSize + 1) / 2;
 +    }
 +
      static int heightInLandscape(Resources r, int numCells) {
          // We use this method from Workspace to figure out how many rows/columns Launcher should
          // have. We ignore the left/right padding on CellLayout because it turns out in our design
          // the padding extends outside the visible screen size, but it looked fine anyway.
-         // However, we make sure there's at least enough space for the crosshairs at the bottom
-         // to be rendered (half the crosshair is sticking out); we don't worry about the top
-         // crosshair since it can bleed into the action bar space
          int cellHeight = r.getDimensionPixelSize(R.dimen.workspace_cell_height);
          int heightGap = r.getDimensionPixelSize(R.dimen.workspace_height_gap_land);
-         int crosshairsSize = r.getDrawable(R.drawable.gardening_crosshairs).getIntrinsicHeight();
  
-         return heightGap * (numCells - 1) + cellHeight * numCells + (crosshairsSize + 1) / 2;
+         return heightGap * (numCells - 1) + cellHeight * numCells;
      }
  
 +    public void enableHardwareLayers() {
 +        mChildren.enableHardwareLayers();
 +    }
 +
 +    public void setGridSize(int x, int y) {
 +        mCountX = x;
 +        mCountY = y;
 +        mOccupied = new boolean[mCountX][mCountY];
 +    }
 +
      private void invalidateBubbleTextView(BubbleTextView icon) {
          final int padding = icon.getPressedOrFocusedBackgroundPadding();
 -        invalidate(icon.getLeft() - padding,
 -                icon.getTop() - padding,
 -                icon.getRight() + padding,
 -                icon.getBottom() + padding);
 +        invalidate(icon.getLeft() + getLeftPadding() - padding,
 +                icon.getTop() + getTopPadding() - padding,
 +                icon.getRight() + getLeftPadding() + padding,
 +                icon.getBottom() + getTopPadding() + padding);
      }
  
      void setPressedOrFocusedIcon(BubbleTextView icon) {