From 5f8afe6280eae34620067696173e71943e1a30a3 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 12 Aug 2013 16:19:28 -0700 Subject: Initial Changes for Dynamic Grid Change-Id: I9e6f1e5167791cf8dc140778dfa447f86424e9bf --- src/com/android/launcher3/Hotseat.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/com/android/launcher3/Hotseat.java') diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index f94ed7829..d28e96f2d 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -37,11 +37,8 @@ public class Hotseat extends FrameLayout { @SuppressWarnings("unused") private static final String TAG = "Hotseat"; - private Launcher mLauncher; private CellLayout mContent; - private int mCellCountX; - private int mCellCountY; private int mAllAppsButtonRank; private boolean mTransposeLayoutWithOrientation; @@ -61,9 +58,6 @@ public class Hotseat extends FrameLayout { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Hotseat, defStyle, 0); Resources r = context.getResources(); - mCellCountX = a.getInt(R.styleable.Hotseat_cellCountX, -1); - mCellCountY = a.getInt(R.styleable.Hotseat_cellCountY, -1); - mAllAppsButtonRank = r.getInteger(R.integer.hotseat_all_apps_index); mTransposeLayoutWithOrientation = r.getBoolean(R.bool.hotseat_transpose_layout_with_orientation); mIsLandscape = context.getResources().getConfiguration().orientation == @@ -71,7 +65,6 @@ public class Hotseat extends FrameLayout { } public void setup(Launcher launcher) { - mLauncher = launcher; setOnKeyListener(new HotseatIconKeyEventListener()); } @@ -101,10 +94,16 @@ public class Hotseat extends FrameLayout { @Override protected void onFinishInflate() { super.onFinishInflate(); - if (mCellCountX < 0) mCellCountX = LauncherModel.getCellCountX(); - if (mCellCountY < 0) mCellCountY = LauncherModel.getCellCountY(); + LauncherAppState app = LauncherAppState.getInstance(); + DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + + mAllAppsButtonRank = (int) (grid.numHotseatIcons / 2); mContent = (CellLayout) findViewById(R.id.layout); - mContent.setGridSize(mCellCountX, mCellCountY); + if (grid.isLandscape && !grid.isLargeTablet()) { + mContent.setGridSize(1, (int) grid.numHotseatIcons); + } else { + mContent.setGridSize((int) grid.numHotseatIcons, 1); + } mContent.setIsHotseat(true); resetLayout(); -- cgit v1.2.3