summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DeviceProfile.java
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-10-05 07:27:23 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-10-05 07:27:23 +0000
commit31bc3da013475316f7d0c6ac3bcdb5df013b12fe (patch)
tree17cc5038139a086ab7126d2b2220f834ff07c26d /src/com/android/launcher3/DeviceProfile.java
parent0db3dc42862f9afca31230b25e763f7f98868f28 (diff)
parenta328a0d83a1149b884dd49d302414d8080d28e40 (diff)
downloadandroid_packages_apps_Trebuchet-31bc3da013475316f7d0c6ac3bcdb5df013b12fe.tar.gz
android_packages_apps_Trebuchet-31bc3da013475316f7d0c6ac3bcdb5df013b12fe.tar.bz2
android_packages_apps_Trebuchet-31bc3da013475316f7d0c6ac3bcdb5df013b12fe.zip
Snap for 4378450 from a328a0d83a1149b884dd49d302414d8080d28e40 to oc-mr1-release
Change-Id: I8ebed7f5fb47b3fec6f44136f2853389d9e2e8df
Diffstat (limited to 'src/com/android/launcher3/DeviceProfile.java')
-rw-r--r--src/com/android/launcher3/DeviceProfile.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index dec0a92a9..69ee03e9e 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -350,9 +350,18 @@ public class DeviceProfile {
iconTextSizePx = (int) (Utilities.pxFromSp(inv.iconTextSize, dm) * scale);
iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * scale);
- cellWidthPx = iconSizePx + iconDrawablePaddingPx;
cellHeightPx = iconSizePx + iconDrawablePaddingPx
+ Utilities.calculateTextHeight(iconTextSizePx);
+ int cellYPadding = (getCellSize().y - cellHeightPx) / 2;
+ if (iconDrawablePaddingPx > cellYPadding && !isVerticalBarLayout()
+ && !inMultiWindowMode()) {
+ // Ensures that the label is closer to its corresponding icon. This is not an issue
+ // with vertical bar layout or multi-window mode since the issue is handled separately
+ // with their calls to {@link #adjustToHideWorkspaceLabels}.
+ cellHeightPx -= (iconDrawablePaddingPx - cellYPadding);
+ iconDrawablePaddingPx = cellYPadding;
+ }
+ cellWidthPx = iconSizePx + iconDrawablePaddingPx;
// All apps
allAppsIconTextSizePx = iconTextSizePx;
@@ -755,11 +764,14 @@ public class DeviceProfile {
return new int[] { padding.left - mInsets.left, padding.right + mInsets.left};
}
+ public boolean inMultiWindowMode() {
+ return this != inv.landscapeProfile && this != inv.portraitProfile;
+ }
+
public boolean shouldIgnoreLongPressToOverview(float touchX) {
- boolean inMultiWindowMode = this != inv.landscapeProfile && this != inv.portraitProfile;
boolean touchedLhsEdge = mInsets.left == 0 && touchX < edgeMarginPx;
boolean touchedRhsEdge = mInsets.right == 0 && touchX > (widthPx - edgeMarginPx);
- return !inMultiWindowMode && (touchedLhsEdge || touchedRhsEdge);
+ return !inMultiWindowMode() && (touchedLhsEdge || touchedRhsEdge);
}
private static Context getContext(Context c, int orientation) {