summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DynamicGrid.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-11-06 13:23:29 -0800
committerDanesh M <daneshm90@gmail.com>2014-06-06 00:26:02 -0700
commitce6ccc71c3a537e5affd54b3047e944e8d0388cc (patch)
treee39c510e24131593999d63b3375314b20a658b6b /src/com/android/launcher3/DynamicGrid.java
parent22d41d5089cd720dd0d53c24ee06341bb8e6108f (diff)
downloadandroid_packages_apps_Trebuchet-ce6ccc71c3a537e5affd54b3047e944e8d0388cc.tar.gz
android_packages_apps_Trebuchet-ce6ccc71c3a537e5affd54b3047e944e8d0388cc.tar.bz2
android_packages_apps_Trebuchet-ce6ccc71c3a537e5affd54b3047e944e8d0388cc.zip
Dyanmically lay out overview mode across all orientations and form factors.
Change-Id: I788bbf289717b30b19afc9ad9d611c85715bc623
Diffstat (limited to 'src/com/android/launcher3/DynamicGrid.java')
-rw-r--r--src/com/android/launcher3/DynamicGrid.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java
index fd09d4ec3..dbabb1da9 100644
--- a/src/com/android/launcher3/DynamicGrid.java
+++ b/src/com/android/launcher3/DynamicGrid.java
@@ -89,6 +89,12 @@ class DeviceProfile {
int availableHeightPx;
int defaultPageSpacingPx;
+ int overviewModeMinIconZoneHeightPx;
+ int overviewModeMaxIconZoneHeightPx;
+ int overviewModeMaxBarWidthPx;
+ float overviewModeIconZoneRatio;
+ float overviewModeScaleFactor;
+
int iconSizePx;
int iconTextSizePx;
int iconDrawablePaddingPx;
@@ -162,6 +168,16 @@ class DeviceProfile {
res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_page_spacing);
allAppsCellPaddingPx =
res.getDimensionPixelSize(R.dimen.dynamic_grid_all_apps_cell_padding);
+ overviewModeMinIconZoneHeightPx =
+ res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_min_icon_zone_height);
+ overviewModeMaxIconZoneHeightPx =
+ res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_max_icon_zone_height);
+ overviewModeMaxBarWidthPx =
+ res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_max_width);
+ overviewModeIconZoneRatio =
+ res.getInteger(R.integer.config_dynamic_grid_overview_icon_zone_percentage) / 100f;
+ overviewModeScaleFactor =
+ res.getInteger(R.integer.config_dynamic_grid_overview_scale_percentage) / 100f;
// Interpolate the rows
for (DeviceProfile p : profiles) {
@@ -467,6 +483,20 @@ class DeviceProfile {
}
}
+ Rect getOverviewModeButtonBarRect() {
+ int zoneHeight = (int) (overviewModeIconZoneRatio * availableHeightPx);
+ zoneHeight = Math.min(overviewModeMaxIconZoneHeightPx,
+ Math.max(overviewModeMinIconZoneHeightPx, zoneHeight));
+ return new Rect(0, availableHeightPx - zoneHeight, 0, availableHeightPx);
+ }
+
+ float getOverviewModeScale() {
+ Rect workspacePadding = getWorkspacePadding();
+ Rect overviewBar = getOverviewModeButtonBarRect();
+ int pageSpace = availableHeightPx - workspacePadding.top - workspacePadding.bottom;
+ return (overviewModeScaleFactor * (pageSpace - overviewBar.height())) / pageSpace;
+ }
+
// The rect returned will be extended to below the system ui that covers the workspace
Rect getHotseatRect() {
if (isVerticalBarLayout()) {
@@ -634,6 +664,7 @@ class DeviceProfile {
lp.gravity = Gravity.CENTER;
appsCustomize.setLayoutParams(lp);
+ // Layout AllApps
AppsCustomizeLayout host = (AppsCustomizeLayout)
launcher.findViewById(R.id.apps_customize_pane);
if (host != null) {
@@ -672,6 +703,17 @@ class DeviceProfile {
pagedView.setWidgetsPageIndicatorPadding(pageIndicatorHeight);
}
}
+
+ // Layout the Overview Mode
+// View overviewMode = launcher.getOverviewPanel();
+// if (overviewMode != null) {
+// Rect r = getOverviewModeButtonBarRect();
+// lp = (FrameLayout.LayoutParams) overviewMode.getLayoutParams();
+// lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
+// lp.width = Math.min(availableWidthPx, overviewModeMaxBarWidthPx);
+// lp.height = r.height();
+// overviewMode.setLayoutParams(lp);
+// }
}
}