parent
8d5211c67e
commit
18a7566e7d
@ -1,41 +0,0 @@ |
||||
package io.legado.app.ui.book.audio |
||||
|
||||
import android.view.View |
||||
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.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.unit.dp |
||||
import androidx.compose.ui.window.Dialog |
||||
import io.legado.app.model.AudioPlay |
||||
import io.legado.app.service.AudioPlayService |
||||
|
||||
|
||||
@Composable |
||||
fun TimerDialog(state: MutableState<Boolean>, parent: View) { |
||||
val intOffset = IntArray(2) |
||||
parent.getLocationInWindow(intOffset) |
||||
if (state.value) { |
||||
val timeMinute = remember { |
||||
mutableStateOf(AudioPlayService.timeMinute) |
||||
} |
||||
Dialog(onDismissRequest = { state.value = false }) { |
||||
Card(Modifier.fillMaxWidth()) { |
||||
Slider( |
||||
modifier = Modifier.padding(horizontal = 16.dp), |
||||
value = timeMinute.value.toFloat(), |
||||
onValueChange = { |
||||
timeMinute.value = it.toInt() |
||||
AudioPlay.setTimer(it.toInt()) |
||||
}, |
||||
valueRange = 0f..180f, |
||||
) |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,41 +0,0 @@ |
||||
package io.legado.app.ui.theme |
||||
|
||||
import androidx.compose.material.MaterialTheme |
||||
import androidx.compose.material.darkColors |
||||
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 { |
||||
|
||||
val colors |
||||
get() = if (ThemeConfig.isDarkTheme()) { |
||||
darkColors( |
||||
primary = Color(appCtx.accentColor), |
||||
primaryVariant = Color(ColorUtils.darkenColor(appCtx.accentColor)), |
||||
secondary = Color(appCtx.primaryColor), |
||||
secondaryVariant = Color(appCtx.primaryColor) |
||||
) |
||||
} else { |
||||
lightColors( |
||||
primary = Color(appCtx.accentColor), |
||||
primaryVariant = Color(ColorUtils.darkenColor(appCtx.accentColor)), |
||||
secondary = Color(appCtx.primaryColor), |
||||
secondaryVariant = Color(appCtx.primaryColor) |
||||
) |
||||
} |
||||
|
||||
} |
||||
|
||||
@Composable |
||||
fun AppTheme(content: @Composable () -> Unit) { |
||||
MaterialTheme( |
||||
colors = AppTheme.colors, |
||||
content = content |
||||
) |
||||
} |
@ -1,48 +0,0 @@ |
||||
package io.legado.app.ui.widget.checkbox |
||||
|
||||
import androidx.compose.foundation.clickable |
||||
import androidx.compose.foundation.interaction.MutableInteractionSource |
||||
import androidx.compose.foundation.layout.* |
||||
import androidx.compose.material.ButtonDefaults |
||||
import androidx.compose.material.Checkbox |
||||
import androidx.compose.material.MaterialTheme |
||||
import androidx.compose.material.Text |
||||
import androidx.compose.material.ripple.rememberRipple |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.runtime.remember |
||||
import androidx.compose.ui.Alignment |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.draw.clip |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
@Composable |
||||
fun LabelledCheckBox( |
||||
checked: Boolean, |
||||
onCheckedChange: ((Boolean) -> Unit), |
||||
label: String, |
||||
modifier: Modifier = Modifier |
||||
) { |
||||
Row( |
||||
verticalAlignment = Alignment.CenterVertically, |
||||
modifier = modifier |
||||
.clip(MaterialTheme.shapes.small) |
||||
.clickable( |
||||
indication = rememberRipple(color = MaterialTheme.colors.primary), |
||||
interactionSource = remember { MutableInteractionSource() }, |
||||
onClick = { onCheckedChange(!checked) } |
||||
) |
||||
.requiredHeight(ButtonDefaults.MinHeight) |
||||
.padding(4.dp) |
||||
) { |
||||
Checkbox( |
||||
checked = checked, |
||||
onCheckedChange = null |
||||
) |
||||
|
||||
Spacer(Modifier.size(6.dp)) |
||||
|
||||
Text( |
||||
text = label, |
||||
) |
||||
} |
||||
} |
Loading…
Reference in new issue