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

status bar is not overriden from alert #283

Open
SoftwareAdvise opened this issue May 23, 2022 · 1 comment
Open

status bar is not overriden from alert #283

SoftwareAdvise opened this issue May 23, 2022 · 1 comment

Comments

@SoftwareAdvise
Copy link

hi all,
i have a problem regarding status bar not overriden by alert, why this happen?

immagine

thanks.

@ryankamanri
Copy link

I found a solution (not good, just solve)
observe Alerter.show()

    public Alert show() {
        //This will get the Activity Window's DecorView
        if (getActivityWeakReference() != null) {
            getActivityWeakReference().get().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    //Add the new Alert to the View Hierarchy
                    final ViewGroup decorView = getActivityDecorView();
                    if (decorView != null && getAlert().getParent() == null) {
                        decorView.addView(getAlert());
                    }
                }
            });
        }

        return getAlert();
    }

It is found that the View of this Alert has been added to the window.decorView
You can find the Alert object by traversing the window.decorView and set its translationZ

So i solved the problem, by:

val children = (window.decorView as ViewGroup).children
        children.forEach {
            if(it.javaClass == Alert::class.java) {
                (it as Alert).translationZ = 100f
            }
        }

Maybe you can wrap it better.

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

No branches or pull requests

2 participants