class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val imageView = findViewById<ImageView>(R.id.image)
val shimmer = Shimmer.ColorHighlightBuilder()
.setBaseColor(ContextCompat.getColor(this, R.color.skeleton_mask))
.setBaseAlpha(1f)
.setHighlightAlpha(1f)
.setHighlightColor(ContextCompat.getColor(this, R.color.skeleton_shimmer))
.setDuration(2000)
.setDirection(Shimmer.Direction.LEFT_TO_RIGHT)
.setAutoStart(true)
.build()
val shimmerDrawable = ShimmerDrawable()
shimmerDrawable.setShimmer(shimmer)
imageView.setImageDrawable(shimmerDrawable)
}
}
Results in:
As i can see the reason is that CardView uses RoundedCornerDrawable underneath and when we place our ShimmerDrawable over it, PorterDuff.Mode.SRC_IN clears corner pixels (and because of it they are black)
Hi @qoswa !
I am a new open source contributor and would like to solve this issue, could you help me understand the issue better by providing some extra references ?
Is this is issue open to contribute ?
Environment: Android emulator, Nexus 5 Api 25
Layout:
Activity:
Results in:![newimage](https://user-images.githubusercontent.com/42031700/121486356-bbc0e800-c9d9-11eb-9c13-63c2513af8bd.png)
As i can see the reason is that CardView uses RoundedCornerDrawable underneath and when we place our ShimmerDrawable over it, PorterDuff.Mode.SRC_IN clears corner pixels (and because of it they are black)