diff options
author | Adam Cohen <adamcohen@google.com> | 2015-05-06 11:42:25 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2015-05-21 16:16:40 -0700 |
commit | 2e6da1539bc7286336b3c24d96ab76434939ce4d (patch) | |
tree | 38c7387dc9a5f6f084c4998aac88495189423d3b /src/com/android/launcher3/Hotseat.java | |
parent | a9d012c6e67b644498e07c63f36617c1b8915e02 (diff) | |
download | android_packages_apps_Trebuchet-2e6da1539bc7286336b3c24d96ab76434939ce4d.tar.gz android_packages_apps_Trebuchet-2e6da1539bc7286336b3c24d96ab76434939ce4d.tar.bz2 android_packages_apps_Trebuchet-2e6da1539bc7286336b3c24d96ab76434939ce4d.zip |
Refactoring DeviceProfile
-> Pulling out the parts of device profile which can (and need to be)
initialized and accessed without access to an Activity context,
ie. the invariant bits.
-> The invariant bits are stored in InvariantDeviceProfile which is
initialized statically from LauncherAppState.
-> The DeviceProfile contains the Activity context-dependent bits,
and we will create one of these for each Activity instance, and
this instance is accessed through the Launcher activity.
-> It's possible that we can continue to refactor this such that
all appropriate dimensions can be computed without an Activity
context (by only specifying orientation). This would be an
extension of this CL and allow us to know exactly how launcher
will look in both orientations from any context.
Sets the stage for some improvements around b/19514688
Change-Id: Ia7daccf14d8ca2b9cb340b8780b684769e9f1892
Diffstat (limited to 'src/com/android/launcher3/Hotseat.java')
-rw-r--r-- | src/com/android/launcher3/Hotseat.java | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index b8337b6a4..1c1342cfe 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -54,10 +54,7 @@ public class Hotseat extends FrameLayout { r.getBoolean(R.bool.hotseat_transpose_layout_with_orientation); mIsLandscape = context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; - } - - public void setup(Launcher launcher) { - mLauncher = launcher; + mLauncher = (Launcher) context; } CellLayout getLayout() { @@ -108,15 +105,14 @@ public class Hotseat extends FrameLayout { @Override protected void onFinishInflate() { super.onFinishInflate(); - LauncherAppState app = LauncherAppState.getInstance(); - DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + DeviceProfile grid = mLauncher.getDeviceProfile(); - mAllAppsButtonRank = grid.hotseatAllAppsRank; + mAllAppsButtonRank = grid.inv.hotseatAllAppsRank; mContent = (CellLayout) findViewById(R.id.layout); if (grid.isLandscape && !grid.isLargeTablet()) { - mContent.setGridSize(1, (int) grid.numHotseatIcons); + mContent.setGridSize(1, (int) grid.inv.numHotseatIcons); } else { - mContent.setGridSize((int) grid.numHotseatIcons, 1); + mContent.setGridSize((int) grid.inv.numHotseatIcons, 1); } mContent.setIsHotseat(true); |