Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a74bfbca51 | ||
|
|
a56160c07b | ||
|
|
889c5f614d | ||
|
|
4710171559 | ||
|
|
29ffb83e66 | ||
|
|
6e88f7c81b | ||
|
|
b092105ed9 | ||
|
|
2cdb779dac | ||
|
|
be15483e34 | ||
|
|
0306c1d2ce |
No files matched your search
+1
-1
@@ -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.7</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
@@ -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.7';
|
||||
/* 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
@@ -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."
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.8
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+53
-8
@@ -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),
|
||||
|
||||
@@ -352,6 +352,14 @@ public class DeviceProfile {
|
||||
private int homeSideMarginDp;
|
||||
private int homeTopMarginDp;
|
||||
private int homeBottomMarginDp;
|
||||
/**
|
||||
* Flexera Launcher: the grid's own side margin, before the owner's home screen margin
|
||||
* replaces it; the drawer keeps this one (updateAllAppsContainerWidth).
|
||||
*/
|
||||
private int flexeraGridSideMarginPx;
|
||||
/** 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 +391,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.
|
||||
@@ -687,6 +704,9 @@ public class DeviceProfile {
|
||||
// width and get centered, leaving a visible side gap even at factor 0.
|
||||
desiredWorkspaceHorizontalMarginPx =
|
||||
Math.round(desiredWorkspaceHorizontalMarginPx * workspacePaddingHorizontalFactor);
|
||||
// Flexera Launcher: the grid's own side margin, kept for the drawer
|
||||
// (updateAllAppsContainerWidth) before the owner's takes its place on the home screen.
|
||||
flexeraGridSideMarginPx = desiredWorkspaceHorizontalMarginPx;
|
||||
// Flexera Launcher: the owner's side margins (app.flexera.home.HomeMargins), except
|
||||
// beside a landscape phone's side bar, where the grid keeps none.
|
||||
if (!isVerticalBarLayout()) {
|
||||
@@ -1473,8 +1493,16 @@ public class DeviceProfile {
|
||||
+ allAppsPadding.left + allAppsPadding.right;
|
||||
allAppsLeftRightMargin = Math.max(1, (mDeviceProperties.getAvailableWidthPx() - usedWidth) / 2);
|
||||
} else if (!mIsResponsiveGrid) {
|
||||
// Flexera Launcher: the grid's own side margin, not the owner's home screen one
|
||||
// (app.flexera.home.HomeMargins), scaled as the workspace's is (updateIconSize).
|
||||
// The multiplier below makes ten pixels of drawer padding out of every pixel of
|
||||
// margin, so 24 dp at the sides of the home screen gave the drawer 160 dp on each
|
||||
// side and from about 30 dp the list had no width left: no app rows, only the
|
||||
// wave alphabet, which lies over the list.
|
||||
int sideMarginPx = mIsScalableGrid
|
||||
? (int) (flexeraGridSideMarginPx * cellScaleToFit) : flexeraGridSideMarginPx;
|
||||
allAppsPadding.left = allAppsPadding.right =
|
||||
Math.max(0, desiredWorkspaceHorizontalMarginPx + cellLayoutHorizontalPadding
|
||||
Math.max(0, sideMarginPx + cellLayoutHorizontalPadding
|
||||
- (getAllAppsProfile().getBorderSpacePx().x / 2));
|
||||
}
|
||||
var allAppLeftRightMarginMultiplier = PreferenceCacheExtensionsKt
|
||||
@@ -1818,9 +1846,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(
|
||||
|
||||
Reference in new issue
Block a user