Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a74bfbca51 | ||
|
|
a56160c07b | ||
|
|
889c5f614d | ||
|
|
4710171559 | ||
|
|
29ffb83e66 | ||
|
|
6e88f7c81b | ||
|
|
b092105ed9 |
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.5</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.5';
|
||||
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."
|
||||
}
|
||||
|
||||
@@ -126,6 +126,8 @@
|
||||
<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>
|
||||
|
||||
@@ -1,10 +1,27 @@
|
||||
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 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
|
||||
@@ -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,17 +71,105 @@ 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)
|
||||
|
||||
/**
|
||||
* 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(side: PreferenceAdapter<Int>, top: PreferenceAdapter<Int>, bottom: PreferenceAdapter<Int>) {
|
||||
fun Preferences(
|
||||
side: PreferenceAdapter<Int>,
|
||||
top: PreferenceAdapter<Int>,
|
||||
bottom: PreferenceAdapter<Int>,
|
||||
limited: Boolean,
|
||||
) {
|
||||
SliderPreference(
|
||||
label = stringResource(id = R.string.flexera_home_side_margins),
|
||||
adapter = side,
|
||||
@@ -82,5 +191,13 @@ object HomeMargins {
|
||||
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.6
|
||||
versionName=1.0.8
|
||||
@@ -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
|
||||
@@ -91,6 +94,8 @@ fun HomeScreenGridPreferences(
|
||||
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) {
|
||||
@@ -146,6 +151,16 @@ fun HomeScreenGridPreferences(
|
||||
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,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
Column(
|
||||
@@ -228,6 +243,7 @@ fun HomeScreenGridPreferences(
|
||||
side = sideMargin.asPreferenceAdapter(),
|
||||
top = topMargin.asPreferenceAdapter(),
|
||||
bottom = bottomMargin.asPreferenceAdapter(),
|
||||
limited = marginsLimited,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -696,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()) {
|
||||
@@ -1482,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
|
||||
@@ -1827,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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user