Skip to content

Commit

Permalink
Added support for accessing resources in commonMain (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushant-Hande authored May 13, 2024
1 parent 422597f commit 5d7007f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id("com.android.application").version("7.4.0").apply(false)
id("com.android.library").version("7.4.0").apply(false)
id("org.jetbrains.compose").version("1.5.12") apply false
id("org.jetbrains.compose").version("1.6.2") apply false
kotlin("android").version("1.8.0").apply(false)
kotlin("multiplatform").version("1.9.22").apply(false)
kotlin("jvm") apply false
Expand Down
1 change: 1 addition & 0 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ kotlin {
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.runtime)
implementation(compose.components.resources)

implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-json:$ktorVersion")
Expand Down
3 changes: 3 additions & 0 deletions shared/src/commonMain/composeResources/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="featured_playlist">Featured Playlist</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ import musicapp.network.models.featuredplaylist.FeaturedPlayList
import musicapp.network.models.newreleases.NewReleasedAlbums
import musicapp.network.models.topfiftycharts.TopFiftyCharts
import com.seiko.imageloader.rememberAsyncImagePainter
import musicapp_kmp.shared.generated.resources.Res
import musicapp_kmp.shared.generated.resources.featured_playlist
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource


/**
Expand Down Expand Up @@ -150,14 +154,15 @@ internal fun TopChartView(topFiftyCharts: TopFiftyCharts, navigateToDetails: (St
}
}

@OptIn(ExperimentalResourceApi::class)
@Composable
internal fun FeaturedPlayLists(
featuredPlayList: FeaturedPlayList,
navigateToDetails: (String) -> Unit
) {
Column(modifier = Modifier.padding(top = 46.dp)) {
Text(
"Featured Playlist",
stringResource(Res.string.featured_playlist),
style = MaterialTheme.typography.h6.copy(
fontWeight = FontWeight.Bold,
color = Color(0xFFEFEEE0)
Expand Down

0 comments on commit 5d7007f

Please sign in to comment.