cascade
cascade copied to clipboard
Allow background dimming
PopupWindow
allows dimming background, but it's a bit difficult do so and doesn't animate in sync with entry/exist transitions. Providing a first-class API for doing it would be sweet.
This can be achieved on the implementation side by using a "View" and changing alpha from 0F to 1.5F(acc. to the intensity required) but this might not be a good idea but could be a way-around.
Using a View would require touching the view hierarchy of the background window. It may not be a very bad idea, but I'd like to know if it can avoided by only using PopupWindow
's APIs
Using a View would require touching the view hierarchy of the background window. It may not be a very bad idea, but I'd like to know if it can avoided by only using
PopupWindow
's APIs
I'm some what succeeded in setting the background dim but clearing background is not yet done, If you can have a look at it once.
//function to apply the backgroundDim
fun applyDim(parent: ViewGroup, dimAmount: Int) {
val dim: Drawable = ColorDrawable(BLACK)
dim.setBounds(0, 0, parent.width, parent.height)
dim.alpha = dimAmount
val overlay = parent.overlay
overlay.add(dim)
}
//function to clear the backgroundDim
fun clearDim(parent: ViewGroup) {
val overlay = parent.overlay
overlay.clear()
}
Used this
Yeah sure I wouldn't mind doing that. Wanna take a stab?
Let's give it a try!
I was too late to view this thread 🤦.
could this lib be used to achiev telegram action popup with background dim like video below? or It only can be used on toolbar actionbutton?
https://user-images.githubusercontent.com/8607299/117559225-dcec8c80-b059-11eb-95b4-e76decca5891.mov
Yep that should already be possible minus background dimming!
Hi, can we using blur view like ios (Context menu)? It's think it's better when support more customView like this:
Screen
i cant see the video
@fukemy I've added support for background dimming. Blur is not yet supported.