Setting tab bar widths automatically

- will make launcher adapt better to different screen sizes
- also, moved customization tray tab setup code from Launcher to CustomizeTrayTabHost

Change-Id: I27a1acdacd231150bf191548d155c0e94d855796
This commit is contained in:
Michael Jurka
2011-02-23 11:48:32 -08:00
parent 26976d9b53
commit 7ef959b917
14 changed files with 219 additions and 182 deletions

View File

@@ -243,6 +243,15 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
setMeasuredDimension(newWidth, newHeight);
}
int getContentWidth() {
// Return the distance from the left edge of the content of the leftmost icon to
// the right edge of the content of the rightmost icon
// icons are centered within cells, find out how much offset that accounts for
int iconHorizontalOffset = (mCellWidth - Utilities.getIconContentSize());
return mCellCountX * mCellWidth + (mCellCountX - 1) * mWidthGap - iconHorizontalOffset;
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int count = getChildCount();
@@ -281,17 +290,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
mHolographicChildren.setGap(widthGap, heightGap);
}
public void setCellDimensions(int width, int height) {
mCellWidth = width;
mCellHeight = height;
mChildren.setCellDimensions(width, height);
mHolographicChildren.setCellDimensions(width, height);
}
public int getDefaultCellDimensions() {
return sDefaultCellDimensions;
}
public int[] getCellCountForDimensions(int width, int height) {
// Always assume we're working with the smallest span to make sure we
// reserve enough space in both orientations