Revert "Have consistent All Apps UI between grid size changes."
Revert submission 557031-1571265377317-631e3e5 Reason for revert: Breaks multiwindow and secondary display layout Reverted Changes: Idee087e31:Remove numAllAppsColumns, allAppsIconSize, allApps... I6235862c9:Have consistent All Apps UI between grid size chan... Change-Id: I64156123a8fbaba1a7d2b64cddd5376671123aa2
This commit is contained in:
1 parent
2fc1c88448
commit
ae190ff807
3 files changed
+111
-137
No files matched your search
@@ -25,8 +25,6 @@ import android.graphics.Rect;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Surface;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.CellLayout.ContainerType;
|
||||
import com.android.launcher3.graphics.IconShape;
|
||||
import com.android.launcher3.icons.DotRenderer;
|
||||
@@ -36,8 +34,6 @@ import com.android.launcher3.util.DefaultDisplay;
|
||||
public class DeviceProfile {
|
||||
|
||||
public final InvariantDeviceProfile inv;
|
||||
// IDP with no grid override values.
|
||||
@Nullable private final InvariantDeviceProfile originalIdp;
|
||||
|
||||
// Device properties
|
||||
public final boolean isTablet;
|
||||
@@ -138,11 +134,10 @@ public class DeviceProfile {
|
||||
public DotRenderer mDotRendererAllApps;
|
||||
|
||||
public DeviceProfile(Context context, InvariantDeviceProfile inv,
|
||||
InvariantDeviceProfile originalIDP, Point minSize, Point maxSize,
|
||||
Point minSize, Point maxSize,
|
||||
int width, int height, boolean isLandscape, boolean isMultiWindowMode) {
|
||||
|
||||
this.inv = inv;
|
||||
this.originalIdp = inv;
|
||||
this.isLandscape = isLandscape;
|
||||
this.isMultiWindowMode = isMultiWindowMode;
|
||||
|
||||
@@ -234,19 +229,6 @@ public class DeviceProfile {
|
||||
// Recalculate the available dimensions using the new hotseat size.
|
||||
updateAvailableDimensions(dm, res);
|
||||
}
|
||||
|
||||
if (originalIDP != null) {
|
||||
// Grid size change should not affect All Apps UI, so we use the original profile
|
||||
// measurements here.
|
||||
DeviceProfile originalProfile = isLandscape
|
||||
? originalIDP.landscapeProfile
|
||||
: originalIDP.portraitProfile;
|
||||
allAppsIconSizePx = originalProfile.iconSizePx;
|
||||
allAppsIconTextSizePx = originalProfile.iconTextSizePx;
|
||||
allAppsCellHeightPx = originalProfile.allAppsCellHeightPx;
|
||||
allAppsIconDrawablePaddingPx = originalProfile.iconDrawablePaddingOriginalPx;
|
||||
allAppsCellWidthPx = allAppsIconSizePx + 2 * allAppsIconDrawablePaddingPx;
|
||||
}
|
||||
updateWorkspacePadding();
|
||||
|
||||
// This is done last, after iconSizePx is calculated above.
|
||||
@@ -259,8 +241,8 @@ public class DeviceProfile {
|
||||
|
||||
public DeviceProfile copy(Context context) {
|
||||
Point size = new Point(availableWidthPx, availableHeightPx);
|
||||
return new DeviceProfile(context, inv, originalIdp, size, size, widthPx, heightPx,
|
||||
isLandscape, isMultiWindowMode);
|
||||
return new DeviceProfile(context, inv, size, size, widthPx, heightPx, isLandscape,
|
||||
isMultiWindowMode);
|
||||
}
|
||||
|
||||
public DeviceProfile getMultiWindowProfile(Context context, Point mwSize) {
|
||||
@@ -271,8 +253,8 @@ 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.
|
||||
DeviceProfile profile = new DeviceProfile(context, inv, originalIdp, mwSize, mwSize,
|
||||
mwSize.x, mwSize.y, isLandscape, true);
|
||||
DeviceProfile profile = new DeviceProfile(context, inv, mwSize, mwSize, mwSize.x, mwSize.y,
|
||||
isLandscape, true);
|
||||
|
||||
// If there isn't enough vertical cell padding with the labels displayed, hide the labels.
|
||||
float workspaceCellPaddingY = profile.getCellSize().y - profile.iconSizePx
|
||||
@@ -356,11 +338,19 @@ public class DeviceProfile {
|
||||
}
|
||||
cellWidthPx = iconSizePx + iconDrawablePaddingPx;
|
||||
|
||||
allAppsIconSizePx = iconSizePx;
|
||||
allAppsIconTextSizePx = iconTextSizePx;
|
||||
allAppsIconDrawablePaddingPx = iconDrawablePaddingPx;
|
||||
allAppsCellHeightPx = getCellSize().y;
|
||||
allAppsCellWidthPx = allAppsIconSizePx + 2 * allAppsIconDrawablePaddingPx;
|
||||
// All apps
|
||||
if (allAppsHasDifferentNumColumns()) {
|
||||
allAppsIconSizePx = ResourceUtils.pxFromDp(inv.allAppsIconSize, dm);
|
||||
allAppsIconTextSizePx = Utilities.pxFromSp(inv.allAppsIconTextSize, dm);
|
||||
allAppsCellHeightPx = getCellSize(inv.numAllAppsColumns, inv.numAllAppsColumns).y;
|
||||
allAppsIconDrawablePaddingPx = iconDrawablePaddingOriginalPx;
|
||||
} else {
|
||||
allAppsIconSizePx = iconSizePx;
|
||||
allAppsIconTextSizePx = iconTextSizePx;
|
||||
allAppsIconDrawablePaddingPx = iconDrawablePaddingPx;
|
||||
allAppsCellHeightPx = getCellSize().y;
|
||||
}
|
||||
allAppsCellWidthPx = allAppsIconSizePx + allAppsIconDrawablePaddingPx;
|
||||
|
||||
if (isVerticalBarLayout()) {
|
||||
// Always hide the Workspace text with vertical bar layout.
|
||||
|
||||
Reference in new issue
Block a user