diff --git a/appDesktop/build.gradle.kts b/appDesktop/build.gradle.kts
index 141a295e..d52ca3c1 100644
--- a/appDesktop/build.gradle.kts
+++ b/appDesktop/build.gradle.kts
@@ -1,3 +1,5 @@
+import org.jetbrains.compose.desktop.application.dsl.TargetFormat
+
plugins {
alias(libs.plugins.jvm)
alias(libs.plugins.compose)
@@ -12,6 +14,11 @@ dependencies {
compose.desktop {
application {
- mainClass = "NotflixApplicationKt"
+ mainClass = "com.vickbt.notflix.MainKt"
+ nativeDistributions {
+ targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
+ packageName = "Notflix"
+ packageVersion = "1.0.0"
+ }
}
}
diff --git a/appDesktop/src/main/kotlin/com/vickbt/notflix/NotflixApplication.kt b/appDesktop/src/main/kotlin/com/vickbt/notflix/Main.kt
similarity index 81%
rename from appDesktop/src/main/kotlin/com/vickbt/notflix/NotflixApplication.kt
rename to appDesktop/src/main/kotlin/com/vickbt/notflix/Main.kt
index 4a2cbc37..b49fe9c9 100644
--- a/appDesktop/src/main/kotlin/com/vickbt/notflix/NotflixApplication.kt
+++ b/appDesktop/src/main/kotlin/com/vickbt/notflix/Main.kt
@@ -11,6 +11,7 @@ fun main() {
koin = initKoin(enableNetworkLogs = true).koin
return application {
+ Thread.currentThread().contextClassLoader = this.javaClass.classLoader
MainWindow(applicationScope = this)
}
}
diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts
index 0e1c7aaa..caed5421 100644
--- a/shared/build.gradle.kts
+++ b/shared/build.gradle.kts
@@ -32,11 +32,10 @@ kotlin {
jvm("desktop")
sourceSets {
- sourceSets["commonMain"].dependencies {
+ commonMain.dependencies {
api(compose.runtime)
api(compose.foundation)
api(compose.material3)
- @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
api(compose.components.resources)
api(compose.materialIconsExtended)
@@ -65,28 +64,23 @@ kotlin {
// implementation(libs.material.windowSizeClass)
}
- /*sourceSets["commonTest"].dependencies {
+ commonTest.dependencies {
implementation(kotlin("test"))
implementation(libs.turbine)
implementation(libs.ktor.mock)
implementation(libs.kotlinX.coroutines.test)
- implementation(libs.multiplatformSettings.test)
- }*/
+ }
- sourceSets["androidMain"].dependencies {
+ androidMain.dependencies {
implementation(libs.ktor.android)
implementation(libs.sqlDelight.android)
}
- // sourceSets["androidUnitTest"].dependencies {}
-
- sourceSets["iosMain"].dependencies {
+ iosMain.dependencies {
implementation(libs.ktor.darwin)
implementation(libs.sqlDelight.native)
}
- sourceSets["iosTest"].dependencies {}
-
sourceSets["desktopMain"].dependencies {
implementation(libs.ktor.java)
implementation(libs.sqlDelight.jvm)
@@ -134,3 +128,9 @@ sqldelight {
}
}
}
+
+compose.resources {
+ publicResClass = true
+ packageOfResClass = "com.vickbt.shared.resources"
+ generateResClass = always
+}
diff --git a/shared/src/commonMain/composeResources/font/nunito.ttf b/shared/src/commonMain/composeResources/font/nunito.ttf
new file mode 100644
index 00000000..0a00f63f
Binary files /dev/null and b/shared/src/commonMain/composeResources/font/nunito.ttf differ
diff --git a/shared/src/commonMain/composeResources/values/strings.xml b/shared/src/commonMain/composeResources/values/strings.xml
new file mode 100644
index 00000000..7ce7b86e
--- /dev/null
+++ b/shared/src/commonMain/composeResources/values/strings.xml
@@ -0,0 +1,64 @@
+
+
+ Home
+ Search
+ Favorites
+ Settings
+ Details
+
+ Trending Movies
+ Popular Movies
+ Upcoming Movies
+ View All
+
+ Share
+
+
+ Personalisation
+ Extras
+
+
+ Change theme
+ Change language
+ Change image quality
+ Report Bug
+ Report bug or request feature
+ Source Code
+ View app source code
+
+ Light theme
+ Dark theme
+ System default
+
+ Popularity
+ Overview
+ Cast
+ Trailer
+ Similar Movies
+
+ Default
+ No Russian
+
+ Cancel
+ Movie poster
+ Unknown movie
+ Rating
+ Unknown Actor
+ Unknown character
+ Back
+ Close Search
+
+
+ - Light theme
+ - Dark theme
+ - System default
+
+
+
+ - High Quality
+ - Low Quality
+
+
+
+
+
\ No newline at end of file
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/BottomNavBar.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/BottomNavBar.kt
index b878cb36..68ef0ebe 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/BottomNavBar.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/BottomNavBar.kt
@@ -13,6 +13,7 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.currentBackStackEntryAsState
import com.vickbt.shared.ui.navigation.NavigationItem
import com.vickbt.shared.ui.theme.Gray
+import org.jetbrains.compose.resources.stringResource
@Composable
fun BottomNavBar(
@@ -32,12 +33,19 @@ fun BottomNavBar(
NavigationBarItem(
icon = {
- Icon(
- imageVector = item.icon!!,
- contentDescription = item.title
+ item.icon?.let {
+ Icon(
+ imageVector = item.icon,
+ contentDescription = stringResource(item.title)
+ )
+ }
+ },
+ label = {
+ Text(
+ text = stringResource(item.title),
+ style = MaterialTheme.typography.labelSmall
)
},
- label = { Text(text = item.title) },
alwaysShowLabel = true,
colors = NavigationBarItemDefaults.colors(
selectedIconColor = MaterialTheme.colorScheme.primary,
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/ExpandedText.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/ExpandedText.kt
index 49f92928..e4c279dc 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/ExpandedText.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/ExpandedText.kt
@@ -32,7 +32,7 @@ fun ExpandableText(
modifier: Modifier = Modifier,
minimizedMaxLines: Int = 1,
fontSize: TextUnit = 14.sp,
- style: TextStyle = MaterialTheme.typography.bodySmall,
+ style: TextStyle = MaterialTheme.typography.bodyMedium,
textAlign: TextAlign = TextAlign.Start,
color: Color = Color.LightGray.copy(alpha = .85f),
) {
@@ -42,7 +42,6 @@ fun ExpandableText(
val seeMoreSizeState = remember { mutableStateOf(null) }
val seeMoreOffsetState = remember { mutableStateOf(null) }
- // getting raw values for smart cast
val textLayoutResult = textLayoutResultState.value
val seeMoreSize = seeMoreSizeState.value
val seeMoreOffset = seeMoreOffsetState.value
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieCardLandscape.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieCardLandscape.kt
index 74ef4ad4..72fd30e5 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieCardLandscape.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieCardLandscape.kt
@@ -15,7 +15,7 @@ import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
-import androidx.compose.material3.Divider
+import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -123,12 +123,12 @@ fun MovieCardLandscape(
)
movie.releaseDate?.let {
- Divider(
+ HorizontalDivider(
modifier = Modifier
.padding(horizontal = 4.dp)
.width(1.dp)
.height(13.dp),
- color = dominantSubTextColor,
+ color = dominantSubTextColor
)
Text(
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieCardPortraitCompact.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieCardPortraitCompact.kt
index 59b53ba0..4d6b0e6e 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieCardPortraitCompact.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieCardPortraitCompact.kt
@@ -58,7 +58,7 @@ fun MovieCardPortraitCompact(
Text(
modifier = Modifier.width(145.dp),
text = movie.title ?: "Unknown movie",
- style = MaterialTheme.typography.labelMedium,
+ style = MaterialTheme.typography.bodyLarge,
color = MaterialTheme.colorScheme.onSurface,
fontSize = 14.sp,
maxLines = 1,
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieRatingSection.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieRatingSection.kt
index 632045ff..65fdcdbe 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieRatingSection.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/MovieRatingSection.kt
@@ -10,16 +10,20 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Star
-import androidx.compose.material3.Divider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
+import androidx.compose.material3.VerticalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
+import com.vickbt.shared.resources.Res
+import com.vickbt.shared.resources.popularity
+import com.vickbt.shared.resources.rating
import com.vickbt.shared.ui.theme.Golden
+import org.jetbrains.compose.resources.stringResource
@Composable
fun MovieRatingSection(popularity: String?, voteAverage: String?) {
@@ -39,13 +43,13 @@ fun MovieRatingSection(popularity: String?, voteAverage: String?) {
Text(
modifier = Modifier,
text = if (popularity.isNullOrEmpty()) "N/A" else popularity,
- style = MaterialTheme.typography.titleMedium,
+ style = MaterialTheme.typography.titleLarge,
fontSize = 42.sp,
color = MaterialTheme.colorScheme.onSurface,
)
Text(
- text = "Popularity",
+ text = stringResource(Res.string.popularity),
style = MaterialTheme.typography.titleMedium,
fontSize = 18.sp,
color = MaterialTheme.colorScheme.onSurface,
@@ -53,7 +57,7 @@ fun MovieRatingSection(popularity: String?, voteAverage: String?) {
}
//endregion
- Divider(
+ VerticalDivider(
modifier = Modifier
.fillMaxHeight()
.width(2.dp),
@@ -70,7 +74,7 @@ fun MovieRatingSection(popularity: String?, voteAverage: String?) {
modifier = Modifier.size(48.dp),
imageVector = Icons.Rounded.Star,
tint = Golden,
- contentDescription = "Rating"
+ contentDescription = stringResource(Res.string.rating)
)
Text(
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/NavRailBar.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/NavRailBar.kt
index 88569096..07260167 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/NavRailBar.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/NavRailBar.kt
@@ -15,6 +15,7 @@ import androidx.navigation.compose.currentBackStackEntryAsState
import com.vickbt.shared.ui.navigation.NavigationItem
import com.vickbt.shared.ui.theme.Gray
import com.vickbt.shared.ui.theme.PrimaryColor
+import org.jetbrains.compose.resources.stringResource
@Composable
fun NavRailBar(
@@ -25,13 +26,6 @@ fun NavRailBar(
NavigationRail(
modifier = modifier.fillMaxHeight().alpha(0.95F),
containerColor = MaterialTheme.colorScheme.surface,
- header = {
- /*Icon(
- modifier = Modifier.size(42.dp),
- painter = painterResource("n_logo.png"),
- contentDescription = "Logo"
- )*/
- },
contentColor = PrimaryColor
) {
navigationItems.forEach { item ->
@@ -45,11 +39,16 @@ fun NavRailBar(
item.icon?.let {
Icon(
imageVector = it,
- contentDescription = item.title
+ contentDescription = stringResource(item.title)
)
}
},
- label = { Text(text = item.title) },
+ label = {
+ Text(
+ text = stringResource(item.title),
+ style = MaterialTheme.typography.labelSmall
+ )
+ },
colors = NavigationRailItemDefaults.colors(
selectedIconColor = PrimaryColor,
unselectedIconColor = Gray
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/SectionSeparator.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/SectionSeparator.kt
index e0db7794..e9fea660 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/SectionSeparator.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/SectionSeparator.kt
@@ -2,13 +2,14 @@ package com.vickbt.shared.ui.components
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.sp
+import androidx.compose.ui.unit.dp
@Composable
fun SectionSeparator(
@@ -16,7 +17,7 @@ fun SectionSeparator(
sectionTitle: String
) {
Row(
- modifier = modifier,
+ modifier = modifier.padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 8.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
) {
@@ -24,8 +25,7 @@ fun SectionSeparator(
modifier = Modifier,
text = sectionTitle,
color = MaterialTheme.colorScheme.onSurface,
- style = MaterialTheme.typography.titleMedium,
- fontSize = 20.sp,
+ style = MaterialTheme.typography.titleLarge,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/appbars/DetailsAppBar.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/appbars/DetailsAppBar.kt
index 623e7ef0..759875ed 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/appbars/DetailsAppBar.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/appbars/DetailsAppBar.kt
@@ -12,7 +12,7 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.rounded.ArrowBack
+import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.rounded.Favorite
import androidx.compose.material.icons.rounded.FavoriteBorder
import androidx.compose.material.icons.rounded.Share
@@ -124,7 +124,7 @@ fun DetailsAppBar(
modifier = Modifier,
text = movieDetails?.runtime?.getMovieDuration() ?: "",
color = dominantTextColor,
- style = MaterialTheme.typography.labelMedium,
+ style = MaterialTheme.typography.bodyMedium,
fontSize = 14.sp
)
}
@@ -147,7 +147,7 @@ fun DetailsAppBar(
navigationIcon = {
IconButton(onClick = { onNavigationIconClick() }) {
Icon(
- imageVector = Icons.Rounded.ArrowBack,
+ imageVector = Icons.AutoMirrored.Rounded.ArrowBack,
contentDescription = "Back",
tint = MaterialTheme.colorScheme.onSurface
)
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/DialogPreferenceSelection.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/DialogPreferenceSelection.kt
index f8c07d79..97c7b945 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/DialogPreferenceSelection.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/DialogPreferenceSelection.kt
@@ -42,7 +42,7 @@ fun DialogPreferenceSelection(
Text(
modifier = Modifier.fillMaxWidth(),
text = title,
- style = MaterialTheme.typography.labelMedium,
+ style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onSurface,
fontSize = 22.sp,
maxLines = 1,
@@ -74,7 +74,7 @@ fun DialogPreferenceSelection(
Text(
modifier = Modifier.clickable { onNegativeClick() },
text = "Cancel".toUpperCase(Locale.current),
- style = MaterialTheme.typography.labelMedium,
+ style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.primary,
fontSize = 16.sp,
maxLines = 1,
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/PreferencesGroup.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/PreferencesGroup.kt
index d8b59616..ec278e7f 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/PreferencesGroup.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/PreferencesGroup.kt
@@ -43,7 +43,7 @@ fun PreferencesGroup(
.weight(8f)
.padding(horizontal = 12.dp),
text = title,
- style = MaterialTheme.typography.labelMedium,
+ style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.primary,
fontSize = 16.sp,
maxLines = 1,
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/TextPreference.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/TextPreference.kt
index 3c94cbd5..67351efc 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/TextPreference.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/components/preferences/TextPreference.kt
@@ -56,7 +56,7 @@ fun TextPreference(
.fillMaxWidth()
.padding(horizontal = 12.dp),
text = title,
- style = MaterialTheme.typography.labelMedium,
+ style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onSurface,
fontSize = 17.sp,
maxLines = 1,
@@ -70,7 +70,7 @@ fun TextPreference(
.fillMaxWidth()
.padding(horizontal = 13.dp),
text = subTitle,
- style = MaterialTheme.typography.labelSmall,
+ style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f),
fontSize = 14.sp,
maxLines = 1,
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/navigation/NavigationItem.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/navigation/NavigationItem.kt
index 9f136136..6a1e6ba1 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/navigation/NavigationItem.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/navigation/NavigationItem.kt
@@ -3,17 +3,30 @@ package com.vickbt.shared.ui.navigation
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Favorite
import androidx.compose.material.icons.rounded.Home
+import androidx.compose.material.icons.rounded.Search
import androidx.compose.material.icons.rounded.Settings
import androidx.compose.ui.graphics.vector.ImageVector
+import com.vickbt.shared.resources.Res
+import com.vickbt.shared.resources.title_favorites
+import com.vickbt.shared.resources.title_home
+import com.vickbt.shared.resources.title_search
+import com.vickbt.shared.resources.title_settings
+import com.vickbt.shared.resources.title_details
+import org.jetbrains.compose.resources.StringResource
sealed class NavigationItem(
val route: String,
- val title: String,
+ val title: StringResource,
val icon: ImageVector?
) {
- object Home : NavigationItem("/home", "Home", Icons.Rounded.Home)
- object Favorites : NavigationItem("/favorites", "Favorites", Icons.Rounded.Favorite)
- object Settings : NavigationItem("/settings", "Settings", Icons.Rounded.Settings)
- object Details : NavigationItem("/details/{movieId}", "Details", null)
+ object Home : NavigationItem("/home", Res.string.title_home, Icons.Rounded.Home)
+ object Favorites :
+ NavigationItem("/favorites", Res.string.title_favorites, Icons.Rounded.Favorite)
+
+ object Search :
+ NavigationItem("/search", Res.string.title_search, Icons.Rounded.Search)
+
+ object Settings : NavigationItem("/settings", Res.string.title_settings, Icons.Rounded.Settings)
+ object Details : NavigationItem("/details/{movieId}", Res.string.title_details, null)
}
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/details/DetailsScreen.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/details/DetailsScreen.kt
index 9fcdcd98..a62aba0e 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/details/DetailsScreen.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/details/DetailsScreen.kt
@@ -1,3 +1,5 @@
+@file:OptIn(KoinExperimentalAPI::class)
+
package com.vickbt.shared.ui.screens.details
import androidx.compose.foundation.layout.Arrangement
@@ -34,8 +36,13 @@ import com.vickbt.shared.ui.components.collapsingToolbar.rememberCollapsingToolb
import com.vickbt.shared.utils.WindowSize
import com.vickbt.shared.utils.getPopularity
import com.vickbt.shared.utils.getRating
-import io.github.aakira.napier.Napier
+import com.vickbt.shared.resources.Res
+import com.vickbt.shared.resources.cast
+import com.vickbt.shared.resources.overview
+import com.vickbt.shared.resources.similar_movies
+import org.jetbrains.compose.resources.stringResource
import org.koin.compose.viewmodel.koinViewModel
+import org.koin.core.annotation.KoinExperimentalAPI
@Composable
fun DetailsScreen(
@@ -53,8 +60,6 @@ fun DetailsScreen(
val movieDetailsState = viewModel.movieDetailsState.collectAsState().value
- Napier.e("is favorite: ${movieDetailsState.isFavorite}")
-
val scrollState = rememberScrollState()
val collapsingScrollState = rememberCollapsingToolbarScaffoldState()
@@ -106,7 +111,7 @@ fun DetailsScreen(
if (!movieDetailsState.movieDetails?.overview.isNullOrEmpty()) {
Text(
modifier = Modifier.padding(horizontal = 16.dp),
- text = "Overview",
+ text = stringResource(Res.string.overview),
style = MaterialTheme.typography.titleMedium,
fontSize = 20.sp,
color = MaterialTheme.colorScheme.onSurface,
@@ -130,7 +135,7 @@ fun DetailsScreen(
if (!movieDetailsState.movieCast.isNullOrEmpty()) {
Text(
modifier = Modifier.padding(horizontal = 16.dp),
- text = "Cast",
+ text = stringResource(Res.string.cast),
style = MaterialTheme.typography.titleMedium,
fontSize = 20.sp
)
@@ -150,7 +155,7 @@ fun DetailsScreen(
if (!movieDetailsState.similarMovies.isNullOrEmpty()) {
Text(
modifier = Modifier.padding(horizontal = 16.dp),
- text = "Similar Movies",
+ text = stringResource(Res.string.similar_movies),
style = MaterialTheme.typography.titleMedium,
fontSize = 20.sp,
color = MaterialTheme.colorScheme.onSurface
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/favorites/FavoritesScreen.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/favorites/FavoritesScreen.kt
index b67a72e6..c9de219c 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/favorites/FavoritesScreen.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/favorites/FavoritesScreen.kt
@@ -1,3 +1,5 @@
+@file:OptIn(KoinExperimentalAPI::class)
+
package com.vickbt.shared.ui.screens.favorites
import androidx.compose.foundation.layout.Box
@@ -15,7 +17,11 @@ import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import com.vickbt.shared.ui.components.MovieCardDescription
import com.vickbt.shared.ui.components.appbars.AppBar
+import com.vickbt.shared.resources.Res
+import com.vickbt.shared.resources.title_favorites
+import org.jetbrains.compose.resources.stringResource
import org.koin.compose.viewmodel.koinViewModel
+import org.koin.core.annotation.KoinExperimentalAPI
@Composable
fun FavoritesScreen(
@@ -25,7 +31,7 @@ fun FavoritesScreen(
val favoriteMovies = viewModel.favoriteMoviesState.collectAsState().value
Scaffold(
- topBar = { AppBar("Favorites") }
+ topBar = { AppBar(stringResource(Res.string.title_favorites)) }
) { paddingValues ->
Box(modifier = Modifier.fillMaxSize().padding(paddingValues)) {
LazyColumn(
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/home/HomeScreen.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/home/HomeScreen.kt
index 6d2a7446..cbc68b23 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/home/HomeScreen.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/home/HomeScreen.kt
@@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
-import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
@@ -20,6 +19,7 @@ import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.rounded.ArrowBack
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material.icons.rounded.Search
@@ -53,6 +53,14 @@ import com.vickbt.shared.ui.components.SectionSeparator
import com.vickbt.shared.ui.screens.search.SearchScreen
import com.vickbt.shared.ui.theme.DarkPrimaryColor
import com.vickbt.shared.utils.WindowSize
+import com.vickbt.shared.resources.Res
+import com.vickbt.shared.resources.back
+import com.vickbt.shared.resources.close_search
+import com.vickbt.shared.resources.popular_movies
+import com.vickbt.shared.resources.title_search
+import com.vickbt.shared.resources.trending_movies
+import com.vickbt.shared.resources.upcoming_movies
+import org.jetbrains.compose.resources.stringResource
import org.koin.compose.viewmodel.koinViewModel
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class)
@@ -93,9 +101,9 @@ fun HomeScreen(
onActiveChange = { activeState = it },
placeholder = {
Text(
- text = "Search Movie",
+ text = stringResource(Res.string.title_search),
fontSize = 18.sp,
- style = MaterialTheme.typography.labelMedium,
+ style = MaterialTheme.typography.titleMedium,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
textAlign = TextAlign.Start
@@ -108,8 +116,8 @@ fun HomeScreen(
searchQuery = ""
}) {
Icon(
- imageVector = Icons.Rounded.ArrowBack,
- contentDescription = "Go back"
+ imageVector = Icons.AutoMirrored.Rounded.ArrowBack,
+ contentDescription = stringResource(Res.string.back)
)
}
} else {
@@ -123,7 +131,7 @@ fun HomeScreen(
}) {
Icon(
imageVector = Icons.Rounded.Close,
- contentDescription = "Close search"
+ contentDescription = stringResource(Res.string.close_search)
)
}
} else {
@@ -198,14 +206,11 @@ fun HomeScreen(
homeUiState.trendingMovies?.let {
SectionSeparator(
modifier = Modifier
- .padding(horizontal = 16.dp, vertical = 6.dp)
.fillMaxWidth()
.wrapContentHeight(),
- sectionTitle = "Trending Movies"
+ sectionTitle = stringResource(Res.string.trending_movies)
)
- Spacer(modifier = Modifier.height(8.dp))
-
LazyRow(
modifier = Modifier
.fillMaxWidth()
@@ -229,14 +234,11 @@ fun HomeScreen(
homeUiState.upcomingMovies?.let {
SectionSeparator(
modifier = Modifier
- .padding(start = 16.dp, end = 16.dp, top = 12.dp)
.fillMaxWidth()
.wrapContentHeight(),
- sectionTitle = "Upcoming Movies"
+ sectionTitle = stringResource(Res.string.upcoming_movies)
)
- Spacer(modifier = Modifier.height(8.dp))
-
LazyRow(
contentPadding = PaddingValues(horizontal = 16.dp),
horizontalArrangement = Arrangement.spacedBy(14.dp),
@@ -262,14 +264,11 @@ fun HomeScreen(
Column(modifier = Modifier.padding(bottom = 90.dp)) {
SectionSeparator(
modifier = Modifier
- .padding(start = 16.dp, end = 16.dp, top = 12.dp)
.fillMaxWidth()
.wrapContentHeight(),
- sectionTitle = "Popular Movies"
+ sectionTitle = stringResource(Res.string.popular_movies)
)
- Spacer(modifier = Modifier.height(8.dp))
-
LazyRow(
modifier = Modifier.wrapContentHeight(),
contentPadding = PaddingValues(horizontal = 16.dp),
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/settings/SettingsScreen.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/settings/SettingsScreen.kt
index 9e272f78..0abdb63b 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/settings/SettingsScreen.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/screens/settings/SettingsScreen.kt
@@ -1,3 +1,5 @@
+@file:OptIn(KoinExperimentalAPI::class)
+
package com.vickbt.shared.ui.screens.settings
import androidx.compose.foundation.layout.Column
@@ -18,15 +20,26 @@ import com.vickbt.shared.ui.components.appbars.AppBar
import com.vickbt.shared.ui.components.preferences.DialogPreferenceSelection
import com.vickbt.shared.ui.components.preferences.PreferencesGroup
import com.vickbt.shared.ui.components.preferences.TextPreference
+import com.vickbt.shared.resources.Res
+import com.vickbt.shared.resources.change_image_quality
+import com.vickbt.shared.resources.change_theme
+import com.vickbt.shared.resources.def
+import com.vickbt.shared.resources.image_qualities
+import com.vickbt.shared.resources.themes
+import com.vickbt.shared.resources.title_personalisation
+import com.vickbt.shared.resources.title_settings
+import org.jetbrains.compose.resources.stringArrayResource
+import org.jetbrains.compose.resources.stringResource
import org.koin.compose.viewmodel.koinViewModel
-
-private val themeLabels = listOf("Light", "Dark", "System Default")
-private val imageQualityLabels = listOf("High Quality", "Low Quality")
+import org.koin.core.annotation.KoinExperimentalAPI
@Composable
fun SettingsScreen(viewModel: SettingsViewModel = koinViewModel()) {
val settingsUiState = viewModel.settingsUiState.collectAsState().value
+ val themeLabels = stringArrayResource(Res.array.themes)
+ val imageQualityLabels = stringArrayResource(Res.array.image_qualities)
+
val showThemeDialog = remember { mutableStateOf(false) }
val showImageQualityDialog = remember { mutableStateOf(false) }
@@ -34,13 +47,13 @@ fun SettingsScreen(viewModel: SettingsViewModel = koinViewModel
Column(modifier = Modifier.padding(paddingValues)) {
- PreferencesGroup(title = "Personalisation") {
+ PreferencesGroup(title = stringResource(Res.string.title_personalisation)) {
TextPreference(
icon = Icons.Rounded.Lightbulb,
- title = "Change theme",
+ title = stringResource(Res.string.change_theme),
subTitle = themeLabel,
onClick = { showThemeDialog.value = !showThemeDialog.value }
)
@@ -55,7 +68,7 @@ fun SettingsScreen(viewModel: SettingsViewModel = koinViewModel
viewModel.savePreferenceSelection(key = KEY_THEME, selection = theme)
@@ -97,9 +110,9 @@ private fun ChangeImageQuality(
) {
DialogPreferenceSelection(
showDialog = showDialog.value,
- title = "Image quality",
- currentValue = currentValue ?: "Default",
- labels = imageQualityLabels,
+ title = stringResource(Res.string.change_image_quality),
+ currentValue = currentValue ?: stringResource(Res.string.def),
+ labels = stringArrayResource(Res.array.image_qualities),
onNegativeClick = { showDialog.value = false }
) { imageQuality ->
viewModel.savePreferenceSelection(
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/theme/Theme.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/theme/Theme.kt
index ac1a0728..70548c54 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/theme/Theme.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/theme/Theme.kt
@@ -1,3 +1,5 @@
+@file:OptIn(ExperimentalCoilApi::class)
+
package com.vickbt.shared.ui.theme
import androidx.compose.foundation.isSystemInDarkTheme
@@ -5,6 +7,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
+import coil3.annotation.ExperimentalCoilApi
import coil3.compose.setSingletonImageLoaderFactory
import com.vickbt.shared.utils.getAsyncImageLoader
@@ -37,7 +40,7 @@ fun NotflixTheme(
MaterialTheme(
colorScheme = colorScheme,
- // typography = Typography,
+ typography = Typography(),
shapes = Shapes
) {
content()
diff --git a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/theme/Type.kt b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/theme/Type.kt
index ef4e07dc..47802282 100644
--- a/shared/src/commonMain/kotlin/com/vickbt/shared/ui/theme/Type.kt
+++ b/shared/src/commonMain/kotlin/com/vickbt/shared/ui/theme/Type.kt
@@ -1 +1,55 @@
-package com.vickbt.shared.presentation.ui.theme
+package com.vickbt.shared.ui.theme
+
+import androidx.compose.material3.Typography
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.FontFamily
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.sp
+import com.vickbt.shared.resources.Res
+import com.vickbt.shared.resources.nunito
+import org.jetbrains.compose.resources.Font
+
+@Composable
+internal fun Typography(): Typography {
+ val Nunito = FontFamily(Font(Res.font.nunito))
+
+ return Typography(
+ titleLarge = TextStyle(
+ fontFamily = Nunito,
+ fontWeight = FontWeight.Bold,
+ fontSize = 24.sp,
+ lineHeight = 28.sp,
+ letterSpacing = 0.sp,
+ ),
+
+ titleMedium = TextStyle(
+ fontFamily = Nunito,
+ fontWeight = FontWeight.SemiBold,
+ fontSize = 16.sp,
+ lineHeight = 24.sp,
+ letterSpacing = 0.15.sp,
+ ),
+
+ bodyLarge = TextStyle(
+ fontFamily = Nunito,
+ fontWeight = FontWeight.Bold,
+ fontSize = 16.sp,
+ lineHeight = 24.sp,
+ letterSpacing = 0.15.sp,
+ ),
+
+ bodyMedium = TextStyle(
+ fontFamily = Nunito,
+ fontWeight = FontWeight.Medium,
+ fontSize = 16.sp,
+ lineHeight = 28.sp,
+ letterSpacing = 0.15.sp,
+ ),
+
+ labelSmall = TextStyle(
+ fontFamily = Nunito,
+ fontWeight = FontWeight.SemiBold
+ )
+ )
+}