diff options
author | Raj Yengisetty <rajesh@cyngn.com> | 2014-06-17 15:23:41 -0700 |
---|---|---|
committer | Abhisek Devkota <ciwrl@cyanogenmod.com> | 2014-06-23 21:23:33 +0000 |
commit | a5ee6730d45a4c5f6ccbce4d6332881f5f15d9b6 (patch) | |
tree | 1e184c8e4744680320e0f236b593b09259b29fb6 /src/com/android/launcher3/DeviceProfile.java | |
parent | 94ba73919c6219be8054696b1a23ef0d97bc64fb (diff) | |
download | android_packages_apps_Trebuchet-a5ee6730d45a4c5f6ccbce4d6332881f5f15d9b6.tar.gz android_packages_apps_Trebuchet-a5ee6730d45a4c5f6ccbce4d6332881f5f15d9b6.tar.bz2 android_packages_apps_Trebuchet-a5ee6730d45a4c5f6ccbce4d6332881f5f15d9b6.zip |
Customizeable Dynamic Grid:
- Presets
- Comfortable (+0)
- Cozy (+1)
- Condensed (+2)
- Custom option with min, max
Reordering items in the settings pane for better organization
Modifying Settings Layout for readability
Change-Id: I5c926b6ca4b2ed73c263ef34eeb368caeb7af9b5
Diffstat (limited to 'src/com/android/launcher3/DeviceProfile.java')
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 28951db94..99819caf3 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -62,11 +62,45 @@ public class DeviceProfile { public void onAvailableSizeChanged(DeviceProfile grid); } + public final static int GRID_SIZE_MAX = 3; + public final static int GRID_SIZE_MIN = 2; + + public enum GridSize { + Comfortable(0), + Cozy(1), + Condensed(2), + Custom(3); + + private final int mValue; + private GridSize(int value) { + mValue = value; + } + + public int getValue() { + return mValue; + } + + public static GridSize getModeForValue(int value) { + switch (value) { + case 1: + return Cozy; + case 2: + return Condensed; + case 3: + return Custom; + default : + return Comfortable; + } + } + } + String name; float minWidthDps; float minHeightDps; float numRows; float numColumns; + int numRowsBase; + int numColumnsBase; float numHotseatIcons; private float iconSize; private float iconTextSize; @@ -191,12 +225,34 @@ public class DeviceProfile { points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.numRows)); } numRows = Math.round(invDistWeightedInterpolate(minWidth, minHeight, points)); + numRowsBase = (int) numRows; + int gridResize = SettingsProvider.getIntCustomDefault(context, + SettingsProvider.SETTINGS_UI_DYNAMIC_GRID_SIZE, 0); + if (GridSize.getModeForValue(gridResize) != GridSize.Custom) { + numRows += gridResize; + } else { + int iTempNumberOfRows = SettingsProvider.getIntCustomDefault(context, + SettingsProvider.SETTINGS_UI_HOMESCREEN_ROWS, (int)numRows); + if (iTempNumberOfRows > 0) { + numRows = iTempNumberOfRows; + } + } // Interpolate the columns points.clear(); for (DeviceProfile p : profiles) { points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.numColumns)); } numColumns = Math.round(invDistWeightedInterpolate(minWidth, minHeight, points)); + numColumnsBase = (int) numColumns; + if (GridSize.getModeForValue(gridResize) != GridSize.Custom) { + numColumns += gridResize; + } else { + int iTempNumberOfColumns = SettingsProvider.getIntCustomDefault(context, + SettingsProvider.SETTINGS_UI_HOMESCREEN_COLUMNS, (int)numColumns); + if (iTempNumberOfColumns > 0) { + numColumns = iTempNumberOfColumns; + } + } // Interpolate the hotseat length points.clear(); for (DeviceProfile p : profiles) { |