Cleaning up grid size specification in Launcher
This commit eliminates the notion of in-place rotations and a bunch of
associated complexities (including the notion of canonical coordinates).
Further, the number of x and y cells per workspace screen is now being stored
in a single location in the XML definition of Workspace. This fixes a couple
bugs where incorrect values were being used. Finally, eliminated the notion of
"shortAxis" and "longAxis" in terms of padding and cell count. These have been
translated to corresponding x and y axis values.
Change-Id: I30cfed66f82d739355b3f01730b28b6c0437989c
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 1f13f1f..8d38a3d6 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -24,14 +24,16 @@
<include layout="@layout/all_apps" />
- <!-- The workspace contains 3 screens of cells -->
+ <!-- The workspace contains 5 screens of cells -->
<com.android.launcher2.Workspace
android:id="@+id/workspace"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="horizontal"
android:fadeScrollbars="true"
- launcher:defaultScreen="2">
+ launcher:defaultScreen="2"
+ launcher:cellCountX="4"
+ launcher:cellCountY="4">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
diff --git a/res/layout-land/workspace_screen.xml b/res/layout-land/workspace_screen.xml
index 315e68b..9323f58 100644
--- a/res/layout-land/workspace_screen.xml
+++ b/res/layout-land/workspace_screen.xml
@@ -24,9 +24,7 @@
launcher:cellWidth="@dimen/workspace_cell_width"
launcher:cellHeight="@dimen/workspace_cell_height"
- launcher:longAxisStartPadding="65dip"
- launcher:longAxisEndPadding="65dip"
- launcher:shortAxisStartPadding="0dip"
- launcher:shortAxisEndPadding="0dip"
- launcher:shortAxisCells="4"
- launcher:longAxisCells="4" />
+ launcher:xAxisStartPadding="65dip"
+ launcher:xAxisEndPadding="65dip"
+ launcher:yAxisStartPadding="0dip"
+ launcher:yAxisEndPadding="0dip"/>
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index 8dc5092..c50dbca 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -24,12 +24,14 @@
<include layout="@layout/all_apps" />
- <!-- The workspace contains 3 screens of cells -->
+ <!-- The workspace contains 5 screens of cells -->
<com.android.launcher2.Workspace
android:id="@+id/workspace"
android:layout_width="match_parent"
android:layout_height="match_parent"
- launcher:defaultScreen="2">
+ launcher:defaultScreen="2"
+ launcher:cellCountX="4"
+ launcher:cellCountY="4">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
diff --git a/res/layout-port/workspace_screen.xml b/res/layout-port/workspace_screen.xml
index 96df91b..f400c40 100644
--- a/res/layout-port/workspace_screen.xml
+++ b/res/layout-port/workspace_screen.xml
@@ -24,9 +24,7 @@
launcher:cellWidth="@dimen/workspace_cell_width"
launcher:cellHeight="@dimen/workspace_cell_height"
- launcher:longAxisStartPadding="8dip"
- launcher:longAxisEndPadding="@dimen/button_bar_height"
- launcher:shortAxisStartPadding="0dip"
- launcher:shortAxisEndPadding="0dip"
- launcher:shortAxisCells="4"
- launcher:longAxisCells="4" />
+ launcher:yAxisStartPadding="8dip"
+ launcher:yAxisEndPadding="@dimen/button_bar_height"
+ launcher:xAxisStartPadding="0dip"
+ launcher:xAxisEndPadding="0dip" />
diff --git a/res/layout-xlarge/launcher.xml b/res/layout-xlarge/launcher.xml
index fa323fd..0dd25d2 100644
--- a/res/layout-xlarge/launcher.xml
+++ b/res/layout-xlarge/launcher.xml
@@ -35,8 +35,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
launcher:defaultScreen="2"
- launcher:canonicalDeviceWidth="8"
- launcher:canonicalDeviceHeight="4">
+ launcher:cellCountX="8"
+ launcher:cellCountY="4">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
diff --git a/res/layout-xlarge/workspace_screen.xml b/res/layout-xlarge/workspace_screen.xml
index aa892b9..6a34975 100644
--- a/res/layout-xlarge/workspace_screen.xml
+++ b/res/layout-xlarge/workspace_screen.xml
@@ -24,9 +24,7 @@
launcher:cellWidth="@dimen/workspace_cell_width"
launcher:cellHeight="@dimen/workspace_cell_height"
- launcher:longAxisStartPadding="8dip"
- launcher:longAxisEndPadding="8dip"
- launcher:shortAxisStartPadding="8dip"
- launcher:shortAxisEndPadding="8dip"
- launcher:shortAxisCells="4"
- launcher:longAxisCells="8" />
+ launcher:yAxisStartPadding="8dip"
+ launcher:yAxisEndPadding="8dip"
+ launcher:xAxisStartPadding="8dip"
+ launcher:xAxisEndPadding="8dip"/>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index c977f97..be27288 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -32,10 +32,10 @@
<declare-styleable name="Workspace">
<!-- The first screen the workspace should display. -->
<attr name="defaultScreen" format="integer" />
- <!-- The number of horizontal cells for the device in its natural orientation -->
- <attr name="canonicalDeviceWidth" format="integer" />
- <!-- The number of vertical cells for the device in its natural orientation -->
- <attr name="canonicalDeviceHeight" format="integer" />
+ <!-- The number of horizontal cells in the CellLayout -->
+ <attr name="cellCountX" format="integer" />
+ <!-- The number of vertical cells in the CellLayout -->
+ <attr name="cellCountY" format="integer" />
</declare-styleable>
<!-- CellLayout specific attributes. These attributes are used to customize
@@ -46,17 +46,13 @@
<!-- The height of a single cell -->
<attr name="cellHeight" format="dimension" />
<!-- Padding to apply at the start of the long axis -->
- <attr name="longAxisStartPadding" format="dimension" />
+ <attr name="xAxisStartPadding" format="dimension" />
<!-- Padding to apply at the end of the long axis -->
- <attr name="longAxisEndPadding" format="dimension" />
+ <attr name="xAxisEndPadding" format="dimension" />
<!-- Padding to apply at the start of the short axis -->
- <attr name="shortAxisStartPadding" format="dimension" />
+ <attr name="yAxisStartPadding" format="dimension" />
<!-- Padding to apply at the end of the short axis -->
- <attr name="shortAxisEndPadding" format="dimension" />
- <!-- Number of cells on the short axis of the CellLayout -->
- <attr name="shortAxisCells" format="integer" />
- <!-- Number of cells on the long axis of the CellLayout -->
- <attr name="longAxisCells" format="integer" />
+ <attr name="yAxisEndPadding" format="dimension" />
</declare-styleable>
<!-- DeleteZone specific attributes. These attributes are used to customize