Skip to content

Commit

Permalink
Improve foreground colors
Browse files Browse the repository at this point in the history
  • Loading branch information
bingzheung committed Aug 30, 2024
1 parent 292965c commit b18812c
Show file tree
Hide file tree
Showing 15 changed files with 333 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import org.jyutping.jyutping.ui.common.SeparatorMark

Expand All @@ -21,8 +20,7 @@ fun CantoneseLexiconView(lexicon: CantoneseLexicon, unihanDefinition: UnihanDefi
Column(
modifier = Modifier
.fillMaxWidth()
.clip(shape = RoundedCornerShape(size = 8.dp))
.background(color = MaterialTheme.colorScheme.background)
.background(color = colorScheme.background, shape = RoundedCornerShape(8.dp))
.padding(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Expand All @@ -41,9 +39,15 @@ fun CantoneseLexiconView(lexicon: CantoneseLexicon, unihanDefinition: UnihanDefi
) {
HorizontalDivider()
Row {
Text(text = "英文")
Text(
text = "英文",
color = colorScheme.onBackground
)
SeparatorMark()
Text(text = it.definition)
Text(
text = it.definition,
color = colorScheme.onBackground
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package org.jyutping.jyutping.search

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
import org.jyutping.jyutping.ui.common.SeparatorMark
Expand All @@ -20,14 +22,21 @@ fun CantoneseTextLabel(text: String) {
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
Row {
Text(text = "文字")
Text(
text = "文字",
color = colorScheme.onBackground
)
SeparatorMark()
Text(text = text)
Text(
text = text,
color = colorScheme.onBackground
)
}
unicode?.let {
Text(
text = it,
color = MaterialTheme.colorScheme.secondary,
modifier = Modifier.alpha(0.75f),
color = colorScheme.onBackground,
fontFamily = FontFamily.Monospace
)
}
Expand Down
73 changes: 56 additions & 17 deletions app/src/main/java/org/jyutping/jyutping/search/ChoHokView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import org.jyutping.jyutping.linguistics.OldCantonese
import org.jyutping.jyutping.presets.PresetString
import org.jyutping.jyutping.ui.common.SeparatorMark

@Composable
fun ChoHokView(entries: List<ChoHokYuetYamCitYiu>) {
Column(
modifier = Modifier
.fillMaxWidth()
.clip(shape = RoundedCornerShape(size = 8.dp))
.background(color = MaterialTheme.colorScheme.background)
.background(color = colorScheme.background, shape = RoundedCornerShape(8.dp))
.padding(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Expand All @@ -43,44 +43,83 @@ fun ChoHokView(entries: List<ChoHokYuetYamCitYiu>) {
@Composable
private fun ChoHokWordLabel(word: String) {
Row {
Text(text = "文字")
Text(
text = "文字",
color = colorScheme.onBackground
)
SeparatorMark()
Text(text = word)
Text(text = "《初學粵音切要》 湛約翰 1855 香港", fontSize = 14.sp, color = MaterialTheme.colorScheme.secondary)
Text(
text = word,
color = colorScheme.onBackground
)
Text(
text = "《初學粵音切要》 湛約翰 1855 香港",
modifier = Modifier.alpha(0.75f),
color = colorScheme.onBackground,
fontSize = 14.sp
)
}
}

@Composable
private fun ChoHokPronunciationView(entry: ChoHokYuetYamCitYiu) {
val ipaText = OldCantonese.IPAText(entry.romanization)
val homophoneText = if (entry.homophones.isEmpty()) null else entry.homophones.joinToString(separator = " ")
val homophoneText = if (entry.homophones.isEmpty()) null else entry.homophones.joinToString(separator = PresetString.SPACE)
Column {
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Row {
Text(text = "原文")
Text(
text = "原文",
color = colorScheme.onBackground
)
SeparatorMark()
Text(text = entry.pronunciation)
Text(
text = entry.pronunciation,
color = colorScheme.onBackground
)
}
Text(text = entry.tone)
Text(text = entry.faancit)
Text(
text = entry.tone,
color = colorScheme.onBackground
)
Text(
text = entry.faancit,
color = colorScheme.onBackground
)
}
Row(
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
Row {
Text(text = "轉寫")
Text(
text = "轉寫",
color = colorScheme.onBackground
)
SeparatorMark()
Text(text = entry.romanization)
Text(
text = entry.romanization,
color = colorScheme.onBackground
)
}
Text(text = ipaText, color = MaterialTheme.colorScheme.secondary)
Text(
text = ipaText,
modifier = Modifier.alpha(0.75f),
color = colorScheme.onBackground
)
}
homophoneText?.let {
Row {
Text(text = "同音")
Text(
text = "同音",
color = colorScheme.onBackground
)
SeparatorMark()
Text(text = it)
Text(
text = it,
color = colorScheme.onBackground
)
}
}
}
Expand Down
43 changes: 26 additions & 17 deletions app/src/main/java/org/jyutping/jyutping/search/FanWanView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import org.jyutping.jyutping.linguistics.OldCantonese
import org.jyutping.jyutping.presets.PresetString
import org.jyutping.jyutping.ui.common.SeparatorMark

@Composable
fun FanWanView(entries: List<FanWanCuetYiu>) {
Column(
modifier = Modifier
.fillMaxWidth()
.clip(shape = RoundedCornerShape(size = 8.dp))
.background(color = MaterialTheme.colorScheme.background)
.background(color = colorScheme.background, shape = RoundedCornerShape(8.dp))
.padding(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Expand All @@ -43,44 +43,53 @@ fun FanWanView(entries: List<FanWanCuetYiu>) {
@Composable
private fun FanWanWordLabel(word: String) {
Row {
Text(text = "文字")
Text(text = "文字", color = colorScheme.onBackground)
SeparatorMark()
Text(text = word)
Text(text = "《分韻撮要》 佚名 清初 廣州府", fontSize = 14.sp, color = MaterialTheme.colorScheme.secondary)
Text(text = word, color = colorScheme.onBackground)
Text(
text = "《分韻撮要》 佚名 清初 廣州府",
modifier = Modifier.alpha(0.75f),
color = colorScheme.onBackground,
fontSize = 14.sp
)
}
}

@Composable
private fun FanWanPronunciationView(entry: FanWanCuetYiu) {
val ipaText = OldCantonese.IPAText(entry.romanization)
val homophoneText = if (entry.homophones.isEmpty()) null else entry.homophones.joinToString(separator = " ")
val homophoneText = if (entry.homophones.isEmpty()) null else entry.homophones.joinToString(separator = PresetString.SPACE)
Column {
Row {
Text(text = "讀音")
Text(text = "讀音", color = colorScheme.onBackground)
SeparatorMark()
Text(text = entry.pronunciation)
Text(text = entry.pronunciation, color = colorScheme.onBackground)
}
Row(
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
Row {
Text(text = "轉寫")
Text(text = "轉寫", color = colorScheme.onBackground)
SeparatorMark()
Text(text = entry.romanization)
Text(text = entry.romanization, color = colorScheme.onBackground)
}
Text(text = ipaText, color = MaterialTheme.colorScheme.secondary)
Text(
text = ipaText,
modifier = Modifier.alpha(0.75f),
color = colorScheme.onBackground
)
}
homophoneText?.let {
Row {
Text(text = "同音")
Text(text = "同音", color = colorScheme.onBackground)
SeparatorMark()
Text(text = it)
Text(text = it, color = colorScheme.onBackground)
}
}
Row {
Text(text = "釋義")
Text(text = "釋義", color = colorScheme.onBackground)
SeparatorMark()
Text(text = entry.interpretation)
Text(text = entry.interpretation, color = colorScheme.onBackground)
}
}
}
26 changes: 15 additions & 11 deletions app/src/main/java/org/jyutping/jyutping/search/GwongWanView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import org.jyutping.jyutping.ui.common.SeparatorMark
Expand All @@ -22,8 +22,7 @@ fun GwongWanView(entries: List<GwongWanCharacter>) {
Column(
modifier = Modifier
.fillMaxWidth()
.clip(shape = RoundedCornerShape(size = 8.dp))
.background(color = MaterialTheme.colorScheme.background)
.background(color = colorScheme.background, shape = RoundedCornerShape(8.dp))
.padding(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Expand All @@ -42,25 +41,30 @@ fun GwongWanView(entries: List<GwongWanCharacter>) {
@Composable
private fun GwongWanWordLabel(word: String) {
Row {
Text(text = "文字")
Text(text = "文字", color = colorScheme.onBackground)
SeparatorMark()
Text(text = word)
Text(text = "《大宋重修廣韻》 陳彭年等 北宋", fontSize = 14.sp, color = MaterialTheme.colorScheme.secondary)
Text(text = word, color = colorScheme.onBackground)
Text(
text = "《大宋重修廣韻》 陳彭年等 北宋",
modifier = Modifier.alpha(0.75f),
color = colorScheme.onBackground,
fontSize = 14.sp
)
}
}

@Composable
private fun GwongWanPronunciationView(entry: GwongWanCharacter) {
Column {
Row {
Text(text = "讀音")
Text(text = "讀音", color = colorScheme.onBackground)
SeparatorMark()
Text(text = entry.pronunciation)
Text(text = entry.pronunciation, color = colorScheme.onBackground)
}
Row {
Text(text = "釋義")
Text(text = "釋義", color = colorScheme.onBackground)
SeparatorMark()
Text(text = entry.interpretation)
Text(text = entry.interpretation, color = colorScheme.onBackground)
}
}
}
Loading

0 comments on commit b18812c

Please sign in to comment.