From f12b88cb605eca7ae43d2aedd0c114a050570b9f Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Tue, 2 Dec 2025 00:15:28 +0700 Subject: [PATCH] feat: Tablet support (ish) --- lawnchair/res/xml/device_profiles.xml | 3 ++- src/com/android/launcher3/DeviceProfile.java | 6 +++--- src/com/android/launcher3/deviceprofile/HotseatProfile.kt | 8 +++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lawnchair/res/xml/device_profiles.xml b/lawnchair/res/xml/device_profiles.xml index 4e15c83c21..bf87d57c20 100644 --- a/lawnchair/res/xml/device_profiles.xml +++ b/lawnchair/res/xml/device_profiles.xml @@ -174,6 +174,7 @@ launcher:devicePaddingId="@xml/paddings_6x5" launcher:dbFile="launcher_6_by_5.db" launcher:defaultLayoutId="@xml/default_workspace_6x5" + launcher:inlineQsb="landscape" launcher:deviceCategory="tablet" > - \ No newline at end of file + diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 0952ca5cc6..1396a56766 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -1849,7 +1849,7 @@ public class DeviceProfile { } else { hotseatBarPadding.left += qsbWidth; } - } else if (isTaskbarPresent) { + } else if (isTaskbarPresent || isQsbInline) { // Center the QSB vertically with hotseat int hotseatBarBottomPadding = getHotseatBarBottomPadding(); int hotseatBarTopPadding = @@ -1958,10 +1958,10 @@ public class DeviceProfile { * Returns the number of pixels the QSB is translated from the bottom of the screen. */ public int getQsbOffsetY() { - if (isQsbInline) { + if (mDeviceProperties.isPhone() && isQsbInline) { return getHotseatBarBottomPadding() - ((getHotseatProfile().getQsbHeight() - hotseatCellHeightPx) / 2); - } else if (isTaskbarPresent) { // QSB on top + } else if (isTaskbarPresent || (mDeviceProperties.isLandscape() && isQsbInline)) { // QSB on top return hotseatBarSizePx - getHotseatProfile().getQsbHeight() + getHotseatProfile().getQsbShadowHeight(); } else { diff --git a/src/com/android/launcher3/deviceprofile/HotseatProfile.kt b/src/com/android/launcher3/deviceprofile/HotseatProfile.kt index ba828f53cb..8a0b62ab8e 100644 --- a/src/com/android/launcher3/deviceprofile/HotseatProfile.kt +++ b/src/com/android/launcher3/deviceprofile/HotseatProfile.kt @@ -19,9 +19,11 @@ package com.android.launcher3.deviceprofile import android.content.Context import android.content.res.Resources import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.unit.dp import app.lawnchair.hotseat.HotseatMode import app.lawnchair.preferences2.PreferenceManager2 import com.android.launcher3.InvariantDeviceProfile +import com.android.launcher3.InvariantDeviceProfile.INDEX_DEFAULT import com.android.launcher3.R import com.android.launcher3.responsive.CalculatedHotseatSpec import com.patrykmichalik.opto.core.firstBlocking @@ -98,7 +100,11 @@ data class HotseatProfile( else res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_side_padding) val hotseatQsbHeight = if (isQsbEnable) res.getDimensionPixelSize(R.dimen.qsb_widget_height) else 0 - val hotseatQsbShadowHeight = res.getDimensionPixelSize(R.dimen.qsb_shadow_height) + val hotseatQsbShadowHeight = if (inv.inlineQsb[INDEX_DEFAULT] && !deviceProperties.isPhone) { + res.getDimensionPixelSize(R.dimen.taskbar_size) + } else { + res.getDimensionPixelSize(R.dimen.qsb_shadow_height) + } val hotseatQsbVisualHeight = if (isQsbEnable) hotseatQsbHeight - 2 * hotseatQsbShadowHeight else 0