Skip to content

Commit

Permalink
Remove out-of-date code
Browse files Browse the repository at this point in the history
  • Loading branch information
linroid committed Jul 12, 2024
1 parent 3ba9497 commit 1bd85f1
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import androidx.core.view.WindowInsetsControllerCompat


@Composable
internal actual fun SystemAppearance(isDark: Boolean) {
internal actual fun SystemAppearance(isDarkTheme: Boolean) {
val view = LocalView.current
LaunchedEffect(isDark) {
LaunchedEffect(isDarkTheme) {
val window = (view.context as Activity).window
WindowInsetsControllerCompat(window, window.decorView).apply {
isAppearanceLightStatusBars = false
isAppearanceLightNavigationBars = isDark
isAppearanceLightStatusBars = !isDarkTheme
isAppearanceLightNavigationBars = !isDarkTheme
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,10 @@ fun PhotoScreen(
photo: Photo,
onExit: () -> Unit
) {
var needTransition by remember { mutableStateOf(false) }
val density = LocalDensity.current
val coroutineScope = rememberCoroutineScope()
val transitionProgress = remember { Animatable(if (needTransition) 0f else 1f) }
BackHandler {
needTransition = true
coroutineScope.launch {
transitionProgress.animateTo(0f)
onExit()
}
onExit()
}
Scaffold(
containerColor = Color.Transparent,
Expand All @@ -76,13 +70,7 @@ fun PhotoScreen(
navigationIconContentColor = Color.White
),
navigationIcon = {
IconButton(onClick = {
needTransition = true
coroutineScope.launch {
transitionProgress.animateTo(0f)
onExit()
}
}) {
IconButton(onClick = onExit) {
Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = stringResource(Res.string.button_back)
Expand All @@ -93,7 +81,7 @@ fun PhotoScreen(
}) {
BoxWithConstraints(
Modifier.fillMaxSize()
.background(Color.Black.copy(alpha = transitionProgress.value))
.background(Color.Black)
) {
val boxAspectRatio = constraints.maxWidth.toFloat() / constraints.maxHeight
val photoAspectRatio = photo.width.toFloat() / photo.height
Expand All @@ -120,12 +108,6 @@ fun PhotoScreen(

var isOriginalLoaded by remember { mutableStateOf(false) }

LaunchedEffect(Unit) {
if (needTransition) {
transitionProgress.animateTo(1.0f) {}
needTransition = false
}
}
val scale = remember { Animatable(1f) }
val offset = remember { Animatable(Offset(0f, 0f), Offset.VectorConverter) }
Box(
Expand Down Expand Up @@ -203,7 +185,7 @@ fun PhotoScreen(
}
})
}
if (!needTransition && !isOriginalLoaded) {
if (!isOriginalLoaded) {
CircularProgressIndicator(Modifier.align(Alignment.Center))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ val unspecified_scheme = ColorFamily(
internal expect fun provideColorScheme(isSystemDark: Boolean): ColorScheme

@Composable
internal expect fun SystemAppearance(isDark: Boolean)
internal expect fun SystemAppearance(isDarkTheme: Boolean)

internal val LocalIsDarkTheme = compositionLocalOf { mutableStateOf(true) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import platform.UIKit.UIStatusBarStyleLightContent
import platform.UIKit.setStatusBarStyle

@Composable
internal actual fun SystemAppearance(isDark: Boolean) {
LaunchedEffect(isDark) {
internal actual fun SystemAppearance(isDarkTheme: Boolean) {
LaunchedEffect(isDarkTheme) {
UIApplication.sharedApplication.setStatusBarStyle(
if (isDark) UIStatusBarStyleDarkContent else UIStatusBarStyleLightContent
if (isDarkTheme) UIStatusBarStyleDarkContent else UIStatusBarStyleLightContent
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.material3.ColorScheme
import androidx.compose.runtime.Composable

@Composable
internal actual fun SystemAppearance(isDark: Boolean) {
internal actual fun SystemAppearance(isDarkTheme: Boolean) {
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.material3.ColorScheme
import androidx.compose.runtime.Composable

@Composable
internal actual fun SystemAppearance(isDark: Boolean) {
internal actual fun SystemAppearance(isDarkTheme: Boolean) {
}
@Composable
internal actual fun provideColorScheme(isSystemDark: Boolean): ColorScheme {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ compose = "1.7.0-alpha01"
agp = "8.6.0-alpha03"
androidx-activityCompose = "1.9.0"
androidx-uiTest = "1.6.8"
androidx-navigation = "2.7.0-alpha07"
androidx-navigation = "2.8.0-alpha08"
napier = "2.7.1"
buildConfig = "5.3.5"
kotlinx-coroutines = "1.8.0"
Expand Down

0 comments on commit 1bd85f1

Please sign in to comment.