Minor cleanup and bugfixes

This commit is contained in:
Syer10
2022-04-01 23:50:58 -04:00
parent a5b9059af3
commit 79ff944bad
3 changed files with 8 additions and 10 deletions

View File

@@ -13,7 +13,6 @@ import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.input.key.KeyEvent import androidx.compose.ui.input.key.KeyEvent
import androidx.compose.ui.input.key.NativeKeyEvent
import androidx.compose.ui.input.key.key import androidx.compose.ui.input.key.key
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import ca.gosyer.jui.ui.base.theme.AppTheme import ca.gosyer.jui.ui.base.theme.AppTheme
@@ -48,9 +47,7 @@ class ReaderActivity : AppCompatActivity() {
} }
setContent { setContent {
CompositionLocalProvider( CompositionLocalProvider(*hooks) {
*hooks
) {
AppTheme { AppTheme {
ReaderMenu( ReaderMenu(
chapterIndex = chapterIndex, chapterIndex = chapterIndex,
@@ -64,8 +61,9 @@ class ReaderActivity : AppCompatActivity() {
} }
override fun onKeyUp(keyCode: Int, event: android.view.KeyEvent?): Boolean { override fun onKeyUp(keyCode: Int, event: android.view.KeyEvent?): Boolean {
event ?: super.onKeyUp(keyCode, event) @Suppress("KotlinConstantConditions")
val composeKeyEvent = KeyEvent(event as NativeKeyEvent) event ?: return super.onKeyUp(keyCode, event)
val composeKeyEvent = KeyEvent(event)
lifecycleScope.launch { lifecycleScope.launch {
hotkeyFlow.emit(composeKeyEvent) hotkeyFlow.emit(composeKeyEvent)
} }

View File

@@ -120,9 +120,9 @@ subprojects {
} }
} }
afterEvaluate { plugins.withType<org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper> {
plugins.withType<org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper> { configure<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension> {
configure<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension> { afterEvaluate {
if (!Config.androidDev) { if (!Config.androidDev) {
sourceSets.addSrcDir("desktopMain", "src/jvmMain/kotlin") sourceSets.addSrcDir("desktopMain", "src/jvmMain/kotlin")
sourceSets.addSrcDir("desktopTest", "src/jvmTest/kotlin") sourceSets.addSrcDir("desktopTest", "src/jvmTest/kotlin")

View File

@@ -19,4 +19,4 @@ actual fun Locale.getDisplayLanguage(displayLocale: Locale): String = toPlatform
actual fun Locale.getDisplayName(displayLocale: Locale): String = toPlatform() actual fun Locale.getDisplayName(displayLocale: Locale): String = toPlatform()
.getDisplayName(displayLocale.toPlatform()) .getDisplayName(displayLocale.toPlatform())
actual val Locale.displayName get() = toPlatform().displayName actual val Locale.displayName: String get() = toPlatform().displayName