mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-11 06:44:00 +00:00
fix(deps): update dependency io.nlopez.compose.rules:ktlint to v0.4.28 (#6123)
* fix(deps): update dependency io.nlopez.compose.rules:ktlint to v0.4.28 * Ktlint 1.8.0 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Goooler <wangzongler@gmail.com>
This commit is contained in:
@@ -22,6 +22,7 @@ ktlint_code_style = intellij_idea
|
||||
ktlint_function_naming_ignore_when_annotated_with = Composable
|
||||
ktlint_standard_discouraged-comment-location = disabled
|
||||
ktlint_standard_function-expression-body = disabled
|
||||
ktlint_standard_mixed-condition-operators = disabled
|
||||
ktlint_compose_lambda-param-event-trailing = disabled
|
||||
|
||||
[*.md]
|
||||
|
||||
@@ -469,8 +469,8 @@ spotless {
|
||||
}
|
||||
kotlin {
|
||||
target("lawnchair/src/**/*.kt")
|
||||
ktlint().customRuleSets([
|
||||
"io.nlopez.compose.rules:ktlint:0.4.27",
|
||||
ktlint("1.8.0").customRuleSets([
|
||||
"io.nlopez.compose.rules:ktlint:0.4.28",
|
||||
]).editorConfigOverride([
|
||||
"ktlint_compose_compositionlocal-allowlist": "disabled",
|
||||
"ktlint_compose_lambda-param-event-trailing": "disabled",
|
||||
|
||||
@@ -97,6 +97,7 @@ class BlankActivity : ComponentActivity() {
|
||||
}.launch(requireNotNull(intent.getParcelableExtra("intent")))
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
finish()
|
||||
return
|
||||
|
||||
@@ -108,6 +108,7 @@ class FeedBridge(private val context: Context) {
|
||||
open fun isSigned(): Boolean {
|
||||
when {
|
||||
BuildConfig.DEBUG -> return true
|
||||
|
||||
Utilities.ATLEAST_P -> {
|
||||
val info =
|
||||
context.packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNING_CERTIFICATES)
|
||||
@@ -115,6 +116,7 @@ class FeedBridge(private val context: Context) {
|
||||
if (signingInfo!!.hasMultipleSigners()) return false
|
||||
return signingInfo.signingCertificateHistory.any { it.hashCode() == signatureHash }
|
||||
}
|
||||
|
||||
else -> {
|
||||
val info = context.packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES)
|
||||
return if (info.signatures!!.any { it.hashCode() != signatureHash }) false else info.signatures!!.isNotEmpty()
|
||||
|
||||
@@ -128,6 +128,7 @@ class LawnchairLauncher : QuickstepLauncher() {
|
||||
-> {
|
||||
LawnchairApp.instance.restoreClockInStatusBar()
|
||||
}
|
||||
|
||||
else -> {
|
||||
workspace.updateStatusbarClock()
|
||||
}
|
||||
@@ -483,6 +484,7 @@ class LawnchairLauncher : QuickstepLauncher() {
|
||||
private fun restartIfPending() {
|
||||
when {
|
||||
sRestartFlags and FLAG_RESTART != 0 -> lawnchairApp.restart(false)
|
||||
|
||||
sRestartFlags and FLAG_RECREATE != 0 -> {
|
||||
sRestartFlags = 0
|
||||
recreate()
|
||||
|
||||
@@ -79,10 +79,12 @@ class SearchResultIcon(context: Context, attrs: AttributeSet?) :
|
||||
allowLongClick = false
|
||||
bindFromAction(target, iconComponentKey == null)
|
||||
}
|
||||
|
||||
target.shortcutInfo != null -> {
|
||||
allowLongClick = true
|
||||
bindFromShortcutInfo(target.shortcutInfo)
|
||||
}
|
||||
|
||||
else -> {
|
||||
allowLongClick = true
|
||||
val className = extras.getString("class").orEmpty()
|
||||
@@ -207,7 +209,9 @@ class SearchResultIcon(context: Context, attrs: AttributeSet?) :
|
||||
info.bitmap = when {
|
||||
info.hasFlags(SearchActionItemInfo.FLAG_PRIMARY_ICON_FROM_TITLE) ->
|
||||
li.createIconBitmap("${info.title}", packageIcon.color)
|
||||
|
||||
icon == null -> packageIcon
|
||||
|
||||
else -> icon.loadDrawable(context)?.let { li.createBadgedIconBitmap(it, BaseIconFactory.IconOptions().setUser(info.user)) }
|
||||
}
|
||||
if (info.hasFlags(SearchActionItemInfo.FLAG_BADGE_WITH_COMPONENT_NAME) && target.extras.containsKey("class")) {
|
||||
|
||||
@@ -368,8 +368,10 @@ class PhysicsAnimator<T> private constructor(target: T) {
|
||||
flingConfigCopy.startVelocity = when {
|
||||
distanceToDestination > 0f && startVelocity >= 0f ->
|
||||
max(velocityToReachDestination, startVelocity)
|
||||
|
||||
distanceToDestination < 0f && startVelocity <= 0f ->
|
||||
min(velocityToReachDestination, startVelocity)
|
||||
|
||||
else -> startVelocity
|
||||
}
|
||||
|
||||
|
||||
@@ -90,11 +90,13 @@ fun RestoreBackupScreen(
|
||||
) {
|
||||
when (uiState) {
|
||||
is RestoreBackupUiState.Success -> RestoreBackupOptions(isPortrait, uiState.backup)
|
||||
|
||||
is RestoreBackupUiState.Loading -> {
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
||||
}
|
||||
}
|
||||
|
||||
is RestoreBackupUiState.Error -> {
|
||||
val context = LocalContext.current
|
||||
val backDispatcher = LocalOnBackPressedDispatcherOwner.current?.onBackPressedDispatcher
|
||||
|
||||
@@ -29,12 +29,16 @@ object LineParser {
|
||||
return when (line[0]) {
|
||||
// Comment
|
||||
'#' -> Rules.NONE
|
||||
|
||||
// Version declaration
|
||||
'$' -> Rules.Version(line.rest.toInt())
|
||||
|
||||
// Intent action
|
||||
':' -> Rules.IntentAction(line.rest)
|
||||
|
||||
// Intent category
|
||||
';' -> Rules.IntentCategory(line.rest)
|
||||
|
||||
// Code rule
|
||||
'&' -> {
|
||||
val parts = line.rest.split("|")
|
||||
@@ -42,6 +46,7 @@ object LineParser {
|
||||
val args = if (parts.size > 1) parts.subList(1, parts.size) else emptyList()
|
||||
Rules.CodeRule(ruleName, args.toTypedArray())
|
||||
}
|
||||
|
||||
// Package
|
||||
else -> if (!line[0].isLetter()) {
|
||||
throw FlowerpotFormatException("Unknown rule identifier '${line[0]}' for version $version")
|
||||
|
||||
@@ -49,6 +49,7 @@ abstract class DirectionalGestureListener(ctx: Context?) : OnTouchListener {
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
shouldReactToSwipe(diffX, velocityX) -> {
|
||||
if (diffX > 0) {
|
||||
Log.d("GESTURE_DETECTION", "Swipe Right Detected")
|
||||
@@ -59,6 +60,7 @@ abstract class DirectionalGestureListener(ctx: Context?) : OnTouchListener {
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ class OpenAppGestureHandler(
|
||||
null,
|
||||
)
|
||||
}
|
||||
|
||||
is OpenAppTarget.Shortcut -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@ class CustomIconPack(context: Context, packPackageName: String) : IconPack(conte
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"dynamic-clock" -> {
|
||||
val drawableName = parseXml["drawable"]
|
||||
if (drawableName != null) {
|
||||
@@ -154,6 +155,7 @@ class CustomIconPack(context: Context, packPackageName: String) : IconPack(conte
|
||||
endCategory()
|
||||
currentTitle = title
|
||||
}
|
||||
|
||||
"item" -> {
|
||||
val drawableName = parser["drawable"] ?: continue
|
||||
val resId = getDrawableId(drawableName)
|
||||
|
||||
@@ -131,23 +131,28 @@ class LawnchairIconProvider @JvmOverloads constructor(
|
||||
themeData = getThemeData(mCalendar.packageName, "")
|
||||
iconType = ICON_TYPE_CALENDAR
|
||||
}
|
||||
|
||||
!supportsIconTheme -> {
|
||||
// theming is disabled, don't populate theme data
|
||||
}
|
||||
|
||||
clock != null -> {
|
||||
// the icon supports dynamic clock, use dynamic themed clock
|
||||
themeData = getThemeData(mClock.packageName, "")
|
||||
iconType = ICON_TYPE_CLOCK
|
||||
}
|
||||
|
||||
packageName == mClock.packageName -> {
|
||||
// is clock app but icon might not be adaptive, fallback to static themed clock
|
||||
themeData = ThemedIconDrawable.ThemeData(context.resources, BuildConfig.APPLICATION_ID, R.drawable.themed_icon_static_clock)
|
||||
}
|
||||
|
||||
packageName == mCalendar.packageName -> {
|
||||
// calendar app, apply the dynamic calendar icon
|
||||
themeData = getThemeData(mCalendar.packageName, "")
|
||||
iconType = ICON_TYPE_CALENDAR
|
||||
}
|
||||
|
||||
else -> {
|
||||
// regular icon
|
||||
themeData = getThemeData(componentName)
|
||||
@@ -320,6 +325,7 @@ class LawnchairIconProvider @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ACTION_DATE_CHANGED -> {
|
||||
context.getSystemService<UserManager>()?.userProfiles?.forEach { user ->
|
||||
iconPack.getCalendars().forEach { componentName ->
|
||||
|
||||
@@ -73,10 +73,15 @@ class SharedPreferencesMigration(private val context: Context) {
|
||||
val newKey = keys[key] ?: key
|
||||
when (value) {
|
||||
is Boolean -> mutablePreferences[booleanPreferencesKey(newKey)] = value
|
||||
|
||||
is Float -> mutablePreferences[floatPreferencesKey(newKey)] = value
|
||||
|
||||
is Int -> mutablePreferences[intPreferencesKey(newKey)] = value
|
||||
|
||||
is Long -> mutablePreferences[longPreferencesKey(newKey)] = value
|
||||
|
||||
is String -> mutablePreferences[stringPreferencesKey(newKey)] = value
|
||||
|
||||
is Set<*> -> {
|
||||
mutablePreferences[stringSetPreferencesKey(newKey)] = value as Set<String>
|
||||
}
|
||||
|
||||
@@ -294,6 +294,7 @@ class SearchTargetFactory(
|
||||
MediaStore.Files.getContentUri("external"),
|
||||
info.fileId,
|
||||
)
|
||||
|
||||
is FolderInfo -> File(info.path).file2Uri()
|
||||
}
|
||||
|
||||
|
||||
@@ -226,6 +226,7 @@ sealed class LawnchairSearchAlgorithm(
|
||||
)
|
||||
|
||||
searchAlgorithm == LOCAL_SEARCH -> LawnchairLocalSearchAlgorithm(context)
|
||||
|
||||
else -> LawnchairAppSearchAlgorithm(context)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,12 +59,14 @@ fun Sequence<AppInfo>.filterHiddenApps(
|
||||
HiddenAppsInSearch.ALWAYS -> {
|
||||
this
|
||||
}
|
||||
|
||||
HiddenAppsInSearch.IF_NAME_TYPED -> {
|
||||
filter {
|
||||
it.toComponentKey().toString() !in hiddenApps ||
|
||||
it.title.toString().lowercase(Locale.getDefault()) == query
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
filter { it.toComponentKey().toString() !in hiddenApps }
|
||||
}
|
||||
|
||||
@@ -34,10 +34,15 @@ data class FileInfo(
|
||||
@get:DrawableRes
|
||||
val iconRes = when (val mime = mimeType.orEmpty()) {
|
||||
in imageFileTypes.values -> R.drawable.ic_file_image
|
||||
|
||||
in videoFileTypes.values -> R.drawable.ic_file_video
|
||||
|
||||
in audioFileTypes.values -> R.drawable.ic_file_music
|
||||
|
||||
in androidPkgTypes.values -> R.drawable.ic_file_app
|
||||
|
||||
in archiveFileTypes.values -> R.drawable.ic_file_zip
|
||||
|
||||
in documentFileTypes.values -> when {
|
||||
mime.contains("excel") || mime.contains("csv") -> R.drawable.ic_file_excel
|
||||
mime.contains("word") -> R.drawable.ic_file_word
|
||||
@@ -46,6 +51,7 @@ data class FileInfo(
|
||||
mime.contains("srt") -> R.drawable.ic_file_subtitle
|
||||
else -> R.drawable.ic_file_text
|
||||
}
|
||||
|
||||
else -> R.drawable.ic_file_unknown
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,9 @@ internal class Evaluator : ExprVisitor<BigDecimal> {
|
||||
|
||||
return when (expr.operator.type) {
|
||||
BAR_BAR -> left or right
|
||||
|
||||
AMP_AMP -> left and right
|
||||
|
||||
else -> throw ExpressionException(
|
||||
"Invalid logical operator '${expr.operator.lexeme}'",
|
||||
)
|
||||
@@ -75,17 +77,29 @@ internal class Evaluator : ExprVisitor<BigDecimal> {
|
||||
|
||||
return when (expr.operator.type) {
|
||||
PLUS -> left + right
|
||||
|
||||
MINUS -> left - right
|
||||
|
||||
STAR -> left * right
|
||||
|
||||
SLASH -> left.divide(right, mathContext)
|
||||
|
||||
MODULO -> left.remainder(right, mathContext)
|
||||
|
||||
EXPONENT -> left pow right
|
||||
|
||||
EQUAL_EQUAL -> (left == right).toBigDecimal()
|
||||
|
||||
NOT_EQUAL -> (left != right).toBigDecimal()
|
||||
|
||||
GREATER -> (left > right).toBigDecimal()
|
||||
|
||||
GREATER_EQUAL -> (left >= right).toBigDecimal()
|
||||
|
||||
LESS -> (left < right).toBigDecimal()
|
||||
|
||||
LESS_EQUAL -> (left <= right).toBigDecimal()
|
||||
|
||||
else -> throw ExpressionException(
|
||||
"Invalid binary operator '${expr.operator.lexeme}'",
|
||||
)
|
||||
@@ -99,9 +113,11 @@ internal class Evaluator : ExprVisitor<BigDecimal> {
|
||||
MINUS -> {
|
||||
right.negate()
|
||||
}
|
||||
|
||||
SQUARE_ROOT -> {
|
||||
right.pow(BigDecimal(0.5))
|
||||
}
|
||||
|
||||
else -> throw ExpressionException("Invalid unary operator")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,22 +60,39 @@ internal class Scanner(
|
||||
-> {
|
||||
// Ignore whitespace.
|
||||
}
|
||||
|
||||
'+' -> addToken(PLUS)
|
||||
|
||||
'-' -> addToken(MINUS)
|
||||
|
||||
'*' -> addToken(STAR)
|
||||
|
||||
'/' -> addToken(SLASH)
|
||||
|
||||
'%' -> addToken(MODULO)
|
||||
|
||||
'^' -> addToken(EXPONENT)
|
||||
|
||||
'√' -> addToken(SQUARE_ROOT)
|
||||
|
||||
'=' -> if (match('=')) addToken(EQUAL_EQUAL) else addToken(ASSIGN)
|
||||
|
||||
'!' -> if (match('=')) addToken(NOT_EQUAL) else invalidToken(c)
|
||||
|
||||
'>' -> if (match('=')) addToken(GREATER_EQUAL) else addToken(GREATER)
|
||||
|
||||
'<' -> if (match('=')) addToken(LESS_EQUAL) else addToken(LESS)
|
||||
|
||||
'|' -> if (match('|')) addToken(BAR_BAR) else invalidToken(c)
|
||||
|
||||
'&' -> if (match('&')) addToken(AMP_AMP) else invalidToken(c)
|
||||
|
||||
',' -> addToken(COMMA)
|
||||
|
||||
'(' -> addToken(LEFT_PAREN)
|
||||
|
||||
')' -> addToken(RIGHT_PAREN)
|
||||
|
||||
else -> {
|
||||
when {
|
||||
c.isDigit() -> number()
|
||||
|
||||
@@ -110,9 +110,11 @@ class BcSmartspaceCard @JvmOverloads constructor(
|
||||
headerAction.hasIntent -> {
|
||||
BcSmartSpaceUtil.setOnClickListener(this, headerAction, null, "BcSmartspaceCard")
|
||||
}
|
||||
|
||||
baseAction.hasIntent -> {
|
||||
BcSmartSpaceUtil.setOnClickListener(this, baseAction, null, "BcSmartspaceCard")
|
||||
}
|
||||
|
||||
else -> {
|
||||
BcSmartSpaceUtil.setOnClickListener(this, headerAction, null, "BcSmartspaceCard")
|
||||
}
|
||||
@@ -171,11 +173,13 @@ class BcSmartspaceCard @JvmOverloads constructor(
|
||||
) {
|
||||
textView.contentDescription = when {
|
||||
title.isNullOrEmpty() -> contentDescription
|
||||
|
||||
!contentDescription.isNullOrEmpty() -> context.getString(
|
||||
R.string.generic_smartspace_concatenated_desc,
|
||||
contentDescription,
|
||||
title,
|
||||
)
|
||||
|
||||
else -> title
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class InterceptingViewPager @JvmOverloads constructor(
|
||||
postDelayed(longPressCallback, ViewConfiguration.getLongPressTimeout().toLong())
|
||||
}
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
|
||||
cancelScheduledLongPress()
|
||||
}
|
||||
|
||||
@@ -83,11 +83,14 @@ class ThemeProvider(private val context: Context) : SafeCloseable {
|
||||
|
||||
val colorScheme get() = when (val accentColor = this.accentColor) {
|
||||
is ColorOption.SystemAccent -> systemColorScheme
|
||||
|
||||
is ColorOption.WallpaperPrimary -> {
|
||||
val wallpaperPrimary = wallpaperManager.wallpaperColors?.primaryColor
|
||||
getColorScheme(wallpaperPrimary ?: ColorOption.LawnchairBlue.color, colorStyle.style)
|
||||
}
|
||||
|
||||
is ColorOption.CustomColor -> getColorScheme(accentColor.color, colorStyle.style)
|
||||
|
||||
else -> getColorScheme(ColorOption.LawnchairBlue.color, colorStyle.style)
|
||||
}
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ private data class Shimmer(
|
||||
fraction = progress / progressForMaxAlpha,
|
||||
)
|
||||
}
|
||||
|
||||
// From ProgressForOpaqueAlpha..1f we animate from 1..0
|
||||
else -> {
|
||||
lerp(
|
||||
|
||||
@@ -133,30 +133,37 @@ object LauncherOptionsPopup {
|
||||
icon = R.drawable.ic_wallpaper,
|
||||
isCarousel = true,
|
||||
)
|
||||
|
||||
"lock" -> LauncherOptionMetadata(
|
||||
label = R.string.home_screen_lock,
|
||||
icon = R.drawable.ic_lock,
|
||||
)
|
||||
|
||||
"sys_settings" -> LauncherOptionMetadata(
|
||||
label = R.string.system_settings,
|
||||
icon = R.drawable.ic_setting,
|
||||
)
|
||||
|
||||
"edit_mode" -> LauncherOptionMetadata(
|
||||
label = R.string.edit_home_screen,
|
||||
icon = R.drawable.enter_home_gardening_icon,
|
||||
)
|
||||
|
||||
"wallpaper" -> LauncherOptionMetadata(
|
||||
label = R.string.styles_wallpaper_button_text,
|
||||
icon = R.drawable.ic_palette,
|
||||
)
|
||||
|
||||
"widgets" -> LauncherOptionMetadata(
|
||||
label = R.string.widget_button_text,
|
||||
icon = R.drawable.ic_widget,
|
||||
)
|
||||
|
||||
"home_settings" -> LauncherOptionMetadata(
|
||||
label = R.string.settings_button_text,
|
||||
icon = R.drawable.ic_home_screen,
|
||||
)
|
||||
|
||||
else -> throw IllegalArgumentException("invalid popup option")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,6 +153,7 @@ private fun PreferenceScreen(
|
||||
displayFeatures = displayFeatures,
|
||||
)
|
||||
}
|
||||
|
||||
isExpandedScreen -> {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.surface,
|
||||
@@ -166,6 +167,7 @@ private fun PreferenceScreen(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
moveableNavHost()
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ class NightlyBuildsRepository(
|
||||
is IOException -> {
|
||||
Log.e(TAG, "Network error during update check", e)
|
||||
}
|
||||
|
||||
else -> {
|
||||
Log.e(TAG, "Failed to check for update", e)
|
||||
}
|
||||
|
||||
@@ -29,9 +29,11 @@ fun UpdateSection(
|
||||
) {
|
||||
when (updateState) {
|
||||
UpdateState.Hidden -> { /* Render nothing */ }
|
||||
|
||||
UpdateState.Checking -> {
|
||||
CircularProgressIndicator(modifier = Modifier.padding(top = 8.dp))
|
||||
}
|
||||
|
||||
UpdateState.UpToDate -> {
|
||||
Text(
|
||||
text = stringResource(R.string.pro_updated),
|
||||
@@ -40,6 +42,7 @@ fun UpdateSection(
|
||||
modifier = Modifier.padding(top = 8.dp),
|
||||
)
|
||||
}
|
||||
|
||||
is UpdateState.Available -> {
|
||||
Button(
|
||||
onClick = onViewChanges,
|
||||
@@ -47,6 +50,7 @@ fun UpdateSection(
|
||||
Text(text = stringResource(R.string.download_update))
|
||||
}
|
||||
}
|
||||
|
||||
is UpdateState.Downloading -> {
|
||||
LinearProgressIndicator(
|
||||
progress = { updateState.progress },
|
||||
@@ -59,6 +63,7 @@ fun UpdateSection(
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
}
|
||||
|
||||
is UpdateState.Downloaded -> {
|
||||
Button(
|
||||
onClick = {
|
||||
@@ -68,6 +73,7 @@ fun UpdateSection(
|
||||
Text(text = stringResource(R.string.install_update))
|
||||
}
|
||||
}
|
||||
|
||||
UpdateState.Failed -> {
|
||||
Text(
|
||||
text = stringResource(R.string.update_check_failed),
|
||||
|
||||
@@ -131,6 +131,7 @@ private fun AnnouncementItemContent(
|
||||
}
|
||||
|
||||
SwipeToDismissBoxValue.EndToStart -> return@rememberSwipeToDismissBoxState false
|
||||
|
||||
SwipeToDismissBoxValue.Settled -> return@rememberSwipeToDismissBoxState false
|
||||
}
|
||||
return@rememberSwipeToDismissBoxState true
|
||||
@@ -180,7 +181,9 @@ private fun AnnouncementItemContent(
|
||||
|
||||
fun calculateAlpha(progress: Float): Float {
|
||||
return when {
|
||||
progress < 0.5f -> 1f // Fully opaque until halfway
|
||||
progress < 0.5f -> 1f
|
||||
|
||||
// Fully opaque until halfway
|
||||
else -> 1f - (progress - 0.5f) * 2 // Fade out linearly from halfway to the end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ fun wallpaperDrawable(
|
||||
) {
|
||||
value = when {
|
||||
wallpaperInfo != null -> wallpaperInfo.loadThumbnail(context.packageManager)
|
||||
|
||||
hasPermission -> {
|
||||
withContext(Dispatchers.IO) {
|
||||
wallpaperManager.drawable?.let {
|
||||
@@ -137,6 +138,7 @@ fun wallpaperDrawable(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ fun ColorSelection(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
1 -> {
|
||||
CustomColorPicker(
|
||||
selectedColor = selectedColor.intValue,
|
||||
|
||||
@@ -185,6 +185,7 @@ fun CustomColorPicker(
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
1 -> {
|
||||
RgbColorPicker(
|
||||
selectedColor = selectedColor,
|
||||
|
||||
@@ -93,6 +93,7 @@ private class NestedScrollStretchConnection(context: Context, invalidate: Runnab
|
||||
val availableY = available.y
|
||||
when {
|
||||
source != NestedScrollSource.UserInput || height == 0 -> return Offset.Zero
|
||||
|
||||
availableY != 0f -> {
|
||||
if (availableY < 0f) {
|
||||
val consumed = topEdgeEffect.onPullDistance(availableY / height, 0f)
|
||||
@@ -117,6 +118,7 @@ private class NestedScrollStretchConnection(context: Context, invalidate: Runnab
|
||||
val availableY = available.y
|
||||
when {
|
||||
source != NestedScrollSource.UserInput || height == 0 -> return Offset.Zero
|
||||
|
||||
availableY != 0f -> {
|
||||
if (availableY > 0f) {
|
||||
topEdgeEffect.onPull(availableY / height)
|
||||
@@ -125,6 +127,7 @@ private class NestedScrollStretchConnection(context: Context, invalidate: Runnab
|
||||
bottomEdgeEffect.onPull(-availableY / height)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
topEdgeEffect.onRelease()
|
||||
bottomEdgeEffect.onRelease()
|
||||
|
||||
@@ -88,6 +88,7 @@ fun TwoTabPreferenceLayout(
|
||||
firstPageContent()
|
||||
}
|
||||
}
|
||||
|
||||
1 -> {
|
||||
Column {
|
||||
secondPageContent()
|
||||
|
||||
@@ -233,6 +233,7 @@ fun GenericSearchProviderPreference(
|
||||
description = stringResource(id = R.string.fuzzy_search_desc),
|
||||
)
|
||||
}
|
||||
|
||||
SearchProviderId.WEB -> {
|
||||
SliderPreference(
|
||||
label = stringResource(id = R.string.max_web_suggestion_delay),
|
||||
@@ -248,6 +249,7 @@ fun GenericSearchProviderPreference(
|
||||
suggestionsUrlAdapter = prefs2.webSuggestionProviderSuggestionsUrl.getAdapter(),
|
||||
)
|
||||
}
|
||||
|
||||
SearchProviderId.HISTORY -> {
|
||||
val context = LocalContext.current
|
||||
|
||||
@@ -264,6 +266,7 @@ fun GenericSearchProviderPreference(
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,6 +238,7 @@ private fun FontSelectionItem(
|
||||
VariantDropdown(adapter = adapter, family = family)
|
||||
}
|
||||
}
|
||||
|
||||
onDelete != null -> {
|
||||
{
|
||||
IconButton(
|
||||
@@ -252,6 +253,7 @@ private fun FontSelectionItem(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> null
|
||||
},
|
||||
applyPaddings = false,
|
||||
|
||||
@@ -238,6 +238,7 @@ private fun NotificationDotColorContrastWarnings(
|
||||
is ColorOption.WallpaperPrimary,
|
||||
is ColorOption.Default,
|
||||
-> true
|
||||
|
||||
else -> false
|
||||
}
|
||||
|
||||
|
||||
@@ -156,18 +156,21 @@ private fun LauncherPopupPreview(optionsList: List<LauncherOptionPopupItem>) {
|
||||
|
||||
val shape = when {
|
||||
isSingleItem -> CircleShape
|
||||
|
||||
isFirst -> RoundedCornerShape(
|
||||
clipRadius.topStart,
|
||||
clipRadius.topEnd,
|
||||
defaultCorner,
|
||||
defaultCorner,
|
||||
)
|
||||
|
||||
isLast -> RoundedCornerShape(
|
||||
defaultCorner,
|
||||
defaultCorner,
|
||||
clipRadius.bottomStart,
|
||||
clipRadius.bottomEnd,
|
||||
)
|
||||
|
||||
else -> RoundedCornerShape(defaultCorner)
|
||||
}
|
||||
|
||||
|
||||
@@ -81,9 +81,11 @@ fun SmartspacePreferences(
|
||||
LawnchairSmartspace -> {
|
||||
LawnchairSmartspaceSettings(smartspaceProvider)
|
||||
}
|
||||
|
||||
Smartspacer -> {
|
||||
SmartspacerSettings()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,11 @@ val isOnePlusStock = checkOnePlusStock()
|
||||
private fun checkOnePlusStock(): Boolean = when {
|
||||
getSystemProperty("ro.rom.version", "")
|
||||
.contains(Regex("Oxygen OS|Hydrogen OS|O2_BETA|H2_BETA")) -> true
|
||||
|
||||
getSystemProperty("ro.oxygen.version", "").isNotEmpty() -> true
|
||||
|
||||
getSystemProperty("ro.hydrogen.version", "").isNotEmpty() -> true
|
||||
|
||||
else -> false
|
||||
}
|
||||
|
||||
|
||||
@@ -24,30 +24,37 @@ fun formatShortElapsedTime(context: Context, millis: Long): String? {
|
||||
val roundedDays = duration.toDouble(DurationUnit.DAYS).round()
|
||||
measureFormat.format(Measure(roundedDays, MeasureUnit.DAY))
|
||||
}
|
||||
|
||||
days >= 2 || days > 0 && hours == 0 -> {
|
||||
val roundedDays = duration.toDouble(DurationUnit.DAYS).round()
|
||||
measureFormat.format(Measure(roundedDays, MeasureUnit.DAY))
|
||||
}
|
||||
|
||||
days > 0 -> measureFormat.formatMeasures(
|
||||
Measure(days, MeasureUnit.DAY),
|
||||
Measure(hours, MeasureUnit.HOUR),
|
||||
)
|
||||
|
||||
hours >= 2 || hours > 0 && minutes == 0 -> {
|
||||
val roundedHours = duration.toDouble(DurationUnit.HOURS).round()
|
||||
measureFormat.format(Measure(roundedHours, MeasureUnit.HOUR))
|
||||
}
|
||||
|
||||
hours > 0 -> measureFormat.formatMeasures(
|
||||
Measure(hours, MeasureUnit.HOUR),
|
||||
Measure(minutes, MeasureUnit.MINUTE),
|
||||
)
|
||||
|
||||
minutes >= 2 || minutes > 0 && seconds == 0 -> {
|
||||
val roundedMinutes = duration.toDouble(DurationUnit.MINUTES).round()
|
||||
measureFormat.format(Measure(roundedMinutes, MeasureUnit.MINUTE))
|
||||
}
|
||||
|
||||
minutes > 0 -> measureFormat.formatMeasures(
|
||||
Measure(minutes, MeasureUnit.MINUTE),
|
||||
Measure(seconds, MeasureUnit.SECOND),
|
||||
)
|
||||
|
||||
else -> measureFormat.format(Measure(seconds, MeasureUnit.SECOND))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,6 +221,7 @@ fun cutOutline(outline: Outline, height: Float, cutTop: Boolean, cutBottom: Bool
|
||||
CornerRadius.Zero,
|
||||
),
|
||||
)
|
||||
|
||||
is Outline.Rounded -> Outline.Rounded(
|
||||
RoundRect(
|
||||
cutRect(outline.roundRect.boundingRect, height, cutTop, cutBottom),
|
||||
@@ -230,6 +231,7 @@ fun cutOutline(outline: Outline, height: Float, cutTop: Boolean, cutBottom: Bool
|
||||
outline.roundRect.bottomRightCornerRadius,
|
||||
),
|
||||
)
|
||||
|
||||
else -> outline
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,11 +209,13 @@ fun Activity.showFullScreenOverlay(
|
||||
overlayView.animateOut(durationOut, onOverlayReady)
|
||||
}
|
||||
}
|
||||
|
||||
FullScreenOverlayMode.SUCK_IN -> {
|
||||
overlayView.suckAnimation(durationOut) {
|
||||
onOverlayReady()
|
||||
}
|
||||
}
|
||||
|
||||
FullScreenOverlayMode.NONE -> {
|
||||
targetRootView?.removeView(overlayView)
|
||||
onOverlayReady()
|
||||
|
||||
@@ -445,9 +445,11 @@ class ColorScheme(
|
||||
degrees < 0 -> {
|
||||
(degrees % 360) + 360
|
||||
}
|
||||
|
||||
degrees >= 360 -> {
|
||||
degrees % 360
|
||||
}
|
||||
|
||||
else -> {
|
||||
degrees
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user