Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow background dimming #3

Open
saket opened this issue Oct 10, 2020 · 13 comments · May be fixed by #18
Open

Allow background dimming #3

saket opened this issue Oct 10, 2020 · 13 comments · May be fixed by #18
Labels
good first issue Good for newcomers

Comments

@saket
Copy link
Owner

saket commented Oct 10, 2020

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.

@saket saket added the good first issue Good for newcomers label Oct 10, 2020
@gsrathoreniks
Copy link

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.

@saket
Copy link
Owner Author

saket commented Oct 10, 2020

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

@gsrathoreniks
Copy link

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.

@gsrathoreniks
Copy link

gsrathoreniks commented Oct 11, 2020

//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

@saket
Copy link
Owner Author

saket commented Oct 15, 2020

Yeah sure I wouldn't mind doing that. Wanna take a stab?

@gsrathoreniks
Copy link

Let's give it a try!

@rohithThammaiah rohithThammaiah linked a pull request Oct 18, 2020 that will close this issue
@rohithThammaiah
Copy link

I was too late to view this thread 🤦.

@tucomel
Copy link

tucomel commented May 9, 2021

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?

take.2021-05-09.at.00.01.55.mov

@saket
Copy link
Owner Author

saket commented May 11, 2021

Yep that should already be possible minus background dimming!

@fukemy
Copy link

fukemy commented Jun 11, 2022

Hi, can we using blur view like ios (Context menu)? It's think it's better when support more customView like this:
165982759-5a5d6eb2-592c-4568-88c0-719d23012d6b

@gsrathoreniks
Copy link

gsrathoreniks commented Oct 18, 2023

Screen_recording_20231018_180308.webm

Able to do it.

@fukemy
Copy link

fukemy commented Oct 18, 2023

Screen

i cant see the video

@gsrathoreniks
Copy link

@fukemy I've added support for background dimming. Blur is not yet supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants