Skip to content

Commit

Permalink
Merge pull request #223 from tarkalabs/mahi/fix/7112
Browse files Browse the repository at this point in the history
Crash Fix: when switching tabs in WoDetail Activity.
  • Loading branch information
rajajawahar authored Apr 15, 2024
2 parents 79c8909 + 31519ac commit 04a50bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tarka-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ publishing {
run {
groupId = "com.tarkalabs"
artifactId = getLibraryArtifactId()
version = "1.1.14"
version = "1.1.15"
artifact("$buildDir/outputs/aar/tarka-ui-release.aar")
}
}
Expand Down
15 changes: 8 additions & 7 deletions tarka-ui/src/main/java/com/tarkalabs/tarkaui/theme/Theme.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.tarkalabs.tarkaui.theme

import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.SideEffect
Expand All @@ -22,12 +19,16 @@ import androidx.core.view.WindowCompat
) {
val colors = if (darkTheme) darkColors else lightColors
val view = LocalView.current
val context = LocalContext.current

if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colors.surface.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
val activity = context as? Activity
if (activity != null) {
SideEffect {
val window = activity.window
window.statusBarColor = colors.surface.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
}
}
}

Expand Down

0 comments on commit 04a50bb

Please sign in to comment.