chore: Spotlessified

This commit is contained in:
Pun Butrach committed 2026-01-10 20:50:52 +07:00
1 parent f75a5c4a0e
commit f2db7d5765
27 files changed
+200 -202

No files matched your search

@@ -88,8 +88,8 @@ fun AnnouncementPreference(
modifier = modifier.animateContentSize(
animationSpec = spring(
stiffness = Spring.StiffnessMediumLow,
dampingRatio = Spring.DampingRatioLowBouncy
)
dampingRatio = Spring.DampingRatioLowBouncy,
),
),
) {
announcements.forEachIndexed { index, announcement ->
@@ -46,8 +46,8 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import app.lawnchair.ui.preferences.components.controls.ClickablePreference
import app.lawnchair.ui.preferences.components.layout.ExpandAndShrink
import app.lawnchair.ui.preferences.components.layout.PreferenceGroupHeading
import app.lawnchair.ui.preferences.components.layout.PreferenceGroup
import app.lawnchair.ui.preferences.components.layout.PreferenceGroupHeading
import app.lawnchair.ui.preferences.components.layout.PreferenceTemplate
import app.lawnchair.ui.theme.preferenceGroupColor
import app.lawnchair.ui.util.addIf
@@ -145,7 +145,7 @@ fun <T> DraggablePreferenceGroup(
ExpandAndShrink(visible = localItems != defaultList) {
PreferenceGroup {
item {
Item {
ClickablePreference(label = stringResource(id = R.string.action_reset)) {
onOrderChange(defaultList)
}
@@ -5,14 +5,12 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material3.RadioButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.key
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import app.lawnchair.theme.color.ColorOption
import app.lawnchair.ui.preferences.components.colorpreference.ColorDot
import app.lawnchair.ui.preferences.components.colorpreference.ColorPreferenceEntry
import app.lawnchair.ui.preferences.components.layout.PreferenceDivider
import app.lawnchair.ui.preferences.components.layout.PreferenceGroup
import app.lawnchair.ui.preferences.components.layout.PreferenceTemplate
import com.android.launcher3.R
@@ -29,7 +27,7 @@ fun PresetsList(
modifier = modifier.padding(top = 12.dp),
) {
dynamicEntries.forEach { entry ->
item(key = entry) {
Item(key = entry) {
PreferenceTemplate(
title = { Text(text = entry.label()) },
verticalPadding = 12.dp,
@@ -52,7 +52,7 @@ fun <T> SwatchGrid(
heading = stringResource(id = R.string.swatches),
modifier = modifier,
) {
item {
Item {
Column(modifier = contentModifier) {
for (rowNo in 1..rowCount) {
val firstIndex = (rowNo - 1) * columnCount
@@ -109,7 +109,7 @@ fun PreferenceGroup(
interface PreferenceGroupScope {
@Composable
fun item(
fun Item(
key: Any? = null,
visible: Boolean = true,
enter: EnterTransition = expandVertically() + fadeIn(),
@@ -134,7 +134,7 @@ private class PreferenceGroupScopeImpl(
) : PreferenceGroupScope {
@Composable
override fun item(
override fun Item(
key: Any?,
visible: Boolean,
enter: EnterTransition,
@@ -55,7 +55,7 @@ fun DockSearchPreference(
if (hotseatEnabled) {
Column {
PreferenceGroup {
item {
Item {
HotseatModePreference(
adapter = hotseatModeAdapter,
)
@@ -72,7 +72,7 @@ fun DockSearchPreference(
PreferenceGroup(
heading = stringResource(R.string.search_bar_settings),
) {
item {
Item {
NavigationActionPreference(
label = stringResource(R.string.search_provider),
destination = DockSearchProvider,
@@ -87,13 +87,13 @@ fun DockSearchPreference(
PreferenceGroup(
heading = stringResource(R.string.style),
) {
item {
Item {
SwitchPreference(
adapter = themeQsbAdapter,
label = stringResource(id = R.string.apply_accent_color_label),
)
}
item {
Item {
SliderPreference(
label = stringResource(id = R.string.corner_radius_label),
adapter = qsbCornerAdapter,
@@ -102,7 +102,7 @@ fun DockSearchPreference(
showAsPercentage = true,
)
}
item {
Item {
SliderPreference(
label = stringResource(id = R.string.qsb_hotseat_background_transparency),
adapter = qsbAlphaAdapter,
@@ -111,7 +111,7 @@ fun DockSearchPreference(
showUnit = "%",
)
}
item {
Item {
SliderPreference(
label = stringResource(id = R.string.qsb_hotseat_stroke_width),
adapter = qsbHotseatStrokeWidth,
@@ -121,7 +121,7 @@ fun DockSearchPreference(
)
}
if (qsbHotseatStrokeWidth.state.value > 0f) {
item { ColorPreference(preference = prefs2.strokeColorStyle) }
Item { ColorPreference(preference = prefs2.strokeColorStyle) }
}
}
}
@@ -47,20 +47,20 @@ fun DrawerSearchPreference(
) {
PreferenceGroup(heading = stringResource(R.string.general_label)) {
if (hiddenApps.isNotEmpty()) {
item { HiddenAppsInSearchPreference() }
Item { HiddenAppsInSearchPreference() }
}
item {
Item {
SwitchPreference(
adapter = prefs2.autoShowKeyboardInDrawer.getAdapter(),
label = stringResource(id = R.string.pref_search_auto_show_keyboard),
)
}
item {
Item {
SearchProvider(
context = context,
)
}
item {
Item {
SwitchPreference(
label = stringResource(R.string.allapps_match_qsb_style_label),
description = stringResource(R.string.allapps_match_qsb_style_description),
@@ -76,7 +76,7 @@ fun DrawerSearchPreference(
val canDisable = searchAlgorithm != LawnchairSearchAlgorithm.APP_SEARCH
val adapter = prefs.searchResultApps.getAdapter()
item {
Item {
TwoTargetSwitchPreference(
checked = if (canDisable) adapter.state.value else true,
onCheckedChange = if (canDisable) adapter::onChange else ({}),
@@ -90,7 +90,7 @@ fun DrawerSearchPreference(
}
when (searchAlgorithm) {
LawnchairSearchAlgorithm.LOCAL_SEARCH -> {
item {
Item {
LocalSearchSettings(
prefs = prefs,
prefs2 = prefs2,
@@ -100,7 +100,7 @@ fun DrawerSearchPreference(
}
LawnchairSearchAlgorithm.ASI_SEARCH -> {
item { ASISearchSettings(prefs) }
Item { ASISearchSettings(prefs) }
}
}
}
@@ -159,7 +159,7 @@ fun FileSearchProvider(
ExpandAndShrink(hasAnyPermissions) {
PreferenceGroup {
item {
Item {
SliderPreference(
label = stringResource(id = R.string.max_file_result_count_title),
adapter = prefs2.maxFileResultCount.getAdapter(),
@@ -173,7 +173,7 @@ fun ContactsSearchProvider(
enabled = contactsPermissionState.status.isGranted,
) {
PreferenceGroup {
item {
Item {
SliderPreference(
label = stringResource(R.string.max_people_result_count_title),
adapter = prefs2.maxPeopleResultCount.getAdapter(),
@@ -225,7 +225,7 @@ fun GenericSearchProviderPreference(
modifier = modifier,
) {
PreferenceGroup {
item {
Item {
SliderPreference(
label = stringResource(
when (provider) {
@@ -252,7 +252,7 @@ fun GenericSearchProviderPreference(
when (provider) {
SearchProviderId.APPS -> {
item {
Item {
SwitchPreference(
adapter = prefs2.enableFuzzySearch.getAdapter(),
label = stringResource(id = R.string.fuzzy_search_title),
@@ -262,7 +262,7 @@ fun GenericSearchProviderPreference(
}
SearchProviderId.WEB -> {
item {
Item {
SliderPreference(
label = stringResource(id = R.string.max_web_suggestion_delay),
adapter = prefs2.maxWebSuggestionDelay.getAdapter(),
@@ -271,7 +271,7 @@ fun GenericSearchProviderPreference(
showUnit = "ms",
)
}
item {
Item {
WebSearchProvider(
adapter = prefs2.webSuggestionProvider.getAdapter(),
nameAdapter = prefs2.webSuggestionProviderName.getAdapter(),
@@ -282,7 +282,7 @@ fun GenericSearchProviderPreference(
}
SearchProviderId.HISTORY -> {
item {
Item {
val context = LocalContext.current
val suggestionsRecent = SearchRecentSuggestions(
@@ -65,7 +65,7 @@ fun AppDrawerFolderPreferenceItem(
PreferenceGroup(
modifier = modifier,
) {
item {
Item {
ClickablePreference(
label = stringResource(R.string.app_drawer_folder),
modifier = Modifier,
@@ -155,7 +155,7 @@ fun AppDrawerFoldersPreference(
PreferenceGroup(
heading = stringResource(R.string.settings),
) {
item {
Item {
SwitchPreference(
adapter = prefs.folderApps.getAdapter(),
label = stringResource(id = R.string.apps_in_folder_label),
@@ -164,7 +164,7 @@ fun AppDrawerFoldersPreference(
}
}
PreferenceGroup(heading = stringResource(R.string.folders_label)) {
item {
Item {
PreferenceTemplate(
title = {},
description = {
@@ -77,19 +77,19 @@ fun AppDrawerPreferences(
}
val hiddenApps = prefs2.hiddenApps.getAdapter().state.value
PreferenceGroup(heading = stringResource(id = R.string.general_label)) {
item {
Item {
NavigationActionPreference(
label = stringResource(id = R.string.hidden_apps_label),
subtitle = resources.getQuantityString(R.plurals.apps_count, hiddenApps.size, hiddenApps.size),
destination = AppDrawerHiddenApps,
)
}
item { SearchBarPreference(SearchRoute.DRAWER_SEARCH, showLabel = false) }
item { SuggestionsPreference() }
Item { SearchBarPreference(SearchRoute.DRAWER_SEARCH, showLabel = false) }
Item { SuggestionsPreference() }
}
PreferenceGroup(heading = stringResource(R.string.style)) {
item { ColorPreference(preference = prefs2.appDrawerBackgroundColor) }
item {
Item { ColorPreference(preference = prefs2.appDrawerBackgroundColor) }
Item {
SliderPreference(
label = stringResource(id = R.string.background_opacity),
adapter = prefs.drawerOpacity.getAdapter(),
@@ -98,7 +98,7 @@ fun AppDrawerPreferences(
showAsPercentage = true,
)
}
item {
Item {
SwitchPreference(
label = stringResource(id = R.string.pref_all_apps_search_bar_background),
adapter = prefs2.appDrawerSearchBarBackground.getAdapter(),
@@ -106,7 +106,7 @@ fun AppDrawerPreferences(
}
}
PreferenceGroup(heading = stringResource(id = R.string.grid)) {
item {
Item {
SliderPreference(
label = stringResource(id = R.string.app_drawer_columns),
adapter = prefs2.drawerColumns.getAdapter(),
@@ -114,7 +114,7 @@ fun AppDrawerPreferences(
valueRange = 3..10,
)
}
item {
Item {
SliderPreference(
adapter = prefs2.drawerCellHeightFactor.getAdapter(),
label = stringResource(id = R.string.row_height_label),
@@ -123,7 +123,7 @@ fun AppDrawerPreferences(
showAsPercentage = true,
)
}
item {
Item {
SliderPreference(
adapter = prefs2.drawerLeftRightMarginFactor.getAdapter(),
label = stringResource(id = R.string.app_drawer_indent_label),
@@ -135,7 +135,7 @@ fun AppDrawerPreferences(
}
val showDrawerLabels = prefs2.showIconLabelsInDrawer.getAdapter()
PreferenceGroup(heading = stringResource(id = R.string.icons)) {
item {
Item {
SliderPreference(
label = stringResource(id = R.string.icon_sizes),
adapter = prefs2.drawerIconSizeFactor.getAdapter(),
@@ -144,15 +144,15 @@ fun AppDrawerPreferences(
showAsPercentage = true,
)
}
item {
Item {
SwitchPreference(
adapter = showDrawerLabels,
label = stringResource(id = R.string.show_labels),
)
}
item(
Item(
"drawer_icon_label_size",
showDrawerLabels.state.value
showDrawerLabels.state.value,
) {
SliderPreference(
label = stringResource(id = R.string.label_size),
@@ -162,9 +162,9 @@ fun AppDrawerPreferences(
showAsPercentage = true,
)
}
item(
Item(
"drawer_label_twoline",
showDrawerLabels.state.value
showDrawerLabels.state.value,
) {
SwitchPreference(
adapter = prefs2.twoLineAllApps.getAdapter(),
@@ -173,21 +173,21 @@ fun AppDrawerPreferences(
}
}
PreferenceGroup(heading = stringResource(id = R.string.advanced)) {
item {
Item {
SwitchPreference(
label = stringResource(id = R.string.pref_all_apps_bulk_icon_loading_title),
description = stringResource(id = R.string.pref_all_apps_bulk_icon_loading_description),
adapter = prefs.allAppBulkIconLoading.getAdapter(),
)
}
item {
Item {
SwitchPreference(
label = stringResource(id = R.string.pref_all_apps_remember_position_title),
description = stringResource(id = R.string.pref_all_apps_remember_position_description),
adapter = prefs2.rememberPosition.getAdapter(),
)
}
item {
Item {
SwitchPreference(
label = stringResource(id = R.string.pref_all_apps_show_scrollbar_title),
adapter = prefs2.showScrollbar.getAdapter(),
@@ -137,7 +137,7 @@ private fun IconShapeCornerPreferenceGroup(
modifier = modifier,
heading = stringResource(id = R.string.color_sliders),
) {
item {
Item {
IconShapeCornerPreference(
title = stringResource(id = R.string.custom_icon_shape_top_left),
scale = selectedIconShape.topLeft.scale.x,
@@ -150,7 +150,7 @@ private fun IconShapeCornerPreferenceGroup(
},
)
}
item {
Item {
IconShapeCornerPreference(
title = stringResource(id = R.string.custom_icon_shape_top_right),
scale = selectedIconShape.topRight.scale.x,
@@ -163,7 +163,7 @@ private fun IconShapeCornerPreferenceGroup(
},
)
}
item {
Item {
IconShapeCornerPreference(
title = stringResource(id = R.string.custom_icon_shape_bottom_left),
scale = selectedIconShape.bottomLeft.scale.x,
@@ -176,7 +176,7 @@ private fun IconShapeCornerPreferenceGroup(
},
)
}
item {
Item {
IconShapeCornerPreference(
title = stringResource(id = R.string.custom_icon_shape_bottom_right),
scale = selectedIconShape.bottomRight.scale.x,
@@ -204,7 +204,7 @@ private fun IconShapeClipboardPreferenceGroup(
modifier = modifier,
heading = stringResource(id = R.string.clipboard),
) {
item {
Item {
ClipboardButton(
imageVector = Icons.Rounded.ContentCopy,
label = stringResource(id = R.string.export_to_clipboard),
@@ -215,7 +215,7 @@ private fun IconShapeClipboardPreferenceGroup(
)
}
}
item {
Item {
ClipboardButton(
imageVector = Icons.Rounded.ContentPaste,
label = stringResource(id = R.string.import_from_clipboard),
@@ -58,7 +58,7 @@ fun DebugMenuPreferences(
) {
MainSwitchPreference(adapter = enableDebug, label = "Show debug menu") {
PreferenceGroup {
item {
Item {
ClickablePreference(
label = "Feature flags (Views)",
onClick = {
@@ -80,7 +80,7 @@ fun DebugMenuPreferences(
},
)
}
item {
Item {
ClickablePreference(
label = "Feature flags (Compose)",
onClick = {
@@ -88,13 +88,13 @@ fun DebugMenuPreferences(
},
)
}
item {
Item {
ClickablePreference(
label = "Crash launcher",
onClick = { throw RuntimeException("User triggered crash") },
)
}
item {
Item {
ClickablePreference(
label = "Reset live information",
onClick = {
@@ -109,7 +109,7 @@ fun DebugMenuPreferences(
PreferenceGroup(heading = "Debug flags") {
flags2.forEach {
item { _ ->
Item { _ ->
SwitchPreference(
adapter = it.getAdapter(),
label = it.key.name,
@@ -117,7 +117,7 @@ fun DebugMenuPreferences(
}
}
flags.forEach {
item { _ ->
Item { _ ->
SwitchPreference(
adapter = it.getAdapter(),
label = it.key,
@@ -125,14 +125,14 @@ fun DebugMenuPreferences(
}
}
textFlags.forEach {
item { _ ->
Item { _ ->
TextPreference(
adapter = it.getAdapter(),
label = it.key.name,
)
}
}
item {
Item {
TextPreference(
label = "Custom version info",
adapter = prefs.pseudonymVersion.getAdapter(),
@@ -142,13 +142,13 @@ fun DebugMenuPreferences(
val apmSupport = context.checkCallingOrSelfPermission(Manifest.permission.PACKAGE_USAGE_STATS) == PackageManager.PERMISSION_GRANTED
PreferenceGroup(heading = "Supported features") {
item {
Item {
ClickablePreference(
label = "Window blurs",
subtitle = BlurUtils.supportsBlursOnWindows().toString(),
) { }
}
item {
Item {
ClickablePreference(
label = "App prediction",
subtitle = apmSupport.toString(),
@@ -46,8 +46,8 @@ import app.lawnchair.ui.preferences.components.controls.SliderPreference
import app.lawnchair.ui.preferences.components.controls.SwitchPreference
import app.lawnchair.ui.preferences.components.createPreviewIdp
import app.lawnchair.ui.preferences.components.layout.DividerColumn
import app.lawnchair.ui.preferences.components.layout.PreferenceGroupHeading
import app.lawnchair.ui.preferences.components.layout.PreferenceGroup
import app.lawnchair.ui.preferences.components.layout.PreferenceGroupHeading
import app.lawnchair.ui.preferences.components.layout.PreferenceLayout
import com.android.launcher3.R
@@ -66,13 +66,13 @@ fun DockPreferences(modifier: Modifier = Modifier) {
MainSwitchPreference(adapter = prefs2.isHotseatEnabled.getAdapter(), label = stringResource(id = R.string.show_hotseat_title)) {
DockPreferencesPreview()
PreferenceGroup(heading = stringResource(id = R.string.style)) {
item {
Item {
SwitchPreference(
adapter = hotseatBgAdapter,
label = stringResource(id = R.string.hotseat_background),
)
}
item(
Item(
key = "feed_pref",
visible = hotseatBgAdapter.state.value,
) {
@@ -82,7 +82,7 @@ fun DockPreferences(modifier: Modifier = Modifier) {
SearchBarPreference(SearchRoute.DOCK_SEARCH)
GridSettings(prefs, prefs2)
PreferenceGroup(heading = stringResource(id = R.string.icons)) {
item {
Item {
SwitchPreference(
adapter = prefs2.enableLabelInDock.getAdapter(),
label = stringResource(id = R.string.show_labels),
@@ -138,7 +138,7 @@ fun HotseatBackgroundSettings(prefs: PreferenceManager, prefs2: PreferenceManage
@Composable
fun GridSettings(prefs: PreferenceManager, prefs2: PreferenceManager2) {
PreferenceGroup(heading = stringResource(id = R.string.grid)) {
item {
Item {
SliderPreference(
label = stringResource(id = R.string.dock_icons),
adapter = prefs.hotseatColumns.getAdapter(),
@@ -146,7 +146,7 @@ fun GridSettings(prefs: PreferenceManager, prefs2: PreferenceManager2) {
valueRange = 3..10,
)
}
item {
Item {
SliderPreference(
adapter = prefs2.hotseatBottomFactor.getAdapter(),
label = stringResource(id = R.string.hotseat_bottom_space_label),
@@ -155,7 +155,7 @@ fun GridSettings(prefs: PreferenceManager, prefs2: PreferenceManager2) {
showAsPercentage = true,
)
}
item {
Item {
SliderPreference(
adapter = prefs2.pageIndicatorHeightFactor.getAdapter(),
label = stringResource(id = R.string.page_indicator_height),
@@ -52,16 +52,16 @@ fun ExperimentalFeaturesPreferences(
stringResource(R.string.workspace_label),
) {
// pE-FeatureTaskForce-TODO(N/A): Make Material 3 Expressive Toggle
item {
Item {
SwitchPreference(
adapter = enableMaterialExpressiveAdapter,
label = stringResource(id = R.string.material_expressive_label),
description = stringResource(id = R.string.material_expressive_description),
)
}
item(
Item(
"material_expressive_warning",
enableMaterialExpressiveAdapter.state.value && (!ATLEAST_S || !BlurUtils.supportsBlursOnWindows())
enableMaterialExpressiveAdapter.state.value && (!ATLEAST_S || !BlurUtils.supportsBlursOnWindows()),
) {
WarningPreference(
"Expressive Blur will be ignored because blur effect required at " +
@@ -70,35 +70,35 @@ fun ExperimentalFeaturesPreferences(
"device manufacturer.",
)
}
item {
Item {
SwitchPreference(
adapter = prefs2.enableFontSelection.getAdapter(),
label = stringResource(id = R.string.font_picker_label),
description = stringResource(id = R.string.font_picker_description),
)
}
item {
Item {
SwitchPreference(
adapter = prefs.workspaceIncreaseMaxGridSize.getAdapter(),
label = stringResource(id = R.string.workspace_increase_max_grid_size_label),
description = stringResource(id = R.string.workspace_increase_max_grid_size_description),
)
}
item {
Item {
SwitchPreference(
adapter = prefs2.iconSwipeGestures.getAdapter(),
label = stringResource(R.string.icon_swipe_gestures),
description = stringResource(R.string.icon_swipe_gestures_description),
)
}
item {
Item {
SwitchPreference(
adapter = prefs2.showDeckLayout.getAdapter(),
label = stringResource(R.string.show_deck_layout),
description = stringResource(R.string.show_deck_layout_description),
)
}
item {
Item {
SwitchPreference(
checked = hasPermission && enableWallpaperBlur.state.value,
onCheckedChange = {
@@ -113,9 +113,9 @@ fun ExperimentalFeaturesPreferences(
}
val canBlur = hasPermission && enableWallpaperBlur.state.value
item(
Item(
"wallpaper_background_blur",
canBlur
canBlur,
) {
SliderPreference(
label = stringResource(id = R.string.wallpaper_background_blur),
@@ -125,9 +125,9 @@ fun ExperimentalFeaturesPreferences(
showUnit = "%",
)
}
item(
Item(
"wallpaper_background_blur",
canBlur
canBlur,
) {
SliderPreference(
label = stringResource(id = R.string.wallpaper_background_blur_factor),
@@ -161,21 +161,21 @@ fun ExperimentalFeaturesPreferences(
stringResource(R.string.internal_description),
) {
// Lawnchair-TODO(Merge): Investigate Always Reload Icons
item {
Item {
SwitchPreference(
adapter = alwaysReloadIconsAdapter,
label = stringResource(id = R.string.always_reload_icons_label),
description = stringResource(id = R.string.always_reload_icons_description),
)
}
item(
Item(
"always_reload_icons_warning",
alwaysReloadIconsAdapter.state.value
alwaysReloadIconsAdapter.state.value,
) {
WarningPreference(stringResource(R.string.always_reload_icons_warning))
}
item {
Item {
SwitchPreference(
adapter = enableGncAdapter,
label = stringResource(id = R.string.gesturenavcontract_label),
@@ -183,9 +183,9 @@ fun ExperimentalFeaturesPreferences(
enabled = ATLEAST_S,
)
}
item(
Item(
"gesturenavcontract_warning",
enableGncAdapter.state.value && !isGestureNavContractCompatible
enableGncAdapter.state.value && !isGestureNavContractCompatible,
) {
WarningPreference(stringResource(R.string.gesturenavcontract_warning_incompatibility))
}
@@ -42,8 +42,8 @@ fun FolderPreferences(
val prefs = preferenceManager()
val prefs2 = preferenceManager2()
PreferenceGroup(heading = stringResource(id = R.string.general_label)) {
item { ColorPreference(preference = prefs2.folderColor) }
item {
Item { ColorPreference(preference = prefs2.folderColor) }
Item {
SliderPreference(
label = stringResource(id = R.string.folder_preview_bg_opacity_label),
adapter = prefs2.folderPreviewBackgroundOpacity.getAdapter(),
@@ -52,7 +52,7 @@ fun FolderPreferences(
showAsPercentage = true,
)
}
item {
Item {
SliderPreference(
label = stringResource(id = R.string.folder_bg_opacity_label),
adapter = prefs2.folderBackgroundOpacity.getAdapter(),
@@ -63,7 +63,7 @@ fun FolderPreferences(
}
}
PreferenceGroup(heading = stringResource(id = R.string.grid)) {
item {
Item {
SliderPreference(
label = stringResource(id = R.string.max_folder_columns),
adapter = prefs2.folderColumns.getAdapter(),
@@ -71,7 +71,7 @@ fun FolderPreferences(
valueRange = 2..5,
)
}
item {
Item {
SliderPreference(
label = stringResource(id = R.string.max_folder_rows),
adapter = prefs.folderRows.getAdapter(),
@@ -83,15 +83,15 @@ fun FolderPreferences(
val homeScreenLabelsAdapter = prefs2.showIconLabelsOnHomeScreenFolder.getAdapter()
PreferenceGroup(heading = stringResource(id = R.string.icons)) {
item {
Item {
SwitchPreference(
adapter = homeScreenLabelsAdapter,
label = stringResource(id = R.string.show_labels),
)
}
item(
Item(
"label_size",
homeScreenLabelsAdapter.state.value
homeScreenLabelsAdapter.state.value,
) {
SliderPreference(
label = stringResource(id = R.string.label_size),
@@ -89,7 +89,7 @@ fun GeneralPreferences() {
label = stringResource(id = R.string.general_label),
) {
PreferenceGroup {
item {
Item {
SwitchPreference(
adapter = prefs.allowRotation.getAdapter(),
label = stringResource(id = R.string.home_screen_rotation_label),
@@ -99,31 +99,31 @@ fun GeneralPreferences() {
}
ExpandAndShrink(visible = prefs2.enableFontSelection.asState().value) {
PreferenceGroup(heading = stringResource(id = R.string.font_label)) {
item {
Item {
FontPreference(
fontPref = prefs.fontWorkspace,
label = stringResource(R.string.fontWorkspace),
)
}
item {
Item {
FontPreference(
fontPref = prefs.fontHeading,
label = stringResource(R.string.fontHeading),
)
}
item {
Item {
FontPreference(
fontPref = prefs.fontHeadingMedium,
label = stringResource(R.string.fontHeadingMedium),
)
}
item {
Item {
FontPreference(
fontPref = prefs.fontBody,
label = stringResource(R.string.fontBody),
)
}
item {
Item {
FontPreference(
fontPref = prefs.fontBodyMedium,
label = stringResource(R.string.fontBodyMedium),
@@ -138,16 +138,16 @@ fun GeneralPreferences() {
description = stringResource(id = (R.string.adaptive_icon_background_description)),
showDescription = wrapAdaptiveIcons.state.value,
) {
item {
Item {
NavigationActionPreference(
label = stringResource(id = R.string.icon_style_label),
destination = GeneralIconPack,
subtitle = iconStyleSubtitle,
)
}
item(
Item(
"themed_icon",
themedIconsEnabled
themedIconsEnabled,
) {
SwitchPreference(
adapter = prefs.transparentIconBackground.getAdapter(),
@@ -155,7 +155,7 @@ fun GeneralPreferences() {
description = stringResource(id = R.string.transparent_background_icons_description),
)
}
item {
Item {
NavigationActionPreference(
label = stringResource(id = R.string.icon_shape_label),
destination = GeneralIconShape,
@@ -165,22 +165,22 @@ fun GeneralPreferences() {
},
)
}
item {
Item {
SwitchPreference(
adapter = wrapAdaptiveIcons,
label = stringResource(id = R.string.auto_adaptive_icons_label),
description = stringResource(id = R.string.auto_adaptive_icons_description),
)
}
item {
Item {
SwitchPreference(
adapter = prefs.shadowBGIcons.getAdapter(),
label = stringResource(id = R.string.shadow_bg_icons_label),
)
}
item(
Item(
"wrap_adaptive_icons",
wrapAdaptiveIcons.state.value
wrapAdaptiveIcons.state.value,
) {
SliderPreference(
label = stringResource(id = R.string.background_lightness_label),
@@ -197,12 +197,12 @@ fun GeneralPreferences() {
!Utilities.ATLEAST_S
PreferenceGroup(heading = stringResource(id = R.string.colors)) {
item { ThemePreference() }
item { ColorPreference(preference = prefs2.accentColor) }
item(
Item { ThemePreference() }
Item { ColorPreference(preference = prefs2.accentColor) }
Item(
"color_style",
showColorStyle
) { ColorStylePreference(prefs2.colorStyle.getAdapter()) }
showColorStyle,
) { ColorStylePreference(prefs2.colorStyle.getAdapter()) }
}
val notificationEnabled by remember { notificationDotsEnabled(context) }.collectAsStateWithLifecycle(initialValue = false)
@@ -213,28 +213,28 @@ fun GeneralPreferences() {
val dotTextColor = prefs2.notificationDotTextColor.asState().value
PreferenceGroup(heading = stringResource(id = R.string.notification_dots)) {
item { NotificationDotsPreference(enabled = notificationEnabled, serviceEnabled = serviceEnabled) }
Item { NotificationDotsPreference(enabled = notificationEnabled, serviceEnabled = serviceEnabled) }
val canDisplayNotificationDot = notificationEnabled && serviceEnabled
item(
Item(
"notification_dot_color",
canDisplayNotificationDot
) { ColorPreference(preference = prefs2.notificationDotColor) }
item(
canDisplayNotificationDot,
) { ColorPreference(preference = prefs2.notificationDotColor) }
Item(
"notification_dot_counter_toggle",
canDisplayNotificationDot
canDisplayNotificationDot,
) {
SwitchPreference(
adapter = showNotificationCountAdapter,
label = stringResource(id = R.string.show_notification_count),
)
}
item(
Item(
"notification_dot_text_color",
canDisplayNotificationDot && showNotificationCount
) { ColorPreference(preference = prefs2.notificationDotTextColor) }
item(
canDisplayNotificationDot && showNotificationCount,
) { ColorPreference(preference = prefs2.notificationDotTextColor) }
Item(
"notification_dot_color_contrast_warning",
canDisplayNotificationDot && showNotificationCount
canDisplayNotificationDot && showNotificationCount,
) {
NotificationDotColorContrastWarnings(
dotColor = dotColor,
@@ -22,31 +22,31 @@ fun GesturePreferences(
modifier = modifier,
) {
PreferenceGroup {
item {
Item {
GestureHandlerPreference(
adapter = prefs.doubleTapGestureHandler.getAdapter(),
label = stringResource(id = R.string.gesture_double_tap),
)
}
item {
Item {
GestureHandlerPreference(
adapter = prefs.swipeUpGestureHandler.getAdapter(),
label = stringResource(id = R.string.gesture_swipe_up),
)
}
item {
Item {
GestureHandlerPreference(
adapter = prefs.swipeDownGestureHandler.getAdapter(),
label = stringResource(id = R.string.gesture_swipe_down),
)
}
item {
Item {
GestureHandlerPreference(
adapter = prefs.homePressGestureHandler.getAdapter(),
label = stringResource(id = R.string.gesture_home_tap),
)
}
item {
Item {
GestureHandlerPreference(
adapter = prefs.backPressGestureHandler.getAdapter(),
label = stringResource(id = R.string.gesture_back_tap),
@@ -62,7 +62,7 @@ fun HomeScreenGridPreferences(
val maxGridSize = if (increaseMaxGridSize.state.value) 20 else 10
PreferenceGroup {
item {
Item {
SliderPreference(
label = stringResource(id = R.string.columns),
adapter = columns.asPreferenceAdapter(),
@@ -70,7 +70,7 @@ fun HomeScreenGridPreferences(
valueRange = 3..maxGridSize,
)
}
item {
Item {
SliderPreference(
label = stringResource(id = R.string.rows),
adapter = rows.asPreferenceAdapter(),
@@ -75,9 +75,9 @@ fun HomeScreenPreferences(
PreferenceGroup(heading = stringResource(id = R.string.general_label)) {
val addIconToHomeAdapter = prefs.addIconToHome.getAdapter()
val isDeckLayoutAdapter = prefs2.deckLayout.getAdapter()
item(
Item(
"add_icon_to_home",
!isDeckLayoutAdapter.state.value
!isDeckLayoutAdapter.state.value,
) {
SwitchPreference(
checked = (!lockHomeScreenAdapter.state.value && addIconToHomeAdapter.state.value) || isDeckLayoutAdapter.state.value,
@@ -87,13 +87,13 @@ fun HomeScreenPreferences(
enabled = lockHomeScreenAdapter.state.value.not(),
)
}
item {
Item {
GestureHandlerPreference(
adapter = prefs2.doubleTapGestureHandler.getAdapter(),
label = stringResource(id = R.string.gesture_double_tap),
)
}
item {
Item {
SwitchPreference(
prefs.infiniteScrolling.getAdapter(),
label = stringResource(id = R.string.infinite_scrolling_label),
@@ -104,7 +104,7 @@ fun HomeScreenPreferences(
val feedAvailable = OverlayCallbackImpl.minusOneAvailable(LocalContext.current)
val enableFeedAdapter = prefs2.enableFeed.getAdapter()
PreferenceGroup(heading = stringResource(id = R.string.minus_one)) {
item {
Item {
SwitchPreference(
adapter = enableFeedAdapter,
label = stringResource(id = R.string.minus_one_enable),
@@ -112,7 +112,7 @@ fun HomeScreenPreferences(
enabled = feedAvailable,
)
}
item(
Item(
key = "feed_pref",
visible = feedAvailable && enableFeedAdapter.state.value,
) {
@@ -120,8 +120,8 @@ fun HomeScreenPreferences(
}
}
PreferenceGroup(heading = stringResource(R.string.style)) {
item { HomeScreenTextColorPreference() }
item {
Item { HomeScreenTextColorPreference() }
Item {
OverlayHandlerPreference(
adapter = prefs2.closingAppOverlay.getAdapter(),
label = stringResource(id = R.string.app_closing_animation),
@@ -129,15 +129,15 @@ fun HomeScreenPreferences(
}
}
PreferenceGroup(heading = stringResource(id = R.string.wallpaper)) {
item {
Item {
SwitchPreference(
prefs.wallpaperScrolling.getAdapter(),
label = stringResource(id = R.string.wallpaper_scrolling_label),
)
}
item(
Item(
"wallpaper_depth_effect",
Utilities.ATLEAST_R
Utilities.ATLEAST_R,
) {
SwitchPreference(
prefs2.wallpaperDepthEffect.getAdapter(),
@@ -145,7 +145,7 @@ fun HomeScreenPreferences(
description = stringResource(id = R.string.wallpaper_depth_effect_description),
)
}
item {
Item {
SwitchPreference(
adapter = prefs2.showTopShadow.getAdapter(),
label = stringResource(id = R.string.show_sys_ui_scrim),
@@ -155,14 +155,14 @@ fun HomeScreenPreferences(
val columns by prefs.workspaceColumns.getAdapter()
val rows by prefs.workspaceRows.getAdapter()
PreferenceGroup(heading = stringResource(id = R.string.layout)) {
item {
Item {
NavigationActionPreference(
label = stringResource(id = R.string.home_screen_grid),
destination = HomeScreenGrid,
subtitle = stringResource(id = R.string.x_by_y, columns, rows),
)
}
item {
Item {
SwitchPreference(
adapter = lockHomeScreenAdapter,
label = stringResource(id = R.string.home_screen_lock),
@@ -171,28 +171,28 @@ fun HomeScreenPreferences(
}
}
PreferenceGroup(heading = stringResource(id = R.string.popup_menu)) {
item { LauncherPopupPreferenceItem() }
Item { LauncherPopupPreferenceItem() }
}
val showStatusBarAdapter = prefs2.showStatusBar.getAdapter()
PreferenceGroup(heading = stringResource(id = R.string.status_bar_label)) {
item {
Item {
SwitchPreference(
adapter = showStatusBarAdapter,
label = stringResource(id = R.string.show_status_bar),
)
}
item(
Item(
"dark_status_bar",
showStatusBarAdapter.state.value
showStatusBarAdapter.state.value,
) {
SwitchPreference(
adapter = prefs2.darkStatusBar.getAdapter(),
label = stringResource(id = R.string.dark_status_bar_label),
)
}
item(
Item(
"status_bar_clock",
showStatusBarAdapter.state.value && LawnchairApp.isRecentsEnabled
showStatusBarAdapter.state.value && LawnchairApp.isRecentsEnabled,
) {
SwitchPreference(
adapter = prefs2.statusBarClock.getAdapter(),
@@ -203,7 +203,7 @@ fun HomeScreenPreferences(
}
val homeScreenLabelsAdapter = prefs2.showIconLabelsOnHomeScreen.getAdapter()
PreferenceGroup(heading = stringResource(id = R.string.icons)) {
item {
Item {
SliderPreference(
label = stringResource(id = R.string.icon_sizes),
adapter = prefs2.homeIconSizeFactor.getAdapter(),
@@ -212,15 +212,15 @@ fun HomeScreenPreferences(
showAsPercentage = true,
)
}
item {
Item {
SwitchPreference(
adapter = homeScreenLabelsAdapter,
label = stringResource(id = R.string.show_labels),
)
}
item(
Item(
"workspace_label_size",
homeScreenLabelsAdapter.state.value
homeScreenLabelsAdapter.state.value,
) {
SliderPreference(
label = stringResource(id = R.string.label_size),
@@ -235,7 +235,7 @@ fun HomeScreenPreferences(
val customIconsCount by remember { overrideRepo.observeCount() }.collectAsStateBlocking()
if (customIconsCount > 0) {
PreferenceGroup {
item {
Item {
ClickablePreference(
label = stringResource(id = R.string.reset_custom_icons),
confirmationText = stringResource(id = R.string.reset_custom_icons_confirmation),
@@ -245,26 +245,26 @@ fun HomeScreenPreferences(
}
}
PreferenceGroup(heading = stringResource(id = R.string.widget_button_text)) {
item {
Item {
SwitchPreference(
adapter = prefs2.roundedWidgets.getAdapter(),
label = stringResource(id = R.string.force_rounded_widgets),
)
}
item {
Item {
SwitchPreference(
adapter = prefs2.allowWidgetOverlap.getAdapter(),
label = stringResource(id = R.string.allow_widget_overlap),
)
}
item {
Item {
SwitchPreference(
adapter = prefs2.widgetUnlimitedSize.getAdapter(),
label = stringResource(id = R.string.widget_unlimited_size_label),
description = stringResource(id = R.string.widget_unlimited_size_description),
)
}
item {
Item {
SwitchPreference(
adapter = prefs2.forceWidgetResize.getAdapter(),
label = stringResource(id = R.string.force_widget_resize_label),
@@ -204,7 +204,7 @@ fun IconPackPreferences(
false,
)
PreferenceGroup {
item {
Item {
SwitchPreference(
adapter = prefs.tintIconPackBackgrounds.getAdapter(),
label = stringResource(id = R.string.themed_icon_pack_tint),
@@ -229,7 +229,7 @@ fun IconPackPreferences(
)
}
PreferenceGroup {
item {
Item {
ListPreference(
enabled = themedIconsAvailable,
label = stringResource(id = R.string.themed_icon_title),
@@ -107,12 +107,12 @@ fun IconShapePreference(
PreferenceGroup(
heading = stringResource(id = R.string.custom),
) {
item {
Item {
CustomIconShapePreferenceOption(
iconShapeAdapter = iconShapeAdapter,
)
}
item {
Item {
ModifyCustomIconShapePreference(
customIconShape = customIconShape.value,
)
@@ -122,7 +122,7 @@ fun IconShapePreference(
heading = stringResource(id = R.string.presets),
) {
entries.forEach { item ->
item {
Item {
PreferenceTemplate(
enabled = item.enabled,
title = { Text(item.label()) },
@@ -115,7 +115,7 @@ fun PreferencesDashboard(
val deckLayout = prefs2.deckLayout.getAdapter()
PreferenceGroup {
item {
Item {
PreferenceCategory(
label = stringResource(R.string.general_label),
description = stringResource(R.string.general_description),
@@ -127,7 +127,7 @@ fun PreferencesDashboard(
)
}
item {
Item {
PreferenceCategory(
label = stringResource(R.string.home_screen_label),
description = stringResource(R.string.home_screen_description),
@@ -140,7 +140,7 @@ fun PreferencesDashboard(
}
val isSmartspaceEnabled = prefs2.enableSmartspace.firstBlocking()
item {
Item {
PreferenceCategory(
label = stringResource(id = R.string.smartspace_widget),
description = stringResource(R.string.smartspace_widget_description),
@@ -152,7 +152,7 @@ fun PreferencesDashboard(
)
}
item {
Item {
PreferenceCategory(
label = stringResource(R.string.dock_label),
description = stringResource(R.string.dock_description),
@@ -164,9 +164,9 @@ fun PreferencesDashboard(
)
}
item(
Item(
key = "app_drawer",
visible = !deckLayout.state.value
visible = !deckLayout.state.value,
) {
PreferenceCategory(
label = stringResource(R.string.app_drawer_label),
@@ -179,7 +179,7 @@ fun PreferencesDashboard(
)
}
item {
Item {
PreferenceCategory(
label = stringResource(R.string.search_bar_label),
description = stringResource(R.string.drawer_search_description),
@@ -191,7 +191,7 @@ fun PreferencesDashboard(
)
}
item {
Item {
PreferenceCategory(
label = stringResource(R.string.folders_label),
description = stringResource(R.string.folders_description),
@@ -203,7 +203,7 @@ fun PreferencesDashboard(
)
}
item {
Item {
PreferenceCategory(
label = stringResource(id = R.string.gestures_label),
description = stringResource(R.string.gestures_description),
@@ -214,9 +214,9 @@ fun PreferencesDashboard(
isLast = it.isLast,
)
}
item(
Item(
"quickstep",
LawnchairApp.isRecentsEnabled || BuildConfig.DEBUG
LawnchairApp.isRecentsEnabled || BuildConfig.DEBUG,
) {
PreferenceCategory(
label = stringResource(id = R.string.quickstep_label),
@@ -229,7 +229,7 @@ fun PreferencesDashboard(
)
}
item {
Item {
PreferenceCategory(
label = stringResource(R.string.about_label),
description = aboutDescrption,
@@ -74,13 +74,13 @@ fun QuickstepPreferences(
if (!LawnchairApp.isRecentsEnabled) QuickSwitchIgnoredWarning()
val recentsTranslucentBackground by prefs.recentsTranslucentBackground.observeAsState()
PreferenceGroup(heading = stringResource(id = R.string.general_label)) {
item {
Item {
SwitchPreference(
adapter = prefs.recentsTranslucentBackground.getAdapter(),
label = stringResource(id = R.string.translucent_background),
)
}
item(
Item(
key = "recents_translucent_background_alpha",
visible = recentsTranslucentBackground,
) {
@@ -105,13 +105,13 @@ fun QuickstepPreferences(
description = stringResource(id = (R.string.window_corner_radius_description)),
showDescription = overrideWindowCornerRadius,
) {
item {
Item {
SwitchPreference(
adapter = prefs.overrideWindowCornerRadius.getAdapter(),
label = stringResource(id = R.string.override_window_corner_radius_label),
)
}
item(
Item(
"window_corner_radius",
overrideWindowCornerRadius,
) {
@@ -128,7 +128,7 @@ fun QuickstepPreferences(
PreferenceGroup(
heading = stringResource(id = R.string.taskbar_label),
) {
item {
Item {
SwitchPreference(
adapter = prefs2.enableTaskbarOnPhone.getAdapter(),
label = stringResource(id = R.string.enable_taskbar_experimental),
@@ -47,7 +47,7 @@ fun SearchBarPreference(
PreferenceGroup(
heading = stringResource(id = R.string.search_bar_label),
) {
item { preference() }
Item { preference() }
}
} else {
preference()
@@ -49,7 +49,7 @@ fun SearchProviderPreferences(
) {
PreferenceGroup {
QsbSearchProvider.values().forEach { qsbSearchProvider ->
item {
Item {
val appInstalled = qsbSearchProvider.isDownloaded(context)
val selected = adapter.state.value == qsbSearchProvider
val hasAppAndWebsite = qsbSearchProvider.type == QsbSearchProviderType.APP_AND_WEBSITE
@@ -70,7 +70,7 @@ fun SmartspacePreferences(
SmartspacePreview()
}
PreferenceGroup {
item {
Item {
SmartspaceProviderPreference(
adapter = smartspaceModeAdapter,
)
@@ -115,7 +115,7 @@ private fun LawnchairSmartspaceSettings(
.filter { it.isAvailable }
.forEach {
key(it.providerName) {
item { _ ->
Item { _ ->
SwitchPreference(
adapter = it.enabledPref.getAdapter(),
label = stringResource(id = it.providerName),
@@ -165,7 +165,7 @@ fun SmartspacePreview(
heading = stringResource(id = R.string.preview_label),
modifier = modifier,
) {
item {
Item {
CompositionLocalProvider(LocalContext provides themedContext) {
AndroidView(
factory = {
@@ -206,7 +206,7 @@ fun SmartspaceDateAndTimePreferences(
modifier = modifier.padding(top = 8.dp),
) {
val supportCustomizationFormat = calendar.formatCustomizationSupport
item(
Item(
key = "smartspace_date",
visible = supportCustomizationFormat,
) {
@@ -216,11 +216,11 @@ fun SmartspaceDateAndTimePreferences(
enabled = if (showDateAdapter.state.value) !calendarHasMinimumContent else true,
)
}
item(
Item(
"smartspace_calendar",
supportCustomizationFormat && showDateAdapter.state.value,
) { SmartspaceCalendarPreference() }
item(
) { SmartspaceCalendarPreference() }
Item(
"smartspace_time",
supportCustomizationFormat,
) {
@@ -230,10 +230,10 @@ fun SmartspaceDateAndTimePreferences(
enabled = if (showTimeAdapter.state.value) !calendarHasMinimumContent else true,
)
}
item(
Item(
"smartspace_time_format",
supportCustomizationFormat && showTimeAdapter.state.value,
) { SmartspaceTimeFormatPreference() }
) { SmartspaceTimeFormatPreference() }
}
}
@@ -288,7 +288,7 @@ fun SmartspacerSettings(
PreferenceGroup(
heading = stringResource(id = R.string.smartspacer_settings),
) {
item {
Item {
SliderPreference(
label = stringResource(R.string.maximum_number_of_targets),
adapter = prefs2.smartspacerMaxCount.getAdapter(),
@@ -296,7 +296,7 @@ fun SmartspacerSettings(
step = 1,
)
}
item {
Item {
ClickablePreference(label = stringResource(R.string.open_smartspacer_settings)) {
val intent = context.packageManager.getLaunchIntentForPackage(
SmartspacerConstants.SMARTSPACER_PACKAGE_NAME,