Skip to content

Commit

Permalink
[#531] Move app placeholder images to ODS lib
Browse files Browse the repository at this point in the history
  • Loading branch information
florentmaitre committed Jan 17, 2024
1 parent 21789c0 commit 7a37d18
Show file tree
Hide file tree
Showing 27 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ fun ComponentImageItem() {
image = OdsImageItem.Image(
rememberAsyncImagePainter(
model = buildImageRequest(context, recipe.imageUrl, darkModeEnabled),
placeholder = painterResource(id = R.drawable.placeholder),
error = painterResource(id = R.drawable.placeholder)
placeholder = painterResource(id = com.orange.ods.R.drawable.placeholder),
error = painterResource(id = com.orange.ods.R.drawable.placeholder)
), ""
),
title = if (hasText) recipe.title else null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ object DrawableManager {
fun getPlaceholderResId(error: Boolean = false): Int {
val darkTheme = isSystemInDarkTheme()
return when {
!darkTheme && !error -> R.drawable.placeholder
!darkTheme && error -> R.drawable.placeholder_error
darkTheme && !error -> R.drawable.placeholder_dark
else -> R.drawable.placeholder_error_dark
!darkTheme && !error -> com.orange.ods.R.drawable.placeholder
!darkTheme && error -> com.orange.ods.R.drawable.placeholder_error
darkTheme && !error -> com.orange.ods.R.drawable.placeholder_dark
else -> com.orange.ods.R.drawable.placeholder_error_dark
}
}

@Composable
fun getPlaceholderSmallResId(error: Boolean = false): Int {
val darkTheme = isSystemInDarkTheme()
return when {
!darkTheme && !error -> R.drawable.placeholder_small
!darkTheme && error -> R.drawable.placeholder_error_small
darkTheme && !error -> R.drawable.placeholder_small_dark
else -> R.drawable.placeholder_error_small_dark
!darkTheme && !error -> com.orange.ods.R.drawable.placeholder_small
!darkTheme && error -> com.orange.ods.R.drawable.placeholder_error_small
darkTheme && !error -> com.orange.ods.R.drawable.placeholder_small_dark
else -> com.orange.ods.R.drawable.placeholder_error_small_dark
}
}
}
Binary file removed app/src/main/res/drawable-hdpi/placeholder.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-mdpi/placeholder.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-xhdpi/placeholder.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-xxhdpi/placeholder.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-xxxhdpi/placeholder.png
Binary file not shown.
Binary file removed app/src/main/res/drawable/placeholder_small.png
Binary file not shown.
9 changes: 8 additions & 1 deletion lib/src/main/res-public/values/public.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,12 @@
-->

<resources>
<public />
<public type="drawable" name="placeholder" />
<public type="drawable" name="placeholder_dark" />
<public type="drawable" name="placeholder_error" />
<public type="drawable" name="placeholder_error_dark" />
<public type="drawable" name="placeholder_error_small" />
<public type="drawable" name="placeholder_error_small_dark" />
<public type="drawable" name="placeholder_small" />
<public type="drawable" name="placeholder_small_dark" />
</resources>

0 comments on commit 7a37d18

Please sign in to comment.