feat: font support

This commit is contained in:
aro 2022-11-20 21:57:54 +01:00
parent 83aa75a89d
commit e511bdac98
3 changed files with 24 additions and 14 deletions

View file

@ -6,7 +6,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow import androidx.compose.ui.draw.shadow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import xyz.atnrch.wrench.colors.WrenchColors import xyz.atnrch.wrench.ui.UIColors
import xyz.atnrch.wrench.watcher.Watcher import xyz.atnrch.wrench.watcher.Watcher
@Composable @Composable
@ -19,7 +19,7 @@ fun BottomAppBar(
cutoutShape = MaterialTheme.shapes.small.copy( cutoutShape = MaterialTheme.shapes.small.copy(
CornerSize(percent = 50) CornerSize(percent = 50)
), ),
backgroundColor = WrenchColors.PRIMARY, backgroundColor = UIColors.PRIMARY,
modifier = Modifier.shadow(20.dp, MaterialTheme.shapes.small, true) modifier = Modifier.shadow(20.dp, MaterialTheme.shapes.small, true)
) { BottomRow(watcher, state, onStateChange) } ) { BottomRow(watcher, state, onStateChange) }
} }

View file

@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.material.* import androidx.compose.material.*
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Build
import androidx.compose.material.icons.filled.Settings import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -12,23 +13,36 @@ import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import xyz.atnrch.wrench.colors.WrenchColors
import xyz.atnrch.wrench.logger.Logger import xyz.atnrch.wrench.logger.Logger
import xyz.atnrch.wrench.ui.Fonts
import xyz.atnrch.wrench.ui.UIColors
@Composable @Composable
fun TopBar() { fun TopBar() {
TopAppBar( TopAppBar(
backgroundColor = WrenchColors.PRIMARY, backgroundColor = UIColors.PRIMARY,
contentColor = Color.White, contentColor = Color.White,
elevation = 16.dp, elevation = 16.dp,
title = { Text("Wrench") }, title = {
Icon(
Icons.Filled.Build,
tint = Color.White,
contentDescription = "Debug Settings",
modifier = Modifier.size(18.dp)
)
Spacer(Modifier.width(5.dp))
Text(
text = "Wrench",
fontFamily = Fonts.JOST_MEDIUM
)
},
actions = { actions = {
//............. //.............
// Debug Button // Debug Button
//............. //.............
Button( Button(
{ Logger.debug("Empty.") }, { Logger.debug("Empty.") },
colors = ButtonDefaults.buttonColors(WrenchColors.STRESS, Color.White), colors = ButtonDefaults.buttonColors(UIColors.STRESS, Color.White),
shape = RectangleShape, shape = RectangleShape,
modifier = Modifier.shadow(20.dp, RectangleShape, true) modifier = Modifier.shadow(20.dp, RectangleShape, true)
) { ) {

View file

@ -11,6 +11,7 @@ import androidx.compose.ui.unit.ExperimentalUnitApi
import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.TextUnitType import androidx.compose.ui.unit.TextUnitType
import xyz.atnrch.wrench.components.dialog.EntryDialog import xyz.atnrch.wrench.components.dialog.EntryDialog
import xyz.atnrch.wrench.ui.Fonts
import xyz.atnrch.wrench.watcher.WatcherEntry import xyz.atnrch.wrench.watcher.WatcherEntry
@OptIn(ExperimentalUnitApi::class) @OptIn(ExperimentalUnitApi::class)
@ -22,7 +23,8 @@ fun WatcherTextEntry(entry: WatcherEntry) {
text = "${entry.file.absolutePath}", text = "${entry.file.absolutePath}",
style = TextStyle( style = TextStyle(
color = Color.Black, color = Color.Black,
fontSize = TextUnit(15F, TextUnitType.Sp) fontSize = TextUnit(15F, TextUnitType.Sp),
fontFamily = Fonts.JOST_LIGHT_ITALIC
), ),
modifier = Modifier.clickable { modifier = Modifier.clickable {
dialogState = true dialogState = true
@ -30,12 +32,6 @@ fun WatcherTextEntry(entry: WatcherEntry) {
) )
if (dialogState) { if (dialogState) {
EntryDialog( EntryDialog(onStateChange = { dialogState = it })
onCancelClick = {
dialogState = false
println("clicked cancel")
},
onStateChange = { dialogState = it }
)
} }
} }