mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-29 05:29:08 +00:00
changes
This commit is contained in:
+5
-8
@@ -15,12 +15,11 @@ import androidx.compose.ui.unit.*
|
||||
import chat.simplex.common.platform.appPlatform
|
||||
import chat.simplex.common.ui.theme.CurrentColors
|
||||
|
||||
@Composable
|
||||
fun Modifier.blurredBackgroundModifier(
|
||||
keyboardInset: WindowInsets,
|
||||
handler: AppBarHandler?,
|
||||
blurRadius: State<Int>,
|
||||
prefAlpha: Float,
|
||||
prefAlpha: State<Float>,
|
||||
keyboardCoversBar: Boolean,
|
||||
onTop: Boolean,
|
||||
density: Density
|
||||
@@ -28,18 +27,17 @@ fun Modifier.blurredBackgroundModifier(
|
||||
val graphicsLayer = handler?.graphicsLayer
|
||||
val backgroundGraphicsLayer = handler?.backgroundGraphicsLayer
|
||||
val backgroundGraphicsLayerSize = handler?.backgroundGraphicsLayerSize
|
||||
if (!(handler != null && graphicsLayer != null && backgroundGraphicsLayer != null && blurRadius.value > 0 && prefAlpha < 1f && backgroundGraphicsLayerSize != null))
|
||||
if (!(handler != null && graphicsLayer != null && backgroundGraphicsLayer != null && blurRadius.value > 0 && prefAlpha.value < 1f && backgroundGraphicsLayerSize != null))
|
||||
return this
|
||||
|
||||
return if (appPlatform.isAndroid) {
|
||||
this.androidBlurredModifier(keyboardInset, blurRadius, keyboardCoversBar, onTop, graphicsLayer, backgroundGraphicsLayer, backgroundGraphicsLayerSize, density)
|
||||
this.desktopBlurredModifier(keyboardInset, blurRadius, keyboardCoversBar, onTop, graphicsLayer, backgroundGraphicsLayer, backgroundGraphicsLayerSize, density)
|
||||
} else {
|
||||
this.desktopBlurredModifier(keyboardInset, blurRadius, keyboardCoversBar, onTop, graphicsLayer, backgroundGraphicsLayer, backgroundGraphicsLayerSize, density)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Modifier.androidBlurredModifier(
|
||||
private fun Modifier.androidBlurredModifier(
|
||||
keyboardInset: WindowInsets,
|
||||
blurRadius: State<Int>,
|
||||
keyboardCoversBar: Boolean,
|
||||
@@ -88,8 +86,7 @@ fun Modifier.androidBlurredModifier(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Modifier.desktopBlurredModifier(
|
||||
private fun Modifier.desktopBlurredModifier(
|
||||
keyboardInset: WindowInsets,
|
||||
blurRadius: State<Int>,
|
||||
keyboardCoversBar: Boolean,
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ fun DefaultTopAppBar(
|
||||
} else Modifier
|
||||
|
||||
val themeBackgroundMix = MaterialTheme.colors.background.mixWith(MaterialTheme.colors.onBackground, 0.97f)
|
||||
val prefAlpha = remember { appPrefs.inAppBarsAlpha.state }.value
|
||||
val prefAlpha = remember { appPrefs.inAppBarsAlpha.state }
|
||||
val handler = LocalAppBarHandler.current
|
||||
val connection = LocalAppBarHandler.current?.connection
|
||||
val titleText = remember(handler?.title?.value, fixedTitleText) {
|
||||
@@ -56,7 +56,7 @@ fun DefaultTopAppBar(
|
||||
.blurredBackgroundModifier(keyboardInset, handler, remember { appPrefs.appearanceBarsBlurRadius.state }, prefAlpha, handler?.keyboardCoversBar == true, onTop, density)
|
||||
.drawWithCache {
|
||||
val backgroundColor = if (title != null || fixedTitleText != null || connection == null || !onTop) {
|
||||
themeBackgroundMix.copy(prefAlpha)
|
||||
themeBackgroundMix.copy(prefAlpha.value)
|
||||
} else {
|
||||
themeBackgroundMix.copy(topTitleAlpha(false, connection))
|
||||
}
|
||||
@@ -81,7 +81,7 @@ fun DefaultTopAppBar(
|
||||
Row(
|
||||
Modifier
|
||||
.graphicsLayer {
|
||||
alpha = if (fixedTitleText != null) prefAlpha else topTitleAlpha(true, connection)
|
||||
alpha = if (fixedTitleText != null) prefAlpha.value else topTitleAlpha(true, connection)
|
||||
}
|
||||
) {
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user