Skip to content

Commit

Permalink
fixes #54
Browse files Browse the repository at this point in the history
  • Loading branch information
yamin8000 committed Jan 31, 2024
1 parent fdd589f commit fdd6924
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 182 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ android {
applicationId = appId
minSdk = 21
targetSdk = 34
versionCode = 35
versionName = "1.5.9"
versionCode = 36
versionName = "1.5.91"
vectorDrawables.useSupportLibrary = true
ksp.arg("room.schemaLocation", "$projectDir/schemas")
archivesName = "$applicationId-v$versionCode($versionName)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import androidx.compose.ui.window.Dialog
import io.github.yamin8000.owl.R
import io.github.yamin8000.owl.ui.theme.DefaultCutShape
import io.github.yamin8000.owl.ui.theme.Samim
import io.github.yamin8000.owl.ui.theme.defaultGradientBorder
import io.github.yamin8000.owl.util.findActivity
import io.github.yamin8000.owl.util.getCurrentLocale
import io.github.yamin8000.owl.util.sanitizeWords
Expand Down Expand Up @@ -236,6 +237,7 @@ fun CopyAbleRippleText(
}
}
ElevatedSuggestionChip(
border = defaultGradientBorder(),
onClick = onItemClick,
label = {
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import io.github.yamin8000.owl.ui.composable.ClickableIcon
import io.github.yamin8000.owl.ui.composable.HighlightText
import io.github.yamin8000.owl.ui.composable.PersianText
import io.github.yamin8000.owl.ui.theme.Samim
import io.github.yamin8000.owl.ui.theme.defaultGradientBorder
import io.github.yamin8000.owl.util.ImmutableHolder
import io.github.yamin8000.owl.util.getCurrentLocale
import kotlinx.coroutines.delay
Expand All @@ -90,6 +91,7 @@ internal fun MainBottomBar(
items = suggestions.item,
itemContent = {
ElevatedSuggestionChip(
border = defaultGradientBorder(),
label = { HighlightText(it, searchText) },
onClick = {
onSuggestionClick(it)
Expand Down Expand Up @@ -123,54 +125,55 @@ internal fun MainBottomBar(
}
)
} else {
BottomAppBar {
TextField(
singleLine = true,
shape = CutCornerShape(topEnd = 10.dp, topStart = 10.dp),
modifier = Modifier
.fillMaxWidth()
.padding(16.dp, 0.dp, 16.dp, 0.dp),
label = {
PersianText(
stringResource(R.string.search),
modifier = Modifier.fillMaxWidth()
)
},
placeholder = {
PersianText(
text = stringResource(R.string.search_hint),
modifier = Modifier.fillMaxWidth(),
fontSize = 12.sp
)
},
leadingIcon = {
ClickableIcon(
imageVector = Icons.TwoTone.Clear,
contentDescription = stringResource(R.string.clear),
onClick = { searchText = "" }
)
},
trailingIcon = {
ClickableIcon(
imageVector = Icons.TwoTone.Search,
contentDescription = stringResource(R.string.search),
onClick = { onSearch(searchText) }
BottomAppBar(
content = {
TextField(
singleLine = true,
shape = CutCornerShape(topEnd = 10.dp, topStart = 10.dp),
modifier = Modifier
.fillMaxWidth()
.padding(16.dp, 0.dp, 16.dp, 0.dp),
label = {
PersianText(
stringResource(R.string.search),
modifier = Modifier.fillMaxWidth()
)
},
placeholder = {
PersianText(
text = stringResource(R.string.search_hint),
modifier = Modifier.fillMaxWidth(),
fontSize = 12.sp
)
},
leadingIcon = {
ClickableIcon(
imageVector = Icons.TwoTone.Clear,
contentDescription = stringResource(R.string.clear),
onClick = { searchText = "" }
)
},
trailingIcon = {
ClickableIcon(
imageVector = Icons.TwoTone.Search,
contentDescription = stringResource(R.string.search),
onClick = { onSearch(searchText) }
)
},
value = searchText,
onValueChange = {
searchText = it
onSearchTermChanged(searchText)
},
textStyle = getTextStyleBasedOnLocale(LocalContext.current),
keyboardActions = KeyboardActions(onSearch = { onSearch(searchText) }),
keyboardOptions = KeyboardOptions(
imeAction = ImeAction.Search,
keyboardType = KeyboardType.Text,
capitalization = KeyboardCapitalization.Words
)
},
value = searchText,
onValueChange = {
searchText = it
onSearchTermChanged(searchText)
},
textStyle = getTextStyleBasedOnLocale(LocalContext.current),
keyboardActions = KeyboardActions(onSearch = { onSearch(searchText) }),
keyboardOptions = KeyboardOptions(
imeAction = ImeAction.Search,
keyboardType = KeyboardType.Text,
capitalization = KeyboardCapitalization.Words
)
)
}
})
}
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import io.github.yamin8000.owl.R
Expand All @@ -57,6 +56,7 @@ import io.github.yamin8000.owl.ui.composable.HighlightText
import io.github.yamin8000.owl.ui.composable.SpeakableRippleTextWithIcon
import io.github.yamin8000.owl.ui.composable.TtsAwareContent
import io.github.yamin8000.owl.ui.theme.DefaultCutShape
import io.github.yamin8000.owl.ui.theme.defaultGradientBorder
import io.github.yamin8000.owl.util.speak

@Composable
Expand Down Expand Up @@ -239,15 +239,7 @@ internal fun MeaningCard(
Card(
shape = DefaultCutShape,
modifier = Modifier.fillMaxWidth(),
border = BorderStroke(
1.dp,
Brush.verticalGradient(
listOf(
MaterialTheme.colorScheme.tertiary,
MaterialTheme.colorScheme.primary
)
)
),
border = defaultGradientBorder(),
content = {
Column(
modifier = Modifier.padding(16.dp),
Expand Down
19 changes: 18 additions & 1 deletion app/src/main/java/io/github/yamin8000/owl/ui/theme/Shape.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,24 @@

package io.github.yamin8000.owl.ui.theme

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.shape.CutCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.unit.dp

val DefaultCutShape = CutCornerShape(8.dp)
val DefaultCutShape = CutCornerShape(8.dp)

@Composable
fun defaultGradientBorder(): BorderStroke {
return BorderStroke(
1.dp,
Brush.verticalGradient(
listOf(
MaterialTheme.colorScheme.tertiary,
MaterialTheme.colorScheme.primary
)
)
)
}
27 changes: 19 additions & 8 deletions app/src/main/java/io/github/yamin8000/owl/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ private val lightColors = lightColorScheme(
errorContainer = md_theme_light_errorContainer,
onErrorContainer = md_theme_light_onErrorContainer,
outline = md_theme_light_outline,
//surfaceTintColor = md_theme_light_surfaceTintColor,
)


Expand Down Expand Up @@ -97,7 +96,6 @@ private val darkColors = darkColorScheme(
inverseSurface = md_theme_dark_inverseSurface,
inversePrimary = md_theme_dark_inversePrimary,
surfaceTint = md_theme_dark_surfaceTint,
//surfaceTintColor = md_theme_dark_surfaceTintColor,
)

@Composable
Expand All @@ -118,11 +116,20 @@ fun OwlTheme(
}

if (isDarkTheme && isOledTheme) {
@Suppress("unused")
colors = colors.copy(
background = colors.background.darken(),
surface = colors.surface.darken(),
surfaceVariant = colors.surfaceVariant.darken(),
inverseOnSurface = colors.inverseOnSurface.darken()
onPrimary = colors.onPrimary.darken(),
primaryContainer = colors.primaryContainer.darken(),
onSecondary = colors.onSecondary.darken(),
secondaryContainer = colors.secondaryContainer.darken(),
onTertiary = colors.onTertiary.darken(),
tertiaryContainer = colors.tertiaryContainer.darken(),
background = Color(0xFF000000),
surface = Color(0xFF000000),
surfaceVariant = Color(0xFF000000),
inverseOnSurface = Color(0xFF000000),
inversePrimary = colors.inversePrimary.darken(),
surfaceTint = colors.surfaceTint.darken(),
)
}

Expand All @@ -139,7 +146,6 @@ fun OwlTheme(

MaterialTheme(
colorScheme = colors,
typography = AppTypography,
content = content
)
}
Expand All @@ -159,5 +165,10 @@ fun PreviewTheme(
}

private fun Color.darken(): Color {
return copy(alpha, red / 10, green / 10, blue / 10)
return copy(alpha, red / 5, green / 5, blue / 5)
}

@Suppress("unused")
private fun Color.lighten(): Color {
return copy(alpha, red + (1f - red) / 2, green + (1f - green) / 2, blue + (1f - blue) / 2)
}
116 changes: 1 addition & 115 deletions app/src/main/java/io/github/yamin8000/owl/ui/theme/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,122 +21,8 @@

package io.github.yamin8000.owl.ui.theme

import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
import io.github.yamin8000.owl.R

val Samim = FontFamily(Font(R.font.samimbold))

val Roboto = FontFamily.Default

val AppTypography = Typography(
labelLarge = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.Medium,
letterSpacing = 0.10000000149011612.sp,
lineHeight = 20.sp,
fontSize = 14.sp
),
labelMedium = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.Medium,
letterSpacing = 0.5.sp,
lineHeight = 16.sp,
fontSize = 12.sp
),
labelSmall = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.Medium,
letterSpacing = 0.5.sp,
lineHeight = 16.sp,
fontSize = 11.sp
),
bodyLarge = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.W400,
letterSpacing = 0.5.sp,
lineHeight = 24.sp,
fontSize = 16.sp
),
bodyMedium = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.W400,
letterSpacing = 0.25.sp,
lineHeight = 20.sp,
fontSize = 14.sp
),
bodySmall = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.W400,
letterSpacing = 0.4000000059604645.sp,
lineHeight = 16.sp,
fontSize = 12.sp
),
headlineLarge = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.W400,
letterSpacing = 0.sp,
lineHeight = 40.sp,
fontSize = 32.sp
),
headlineMedium = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.W400,
letterSpacing = 0.sp,
lineHeight = 36.sp,
fontSize = 28.sp
),
headlineSmall = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.W400,
letterSpacing = 0.sp,
lineHeight = 32.sp,
fontSize = 24.sp
),
displayLarge = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.W400,
letterSpacing = (-0.25).sp,
lineHeight = 64.sp,
fontSize = 57.sp
),
displayMedium = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.W400,
letterSpacing = 0.sp,
lineHeight = 52.sp,
fontSize = 45.sp
),
displaySmall = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.W400,
letterSpacing = 0.sp,
lineHeight = 44.sp,
fontSize = 36.sp
),
titleLarge = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.W400,
letterSpacing = 0.sp,
lineHeight = 28.sp,
fontSize = 22.sp
),
titleMedium = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.Medium,
letterSpacing = 0.15000000596046448.sp,
lineHeight = 24.sp,
fontSize = 16.sp
),
titleSmall = TextStyle(
fontFamily = Roboto,
fontWeight = FontWeight.Medium,
letterSpacing = 0.10000000149011612.sp,
lineHeight = 20.sp,
fontSize = 14.sp
),
)
val Samim = FontFamily(Font(R.font.samimbold))
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/36.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OLED Theme Fixed!

0 comments on commit fdd6924

Please sign in to comment.