Skip to content

Commit

Permalink
Added placeholder color and placeholder drawable samples to Showcase …
Browse files Browse the repository at this point in the history
…ImageOptions config example

Reviewed By: defHLT

Differential Revision: D67792500

fbshipit-source-id: 2abd02728077c48035e2adf11936625290f009e8
  • Loading branch information
oprisnik authored and facebook-github-bot committed Jan 3, 2025
1 parent bc37887 commit e734406
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class FrescoVitoLithoImageOptionsConfigFragment : BaseShowcaseFragment() {
spinnerColorFilter.setupWithList(VitoSpinners.colorFilters) {
refresh(imageOptionsBuilder.colorFilter(it))
}
spinnerPlaceholder.setupWithList(VitoSpinners.placeholderOptions) {
spinnerPlaceholder.setupWithList(VitoSpinners.placeholderOptions(resources)) {
refresh(it(imageOptionsBuilder))
}
spinnerError.setupWithList(VitoSpinners.errorOptions) { refresh(it(imageOptionsBuilder)) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.facebook.drawee.drawable.RoundedCornersDrawable
import com.facebook.drawee.drawable.ScalingUtils
import com.facebook.fresco.samples.showcase.R
import com.facebook.fresco.samples.showcase.common.CustomScaleTypes
import com.facebook.fresco.samples.showcase.misc.CheckerBoardDrawable
import com.facebook.fresco.samples.showcase.postprocessor.CachedWatermarkPostprocessor
import com.facebook.fresco.samples.showcase.postprocessor.FasterGreyScalePostprocessor
import com.facebook.fresco.samples.showcase.postprocessor.ScalingBlurPostprocessor
Expand Down Expand Up @@ -108,7 +109,7 @@ object VitoSpinners {
"10000 ms" to 10000),
"Fading")

val placeholderOptions =
fun placeholderOptions(resources: Resources) =
Pair(
listOf(
"none" to { builder: ImageOptions.Builder -> builder.placeholder(null) },
Expand All @@ -118,13 +119,18 @@ object VitoSpinners {
},
"block color" to
{ builder: ImageOptions.Builder ->
builder.placeholder(ColorDrawable(Color.RED))
builder.placeholderColor(Color.RED)
},
"checker board drawable" to
{ builder: ImageOptions.Builder ->
builder.placeholder(CheckerBoardDrawable(resources))
},
"color res" to
{ builder: ImageOptions.Builder ->
builder.placeholderRes(R.color.placeholder_color)
}),
"Placeholder")

val errorOptions =
Pair(
listOf(
Expand Down

0 comments on commit e734406

Please sign in to comment.