Merge "Updating folder grid sizes for various devices" into ub-launcher3-burnaby

This commit is contained in:
Sunny Goyal
2015-05-11 22:53:47 +00:00
committed by Android (Google) Code Review
3 changed files with 29 additions and 27 deletions
+16 -6
View File
@@ -69,8 +69,10 @@ public class DeviceProfile {
String name; String name;
float minWidthDps; float minWidthDps;
float minHeightDps; float minHeightDps;
public float numRows; public int numRows;
public float numColumns; public int numColumns;
public int numFolderRows;
public int numFolderColumns;
float numHotseatIcons; float numHotseatIcons;
float iconSize; float iconSize;
private float iconTextSize; private float iconTextSize;
@@ -137,8 +139,9 @@ public class DeviceProfile {
private ArrayList<DeviceProfileCallbacks> mCallbacks = new ArrayList<DeviceProfileCallbacks>(); private ArrayList<DeviceProfileCallbacks> mCallbacks = new ArrayList<DeviceProfileCallbacks>();
DeviceProfile(String n, float w, float h, float r, float c, DeviceProfile(String n, float w, float h,
float is, float its, float hs, float his, int dlId) { int r, int c, int fr, int fc,
float is, float its, float hs, float his, int dlId) {
// Ensure that we have an odd number of hotseat items (since we need to place all apps) // Ensure that we have an odd number of hotseat items (since we need to place all apps)
if (hs % 2 == 0) { if (hs % 2 == 0) {
throw new RuntimeException("All Device Profiles must have an odd number of hotseat spaces"); throw new RuntimeException("All Device Profiles must have an odd number of hotseat spaces");
@@ -147,8 +150,12 @@ public class DeviceProfile {
name = n; name = n;
minWidthDps = w; minWidthDps = w;
minHeightDps = h; minHeightDps = h;
numRows = r; numRows = r;
numColumns = c; numColumns = c;
numFolderRows = fr;
numFolderColumns = fc;
iconSize = is; iconSize = is;
iconTextSize = its; iconTextSize = its;
numHotseatIcons = hs; numHotseatIcons = hs;
@@ -209,6 +216,9 @@ public class DeviceProfile {
// Snap to the closest column count // Snap to the closest column count
numColumns = closestProfile.numColumns; numColumns = closestProfile.numColumns;
numFolderRows = closestProfile.numFolderRows;
numFolderColumns = closestProfile.numFolderColumns;
// Snap to the closest hotseat size // Snap to the closest hotseat size
numHotseatIcons = closestProfile.numHotseatIcons; numHotseatIcons = closestProfile.numHotseatIcons;
hotseatAllAppsRank = (int) (numHotseatIcons / 2); hotseatAllAppsRank = (int) (numHotseatIcons / 2);
@@ -265,8 +275,8 @@ public class DeviceProfile {
DeviceProfile partnerDp = p.getDeviceProfileOverride(dm); DeviceProfile partnerDp = p.getDeviceProfileOverride(dm);
if (partnerDp != null) { if (partnerDp != null) {
if (partnerDp.numRows > 0 && partnerDp.numColumns > 0) { if (partnerDp.numRows > 0 && partnerDp.numColumns > 0) {
numRows = partnerDp.numRows; numRows = numFolderRows = partnerDp.numRows;
numColumns = partnerDp.numColumns; numColumns = numFolderColumns = partnerDp.numColumns;
} }
if (partnerDp.allAppsShortEdgeCount > 0 && partnerDp.allAppsLongEdgeCount > 0) { if (partnerDp.allAppsShortEdgeCount > 0 && partnerDp.allAppsLongEdgeCount > 0) {
allAppsShortEdgeCount = partnerDp.allAppsShortEdgeCount; allAppsShortEdgeCount = partnerDp.allAppsShortEdgeCount;
+11 -11
View File
@@ -59,30 +59,30 @@ public class DynamicGrid {
DEFAULT_ICON_SIZE_PX = pxFromDp(DEFAULT_ICON_SIZE_DP, dm); DEFAULT_ICON_SIZE_PX = pxFromDp(DEFAULT_ICON_SIZE_DP, dm);
// Our phone profiles include the bar sizes in each orientation // Our phone profiles include the bar sizes in each orientation
deviceProfiles.add(new DeviceProfile("Super Short Stubby", deviceProfiles.add(new DeviceProfile("Super Short Stubby",
255, 300, 2, 3, 48, 13, 3, 48, R.xml.default_workspace_4x4)); 255, 300, 2, 3, 2, 3, 48, 13, 3, 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Shorter Stubby", deviceProfiles.add(new DeviceProfile("Shorter Stubby",
255, 400, 3, 3, 48, 13, 3, 48, R.xml.default_workspace_4x4)); 255, 400, 3, 3, 3, 3, 48, 13, 3, 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Short Stubby", deviceProfiles.add(new DeviceProfile("Short Stubby",
275, 420, 3, 4, 48, 13, 5, 48, R.xml.default_workspace_4x4)); 275, 420, 3, 4, 3, 4, 48, 13, 5, 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Stubby", deviceProfiles.add(new DeviceProfile("Stubby",
255, 450, 3, 4, 48, 13, 5, 48, R.xml.default_workspace_4x4)); 255, 450, 3, 4, 3, 4, 48, 13, 5, 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Nexus S", deviceProfiles.add(new DeviceProfile("Nexus S",
296, 491.33f, 4, 4, 48, 13, 5, 48, R.xml.default_workspace_4x4)); 296, 491.33f, 4, 4, 4, 4, 48, 13, 5, 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Nexus 4", deviceProfiles.add(new DeviceProfile("Nexus 4",
335, 567, 4, 4, DEFAULT_ICON_SIZE_DP, 13, 5, 56, R.xml.default_workspace_4x4)); 335, 567, 4, 4, 4, 4, DEFAULT_ICON_SIZE_DP, 13, 5, 56, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Nexus 5", deviceProfiles.add(new DeviceProfile("Nexus 5",
359, 567, 4, 4, DEFAULT_ICON_SIZE_DP, 13, 5, 56, R.xml.default_workspace_4x4)); 359, 567, 4, 4, 4, 4, DEFAULT_ICON_SIZE_DP, 13, 5, 56, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Large Phone", deviceProfiles.add(new DeviceProfile("Large Phone",
406, 694, 5, 5, 64, 14.4f, 5, 56, R.xml.default_workspace_5x5)); 406, 694, 5, 5, 4, 4, 64, 14.4f, 5, 56, R.xml.default_workspace_5x5));
// The tablet profile is odd in that the landscape orientation // The tablet profile is odd in that the landscape orientation
// also includes the nav bar on the side // also includes the nav bar on the side
deviceProfiles.add(new DeviceProfile("Nexus 7", deviceProfiles.add(new DeviceProfile("Nexus 7",
575, 904, 5, 6, 72, 14.4f, 7, 60, R.xml.default_workspace_5x6)); 575, 904, 5, 6, 4, 5, 72, 14.4f, 7, 60, R.xml.default_workspace_5x6));
// Larger tablet profiles always have system bars on the top & bottom // Larger tablet profiles always have system bars on the top & bottom
deviceProfiles.add(new DeviceProfile("Nexus 10", deviceProfiles.add(new DeviceProfile("Nexus 10",
727, 1207, 5, 6, 76, 14.4f, 7, 64, R.xml.default_workspace_5x6)); 727, 1207, 5, 6, 4, 5, 76, 14.4f, 7, 64, R.xml.default_workspace_5x6));
deviceProfiles.add(new DeviceProfile("20-inch Tablet", deviceProfiles.add(new DeviceProfile("20-inch Tablet",
1527, 2527, 7, 7, 100, 20, 7, 72, R.xml.default_workspace_4x4)); 1527, 2527, 7, 7, 6, 6, 100, 20, 7, 72, R.xml.default_workspace_4x4));
mMinWidth = dpiFromPx(minWidthPx, dm); mMinWidth = dpiFromPx(minWidthPx, dm);
mMinHeight = dpiFromPx(minHeightPx, dm); mMinHeight = dpiFromPx(minHeightPx, dm);
mProfile = new DeviceProfile(context, deviceProfiles, mProfile = new DeviceProfile(context, deviceProfiles,
+2 -10
View File
@@ -51,9 +51,6 @@ public class FolderPagedView extends PagedView {
private static final int[] sTempPosArray = new int[2]; private static final int[] sTempPosArray = new int[2];
// TODO: Remove this restriction
private static final int MAX_ITEMS_PER_PAGE = 4;
public final boolean rtlLayout; public final boolean rtlLayout;
private final LayoutInflater mInflater; private final LayoutInflater mInflater;
@@ -80,13 +77,8 @@ public class FolderPagedView extends PagedView {
LauncherAppState app = LauncherAppState.getInstance(); LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
if (ALLOW_FOLDER_SCROLL) { mMaxCountX = (int) grid.numFolderColumns;
mMaxCountX = Math.min((int) grid.numColumns, MAX_ITEMS_PER_PAGE); mMaxCountY = (int) grid.numFolderRows;
mMaxCountY = Math.min((int) grid.numRows, MAX_ITEMS_PER_PAGE);
} else {
mMaxCountX = (int) grid.numColumns;
mMaxCountY = (int) grid.numRows;
}
mMaxItemsPerPage = mMaxCountX * mMaxCountY; mMaxItemsPerPage = mMaxCountX * mMaxCountY;