Skip to content

Commit bb567f5

Browse files
committed
Apply spotless for Jetcaster
1 parent d0581e2 commit bb567f5

File tree

132 files changed

+1336
-1651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1336
-1651
lines changed

Jetcaster/core/data-testing/build.gradle.kts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
118
plugins {
219
alias(libs.plugins.android.library)
320
alias(libs.plugins.kotlin.android)
421
}
522

623
android {
724
namespace = "com.example.jetcaster.core.data.testing"
8-
compileSdk = libs.versions.compileSdk.get().toInt()
25+
compileSdk =
26+
libs.versions.compileSdk
27+
.get()
28+
.toInt()
929

1030
defaultConfig {
11-
minSdk = libs.versions.minSdk.get().toInt()
31+
minSdk =
32+
libs.versions.minSdk
33+
.get()
34+
.toInt()
1235

1336
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1437
consumerProguardFiles("consumer-rules.pro")
@@ -19,7 +42,7 @@ android {
1942
isMinifyEnabled = false
2043
proguardFiles(
2144
getDefaultProguardFile("proguard-android-optimize.txt"),
22-
"proguard-rules.pro"
45+
"proguard-rules.pro",
2346
)
2447
}
2548
}

Jetcaster/core/data-testing/src/main/java/com/example/jetcaster/core/data/testing/repository/TestCategoryStore.kt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,14 @@ class TestCategoryStore : CategoryStore {
3939
private val episodesFromPodcasts =
4040
MutableStateFlow<Map<Long, List<EpisodeToPodcast>>>(emptyMap())
4141

42-
override fun categoriesSortedByPodcastCount(limit: Int): Flow<List<Category>> =
43-
categoryFlow
42+
override fun categoriesSortedByPodcastCount(limit: Int): Flow<List<Category>> = categoryFlow
4443

45-
override fun podcastsInCategorySortedByPodcastCount(
46-
categoryId: Long,
47-
limit: Int
48-
): Flow<List<PodcastWithExtraInfo>> = podcastsInCategoryFlow.map {
49-
it[categoryId]?.take(limit) ?: emptyList()
50-
}
44+
override fun podcastsInCategorySortedByPodcastCount(categoryId: Long, limit: Int): Flow<List<PodcastWithExtraInfo>> =
45+
podcastsInCategoryFlow.map {
46+
it[categoryId]?.take(limit) ?: emptyList()
47+
}
5148

52-
override fun episodesFromPodcastsInCategory(
53-
categoryId: Long,
54-
limit: Int
55-
): Flow<List<EpisodeToPodcast>> = episodesFromPodcasts.map {
49+
override fun episodesFromPodcastsInCategory(categoryId: Long, limit: Int): Flow<List<EpisodeToPodcast>> = episodesFromPodcasts.map {
5650
it[categoryId]?.take(limit) ?: emptyList()
5751
}
5852

Jetcaster/core/data-testing/src/main/java/com/example/jetcaster/core/data/testing/repository/TestEpisodeStore.kt

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -29,57 +29,47 @@ import kotlinx.coroutines.flow.update
2929
class TestEpisodeStore : EpisodeStore {
3030

3131
private val episodesFlow = MutableStateFlow<List<Episode>>(listOf())
32-
override fun episodeWithUri(episodeUri: String): Flow<Episode> =
33-
episodesFlow.map { episodes ->
34-
episodes.first { it.uri == episodeUri }
32+
override fun episodeWithUri(episodeUri: String): Flow<Episode> = episodesFlow.map { episodes ->
33+
episodes.first { it.uri == episodeUri }
34+
}
35+
36+
override fun episodeAndPodcastWithUri(episodeUri: String): Flow<EpisodeToPodcast> = episodesFlow.map { episodes ->
37+
val e = episodes.first {
38+
it.uri == episodeUri
39+
}
40+
EpisodeToPodcast().apply {
41+
episode = e
42+
_podcasts = emptyList()
3543
}
44+
}
3645

37-
override fun episodeAndPodcastWithUri(episodeUri: String): Flow<EpisodeToPodcast> =
38-
episodesFlow.map { episodes ->
39-
val e = episodes.first {
40-
it.uri == episodeUri
41-
}
46+
override fun episodesInPodcast(podcastUri: String, limit: Int): Flow<List<EpisodeToPodcast>> = episodesFlow.map { episodes ->
47+
episodes.filter {
48+
it.podcastUri == podcastUri
49+
}.map { e ->
4250
EpisodeToPodcast().apply {
4351
episode = e
44-
_podcasts = emptyList()
4552
}
4653
}
54+
}
4755

48-
override fun episodesInPodcast(podcastUri: String, limit: Int): Flow<List<EpisodeToPodcast>> =
49-
episodesFlow.map { episodes ->
50-
episodes.filter {
51-
it.podcastUri == podcastUri
52-
}.map { e ->
53-
EpisodeToPodcast().apply {
54-
episode = e
55-
}
56-
}
57-
}
58-
59-
override fun episodesInPodcasts(
60-
podcastUris: List<String>,
61-
limit: Int
62-
): Flow<List<EpisodeToPodcast>> =
63-
episodesFlow.map { episodes ->
64-
episodes.filter {
65-
podcastUris.contains(it.podcastUri)
66-
}.map { ep ->
67-
EpisodeToPodcast().apply {
68-
episode = ep
69-
}
56+
override fun episodesInPodcasts(podcastUris: List<String>, limit: Int): Flow<List<EpisodeToPodcast>> = episodesFlow.map { episodes ->
57+
episodes.filter {
58+
podcastUris.contains(it.podcastUri)
59+
}.map { ep ->
60+
EpisodeToPodcast().apply {
61+
episode = ep
7062
}
7163
}
64+
}
7265

73-
override suspend fun addEpisodes(episodes: Collection<Episode>) =
74-
episodesFlow.update {
75-
it + episodes
76-
}
66+
override suspend fun addEpisodes(episodes: Collection<Episode>) = episodesFlow.update {
67+
it + episodes
68+
}
7769

78-
override suspend fun deleteEpisode(episode: Episode) =
79-
episodesFlow.update {
80-
it - episode
81-
}
70+
override suspend fun deleteEpisode(episode: Episode) = episodesFlow.update {
71+
it - episode
72+
}
8273

83-
override suspend fun isEmpty(): Boolean =
84-
episodesFlow.first().isEmpty()
74+
override suspend fun isEmpty(): Boolean = episodesFlow.first().isEmpty()
8575
}

Jetcaster/core/data-testing/src/main/java/com/example/jetcaster/core/data/testing/repository/TestPodcastStore.kt

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -31,71 +31,62 @@ class TestPodcastStore : PodcastStore {
3131

3232
private val podcastFlow = MutableStateFlow<List<Podcast>>(listOf())
3333
private val followedPodcasts = mutableSetOf<String>()
34-
override fun podcastWithUri(uri: String): Flow<Podcast> =
35-
podcastFlow.map { podcasts ->
36-
podcasts.first { it.uri == uri }
37-
}
34+
override fun podcastWithUri(uri: String): Flow<Podcast> = podcastFlow.map { podcasts ->
35+
podcasts.first { it.uri == uri }
36+
}
3837

39-
override fun podcastWithExtraInfo(podcastUri: String): Flow<PodcastWithExtraInfo> =
40-
podcastFlow.map { podcasts ->
41-
val podcast = podcasts.first { it.uri == podcastUri }
42-
PodcastWithExtraInfo().apply {
43-
this.podcast = podcast
44-
}
38+
override fun podcastWithExtraInfo(podcastUri: String): Flow<PodcastWithExtraInfo> = podcastFlow.map { podcasts ->
39+
val podcast = podcasts.first { it.uri == podcastUri }
40+
PodcastWithExtraInfo().apply {
41+
this.podcast = podcast
4542
}
43+
}
4644

47-
override fun podcastsSortedByLastEpisode(limit: Int): Flow<List<PodcastWithExtraInfo>> =
48-
podcastFlow.map { podcasts ->
49-
podcasts.map { p ->
50-
PodcastWithExtraInfo().apply {
51-
podcast = p
52-
isFollowed = followedPodcasts.contains(p.uri)
53-
}
45+
override fun podcastsSortedByLastEpisode(limit: Int): Flow<List<PodcastWithExtraInfo>> = podcastFlow.map { podcasts ->
46+
podcasts.map { p ->
47+
PodcastWithExtraInfo().apply {
48+
podcast = p
49+
isFollowed = followedPodcasts.contains(p.uri)
5450
}
5551
}
52+
}
5653

57-
override fun followedPodcastsSortedByLastEpisode(limit: Int): Flow<List<PodcastWithExtraInfo>> =
58-
podcastFlow.map { podcasts ->
59-
podcasts.filter {
60-
followedPodcasts.contains(it.uri)
61-
}.map { p ->
62-
PodcastWithExtraInfo().apply {
63-
podcast = p
64-
isFollowed = true
65-
}
54+
override fun followedPodcastsSortedByLastEpisode(limit: Int): Flow<List<PodcastWithExtraInfo>> = podcastFlow.map { podcasts ->
55+
podcasts.filter {
56+
followedPodcasts.contains(it.uri)
57+
}.map { p ->
58+
PodcastWithExtraInfo().apply {
59+
podcast = p
60+
isFollowed = true
6661
}
6762
}
63+
}
6864

69-
override fun searchPodcastByTitle(
70-
keyword: String,
71-
limit: Int
72-
): Flow<List<PodcastWithExtraInfo>> =
73-
podcastFlow.map { podcastList ->
74-
podcastList.filter {
75-
it.title.contains(keyword)
76-
}.map { p ->
77-
PodcastWithExtraInfo().apply {
78-
podcast = p
79-
isFollowed = true
80-
}
65+
override fun searchPodcastByTitle(keyword: String, limit: Int): Flow<List<PodcastWithExtraInfo>> = podcastFlow.map { podcastList ->
66+
podcastList.filter {
67+
it.title.contains(keyword)
68+
}.map { p ->
69+
PodcastWithExtraInfo().apply {
70+
podcast = p
71+
isFollowed = true
8172
}
8273
}
74+
}
8375

8476
override fun searchPodcastByTitleAndCategories(
8577
keyword: String,
8678
categories: List<Category>,
87-
limit: Int
88-
): Flow<List<PodcastWithExtraInfo>> =
89-
podcastFlow.map { podcastList ->
90-
podcastList.filter {
91-
it.title.contains(keyword)
92-
}.map { p ->
93-
PodcastWithExtraInfo().apply {
94-
podcast = p
95-
isFollowed = true
96-
}
79+
limit: Int,
80+
): Flow<List<PodcastWithExtraInfo>> = podcastFlow.map { podcastList ->
81+
podcastList.filter {
82+
it.title.contains(keyword)
83+
}.map { p ->
84+
PodcastWithExtraInfo().apply {
85+
podcast = p
86+
isFollowed = true
9787
}
9888
}
89+
}
9990

10091
override suspend fun togglePodcastFollowed(podcastUri: String) {
10192
if (podcastUri in followedPodcasts) {
@@ -113,9 +104,7 @@ class TestPodcastStore : PodcastStore {
113104
followedPodcasts.remove(podcastUri)
114105
}
115106

116-
override suspend fun addPodcast(podcast: Podcast) =
117-
podcastFlow.update { it + podcast }
107+
override suspend fun addPodcast(podcast: Podcast) = podcastFlow.update { it + podcast }
118108

119-
override suspend fun isEmpty(): Boolean =
120-
podcastFlow.first().isEmpty()
109+
override suspend fun isEmpty(): Boolean = podcastFlow.first().isEmpty()
121110
}

Jetcaster/core/data/build.gradle.kts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
118
plugins {
219
alias(libs.plugins.android.library)
320
alias(libs.plugins.kotlin.android)
@@ -7,10 +24,16 @@ plugins {
724

825
android {
926
namespace = "com.example.jetcaster.core.data"
10-
compileSdk = libs.versions.compileSdk.get().toInt()
27+
compileSdk =
28+
libs.versions.compileSdk
29+
.get()
30+
.toInt()
1131

1232
defaultConfig {
13-
minSdk = libs.versions.minSdk.get().toInt()
33+
minSdk =
34+
libs.versions.minSdk
35+
.get()
36+
.toInt()
1437

1538
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1639
consumerProguardFiles("consumer-rules.pro")

Jetcaster/core/data/src/main/java/com/example/jetcaster/core/data/database/JetcasterDatabase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ import com.example.jetcaster.core.data.database.model.PodcastFollowedEntry
4040
Episode::class,
4141
PodcastCategoryEntry::class,
4242
Category::class,
43-
PodcastFollowedEntry::class
43+
PodcastFollowedEntry::class,
4444
],
4545
version = 1,
46-
exportSchema = false
46+
exportSchema = false,
4747
)
4848
@TypeConverters(DateTimeTypeConverters::class)
4949
abstract class JetcasterDatabase : RoomDatabase() {

Jetcaster/core/data/src/main/java/com/example/jetcaster/core/data/database/dao/CategoriesDao.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ abstract class CategoriesDao : BaseDao<Category> {
3535
) ON category_id = categories.id
3636
ORDER BY podcast_count DESC
3737
LIMIT :limit
38-
"""
38+
""",
3939
)
40-
abstract fun categoriesSortedByPodcastCount(
41-
limit: Int
42-
): Flow<List<Category>>
40+
abstract fun categoriesSortedByPodcastCount(limit: Int): Flow<List<Category>>
4341

4442
@Query("SELECT * FROM categories WHERE name = :name")
4543
abstract suspend fun getCategoryWithName(name: String): Category?

0 commit comments

Comments
 (0)