Giter VIP home page Giter VIP logo

Comments (2)

thiagokimo avatar thiagokimo commented on August 17, 2024

Are you using fitSystemWindows=true from your drawer?

I'm still investigating this problem. I guess something is messing up with the AppTheme.OverlapSystemBar theme.

from konamicode.

carrierev avatar carrierev commented on August 17, 2024

I guess I was using fitSystemWindows=true since it was in the template too.

I kinda worked around the behavior by injecting the code manually, without using

new KonamiCode.Installer(context)
        .on(activity-or-fragment-or-view)
        .install();

I think it has something to do with the way the alertDialog is bind to the view. But I'm not sure.

I don't know if this can be useful to you, since I'm not using the library installer, but my working code looks like this :

        cheatCode = null;
        try {
             final ViewGroup viewGroup = (ViewGroup) ((ViewGroup) this.findViewById(android.R.id.content)).getChildAt(0);
            View buttonsView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.dialog_buttons, viewGroup, false);
            View aButton = buttonsView.findViewById(R.id.konami_button_a);
            View bButton = buttonsView.findViewById(R.id.konami_button_b);
            View startButton = buttonsView.findViewById(R.id.konami_button_start);
            aButton.setOnClickListener(buttonsClickListener);
            bButton.setOnClickListener(buttonsClickListener);
            startButton.setOnClickListener(buttonsClickListener);

            buttonDialog = new AlertDialog.Builder(this)
                    .setView(buttonsView)
                    .create();

            cheatCode = new KonamiCode(getApplicationContext());
            cheatCode.setOnKonamiCodeListener(new KonamiCode.OnKonamiCodeListener()
            {
                public void onSuccessfulCode()
                {
                    showDialog();
                }
            });

            viewGroup.setOnTouchListener(cheatCode);


from konamicode.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.