diff options
author | Raj Yengisetty <rajesh@cyngn.com> | 2014-11-10 10:35:00 -0800 |
---|---|---|
committer | Adnan <adnan@cyngn.com> | 2014-11-19 15:53:57 -0800 |
commit | d784b52040dc1d688b5f98c186038ab188669040 (patch) | |
tree | 27d8940569edd2e0ff30d1f5f8b174551675943d /src/com/android/launcher3/DeviceProfile.java | |
parent | 5dc390cde4aa6efc41e145610bb993e4754fd440 (diff) | |
download | android_packages_apps_Trebuchet-d784b52040dc1d688b5f98c186038ab188669040.tar.gz android_packages_apps_Trebuchet-d784b52040dc1d688b5f98c186038ab188669040.tar.bz2 android_packages_apps_Trebuchet-d784b52040dc1d688b5f98c186038ab188669040.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
Conflicts:
res/layout/settings_pane_list_item.xml
res/values/cm_strings.xml
src/com/android/launcher3/DeviceProfile.java
src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
Change-Id: I5c926b6ca4b2ed73c263ef34eeb368caeb7af9b5
Diffstat (limited to 'src/com/android/launcher3/DeviceProfile.java')
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index c5f51d8bb..b6a8d8206 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -41,6 +41,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import com.android.launcher3.settings.SettingsProvider; class DeviceProfileQuery { DeviceProfile profile; @@ -63,11 +64,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; float iconSize; private float iconTextSize; @@ -212,6 +247,29 @@ public class DeviceProfile { numHotseatIcons = closestProfile.numHotseatIcons; hotseatAllAppsRank = (int) (numHotseatIcons / 2); + 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; + } + } + 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; + } + } + // Snap to the closest default layout id defaultLayoutId = closestProfile.defaultLayoutId; |