Compare commits

...
7 Commits
Author SHA1 Message Date
TMC 4710171559 Release 1.0.7 2026-11-18 14:47:45 +01:00
TMCandClaude Opus 5.5 29ffb83e66 release.ps1: start-up check on the Flexera emulator, not just the first one
Step 4 installed the APK on the first emulator adb listed. Another
project's emulator (a Pixel_9a AVD) runs beside this one at times, and
was running when 1.0.7 was about to be built: had it come first, the
release would have been installed and started there. The step now picks
the emulator named Flexera_Launcher_A17, or the only emulator running,
and stops when there are several and none has that name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:47:34 +01:00
TMCandClaude Opus 5.5 6e88f7c81b Grid and margins: draw the margins in the preview; fit them to the rows
The owner reported that the preview did not show the top and bottom
margins. On the emulator it did, but little: the rows share the height
the margins leave, so a first row moves by less than the margin, and
at about 40% of real size a 16 dp margin moves it some 6 dp. On a page
with few icons that is hard to see. At large values it also went wrong
the other way: a phone's grid (not scalable) does not shrink its icons
to fit shorter rows, so with labels on, 120 dp top and bottom cut off
the last row's labels (cell height 201 px, rows got 179 px).

Now:
- The preview draws the margins: tinted bands along the sides and
  above and below the rows, as wide as they are laid out, and a dashed
  outline around the rows (HomeMargins.Guides, through a new overlay
  slot in GridOverridesPreview). They show however empty the page is.
- Top and bottom margins take only the height the rows can spare
  beyond their icons and labels, cut in proportion
  (HomeMargins.fitTopBottom, in DeviceProfile.updateWorkspacePadding);
  DeviceProfile keeps what it laid out (flexeraTopMarginPx,
  flexeraBottomMarginPx) for the guides.
- When the grid has room for less than the sliders ask, a note under
  them says so and that fewer rows or columns leave more room.
- The class comment no longer claims that rows too short get smaller
  icons; that was wrong for these grids.

Tested on the emulator: guides on a 5x5 and a 4x9 grid line up with
the rows and columns; on 5x5 with labels 120/120 fits whole and no
label is cut; on 4x9 with labels the bands shrink to what fits and the
note shows; 8, 0, 0 leaves the layout as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:44:33 +01:00
TMCandClaude Opus 5.5 b092105ed9 Website: version 1.0.6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 13:18:16 +01:00
TMC 2cdb779dac Release 1.0.6 2026-11-18 13:12:01 +01:00
TMCandClaude Opus 5.5 be15483e34 Home screen margins: on the grid page, with its live preview
The side, top and bottom margins move from the Home screen settings to
the grid page, renamed "Grid and margins", under its preview of the
home screen. The preview shows the margins being chosen together with
the columns, rows and dock icons, and nothing changes on the home
screen until Apply.

The preview builds its own InvariantDeviceProfile from
PreviewOverrides, as it does for a foldable's dock icons; the overrides
now carry the three margins, the IDP keeps them for the device profiles
it makes (set before initGrid, which makes them), and DeviceProfile
uses them in place of the kept preferences. Apply writes them with the
grid. HomeScreenGridPreferences keeps a little more room for the
settings under the preview (0.46 of the height instead of 0.40), as its
own comment asks when preferences are added.

Tested on the emulator: the page shows the preview; 40, 48, 48 dp moved
the preview's columns in and rows down while the launcher still
reported 8 dp and 0; after Apply the home screen matched the preview;
8, 0, 0 and Apply restored it. The Home screen page lists "Grid and
margins" and no longer has the sliders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 12:57:28 +01:00
TMCandClaude Opus 5.5 0306c1d2ce Website: version 1.0.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 12:43:19 +01:00
12 changed files with 256 additions and 32 deletions

No files matched your search

+1 -1
View File
@@ -280,7 +280,7 @@
<div class="install">
<div class="install__main">
<h2 id="install-title">Install Flexera</h2>
<p class="intro">Version <span data-version>1.0.4</span>, for Android 8.0 or newer. It’s free, and there are no ads in it.</p>
<p class="intro">Version <span data-version>1.0.6</span>, for Android 8.0 or newer. It’s free, and there are no ads in it.</p>
<div class="install__actions">
<a class="btn btn--lg" href="https://git.mariosem.es/msemes/Flexera-Launcher-Releases/releases/download/latest/FlexeraLauncher.apk" data-apk><svg class="btn__mark" aria-hidden="true"><use href="#b-android"/></svg>Download the APK</a>
<a class="link" href="https://git.mariosem.es/msemes/Flexera-Launcher-Releases/releases">Every release, with its notes</a>
+1 -1
View File
@@ -9,7 +9,7 @@
'use strict';
/** The version shown on the page. Change it here after a release. */
const VERSION = '1.0.4';
const VERSION = '1.0.6';
/* The phone is drawn at 390 x 844, one pixel per dp; the numbers below are the app's own. */
const W = 390, H = 844;
const STATUS_H = 40, NAV_H = 24;
+16 -2
View File
@@ -297,8 +297,22 @@ if ($NoSmokeTest) {
} else {
Step "4/7 Starting the APK on the emulator"
$emulator = & $Adb devices | Where-Object { $_ -match '^(emulator-\d+)\s+device$' } |
ForEach-Object { $Matches[1] } | Select-Object -First 1
$emulators = @(& $Adb devices | Where-Object { $_ -match '^(emulator-\d+)\s+device$' } |
ForEach-Object { $Matches[1] })
# Another project's emulator may run beside this one: the APK goes only to the one of this
# project, known by its name, or to the only emulator there is.
$named = @($emulators | Where-Object {
((& $Adb -s $_ emu avd name) | Select-Object -First 1).Trim() -eq 'Flexera_Launcher_A17'
})
if ($named.Count -gt 0) {
$emulator = $named[0]
} elseif ($emulators.Count -eq 1) {
$emulator = $emulators[0]
} elseif ($emulators.Count -gt 1) {
throw "Several emulators are running ($($emulators -join ', ')) and none is Flexera_Launcher_A17, so the APK would go to one that may belong to something else. Start Flexera_Launcher_A17, or close the others, and run this again with -SkipBuild."
} else {
$emulator = $null
}
if (-not $emulator) {
throw "No running emulator found. Start one (emulator.exe -avd Flexera_Launcher_A17) and run this again with -SkipBuild, or pass -NoSmokeTest."
}
+5
View File
@@ -122,9 +122,14 @@
<string name="flexera_full_screen_folders">Full screen folders</string>
<string name="flexera_full_screen_folders_description">Opens folders over the whole screen, with their apps at the bottom, within reach of your thumb</string>
<!-- Home screen settings, Layout: the space at the screen's sides, above the first row and below the last (app.flexera.home.HomeMargins) -->
<string name="flexera_home_margins">Margins</string>
<string name="flexera_home_side_margins">Side margins</string>
<string name="flexera_home_top_margin">Top margin</string>
<string name="flexera_home_bottom_margin">Bottom margin</string>
<!-- Under the margin sliders when the grid cannot lay out as much as they ask for -->
<string name="flexera_home_margins_limited">The grid leaves no more room: larger margins would cut off labels or make icons overlap. Fewer rows or columns leave more room.</string>
<!-- Lawnchair's "Home screen grid", the settings page with the preview, which has the margins as well since 1.0.6 -->
<string name="home_screen_grid">Grid and margins</string>
<string name="flexera_quick_launch">Quick launch</string>
<string name="flexera_quick_launch_description">Swipe on from the first or the last home screen page, as if there were one more, to open an app or do something else. Has no effect while Infinite scrolling is on.</string>
<string name="flexera_quick_launch_first_page">Swipe past the first page</string>
+132 -13
View File
@@ -1,18 +1,35 @@
package app.flexera.home
import android.content.Context
import android.util.DisplayMetrics
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.PathEffect
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import app.lawnchair.preferences.getAdapter
import app.lawnchair.preferences2.preferenceManager2
import androidx.compose.ui.unit.dp
import app.lawnchair.preferences.PreferenceAdapter
import app.lawnchair.ui.preferences.components.controls.SliderPreference
import app.lawnchair.ui.preferences.components.wallpaperSupportsDarkText
import app.lawnchair.ui.theme.LawnchairTheme
import com.android.launcher3.InvariantDeviceProfile
import com.android.launcher3.R
import com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR
import com.android.launcher3.testing.shared.ResourceUtils.pxFromDp
/**
* The home screen's margins: the space at its sides, above its first row and below its last,
* in dp, set under Settings, Home screen, Layout.
* in dp, set under Settings, Home screen, Grid and margins, where the preview shows them with the
* grid before they are kept (HomeScreenGridPreferences, through PreviewOverrides).
*
* They replace Lawnchair's Horizontal and Vertical padding, which scaled the grid's own margins
* by a percentage. On a phone those are 8 dp at the sides and nothing at the top or bottom, so
@@ -20,10 +37,14 @@ import com.android.launcher3.testing.shared.ResourceUtils.pxFromDp
* looked as if the settings did nothing.
*
* The rows and columns share what room the margins leave, so larger margins also bring the
* icons closer together; that is how the spacing between icons is set. Rows that become too
* short for their icons get smaller icons, as Launcher3 does by itself (DeviceProfile
* .updateAvailableDimensions). Columns get no such help, so the side margins are kept narrow
* enough that every column stays wider than what is seen of its icon ([sidePx]).
* icons closer together; that is how the spacing between icons is set. A phone's grid does not
* shrink its icons to fit smaller cells (Launcher3 does that only for scalable grids), so the
* margins stop growing where the cells would get too small: the side margins where a column
* would be narrower than what is seen of its icon ([sidePx]), the top and bottom margins where
* a row would be shorter than its icon and label ([fitTopBottom]).
*
* The grid page's preview draws the margins over the home screen ([Guides]), so that they can
* be seen however full or empty the page is.
*/
object HomeMargins {
@@ -50,35 +71,133 @@ object HomeMargins {
return chosen.coerceAtMost(most).coerceAtLeast(0)
}
/**
* What the rows can spare of a top margin of [topPx] and a bottom margin of [bottomPx]:
* [spare] is the height the rows have beyond what their icons and labels need. Both are cut
* in proportion until they fit. The top margin comes first, then the bottom one.
*/
@JvmStatic
fun fitTopBottom(topPx: Int, bottomPx: Int, spare: Int): IntArray {
val wanted = topPx + bottomPx
if (wanted <= 0 || spare <= 0) return intArrayOf(0, 0)
if (wanted <= spare) return intArrayOf(topPx, bottomPx)
val top = (topPx.toLong() * spare / wanted).toInt()
return intArrayOf(top, spare - top)
}
/**
* The margins over the grid page's preview of [idp]: tinted bands along the screen's sides
* and above and below the rows, as wide as the margins are laid out, and a dashed outline
* around the rows. Drawn in the colours of the preview's own background, which follows the
* wallpaper, so that they stand out from it.
*/
@Composable
fun Guides(idp: InvariantDeviceProfile) {
val context = LocalContext.current
val profile = remember(idp) { idp.getDeviceProfile(context) }
LawnchairTheme(darkTheme = !wallpaperSupportsDarkText()) {
val tint = MaterialTheme.colorScheme.primary
Canvas(modifier = Modifier.fillMaxSize()) {
val screen = profile.deviceProperties
val scaleX = size.width / screen.widthPx
val scaleY = size.height / screen.heightPx
val insets = profile.insets
val padding = profile.workspacePadding
val cells = profile.cellLayoutPaddingPx
// The rows, as the workspace lays them out: inside the system bars, the
// workspace's padding and the page's own.
val left = (insets.left + padding.left + cells.left) * scaleX
val right = (screen.widthPx - insets.right - padding.right - cells.right) * scaleX
val top = (insets.top + padding.top + cells.top) * scaleY
val bottom = (screen.heightPx - insets.bottom - padding.bottom - cells.bottom) * scaleY
if (right <= left || bottom <= top) return@Canvas
val band = tint.copy(alpha = BAND_ALPHA)
val side = profile.desiredWorkspaceHorizontalMarginPx * scaleX
val above = profile.flexeraTopMarginPx * scaleY
val below = profile.flexeraBottomMarginPx * scaleY
if (side > 0f) {
drawRect(band, Offset(left - side, top), Size(side, bottom - top))
drawRect(band, Offset(right, top), Size(side, bottom - top))
}
if (above > 0f) drawRect(band, Offset(left, top - above), Size(right - left, above))
if (below > 0f) drawRect(band, Offset(left, bottom), Size(right - left, below))
drawRect(
color = tint,
topLeft = Offset(left, top),
size = Size(right - left, bottom - top),
style = Stroke(
width = OUTLINE_DP.dp.toPx(),
pathEffect = PathEffect.dashPathEffect(floatArrayOf(DASH_DP.dp.toPx(), GAP_DP.dp.toPx())),
),
)
}
}
}
private const val BAND_ALPHA = 0.32f
private const val OUTLINE_DP = 1.5f
private const val DASH_DP = 5f
private const val GAP_DP = 4f
/** A top or bottom margin of [chosenDp], in pixels. */
@JvmStatic
fun topBottomPx(chosenDp: Int, metrics: DisplayMetrics): Int =
pxFromDp(chosenDp.coerceIn(0, MAX_TOP_BOTTOM_DP).toFloat(), metrics)
/** The three sliders, in place of Lawnchair's two (HomeScreenPreferences). */
/**
* Whether the grid of [idp] lays out less of the margins than [sideDp], [topDp] and
* [bottomDp]: its rows or columns leave no more room (see [sidePx] and [fitTopBottom]).
*/
fun isLimited(context: Context, idp: InvariantDeviceProfile, sideDp: Int, topDp: Int, bottomDp: Int): Boolean {
val profile = idp.getDeviceProfile(context)
val metrics = context.resources.displayMetrics
val side = profile.desiredWorkspaceHorizontalMarginPx < pxFromDp(sideDp.toFloat(), metrics) - 1
val wanted = topBottomPx(topDp, metrics) + topBottomPx(bottomDp, metrics)
val laidOut = profile.flexeraTopMarginPx + profile.flexeraBottomMarginPx
return side || laidOut < wanted - 1
}
/**
* The three sliders, on the grid page in place of Lawnchair's two padding sliders on the home
* screen page. They change [side], [top] and [bottom], which the grid page keeps on Apply.
* When the grid cannot lay out as much as they ask ([limited]), a note under them says why.
*/
@Composable
fun Preferences() {
val prefs2 = preferenceManager2()
fun Preferences(
side: PreferenceAdapter<Int>,
top: PreferenceAdapter<Int>,
bottom: PreferenceAdapter<Int>,
limited: Boolean,
) {
SliderPreference(
label = stringResource(id = R.string.flexera_home_side_margins),
adapter = prefs2.homeSideMargin.getAdapter(),
adapter = side,
valueRange = 0..MAX_SIDE_DP,
step = 2,
showUnit = "dp",
)
SliderPreference(
label = stringResource(id = R.string.flexera_home_top_margin),
adapter = prefs2.homeTopMargin.getAdapter(),
adapter = top,
valueRange = 0..MAX_TOP_BOTTOM_DP,
step = 4,
showUnit = "dp",
)
SliderPreference(
label = stringResource(id = R.string.flexera_home_bottom_margin),
adapter = prefs2.homeBottomMargin.getAdapter(),
adapter = bottom,
valueRange = 0..MAX_TOP_BOTTOM_DP,
step = 4,
showUnit = "dp",
)
if (limited) {
Text(
text = stringResource(id = R.string.flexera_home_margins_limited),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),
)
}
}
}
+1 -1
View File
@@ -2,4 +2,4 @@
# build.gradle reads this and derives the Android version code from it
# (major * 10000 + minor * 100 + patch), so the name and the code can never disagree.
# flexera/release.ps1 raises it for every release.
versionName=1.0.5
versionName=1.0.7
@@ -89,6 +89,11 @@ class DeviceProfileOverrides @Inject constructor(
/** Override for any other value that's not a DBGridInfo, extends this value when needed */
data class PreviewOverrides(
val foldableDatabaseHotseatIcons: Int? = null,
// Flexera Launcher: margins shown in a preview before they are kept
// (app.flexera.home.HomeMargins); read by DeviceProfile.
val homeSideMarginDp: Int? = null,
val homeTopMarginDp: Int? = null,
val homeBottomMarginDp: Int? = null,
)
data class Options(
@@ -1,6 +1,7 @@
package app.lawnchair.ui.preferences.components
import android.content.res.Configuration
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.fillMaxSize
@@ -26,6 +27,8 @@ fun ColumnScope.GridOverridesPreview(
modifier: Modifier = Modifier,
expandToAvailableSpace: Boolean = true,
previewOverrides: DeviceProfileOverrides.PreviewOverrides = DeviceProfileOverrides.PreviewOverrides(),
// Flexera Launcher: drawn over the preview, such as the margins (app.flexera.home.HomeMargins).
overlay: @Composable BoxScope.(InvariantDeviceProfile) -> Unit = {},
updateGridOptions: DeviceProfileOverrides.DBGridInfo.() -> DeviceProfileOverrides.DBGridInfo,
) {
val previewIdp = createPreviewIdp(updateGridOptions, previewOverrides)
@@ -81,6 +84,7 @@ fun ColumnScope.GridOverridesPreview(
idp = previewIdp,
modifier = Modifier.fillMaxSize(),
)
overlay(previewIdp)
}
}
}
@@ -22,9 +22,12 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
@@ -35,6 +38,7 @@ import app.lawnchair.DeviceProfileOverrides
import app.lawnchair.preferences.asPreferenceAdapter
import app.lawnchair.preferences.getAdapter
import app.lawnchair.preferences.preferenceManager
import app.lawnchair.preferences2.preferenceManager2
import app.lawnchair.ui.preferences.LocalIsExpandedScreen
import app.lawnchair.ui.preferences.LocalNavController
import app.lawnchair.ui.preferences.components.GridOverridesPreview
@@ -78,6 +82,21 @@ fun HomeScreenGridPreferences(
mutableIntStateOf(originalHotseatColumnsUnfolded.coerceAtLeast(originalHotseatColumns))
}
// Flexera Launcher: the home screen's margins, shown in the preview and kept on Apply with
// the grid (app.flexera.home.HomeMargins).
val prefs2 = preferenceManager2()
val sideMarginAdapter = prefs2.homeSideMargin.getAdapter()
val topMarginAdapter = prefs2.homeTopMargin.getAdapter()
val bottomMarginAdapter = prefs2.homeBottomMargin.getAdapter()
val originalSideMargin = remember { sideMarginAdapter.state.value }
val originalTopMargin = remember { topMarginAdapter.state.value }
val originalBottomMargin = remember { bottomMarginAdapter.state.value }
val sideMargin = rememberSaveable { mutableIntStateOf(originalSideMargin) }
val topMargin = rememberSaveable { mutableIntStateOf(originalTopMargin) }
val bottomMargin = rememberSaveable { mutableIntStateOf(originalBottomMargin) }
// Whether the previewed grid has room for less than these margins.
var marginsLimited by remember { mutableStateOf(false) }
LaunchedEffect(hotseatColumns.intValue) {
if (hotseatColumnsUnfolded.intValue < hotseatColumns.intValue) {
hotseatColumnsUnfolded.intValue = hotseatColumns.intValue
@@ -101,7 +120,8 @@ fun HomeScreenGridPreferences(
// This should be enough for 3 preferences, they can't scroll beyond this.
// Should you introduce another prefs, raise the value by a little so that they
// have an indication that you can scroll the entries.
isPortrait -> (maxHeight * 0.40f).coerceAtLeast(315.dp)
// Flexera Launcher: raised from 0.40 for the margins below the grid.
isPortrait -> (maxHeight * 0.46f).coerceAtLeast(315.dp)
// Landscape mode
else -> (maxHeight * 0.52f).coerceAtLeast(280.dp)
@@ -125,12 +145,21 @@ fun HomeScreenGridPreferences(
numHotseatColumns = hotseatColumns.intValue,
)
},
previewOverrides = if (isFoldable) {
DeviceProfileOverrides.PreviewOverrides(
foldableDatabaseHotseatIcons = hotseatColumnsUnfolded.intValue,
)
} else {
DeviceProfileOverrides.PreviewOverrides()
previewOverrides = DeviceProfileOverrides.PreviewOverrides(
foldableDatabaseHotseatIcons = if (isFoldable) hotseatColumnsUnfolded.intValue else null,
homeSideMarginDp = sideMargin.intValue,
homeTopMarginDp = topMargin.intValue,
homeBottomMarginDp = bottomMargin.intValue,
),
// Flexera Launcher: the margins drawn over the preview, and whether they fit.
overlay = { idp ->
app.flexera.home.HomeMargins.Guides(idp)
val context = LocalContext.current
LaunchedEffect(idp) {
marginsLimited = app.flexera.home.HomeMargins.isLimited(
context, idp, sideMargin.intValue, topMargin.intValue, bottomMargin.intValue,
)
}
},
)
@@ -208,6 +237,15 @@ fun HomeScreenGridPreferences(
)
}
}
// Flexera Launcher: the margins, below the grid.
PreferenceGroup(heading = stringResource(id = R.string.flexera_home_margins)) {
app.flexera.home.HomeMargins.Preferences(
side = sideMargin.asPreferenceAdapter(),
top = topMargin.asPreferenceAdapter(),
bottom = bottomMargin.asPreferenceAdapter(),
limited = marginsLimited,
)
}
}
val navController = LocalNavController.current
@@ -219,6 +257,10 @@ fun HomeScreenGridPreferences(
hotseatColumnsAdapter.onChange(hotseatColumns.intValue)
hotseatColumnsUnfoldedAdapter.onChange(hotseatColumnsUnfolded.intValue)
}
// Flexera Launcher: the margins, which reload the grid again once kept.
sideMarginAdapter.onChange(sideMargin.intValue)
topMarginAdapter.onChange(topMargin.intValue)
bottomMarginAdapter.onChange(bottomMargin.intValue)
InvariantDeviceProfile.INSTANCE.get(context).onPreferencesChanged(context)
navController.popBackStack()
}
@@ -226,7 +268,10 @@ fun HomeScreenGridPreferences(
val isChanged = columns.intValue != originalColumns ||
rows.intValue != originalRows ||
hotseatColumns.intValue != originalHotseatColumns ||
hotseatColumnsUnfolded.intValue != originalHotseatColumnsUnfolded
hotseatColumnsUnfolded.intValue != originalHotseatColumnsUnfolded ||
sideMargin.intValue != originalSideMargin ||
topMargin.intValue != originalTopMargin ||
bottomMargin.intValue != originalBottomMargin
Box(
modifier = Modifier
@@ -189,9 +189,9 @@ fun HomeScreenPreferences(
destination = HomeScreenGrid,
subtitle = stringResource(id = R.string.x_by_y, columns, rows),
)
// Flexera Launcher: margins in dp in place of Horizontal and Vertical padding, which
// scaled margins too small to see (app.flexera.home.HomeMargins).
app.flexera.home.HomeMargins.Preferences()
// Flexera Launcher: Horizontal and Vertical padding scaled margins too small to see.
// The margins in dp that replace them are on the grid page, with its preview
// (app.flexera.home.HomeMargins).
SwitchPreference(
adapter = lockHomeScreenAdapter,
label = stringResource(id = R.string.home_screen_lock),
+27 -3
View File
@@ -352,6 +352,9 @@ public class DeviceProfile {
private int homeSideMarginDp;
private int homeTopMarginDp;
private int homeBottomMarginDp;
/** Flexera Launcher: the top and bottom margins as laid out, after fitting the rows. */
public int flexeraTopMarginPx;
public int flexeraBottomMarginPx;
private float widgetPaddingFactor;
// Flexera Launcher: widgets lined up with the icons (app.flexera.widget.FlexeraWidgets).
public boolean alignWidgetsWithIcons;
@@ -383,6 +386,15 @@ public class DeviceProfile {
.firstCached(preferenceManager2.getHomeTopMargin());
homeBottomMarginDp = PreferenceCacheExtensionsKt
.firstCached(preferenceManager2.getHomeBottomMargin());
// Flexera Launcher: in a preview, the margins being chosen (HomeScreenGridPreferences).
app.lawnchair.DeviceProfileOverrides.PreviewOverrides preview = inv.flexeraPreviewOverrides;
if (preview != null) {
if (preview.getHomeSideMarginDp() != null) homeSideMarginDp = preview.getHomeSideMarginDp();
if (preview.getHomeTopMarginDp() != null) homeTopMarginDp = preview.getHomeTopMarginDp();
if (preview.getHomeBottomMarginDp() != null) {
homeBottomMarginDp = preview.getHomeBottomMarginDp();
}
}
widgetPaddingFactor = Utilities.boundToRange(PreferenceCacheExtensionsKt
.firstCached(preferenceManager2.getWidgetPaddingFactor()), 0f, 2f);
// Flexera Launcher: read with the grid, which the setting reloads when it changes.
@@ -1818,9 +1830,21 @@ public class DeviceProfile {
int bottomHotseatReserve = Math.min(hotseatBarSizePx, paddingBottom);
paddingBottom = bottomHotseatReserve
+ Math.round((paddingBottom - bottomHotseatReserve) * workspacePaddingVerticalFactor);
// Flexera Launcher: the owner's top and bottom margins (app.flexera.home.HomeMargins).
paddingTop += app.flexera.home.HomeMargins.topBottomPx(homeTopMarginDp, mMetrics);
paddingBottom += app.flexera.home.HomeMargins.topBottomPx(homeBottomMarginDp, mMetrics);
// Flexera Launcher: the owner's top and bottom margins (app.flexera.home.HomeMargins),
// as far as the rows can spare the room. This grid does not shrink its icons to fit
// shorter rows, so taller margins would cut off the labels of the last row.
int rowsNeed = cellHeightPx * inv.numRows
+ cellLayoutBorderSpacePx.y * (inv.numRows - 1);
int spare = mDeviceProperties.getAvailableHeightPx()
- Math.max(paddingTop, cellLayoutPaddingPx.top)
- Math.max(paddingBottom, cellLayoutPaddingPx.bottom) - rowsNeed;
int[] margins = app.flexera.home.HomeMargins.fitTopBottom(
app.flexera.home.HomeMargins.topBottomPx(homeTopMarginDp, mMetrics),
app.flexera.home.HomeMargins.topBottomPx(homeBottomMarginDp, mMetrics), spare);
flexeraTopMarginPx = margins[0];
flexeraBottomMarginPx = margins[1];
paddingTop += margins[0];
paddingBottom += margins[1];
padding.set(paddingLeft, paddingTop, paddingRight, paddingBottom);
}
@@ -353,9 +353,17 @@ public class InvariantDeviceProfile {
this.mDisplayController = DisplayController.INSTANCE.get(context.getApplicationContext());
this.mWMProxy = WindowManagerProxy.INSTANCE.get(context.getApplicationContext());
String gridName = DeviceProfileOverrides.INSTANCE.get(context).getGridName(dbGridInfo);
// Flexera Launcher: set before initGrid, which makes the device profiles that read it.
flexeraPreviewOverrides = previewOverrides;
initGrid(context, gridName, dbGridInfo, previewOverrides);
}
/**
* Flexera Launcher: what a preview shows in place of the kept preferences, such as margins
* not applied yet (app.flexera.home.HomeMargins); null outside a preview.
*/
public DeviceProfileOverrides.PreviewOverrides flexeraPreviewOverrides;
private String initGrid(Context context, String gridName) {
Info displayInfo = mDisplayController.getInfo();
List<DisplayOption> allOptions = getPredefinedDeviceProfiles(