-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract platform specific UI from theme to UI Kit to Compose App root
- Loading branch information
1 parent
71fd173
commit 9b95eca
Showing
8 changed files
with
69 additions
and
44 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
compose-app/src/androidMain/kotlin/dev/androidbroadcast/news/compose/NewsApp.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package dev.androidbroadcast.news.compose | ||
|
||
import android.app.Activity | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.SideEffect | ||
import androidx.compose.ui.graphics.toArgb | ||
import androidx.compose.ui.platform.LocalView | ||
import androidx.core.view.WindowCompat | ||
import dev.androidbroadcast.news.NewsTheme | ||
|
||
@Composable | ||
internal actual fun NewsPlatformTheme( | ||
darkTheme: Boolean, | ||
content: @Composable () -> Unit, | ||
) { | ||
val view = LocalView.current | ||
if (!view.isInEditMode) { | ||
val colorScheme = NewsTheme.colorScheme | ||
SideEffect { | ||
val window = (view.context as Activity).window | ||
window.statusBarColor = colorScheme.primary.toArgb() | ||
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme | ||
} | ||
} | ||
content() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
compose-app/src/iosMain/kotlin/dev/androidbroadcast/news/compose/NewsApp.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.androidbroadcast.news.compose | ||
|
||
import androidx.compose.runtime.Composable | ||
|
||
@Composable | ||
internal actual fun NewsPlatformTheme( | ||
darkTheme: Boolean, | ||
content: @Composable () -> Unit, | ||
) { | ||
// Do nothing | ||
} |
11 changes: 11 additions & 0 deletions
11
compose-app/src/jvmMain/kotlin/dev/androidbroadcast/news/compose/NewsApp.jvm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.androidbroadcast.news.compose | ||
|
||
import androidx.compose.runtime.Composable | ||
|
||
@Composable | ||
internal actual fun NewsPlatformTheme( | ||
darkTheme: Boolean, | ||
content: @Composable () -> Unit, | ||
) { | ||
// Do nothing | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters