Full-screen folders: apps at the bottom in the home screen's grid
At the user's request, a folder on the home screen or in the dock opens over the whole screen instead of as a floating panel. Settings, Folders, "Full screen folders", on by default; switched off, folders float as before. Folders in the app list are unchanged. - No panel. The home screen behind is darkened and blurred as behind the app drawer: black at 78% (FlexeraDrawer.BACKDROP_COLOR) and the largest blur radius, which the drawer's depth comes to. - The apps sit at the bottom of the screen, centred, just above the navigation bar, with white labels and the folder's name below them, wherever the folder's icon is. - They are laid out like the home screen's icons: its column count, filled row by row (FolderGridOrganizer.createFullScreenFolderGridOrganizer), in cells the size of the home screen's cells as a page lays them out (larger than the device profile's cell size, which the page stretches), so that the columns line up with the home screen's. A row is never lower than one app with its label needs. The folder icon's preview keeps the folder grid. While a full-screen folder is open, state changes leave the scrim alone (WorkspaceStateTransitionAnimation.setScrim), so that dragging an app inside the folder no longer lightens its backdrop; the folder hands the scrim back as it closes. The depth controller's folder blur now carries its own strength (FolderBlur.strength); quick launch scales its blur by FolderBlur.STRENGTH itself and looks as before. While full-screen folders are on, Settings hides the panel's opacity and the folder column count, which do not apply to them. Checked on the emulator (Android 17, 4-column test grid): open, tap an app, tap outside, Back, rename with the keyboard (the folder lifts above it), reorder inside the folder (the backdrop holds), drag an app out to the home screen, the setting off and on again (the floating folder comes back with its panel, 3 columns and dark labels), and columns and rows 259 and 243 px apart, as on the home screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a79962e5c4
commit
2a14ae11e0
12 files changed
+335
-39
No files matched your search
@@ -101,6 +101,9 @@
|
||||
<string name="flexera_align_widgets">Line up with icons</string>
|
||||
<string name="flexera_align_widgets_description">The edges of every widget meet the edges of the icons above, below and beside it</string>
|
||||
<string name="flexera_folder_blur_description">Blurs the home screen while a folder is open</string>
|
||||
<!-- Folder settings: folders open over the whole screen, apps at the bottom (app.flexera.home.FullScreenFolders) -->
|
||||
<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>
|
||||
<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>
|
||||
|
||||
@@ -16,12 +16,25 @@ import com.android.launcher3.Utilities
|
||||
object FolderBlur {
|
||||
|
||||
/**
|
||||
* The blur's radius behind a fully open folder, as a share of the largest radius the
|
||||
* launcher blurs with (30dp). Strong enough that the icons behind the folder are no longer
|
||||
* read, which is the point: the folder is what is in focus.
|
||||
* The blur's radius behind a fully open floating folder, as a share of the largest radius
|
||||
* the launcher blurs with (30dp). Strong enough that the icons behind the folder are no
|
||||
* longer read, which is the point: the folder is what is in focus.
|
||||
*/
|
||||
const val STRENGTH = 0.8f
|
||||
|
||||
/**
|
||||
* Behind a full-screen folder ([FullScreenFolders]) the blur is the app drawer's: the
|
||||
* largest radius, which the drawer's depth comes to.
|
||||
*/
|
||||
const val FULL_SCREEN_STRENGTH = 1f
|
||||
|
||||
/**
|
||||
* How far the folder's opening animation takes the depth controller's folder blur, which is
|
||||
* the share of the largest radius: [FULL_SCREEN_STRENGTH] or [STRENGTH].
|
||||
*/
|
||||
@JvmStatic
|
||||
fun strength(fullScreen: Boolean): Float = if (fullScreen) FULL_SCREEN_STRENGTH else STRENGTH
|
||||
|
||||
/** Blurring a view needs Android 12. */
|
||||
@JvmStatic
|
||||
fun isOn(context: Context): Boolean =
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package app.flexera.home
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.Point
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import app.flexera.drawer.FlexeraDrawer
|
||||
import app.lawnchair.preferences2.PreferenceManager2
|
||||
import app.lawnchair.preferences2.firstCached
|
||||
import com.android.launcher3.CellLayout
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.Launcher
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.Utilities
|
||||
import com.android.launcher3.util.Themes
|
||||
import kotlin.math.max
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* Full-screen folders: a folder on the home screen or in the dock opens over the whole screen
|
||||
* instead of as a floating panel. There is no panel. The home screen behind is blurred and
|
||||
* darkened as behind the app drawer ([FolderBlur], [dim]), and the folder's apps sit at the
|
||||
* bottom of the screen, within the thumb's reach, with the folder's name below them. They are
|
||||
* laid out like the home screen's icons: in its columns, in cells of the same size
|
||||
* ([cellSize], [com.android.launcher3.folder.FolderGridOrganizer.createFullScreenFolderGridOrganizer]).
|
||||
* Where the folder's icon is makes no difference to where its apps appear.
|
||||
*
|
||||
* The folder view itself ([com.android.launcher3.folder.Folder]) is still only as large as its
|
||||
* apps and its name; the rest of the screen is the darkened home screen. So a tap there closes
|
||||
* the folder, as a tap beside a floating folder does, and an app dragged out of the folder leaves
|
||||
* it as before. Folders in the app list are left as they were.
|
||||
*/
|
||||
object FullScreenFolders {
|
||||
|
||||
/** Space between the folder's name, under its apps, and the navigation bar. */
|
||||
private const val BOTTOM_MARGIN_DP = 16f
|
||||
|
||||
/** Space kept free below the status bar, should a folder be taller than the screen allows. */
|
||||
private const val TOP_MARGIN_DP = 8f
|
||||
|
||||
/** The folder name's hint ("Unnamed folder") while it is being edited. */
|
||||
private const val HINT_COLOR = 0xB3FFFFFF.toInt()
|
||||
|
||||
/** Whether the owner wants folders full screen (Settings, Folders). */
|
||||
@JvmStatic
|
||||
fun isOn(context: Context): Boolean =
|
||||
PreferenceManager2.getInstance(context).fullScreenFolders.firstCached()
|
||||
|
||||
/**
|
||||
* The size of a cell in a full-screen folder: that of the home screen's cells as they are
|
||||
* laid out on a page (stretched to fill it, so larger than the device profile's own cell
|
||||
* size), less the difference between the folder's and the home screen's spacing between
|
||||
* cells. The folder's apps are then as far apart as the home screen's, both ways, and a
|
||||
* folder centred on the screen has its columns where the home screen has them. A row is
|
||||
* never lower than one app with its label needs, should the home screen's rows be lower.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun cellSize(launcher: Launcher): Point {
|
||||
val dp = launcher.deviceProfile
|
||||
val workspace = launcher.workspace
|
||||
val page = workspace?.getPageAt(workspace.currentPage) as? CellLayout
|
||||
var width = page?.cellWidth ?: 0
|
||||
var height = page?.cellHeight ?: 0
|
||||
if (width <= 0 || height <= 0) {
|
||||
// No page laid out yet: the width as a page would lay it out.
|
||||
val columns = max(1, dp.inv.numColumns)
|
||||
val pageWidth = dp.deviceProperties.widthPx -
|
||||
dp.workspacePadding.left - dp.workspacePadding.right -
|
||||
dp.cellLayoutPaddingPx.left - dp.cellLayoutPaddingPx.right
|
||||
width = (pageWidth - (columns - 1) * dp.cellLayoutBorderSpacePx.x) / columns
|
||||
height = dp.cellHeightPx
|
||||
}
|
||||
val appHeight = dp.folderChildIconSizePx + dp.folderChildDrawablePaddingPx +
|
||||
Utilities.calculateTextHeight(dp.folderChildTextSizePx.toFloat())
|
||||
return Point(
|
||||
max(width + dp.cellLayoutBorderSpacePx.x - dp.folderCellLayoutBorderSpacePx.x,
|
||||
dp.folderChildIconSizePx),
|
||||
max(height + dp.cellLayoutBorderSpacePx.y - dp.folderCellLayoutBorderSpacePx.y,
|
||||
appHeight),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Where a full-screen folder of [width] by [height] goes, as its left and top in [dragLayer]:
|
||||
* centred across the screen, its bottom just above the navigation bar. A folder too tall for
|
||||
* that starts just below the status bar instead.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun position(dragLayer: View, dp: DeviceProfile, width: Int, height: Int): IntArray {
|
||||
val insets = dp.insets
|
||||
val density = dragLayer.resources.displayMetrics.density
|
||||
val screenWidth = if (dragLayer.width > 0) dragLayer.width else dp.deviceProperties.widthPx
|
||||
val screenHeight =
|
||||
if (dragLayer.height > 0) dragLayer.height else dp.deviceProperties.heightPx
|
||||
val left = insets.left + (screenWidth - insets.left - insets.right - width) / 2
|
||||
val bottom = screenHeight - insets.bottom - (BOTTOM_MARGIN_DP * density).roundToInt()
|
||||
val highest = insets.top + (TOP_MARGIN_DP * density).roundToInt()
|
||||
return intArrayOf(left, max(highest, bottom - height))
|
||||
}
|
||||
|
||||
/**
|
||||
* How dark the home screen behind a full-screen folder gets (black, 0 to 1): as dark as
|
||||
* behind the app drawer ([FlexeraDrawer.BACKDROP_COLOR]), whatever the theme and the
|
||||
* wallpaper, so that the white labels stay readable. With the blur at the drawer's strength
|
||||
* too ([FolderBlur.FULL_SCREEN_STRENGTH]) it is the drawer's backdrop.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun dim(): Float = Color.alpha(FlexeraDrawer.BACKDROP_COLOR) / 255f
|
||||
|
||||
/**
|
||||
* Gives an app's label in a folder the colour of its style: white over the dimmed home
|
||||
* screen, or the theme's folder text colour on a floating panel. The views in folders are
|
||||
* reused from one folder to the next, so both are set every time.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun styleLabel(label: TextView, fullScreen: Boolean) {
|
||||
label.setTextColor(
|
||||
if (fullScreen) Color.WHITE else Themes.getAttrColor(label.context, R.attr.folderTextColor),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Colours the folder's [name] for its style: white over the dimmed home screen, or as laid
|
||||
* out for a floating panel. Its size is the same in both.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun styleName(name: TextView, fullScreen: Boolean) {
|
||||
val context = name.context
|
||||
if (fullScreen) {
|
||||
name.setTextColor(Color.WHITE)
|
||||
name.setHintTextColor(HINT_COLOR)
|
||||
} else {
|
||||
name.setTextColor(Themes.getAttrColor(context, R.attr.folderTextColor))
|
||||
name.setHintTextColor(Themes.getAttrColor(context, R.attr.folderHintTextColor))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,8 @@ class QuickLaunchPage private constructor(private val launcher: Launcher) {
|
||||
dragLayer.setAnimationMatrix(null)
|
||||
}
|
||||
|
||||
launcher.depthController?.quickLaunchBlur?.value = blurFor(p)
|
||||
// As strong as behind a floating folder, at most.
|
||||
launcher.depthController?.quickLaunchBlur?.value = blurFor(p) * FolderBlur.STRENGTH
|
||||
|
||||
// Light status bar icons once the page is most of what is seen.
|
||||
launcher.systemUiController?.updateUiState(
|
||||
|
||||
@@ -902,6 +902,13 @@ class PreferenceManager2 @Inject constructor(
|
||||
defaultValue = true,
|
||||
)
|
||||
|
||||
// Flexera Launcher: whether a folder on the home screen opens full screen, with its apps at
|
||||
// the bottom of the screen (app.flexera.home.FullScreenFolders). Read when a folder opens.
|
||||
val fullScreenFolders = preference(
|
||||
key = booleanPreferencesKey(name = "flexera_full_screen_folders"),
|
||||
defaultValue = true,
|
||||
)
|
||||
|
||||
val autoUpdaterNightly = preference(
|
||||
key = booleanPreferencesKey(name = "enable_nightly_auto_updater"),
|
||||
defaultValue = if (BuildConfig.APPLICATION_ID.contains("nightly")) {
|
||||
|
||||
@@ -52,7 +52,15 @@ fun FolderPreferences(
|
||||
.firstOrNull { it.value == folderIconShapeAdapter.state.value }
|
||||
?.label?.invoke()
|
||||
?: stringResource(id = R.string.custom)
|
||||
// Flexera Launcher: full-screen folders have no panel, and their columns are the home
|
||||
// screen's, so the panel's opacity and the column count are hidden while they are on.
|
||||
val fullScreenFoldersAdapter = prefs2.fullScreenFolders.getAdapter()
|
||||
PreferenceGroup(heading = stringResource(id = R.string.general_label)) {
|
||||
SwitchPreference(
|
||||
adapter = fullScreenFoldersAdapter,
|
||||
label = stringResource(id = R.string.flexera_full_screen_folders),
|
||||
description = stringResource(id = R.string.flexera_full_screen_folders_description),
|
||||
)
|
||||
NavigationActionPreference(
|
||||
label = stringResource(id = R.string.folder_shape_label),
|
||||
destination = GeneralIconShape(ShapeRoute.FOLDER_SHAPE),
|
||||
@@ -69,13 +77,15 @@ fun FolderPreferences(
|
||||
valueRange = 0F..1F,
|
||||
showAsPercentage = true,
|
||||
)
|
||||
SliderPreference(
|
||||
label = stringResource(id = R.string.folder_bg_opacity_label),
|
||||
adapter = prefs2.folderBackgroundOpacity.getAdapter(),
|
||||
step = 0.1F,
|
||||
valueRange = 0F..1F,
|
||||
showAsPercentage = true,
|
||||
)
|
||||
ExpandAndShrink(visible = !fullScreenFoldersAdapter.state.value) {
|
||||
SliderPreference(
|
||||
label = stringResource(id = R.string.folder_bg_opacity_label),
|
||||
adapter = prefs2.folderBackgroundOpacity.getAdapter(),
|
||||
step = 0.1F,
|
||||
valueRange = 0F..1F,
|
||||
showAsPercentage = true,
|
||||
)
|
||||
}
|
||||
// Flexera Launcher: blurring a view needs Android 12.
|
||||
if (Utilities.ATLEAST_S) {
|
||||
SwitchPreference(
|
||||
@@ -86,12 +96,14 @@ fun FolderPreferences(
|
||||
}
|
||||
}
|
||||
PreferenceGroup(heading = stringResource(id = R.string.grid)) {
|
||||
SliderPreference(
|
||||
label = stringResource(id = R.string.max_folder_columns),
|
||||
adapter = prefs2.folderColumns.getAdapter(),
|
||||
step = 1,
|
||||
valueRange = 2..5,
|
||||
)
|
||||
ExpandAndShrink(visible = !fullScreenFoldersAdapter.state.value) {
|
||||
SliderPreference(
|
||||
label = stringResource(id = R.string.max_folder_columns),
|
||||
adapter = prefs2.folderColumns.getAdapter(),
|
||||
step = 1,
|
||||
valueRange = 2..5,
|
||||
)
|
||||
}
|
||||
SliderPreference(
|
||||
label = stringResource(id = R.string.max_folder_rows),
|
||||
adapter = prefs.folderRows.getAdapter(),
|
||||
|
||||
@@ -91,14 +91,15 @@ public class BaseDepthControllerImpl implements BaseDepthController {
|
||||
/** Property to set just the wallpaper zoom for folder expansion. */
|
||||
public final MultiProperty folderZoom;
|
||||
/**
|
||||
* Flexera Launcher: property to set the blur behind an open folder, from 0 to 1. Unlike the
|
||||
* depth it comes with no zoom, and it reaches the icons as well as the wallpaper.
|
||||
* Flexera Launcher: property to set the blur behind an open folder, as a share of the
|
||||
* largest blur radius, from 0 to 1 (app.flexera.home.FolderBlur.strength). Unlike the depth
|
||||
* it comes with no zoom, and it reaches the icons as well as the wallpaper.
|
||||
*/
|
||||
public final MultiProperty folderBlur;
|
||||
/**
|
||||
* Flexera Launcher: property to set the blur of the home screen while quick launch's page
|
||||
* slides in over it (app.flexera.home.QuickLaunchPage), from 0 to 1. It shares the folder
|
||||
* blur's machinery; the stronger of the two wins.
|
||||
* slides in over it (app.flexera.home.QuickLaunchPage), as a share of the largest blur
|
||||
* radius. It shares the folder blur's machinery; the stronger of the two wins.
|
||||
*/
|
||||
public final MultiProperty quickLaunchBlur;
|
||||
|
||||
@@ -244,8 +245,8 @@ public class BaseDepthControllerImpl implements BaseDepthController {
|
||||
if (!Utilities.ATLEAST_S || amount <= 0f) {
|
||||
return false;
|
||||
}
|
||||
float radius = Math.max(mCurrentBlur,
|
||||
amount * app.flexera.home.FolderBlur.STRENGTH * mMaxBlurRadius);
|
||||
// The amount is already the share of the largest radius (FolderBlur.strength).
|
||||
float radius = Math.max(mCurrentBlur, amount * mMaxBlurRadius);
|
||||
if (radius < 1f) {
|
||||
// Too little to see, and a blur of no radius is not one the system accepts.
|
||||
mLauncher.getDepthBlurTargets().forEach(target -> target.setRenderEffect(null));
|
||||
@@ -336,8 +337,9 @@ public class BaseDepthControllerImpl implements BaseDepthController {
|
||||
} else {
|
||||
blurAmount = depth;
|
||||
}
|
||||
// Flexera Launcher: an open folder blurs what is behind it, whatever the depth is.
|
||||
float behindFolder = folderBlurAmount() * app.flexera.home.FolderBlur.STRENGTH;
|
||||
// Flexera Launcher: an open folder blurs what is behind it, whatever the depth is. The
|
||||
// amount is already the share of the largest radius (FolderBlur.strength).
|
||||
float behindFolder = folderBlurAmount();
|
||||
blurAmount = Math.max(blurAmount, behindFolder);
|
||||
mFolderBlurApplied = behindFolder > 0f;
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.anim.PropertySetter;
|
||||
import com.android.launcher3.anim.SpringAnimationBuilder;
|
||||
import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.graphics.Scrim;
|
||||
import com.android.launcher3.graphics.SysUiScrim;
|
||||
import com.android.launcher3.states.EditModeState;
|
||||
@@ -207,9 +208,15 @@ public class WorkspaceStateTransitionAnimation {
|
||||
propertySetter.setFloat(sysUiScrim.getSysUIProgress(), AnimatedFloat.VALUE,
|
||||
state.hasFlag(FLAG_HAS_SYS_UI_SCRIM) ? 1 : 0, LINEAR);
|
||||
|
||||
propertySetter.setScrimColors(mLauncher.getScrimView(),
|
||||
state.getWorkspaceScrimColor(mLauncher),
|
||||
config.getInterpolator(ANIM_SCRIM_FADE, ACCELERATE_2));
|
||||
// Flexera Launcher: while a full-screen folder is open the scrim is its backdrop
|
||||
// (app.flexera.home.FullScreenFolders), also through the drag state an app dragged inside
|
||||
// it passes; the folder hands the scrim back as it closes (FolderScrimAnimationListener).
|
||||
Folder openFolder = Folder.getOpen(mLauncher);
|
||||
if (openFolder == null || !openFolder.isFullScreen()) {
|
||||
propertySetter.setScrimColors(mLauncher.getScrimView(),
|
||||
state.getWorkspaceScrimColor(mLauncher),
|
||||
config.getInterpolator(ANIM_SCRIM_FADE, ACCELERATE_2));
|
||||
}
|
||||
}
|
||||
|
||||
public void applyChildState(LauncherState state, CellLayout cl, int childIndex) {
|
||||
|
||||
@@ -139,6 +139,7 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.patrykmichalik.opto.core.PreferenceExtensionsKt;
|
||||
import app.flexera.home.FullScreenFolders;
|
||||
import app.lawnchair.preferences2.PreferenceManager2;
|
||||
import app.lawnchair.theme.color.ColorOption;
|
||||
import app.lawnchair.theme.color.tokens.ColorTokens;
|
||||
@@ -297,6 +298,14 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
|
||||
private @NonNull GradientDrawable mBackground;
|
||||
|
||||
/**
|
||||
* Flexera Launcher: whether this folder is open full screen (app.flexera.home.FullScreenFolders):
|
||||
* no panel, its apps in the home screen's columns at the bottom of the screen, its name below
|
||||
* them. Decided each time it opens, and kept until it opens again, so that it closes as it
|
||||
* opened.
|
||||
*/
|
||||
private boolean mFullScreen;
|
||||
|
||||
PreferenceManager2 preferenceManager2;
|
||||
|
||||
/**
|
||||
@@ -533,6 +542,23 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
return mInfo.container == ItemInfo.NO_ID;
|
||||
}
|
||||
|
||||
/** Flexera Launcher: see {@link #mFullScreen}. */
|
||||
public boolean isFullScreen() {
|
||||
return mFullScreen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flexera Launcher: sets up this folder, about to open, as a full-screen or a floating one.
|
||||
* Everything is set both ways, because a folder view lives on from one opening to the next.
|
||||
*/
|
||||
private void setFullScreen(boolean fullScreen) {
|
||||
mFullScreen = fullScreen;
|
||||
mContent.setFullScreen(fullScreen);
|
||||
// No panel behind the apps of a full-screen folder: the dimmed home screen is behind them.
|
||||
mBackground.setAlpha(fullScreen ? 0 : LawnchairUtilsKt.getFolderBackgroundAlpha(getContext()));
|
||||
FullScreenFolders.styleName(mFolderName, fullScreen);
|
||||
}
|
||||
|
||||
/**
|
||||
* LC: App drawer folders live in Lawnchair's own database and are not part of the
|
||||
* launcher model, so writing them through ModelWriter can collide with an unrelated
|
||||
@@ -845,6 +871,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
Folder openFolder = getOpen(mActivityContext);
|
||||
closeOpenFolder(openFolder);
|
||||
|
||||
// Flexera Launcher: before the apps are bound, which style them for it.
|
||||
setFullScreen(mActivityContext instanceof Launcher && !isInAppDrawer()
|
||||
&& FullScreenFolders.isOn(getContext()));
|
||||
mContent.bindItems(items);
|
||||
mContent.setCanAnnouncePageDescriptionForFolder(true);
|
||||
centerAboutIcon();
|
||||
@@ -1398,13 +1427,23 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
int centeredLeft = centerX - width / 2;
|
||||
int centeredTop = centerY - height / 2;
|
||||
|
||||
sTempRect.set(mActivityContext.getFolderBoundingBox());
|
||||
int left = Utilities.boundToRange(centeredLeft, sTempRect.left, sTempRect.right - width);
|
||||
int top = Utilities.boundToRange(centeredTop, sTempRect.top, sTempRect.bottom - height);
|
||||
int[] inOutPosition = new int[]{left, top};
|
||||
mActivityContext.updateOpenFolderPosition(inOutPosition, sTempRect, width, height);
|
||||
left = inOutPosition[0];
|
||||
top = inOutPosition[1];
|
||||
int left;
|
||||
int top;
|
||||
if (mFullScreen) {
|
||||
// Flexera Launcher: at the bottom of the screen, wherever the folder's icon is.
|
||||
int[] position = FullScreenFolders.position(
|
||||
parent, mActivityContext.getDeviceProfile(), width, height);
|
||||
left = position[0];
|
||||
top = position[1];
|
||||
} else {
|
||||
sTempRect.set(mActivityContext.getFolderBoundingBox());
|
||||
left = Utilities.boundToRange(centeredLeft, sTempRect.left, sTempRect.right - width);
|
||||
top = Utilities.boundToRange(centeredTop, sTempRect.top, sTempRect.bottom - height);
|
||||
int[] inOutPosition = new int[]{left, top};
|
||||
mActivityContext.updateOpenFolderPosition(inOutPosition, sTempRect, width, height);
|
||||
left = inOutPosition[0];
|
||||
top = inOutPosition[1];
|
||||
}
|
||||
|
||||
int folderPivotX = width / 2 + (centeredLeft - left);
|
||||
int folderPivotY = height / 2 + (centeredTop - top);
|
||||
|
||||
@@ -45,13 +45,24 @@ public class FolderGridOrganizer {
|
||||
private static final int PREVIEW_MAX_ROWS = 2;
|
||||
private static final int PREVIEW_MAX_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* Flexera Launcher: rows are always full width, as on the home screen, instead of a grid
|
||||
* about as tall as it is wide.
|
||||
*/
|
||||
private final boolean mFullRows;
|
||||
|
||||
/**
|
||||
* Note: must call {@link #setFolderInfo(FolderInfo)} manually for verifier to work.
|
||||
*/
|
||||
public FolderGridOrganizer(int maxCountX, int maxCountY) {
|
||||
this(maxCountX, maxCountY, false);
|
||||
}
|
||||
|
||||
private FolderGridOrganizer(int maxCountX, int maxCountY, boolean fullRows) {
|
||||
mMaxCountX = maxCountX;
|
||||
mMaxCountY = maxCountY;
|
||||
mMaxItemsPerPage = mMaxCountX * mMaxCountY;
|
||||
mFullRows = fullRows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,6 +72,16 @@ public class FolderGridOrganizer {
|
||||
return new FolderGridOrganizer(profile.numFolderColumns, profile.numFolderRows);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flexera Launcher: the grid of an open full-screen folder (app.flexera.home.FullScreenFolders):
|
||||
* the home screen's columns, filled row by row, and as many rows as a folder may have. Only
|
||||
* the open folder is laid out with it; its icon's preview keeps the folder grid.
|
||||
*/
|
||||
public static FolderGridOrganizer createFullScreenFolderGridOrganizer(DeviceProfile profile) {
|
||||
return new FolderGridOrganizer(
|
||||
Math.max(1, profile.inv.numColumns), Math.max(1, profile.numFolderRows), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the organizer with the provided folder info
|
||||
*/
|
||||
@@ -99,6 +120,11 @@ public class FolderGridOrganizer {
|
||||
* maintaining the restrictions of {@link #mMaxCountX} & {@link #mMaxCountY}.
|
||||
*/
|
||||
private void calculateGridSize(int count) {
|
||||
if (mFullRows) {
|
||||
mCountX = mMaxCountX;
|
||||
mCountY = Math.max(1, Math.min(mMaxCountY, (count + mMaxCountX - 1) / mMaxCountX));
|
||||
return;
|
||||
}
|
||||
boolean done;
|
||||
int gridCountX = mCountX;
|
||||
int gridCountY = mCountY;
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.PagedView;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.ShortcutAndWidgetContainer;
|
||||
@@ -67,6 +68,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.ToIntFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import app.flexera.home.FullScreenFolders;
|
||||
|
||||
public class FolderPagedView extends PagedView<PageIndicatorDots> implements ClipPathView {
|
||||
|
||||
private static final String TAG = "FolderPagedView";
|
||||
@@ -88,7 +91,10 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
|
||||
|
||||
@Thunk final ArrayMap<View, Runnable> mPendingAnimations = new ArrayMap<>();
|
||||
|
||||
private final FolderGridOrganizer mOrganizer;
|
||||
// Flexera Launcher: not final; a full-screen folder has a grid of its own (setFullScreen).
|
||||
private FolderGridOrganizer mOrganizer;
|
||||
private final FolderGridOrganizer mFloatingOrganizer;
|
||||
private boolean mFullScreen;
|
||||
private final ViewCache mViewCache;
|
||||
|
||||
private int mAllocatedContentSize;
|
||||
@@ -124,6 +130,7 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
|
||||
super(context, attrs);
|
||||
ActivityContext activityContext = ActivityContext.lookupContext(context);
|
||||
mOrganizer = folderGridOrganizer;
|
||||
mFloatingOrganizer = folderGridOrganizer;
|
||||
|
||||
mIsRtl = Utilities.isRtl(getResources());
|
||||
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
|
||||
@@ -138,6 +145,19 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
|
||||
initParentViews(folder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flexera Launcher: a full-screen folder (app.flexera.home.FullScreenFolders) lays its apps out
|
||||
* in the home screen's columns, each as wide as on the home screen; a floating one in its own
|
||||
* grid. Called as the folder opens, before its items are bound.
|
||||
*/
|
||||
void setFullScreen(boolean fullScreen) {
|
||||
mFullScreen = fullScreen;
|
||||
mOrganizer = fullScreen
|
||||
? FolderGridOrganizer.createFullScreenFolderGridOrganizer(
|
||||
mFolder.mActivityContext.getDeviceProfile())
|
||||
: mFloatingOrganizer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the grid size such that {@param count} items can fit in the grid.
|
||||
*/
|
||||
@@ -359,6 +379,16 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
|
||||
}
|
||||
}
|
||||
|
||||
// Flexera Launcher: white labels over the dimmed home screen of a full-screen folder. Set
|
||||
// both ways, as the views are reused from one folder to the next.
|
||||
if (!mFolder.isInAppDrawer()) {
|
||||
if (icon instanceof AppPairIcon appPair) {
|
||||
FullScreenFolders.styleLabel(appPair.getTitleTextView(), mFolder.isFullScreen());
|
||||
} else if (icon instanceof BubbleTextView label) {
|
||||
FullScreenFolders.styleLabel(label, mFolder.isFullScreen());
|
||||
}
|
||||
}
|
||||
|
||||
icon.setOnClickListener(mFolder.mActivityContext.getItemOnClickListener());
|
||||
icon.setOnLongClickListener(mFolder);
|
||||
icon.setOnFocusChangeListener(mFocusIndicatorHelper);
|
||||
@@ -392,6 +422,10 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
|
||||
// Lawnchair: Find the correct folder size depending on which parent owned them
|
||||
if (mFolder.isInAppDrawer()) {
|
||||
page.setCellDimensions(grid.getAllAppsProfile().getCellWidthPx(), grid.getAllAppsProfile().getCellHeightPx());
|
||||
} else if (mFullScreen && mFolder.mActivityContext instanceof Launcher launcher) {
|
||||
// Flexera Launcher: cells as large as the home screen's, so that the apps line up.
|
||||
Point cell = FullScreenFolders.cellSize(launcher);
|
||||
page.setCellDimensions(cell.x, cell.y);
|
||||
} else {
|
||||
page.setCellDimensions(grid.folderCellWidthPx, grid.folderCellHeightPx);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
|
||||
animatorSet,
|
||||
folderAnimData.isOpening,
|
||||
launcherDelegate,
|
||||
folder.isFullScreen,
|
||||
)
|
||||
launcherDelegate.launcher?.depthController?.folderZoom?.let {
|
||||
addWallpaperZoomAnimator(folder.context, animatorSet, folderAnimData.isOpening, it)
|
||||
@@ -96,6 +97,7 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
|
||||
animatorSet,
|
||||
folderAnimData.isOpening,
|
||||
launcherDelegate,
|
||||
folder.isFullScreen,
|
||||
)
|
||||
iconAnimData.forEach { addContentIconAnimators(folder.context, animatorSet, it) }
|
||||
return FolderSpringAnimatorSet(animatorSet)
|
||||
@@ -267,13 +269,15 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
|
||||
/**
|
||||
* Flexera Launcher: blurs the home screen behind the folder as it opens, and clears it
|
||||
* again as it closes, in step with the dimming. Closing always plays, also when the
|
||||
* setting has been switched off since the folder was opened.
|
||||
* setting has been switched off since the folder was opened. A full-screen folder is
|
||||
* blurred behind as strongly as the app drawer.
|
||||
*/
|
||||
private fun addBackdropBlurAnimator(
|
||||
context: Context,
|
||||
animatorSet: AnimatorSet,
|
||||
isOpening: Boolean,
|
||||
launcherDelegate: LauncherDelegate,
|
||||
fullScreen: Boolean,
|
||||
) {
|
||||
val launcher = launcherDelegate.launcher ?: return
|
||||
// As with the dimming: a folder in the app list leaves the list as it is.
|
||||
@@ -290,7 +294,7 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
|
||||
stiffness = STIFFNESS_LAUNCHER_SCRIM,
|
||||
damping = DAMPING_LAUNCHER_SCRIM,
|
||||
startValue = 0f,
|
||||
endValue = 1f,
|
||||
endValue = app.flexera.home.FolderBlur.strength(fullScreen),
|
||||
minVisibleChange = MIN_VISIBLE_CHANGE_ALPHA,
|
||||
property = MULTI_PROPERTY_VALUE,
|
||||
view = blur,
|
||||
@@ -401,6 +405,7 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
|
||||
animatorSet: AnimatorSet,
|
||||
isOpening: Boolean,
|
||||
launcherDelegate: LauncherDelegate,
|
||||
fullScreen: Boolean,
|
||||
) {
|
||||
val launcher = launcherDelegate.launcher ?: return
|
||||
// Folder scrim uses a black overlay with alpha 0→dimmed; that replaces the app drawer
|
||||
@@ -413,7 +418,16 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
|
||||
val hotseat = launcher.hotseat
|
||||
val workspaceScale = WORKSPACE_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_FOLDER_ANIM)
|
||||
val hotseatScale = HOTSEAT_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_FOLDER_ANIM)
|
||||
val finalScrimAlpha = if (isDarkTheme(context)) 0.32f else 0.2f
|
||||
// Flexera Launcher: behind a full-screen folder, whose white labels have no panel
|
||||
// behind them, as dark as behind the app drawer.
|
||||
val finalScrimAlpha =
|
||||
if (fullScreen) {
|
||||
app.flexera.home.FullScreenFolders.dim()
|
||||
} else if (isDarkTheme(context)) {
|
||||
0.32f
|
||||
} else {
|
||||
0.2f
|
||||
}
|
||||
scrimView.setBackgroundColor(Color.BLACK)
|
||||
playSpringAnimation(
|
||||
context = context,
|
||||
|
||||
Reference in new issue
Block a user