Skip to content

Commit a877cd0

Browse files
Fixed crash when trying to open global filters settings,
Show more info on the media screen, Show "NoInfo" block if no info was found Signed-off-by: MrBoom <[email protected]>
1 parent 5c4ad8e commit a877cd0

File tree

10 files changed

+318
-93
lines changed

10 files changed

+318
-93
lines changed

ext/src/main/kotlin/com/mrboomdev/awery/ext/data/CatalogMedia.kt

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package com.mrboomdev.awery.ext.data
22
import com.mrboomdev.awery.ext.constants.AgeRating
3+
import com.mrboomdev.awery.ext.data.CatalogMedia.Companion.EXTRA_BANNER
4+
import com.mrboomdev.awery.ext.data.CatalogMedia.Companion.EXTRA_DESCRIPTION
5+
import com.mrboomdev.awery.ext.data.CatalogMedia.Companion.EXTRA_EPISODES
6+
import com.mrboomdev.awery.ext.data.CatalogMedia.Companion.EXTRA_POSTER
7+
import com.mrboomdev.awery.ext.data.CatalogMedia.Companion.EXTRA_RATINGS
8+
import com.mrboomdev.awery.ext.data.CatalogMedia.Companion.EXTRA_TYPE
39
import com.mrboomdev.awery.ext.util.GlobalId
410
import kotlinx.serialization.json.Json
511
import java.io.Serial
@@ -46,39 +52,6 @@ class CatalogMedia(
4652
enum class Type {
4753
MUSIC, VIDEO, POST, MOVIE, BOOK
4854
}
49-
50-
inline val status: Status?
51-
get() = extras[EXTRA_STATUS]?.uppercase()?.let {
52-
try { Status.valueOf(it) } catch(_: Throwable) { null }
53-
}
54-
55-
inline val type: Type?
56-
get() = when(extras[EXTRA_TYPE]?.lowercase()) {
57-
"movie", "tv" -> Type.MOVIE
58-
"book", "comic" -> Type.BOOK
59-
"post" -> Type.POST
60-
"video" -> Type.VIDEO
61-
"music" -> Type.MUSIC
62-
else -> null
63-
}
64-
65-
inline val authors: Array<String>?
66-
get() = extras[EXTRA_AUTHORS]?.let {
67-
Json.decodeFromString(it)
68-
}
69-
70-
inline val tags: Array<CatalogTag>?
71-
get() = extras[EXTRA_TAGS]?.let {
72-
Json.decodeFromString(it)
73-
}
74-
75-
inline val genres: Array<String>?
76-
get() = extras[EXTRA_GENRES]?.let {
77-
Json.decodeFromString(it)
78-
}
79-
80-
inline val ageRating: AgeRating?
81-
get() = extras[EXTRA_AGE_RATING]?.let { AgeRating.match(it) }
8255

8356
companion object {
8457
@Serial

resources/src/commonMain/composeResources/drawable/ic_collections_bookmark_filled.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
android:viewportHeight="960"
66
android:tint="#ffffff">
77
<path
8-
android:fillColor="@android:color/white"
8+
android:fillColor="#ffffff"
99
android:pathData="M212.77,744.23L212.77,85L872,85L872,744.23L212.77,744.23ZM89,868L89,221.08L147.39,221.08L147.39,809.61L735.92,809.61L735.92,868L89,868ZM563.38,143.39L563.38,417.08L656.31,361.46L748.23,417.08L748.23,143.39L563.38,143.39Z"/>
1010
</vector>

resources/src/commonMain/composeResources/drawable/ic_collections_bookmark_outlined.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
android:viewportHeight="960"
66
android:tint="#ffffff">
77
<path
8-
android:fillColor="@android:color/white"
8+
android:fillColor="#ffffff"
99
android:pathData="M271.15,685.84L813.61,685.84L813.61,143.39L748.23,143.39L748.23,417.08L656.31,361.46L563.38,417.08L563.38,143.39L271.15,143.39L271.15,685.84ZM212.77,744.23L212.77,85L872,85L872,744.23L212.77,744.23ZM89,868L89,221.08L147.39,221.08L147.39,809.61L735.92,809.61L735.92,868L89,868ZM271.15,143.39L271.15,143.39L271.15,685.84L271.15,685.84L271.15,143.39ZM563.38,417.08L563.38,417.08L656.31,361.46L748.23,417.08L748.23,417.08L656.31,361.46L563.38,417.08Z"/>
1010
</vector>

shared/src/androidMain/kotlin/com/mrboomdev/awery/sources/yomi/aniyomi/AniyomiMedia.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import com.mrboomdev.awery.ext.data.CatalogMedia
44
import com.mrboomdev.awery.ext.util.createGlobalId
55
import com.mrboomdev.awery.sources.yomi.YomiSource
66
import com.mrboomdev.awery.utils.arrayOfNotNull
7+
import com.mrboomdev.awery.utils.genres
8+
import com.mrboomdev.awery.utils.status
79
import eu.kanade.tachiyomi.animesource.model.SAnime
810
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
911

shared/src/androidMain/kotlin/com/mrboomdev/awery/sources/yomi/tachiyomi/TachiyomiMedia.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import com.mrboomdev.awery.ext.data.CatalogMedia
44
import com.mrboomdev.awery.ext.util.createGlobalId
55
import com.mrboomdev.awery.sources.yomi.YomiSource
66
import com.mrboomdev.awery.utils.arrayOfNotNull
7+
import com.mrboomdev.awery.utils.genres
8+
import com.mrboomdev.awery.utils.status
79
import eu.kanade.tachiyomi.animesource.model.SAnime
810
import eu.kanade.tachiyomi.source.model.SManga
911
import eu.kanade.tachiyomi.source.online.HttpSource
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.mrboomdev.awery.ui.components
2+
3+
import androidx.compose.foundation.layout.Column
4+
import androidx.compose.foundation.layout.padding
5+
import androidx.compose.material3.MaterialTheme
6+
import androidx.compose.material3.Text
7+
import androidx.compose.runtime.Composable
8+
import androidx.compose.ui.Alignment
9+
import androidx.compose.ui.Modifier
10+
import androidx.compose.ui.text.font.FontWeight
11+
import androidx.compose.ui.text.style.TextAlign
12+
import androidx.compose.ui.unit.dp
13+
14+
@Composable
15+
fun StateBox(
16+
modifier: Modifier = Modifier,
17+
title: String,
18+
message: String
19+
) {
20+
Column(
21+
modifier = modifier,
22+
horizontalAlignment = Alignment.CenterHorizontally
23+
) {
24+
Text(
25+
fontWeight = FontWeight.SemiBold,
26+
textAlign = TextAlign.Center,
27+
style = MaterialTheme.typography.headlineMedium,
28+
text = title
29+
)
30+
31+
Text(
32+
modifier = Modifier.padding(12.dp),
33+
textAlign = TextAlign.Center,
34+
text = message
35+
)
36+
}
37+
}

shared/src/commonMain/kotlin/com/mrboomdev/awery/ui/pane/FeedsPane.kt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import androidx.compose.runtime.snapshots.SnapshotStateList
2929
import androidx.compose.ui.Alignment
3030
import androidx.compose.ui.Modifier
3131
import androidx.compose.ui.text.font.FontWeight
32-
import androidx.compose.ui.text.style.TextAlign
3332
import androidx.compose.ui.unit.dp
3433
import androidx.compose.ui.unit.sp
3534
import com.mrboomdev.awery.ext.data.CatalogFeed
@@ -40,6 +39,7 @@ import com.mrboomdev.awery.sources.LoadedFeed
4039
import com.mrboomdev.awery.sources.loadAll
4140
import com.mrboomdev.awery.sources.processFeeds
4241
import com.mrboomdev.awery.ui.components.SmallCard
42+
import com.mrboomdev.awery.ui.components.StateBox
4343
import com.mrboomdev.awery.ui.utils.ScrollFixer
4444
import com.mrboomdev.awery.ui.utils.only
4545
import com.mrboomdev.awery.utils.UniqueIdGenerator
@@ -207,17 +207,10 @@ fun FeedsPane(
207207
FeedsPaneLoadingState.Loading -> CircularProgressIndicator()
208208

209209
FeedsPaneLoadingState.End -> {
210-
Text(
211-
fontWeight = FontWeight.SemiBold,
212-
textAlign = TextAlign.Center,
213-
style = MaterialTheme.typography.headlineMedium,
214-
text = stringResource(Res.string.you_reached_end)
215-
)
216-
217-
Text(
218-
modifier = Modifier.padding(12.dp),
219-
textAlign = TextAlign.Center,
220-
text = stringResource(Res.string.you_reached_end_description)
210+
StateBox(
211+
modifier = Modifier.fillMaxWidth(),
212+
title = stringResource(Res.string.you_reached_end),
213+
message = stringResource(Res.string.you_reached_end_description)
221214
)
222215
}
223216
}

0 commit comments

Comments
 (0)