-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
7,141 additions
and
20 deletions.
There are no files selected for viewing
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
40 changes: 40 additions & 0 deletions
40
app/shared/src/androidMain/kotlin/dev/datlag/burningseries/ui/theme/SchemeTheme.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,40 @@ | ||
package dev.datlag.burningseries.ui.theme | ||
|
||
import androidx.compose.material3.ColorScheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.asAndroidBitmap | ||
import androidx.compose.ui.graphics.painter.Painter | ||
import androidx.compose.ui.graphics.toPixelMap | ||
import androidx.compose.ui.platform.LocalDensity | ||
import androidx.compose.ui.platform.LocalLayoutDirection | ||
import dev.datlag.burningseries.color.createTheme | ||
import dev.datlag.burningseries.color.utils.ThemeUtils | ||
import dev.datlag.burningseries.ui.theme.image.PainterImage | ||
|
||
@Composable | ||
actual fun SchemeThemeSystemProvider( | ||
scheme: ColorScheme, | ||
content: @Composable () -> Unit | ||
) { | ||
content() | ||
} | ||
|
||
@Composable | ||
actual fun loadImageScheme(key: Any, painter: Painter) { | ||
if (!SchemeTheme.containsScheme(key)) { | ||
val density = LocalDensity.current | ||
val layout = LocalLayoutDirection.current | ||
|
||
SchemeTheme.createColorScheme(key) { | ||
val bitmap = PainterImage( | ||
painter, | ||
density, | ||
layout | ||
).asBitmap() | ||
|
||
ThemeUtils.intArrayToTheme( | ||
bitmap.toPixelMap().buffer | ||
) | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.