mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Increase icon size to be closer to spec
Also change paddings because spaces changed Bug: 258463609 Test: DeviceProfileDumpTest Change-Id: Iaee433ea3fb5ef633ad428699ce230317021b170
This commit is contained in:
33
res/xml/paddings_handhelds.xml
Normal file
33
res/xml/paddings_handhelds.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- Putting in the test/xml folder gives an error that maxEmptySpace doesn't exist -->
|
||||
<device-paddings xmlns:launcher="http://schemas.android.com/apk/res-auto" >
|
||||
|
||||
<device-padding
|
||||
launcher:maxEmptySpace="9999dp">
|
||||
<workspaceTopPadding
|
||||
launcher:a="0.48"
|
||||
launcher:b="0"/>
|
||||
<workspaceBottomPadding
|
||||
launcher:a="0.52"
|
||||
launcher:b="0"/>
|
||||
<hotseatBottomPadding
|
||||
launcher:a="0"
|
||||
launcher:b="0"/>
|
||||
</device-padding>
|
||||
</device-paddings>
|
||||
@@ -498,10 +498,11 @@ public class DeviceProfile {
|
||||
extraSpace = updateAvailableDimensions(res);
|
||||
|
||||
// Now that we have all of the variables calculated, we can tune certain sizes.
|
||||
if (isScalableGrid && inv.devicePaddings != null) {
|
||||
if (isScalableGrid && inv.devicePaddingId != INVALID_RESOURCE_HANDLE) {
|
||||
// Paddings were created assuming no scaling, so we first unscale the extra space.
|
||||
int unscaledExtraSpace = (int) (extraSpace / cellScaleToFit);
|
||||
DevicePadding padding = inv.devicePaddings.getDevicePadding(unscaledExtraSpace);
|
||||
DevicePaddings devicePaddings = new DevicePaddings(context, inv.devicePaddingId);
|
||||
DevicePadding padding = devicePaddings.getDevicePadding(unscaledExtraSpace);
|
||||
|
||||
int paddingWorkspaceTop = padding.getWorkspaceTopPadding(unscaledExtraSpace);
|
||||
int paddingWorkspaceBottom = padding.getWorkspaceBottomPadding(unscaledExtraSpace);
|
||||
@@ -1565,10 +1566,11 @@ public class DeviceProfile {
|
||||
writer.println(prefix + pxToDpStr("extraSpace", extraSpace));
|
||||
writer.println(prefix + pxToDpStr("unscaled extraSpace", extraSpace / iconScale));
|
||||
|
||||
if (inv.devicePaddings != null) {
|
||||
if (inv.devicePaddingId != INVALID_RESOURCE_HANDLE) {
|
||||
int unscaledExtraSpace = (int) (extraSpace / iconScale);
|
||||
DevicePaddings devicePaddings = new DevicePaddings(context, inv.devicePaddingId);
|
||||
writer.println(prefix + pxToDpStr("maxEmptySpace",
|
||||
inv.devicePaddings.getDevicePadding(unscaledExtraSpace).getMaxEmptySpacePx()));
|
||||
devicePaddings.getDevicePadding(unscaledExtraSpace).getMaxEmptySpacePx()));
|
||||
}
|
||||
writer.println(prefix + pxToDpStr("workspaceTopPadding", workspaceTopPadding));
|
||||
writer.println(prefix + pxToDpStr("workspaceBottomPadding", workspaceBottomPadding));
|
||||
|
||||
@@ -47,9 +47,9 @@ import android.view.Display;
|
||||
|
||||
import androidx.annotation.DimenRes;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.annotation.XmlRes;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.android.launcher3.icons.DotRenderer;
|
||||
@@ -172,7 +172,8 @@ public class InvariantDeviceProfile {
|
||||
* Do not query directly. see {@link DeviceProfile#isScalableGrid}.
|
||||
*/
|
||||
protected boolean isScalable;
|
||||
public int devicePaddingId;
|
||||
@XmlRes
|
||||
public int devicePaddingId = INVALID_RESOURCE_HANDLE;
|
||||
|
||||
public String dbFile;
|
||||
public int defaultLayoutId;
|
||||
@@ -184,9 +185,6 @@ public class InvariantDeviceProfile {
|
||||
*/
|
||||
public List<DeviceProfile> supportedProfiles = Collections.EMPTY_LIST;
|
||||
|
||||
@Nullable
|
||||
public DevicePaddings devicePaddings;
|
||||
|
||||
public Point defaultWallpaperSize;
|
||||
public Rect defaultWidgetPadding;
|
||||
|
||||
@@ -384,10 +382,6 @@ public class InvariantDeviceProfile {
|
||||
allAppsIconSize = displayOption.allAppsIconSizes;
|
||||
allAppsIconTextSize = displayOption.allAppsIconTextSizes;
|
||||
|
||||
if (devicePaddingId != 0) {
|
||||
devicePaddings = new DevicePaddings(context, devicePaddingId);
|
||||
}
|
||||
|
||||
inlineQsb = closestProfile.inlineQsb;
|
||||
|
||||
// If the partner customization apk contains any grid overrides, apply them
|
||||
@@ -825,7 +819,7 @@ public class InvariantDeviceProfile {
|
||||
isScalable = a.getBoolean(
|
||||
R.styleable.GridDisplayOption_isScalable, false);
|
||||
devicePaddingId = a.getResourceId(
|
||||
R.styleable.GridDisplayOption_devicePaddingId, 0);
|
||||
R.styleable.GridDisplayOption_devicePaddingId, INVALID_RESOURCE_HANDLE);
|
||||
|
||||
int deviceCategory = a.getInt(R.styleable.GridDisplayOption_deviceCategory,
|
||||
DEVICE_CATEGORY_ALL);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.android.launcher3
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Point
|
||||
import android.graphics.PointF
|
||||
import android.graphics.Rect
|
||||
import android.util.SparseArray
|
||||
@@ -26,7 +25,6 @@ import com.android.launcher3.util.DisplayController.Info
|
||||
import com.android.launcher3.util.WindowBounds
|
||||
import org.junit.Before
|
||||
import org.mockito.ArgumentMatchers.any
|
||||
import org.mockito.ArgumentMatchers.anyInt
|
||||
import org.mockito.Mockito.mock
|
||||
import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
@@ -42,9 +40,6 @@ abstract class DeviceProfileBaseTest {
|
||||
protected var transposeLayoutWithOrientation: Boolean = false
|
||||
protected var useTwoPanels: Boolean = false
|
||||
protected var isGestureMode: Boolean = true
|
||||
protected var devicePaddingsMock: DevicePaddings = mock(DevicePaddings::class.java)
|
||||
protected var staticdevicePaddingsMock: DevicePaddings.DevicePadding =
|
||||
mock(DevicePaddings.DevicePadding::class.java)
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
@@ -83,11 +78,6 @@ abstract class DeviceProfileBaseTest {
|
||||
whenever(info.isTablet(any())).thenReturn(false)
|
||||
whenever(info.getDensityDpi()).thenReturn(420)
|
||||
whenever(info.smallestSizeDp(any())).thenReturn(411f)
|
||||
whenever(devicePaddingsMock.getDevicePadding(anyInt())).thenReturn(staticdevicePaddingsMock)
|
||||
whenever(staticdevicePaddingsMock.getWorkspaceTopPadding(anyInt())).thenReturn(95)
|
||||
whenever(staticdevicePaddingsMock.getWorkspaceBottomPadding(anyInt())).thenReturn(116)
|
||||
whenever(staticdevicePaddingsMock.maxEmptySpacePx)
|
||||
.thenReturn(if (isVerticalBar) if (isGestureMode) 131 else 184 else 315)
|
||||
|
||||
this.isGestureMode = isGestureMode
|
||||
transposeLayoutWithOrientation = true
|
||||
@@ -152,7 +142,7 @@ abstract class DeviceProfileBaseTest {
|
||||
|
||||
inlineQsb = BooleanArray(4) { false }
|
||||
|
||||
devicePaddings = devicePaddingsMock
|
||||
devicePaddingId = R.xml.paddings_handhelds
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,13 +159,6 @@ abstract class DeviceProfileBaseTest {
|
||||
whenever(info.isTablet(any())).thenReturn(true)
|
||||
whenever(info.getDensityDpi()).thenReturn(320)
|
||||
whenever(info.smallestSizeDp(any())).thenReturn(800f)
|
||||
whenever(devicePaddingsMock.getDevicePadding(anyInt())).thenReturn(staticdevicePaddingsMock)
|
||||
whenever(staticdevicePaddingsMock.getWorkspaceTopPadding(anyInt()))
|
||||
.thenReturn(if (isLandscape) 32 else 159)
|
||||
whenever(staticdevicePaddingsMock.getWorkspaceBottomPadding(anyInt()))
|
||||
.thenReturn(if (isLandscape) 72 else 203)
|
||||
whenever(staticdevicePaddingsMock.maxEmptySpacePx).thenReturn(if (isLandscape) 200 else 19998)
|
||||
|
||||
|
||||
this.isGestureMode = isGestureMode
|
||||
useTwoPanels = false
|
||||
@@ -246,7 +229,7 @@ abstract class DeviceProfileBaseTest {
|
||||
false
|
||||
)
|
||||
|
||||
devicePaddings = devicePaddingsMock
|
||||
devicePaddingId = R.xml.paddings_handhelds
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,15 +246,6 @@ abstract class DeviceProfileBaseTest {
|
||||
whenever(info.isTablet(any())).thenReturn(true)
|
||||
whenever(info.getDensityDpi()).thenReturn(420)
|
||||
whenever(info.smallestSizeDp(any())).thenReturn(700f)
|
||||
whenever(devicePaddingsMock.getDevicePadding(anyInt())).thenReturn(staticdevicePaddingsMock)
|
||||
|
||||
val topPadding = if (isLandscape) 18 else 89
|
||||
val bottomPadding = if (isLandscape) 39 else 146
|
||||
val maxEmptySpace = if (isLandscape) 131 else 236
|
||||
whenever(staticdevicePaddingsMock.getWorkspaceTopPadding(anyInt())).thenReturn(topPadding)
|
||||
whenever(staticdevicePaddingsMock.getWorkspaceBottomPadding(anyInt()))
|
||||
.thenReturn(bottomPadding)
|
||||
whenever(staticdevicePaddingsMock.maxEmptySpacePx).thenReturn(maxEmptySpace)
|
||||
|
||||
this.isGestureMode = isGestureMode
|
||||
useTwoPanels = true
|
||||
@@ -342,7 +316,7 @@ abstract class DeviceProfileBaseTest {
|
||||
false
|
||||
)
|
||||
|
||||
devicePaddings = devicePaddingsMock
|
||||
devicePaddingId = R.xml.paddings_handhelds
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user