summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2016-11-11 14:13:04 -0800
committerJon Miranda <jonmiranda@google.com>2016-11-15 11:19:03 -0800
commit93e1f04fa915fc22ecccc7e40794472914f3d446 (patch)
tree04e579fa9968421ef03f8b813c2e999785054968
parentf8d5370a9f74127c20e1ecd371a68918fe1f14ce (diff)
downloadandroid_packages_apps_Trebuchet-93e1f04fa915fc22ecccc7e40794472914f3d446.tar.gz
android_packages_apps_Trebuchet-93e1f04fa915fc22ecccc7e40794472914f3d446.tar.bz2
android_packages_apps_Trebuchet-93e1f04fa915fc22ecccc7e40794472914f3d446.zip
Hide workspace text in multi-window mode.
* Vertically centers workspace icons. * New iconDisplay value so shortcut text is not overriden. Bug: 32176631 Change-Id: I86753bab5b24aafc417e0f77d8c471fc4c0dc7f0
-rw-r--r--res/values/attrs.xml1
-rw-r--r--res/values/styles.xml1
-rw-r--r--src/com/android/launcher3/CellLayout.java4
-rw-r--r--src/com/android/launcher3/DeviceProfile.java10
-rw-r--r--src/com/android/launcher3/ShortcutAndWidgetContainer.java37
-rw-r--r--src/com/android/launcher3/folder/FolderPagedView.java1
6 files changed, 38 insertions, 16 deletions
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 3423835a9..32bccb82c 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -27,6 +27,7 @@
<enum name="all_apps" value="1" />
<enum name="folder" value="2" />
<enum name="widget_section" value="3" />
+ <enum name="shortcut_popup" value="4" />
</attr>
<attr name="deferShadowGeneration" format="boolean" />
<attr name="customShadows" format="boolean" />
diff --git a/res/values/styles.xml b/res/values/styles.xml
index bb0bc2ffb..4e70f43d0 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -108,6 +108,7 @@
<item name="android:shadowRadius">0</item>
<item name="customShadows">false</item>
<item name="layoutHorizontal">true</item>
+ <item name="iconDisplay">shortcut_popup</item>
<item name="iconSizeOverride">@dimen/deep_shortcut_icon_size</item>
</style>
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 979c9508b..84b504ebc 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -618,7 +618,9 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
public void setIsHotseat(boolean isHotseat) {
mIsHotseat = isHotseat;
- mShortcutsAndWidgets.setIsHotseat(isHotseat);
+ mShortcutsAndWidgets.setContainerType(isHotseat
+ ? ShortcutAndWidgetContainer.HOTSEAT
+ : ShortcutAndWidgetContainer.DEFAULT);
}
public boolean isHotseat() {
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index cc21920b0..483c5a9ce 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -207,7 +207,15 @@ public class DeviceProfile {
// In multi-window mode, we can have widthPx = availableWidthPx
// and heightPx = availableHeightPx because Launcher uses the InvariantDeviceProfiles'
// widthPx and heightPx values where it's needed.
- return new DeviceProfile(context, inv, mwSize, mwSize, mwSize.x, mwSize.y, isLandscape);
+ DeviceProfile profile = new DeviceProfile(context, inv, mwSize, mwSize, mwSize.x, mwSize.y,
+ isLandscape);
+
+ // Hide labels on the workspace.
+ profile.iconTextSizePx = 0;
+ profile.cellHeightPx = profile.iconSizePx + profile.iconDrawablePaddingPx
+ + Utilities.calculateTextHeight(profile.iconTextSizePx);
+
+ return profile;
}
public void addLauncherLayoutChangedListener(LauncherLayoutChangeListener listener) {
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index c8bb79306..dafc81ace 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -18,13 +18,25 @@ package com.android.launcher3;
import android.app.WallpaperManager;
import android.content.Context;
-import android.graphics.Paint;
import android.graphics.Rect;
+import android.support.annotation.IntDef;
import android.view.View;
import android.view.ViewGroup;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
public class ShortcutAndWidgetContainer extends ViewGroup {
- static final String TAG = "CellLayoutChildren";
+ static final String TAG = "ShortcutAndWidgetContainer";
+
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({DEFAULT, HOTSEAT, FOLDER})
+ public @interface ContainerType{}
+ public static final int DEFAULT = 0;
+ public static final int HOTSEAT = 1;
+ public static final int FOLDER = 2;
+
+ private int mContainerType = DEFAULT;
// These are temporary variables to prevent having to allocate a new object just to
// return an (x, y) value from helper functions. Do NOT use them to maintain other state.
@@ -32,8 +44,6 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
private final WallpaperManager mWallpaperManager;
- private boolean mIsHotseatLayout;
-
private int mCellWidth;
private int mCellHeight;
@@ -101,20 +111,19 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
mInvertIfRtl = invert;
}
- public void setIsHotseat(boolean isHotseat) {
- mIsHotseatLayout = isHotseat;
- }
-
- int getCellContentWidth() {
- final DeviceProfile grid = mLauncher.getDeviceProfile();
- return Math.min(getMeasuredHeight(), mIsHotseatLayout ?
- grid.hotseatCellWidthPx: grid.cellWidthPx);
+ public void setContainerType(@ContainerType int containerType) {
+ mContainerType = containerType;
}
int getCellContentHeight() {
final DeviceProfile grid = mLauncher.getDeviceProfile();
- return Math.min(getMeasuredHeight(), mIsHotseatLayout ?
- grid.hotseatCellHeightPx : grid.cellHeightPx);
+ int cellContentHeight = grid.cellHeightPx;
+ if (mContainerType == HOTSEAT) {
+ cellContentHeight = grid.hotseatCellHeightPx;
+ } else if (mContainerType == FOLDER) {
+ cellContentHeight = grid.folderCellHeightPx;
+ }
+ return Math.min(getMeasuredHeight(), cellContentHeight);
}
public void measureChild(View child) {
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index 31ec7092b..e71c5e9cc 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -256,6 +256,7 @@ public class FolderPagedView extends PagedView {
CellLayout page = new CellLayout(getContext());
page.setCellDimensions(grid.folderCellWidthPx, grid.folderCellHeightPx);
page.getShortcutsAndWidgets().setMotionEventSplittingEnabled(false);
+ page.getShortcutsAndWidgets().setContainerType(ShortcutAndWidgetContainer.FOLDER);
page.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
page.setInvertIfRtl(true);
page.setGridSize(mGridCountX, mGridCountY);