mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-03 16:41:26 +01:00
fix(android): lint on the predictive-back opt-in and the shared-art modifier
enableOnBackInvokedCallback only exists from API 33 and the app runs from 31, which lint reports as UnusedAttribute; tools:targetApi says that is intended, since older releases ignore it. sharedArt becomes an extension on Modifier, as Compose lint asks of modifier factories.
This commit is contained in:
1 parent
bedbe0ef52
commit
50481e6aed
4 files changed
+7
-6
No files matched your search
@@ -12,6 +12,7 @@
|
||||
android:allowBackup="false"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
tools:targetApi="33"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
|
||||
@@ -83,11 +83,11 @@ internal val LocalPaneVisibility = staticCompositionLocalOf<AnimatedVisibilitySc
|
||||
*/
|
||||
@OptIn(ExperimentalSharedTransitionApi::class)
|
||||
@Composable
|
||||
internal fun sharedArt(key: String): Modifier {
|
||||
val transition = LocalSharedTransition.current ?: return Modifier
|
||||
val visibility = LocalPaneVisibility.current ?: return Modifier
|
||||
internal fun Modifier.sharedArt(key: String): Modifier {
|
||||
val transition = LocalSharedTransition.current ?: return this
|
||||
val visibility = LocalPaneVisibility.current ?: return this
|
||||
return with(transition) {
|
||||
Modifier.sharedBounds(rememberSharedContentState("art/$key"), visibility)
|
||||
this@sharedArt.sharedBounds(rememberSharedContentState("art/$key"), visibility)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -520,7 +520,7 @@ private fun PosterTile(title: TitleRecord, onClick: () -> Unit, onLongClick: ()
|
||||
RemoteArtwork(
|
||||
title.posterUrl ?: title.backdropUrl,
|
||||
title.canonicalName ?: title.name,
|
||||
Modifier.then(sharedArt(title.key)).fillMaxWidth().aspectRatio(2f / 3f).clip(MaterialTheme.shapes.medium),
|
||||
Modifier.sharedArt(title.key).fillMaxWidth().aspectRatio(2f / 3f).clip(MaterialTheme.shapes.medium),
|
||||
fallback = title.thumbnailSource,
|
||||
)
|
||||
Spacer(Modifier.height(6.dp))
|
||||
|
||||
@@ -162,7 +162,7 @@ internal fun TitleScreen(
|
||||
// Edge to edge, fading into the page: the art is the first thing
|
||||
// the page says, and a framed thumbnail with a margin round it read
|
||||
// as one card among the many below it.
|
||||
Box(Modifier.then(sharedArt(title.key)).fillMaxWidth().height(backdropHeight)) {
|
||||
Box(Modifier.sharedArt(title.key).fillMaxWidth().height(backdropHeight)) {
|
||||
RemoteArtwork(
|
||||
title.backdropUrl ?: title.posterUrl,
|
||||
title.canonicalName ?: title.name,
|
||||
|
||||
Reference in new issue
Block a user