pull/1751/head
kunfei 3 years ago
parent 676e7345ad
commit e256a2d9a8
  1. 10
      app/src/main/java/io/legado/app/ui/book/audio/ComposeView.kt
  2. 21
      app/src/main/java/io/legado/app/ui/theme/AppTheme.kt

@ -5,15 +5,19 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Card
import androidx.compose.material.Slider
import androidx.compose.material.SliderDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import io.legado.app.lib.theme.accentColor
import io.legado.app.model.AudioPlay
import io.legado.app.service.AudioPlayService
import splitties.init.appCtx
@Composable
@ -32,7 +36,11 @@ fun TimerDialog(state: MutableState<Boolean>, parent: View) {
timeMinute.value = it.toInt()
AudioPlay.setTimer(it.toInt())
},
valueRange = 0f..180f
valueRange = 0f..180f,
colors = SliderDefaults.colors(
thumbColor = Color(appCtx.accentColor),
activeTrackColor = Color(appCtx.accentColor)
)
)
}
}

@ -6,23 +6,36 @@ import androidx.compose.material.lightColors
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import io.legado.app.help.config.ThemeConfig
import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.primaryColor
import io.legado.app.utils.ColorUtils
import splitties.init.appCtx
object AppTheme {
@Composable
fun AppTheme(content: @Composable () -> Unit) {
val colors = if (ThemeConfig.isDarkTheme()) {
val colors
get() = if (ThemeConfig.isDarkTheme()) {
darkColors(
primary = Color(appCtx.primaryColor),
primaryVariant = Color(ColorUtils.darkenColor(appCtx.primaryColor)),
secondary = Color(appCtx.accentColor),
secondaryVariant = Color(appCtx.accentColor)
)
} else {
lightColors(
primary = Color(appCtx.primaryColor),
primaryVariant = Color(ColorUtils.darkenColor(appCtx.primaryColor)),
secondary = Color(appCtx.accentColor),
secondaryVariant = Color(appCtx.accentColor)
)
}
}
@Composable
fun AppTheme(content: @Composable () -> Unit) {
MaterialTheme(
colors = colors,
colors = AppTheme.colors,
content = content
)
}
Loading…
Cancel
Save