Giter VIP home page Giter VIP logo

Comments (3)

dmytroDenysenko avatar dmytroDenysenko commented on May 29, 2024

Hey @joaosardinha
Can you provide some code example of your GuillotineActivity implementation and details of problem? So I can help you solve this.

from guillotinemenu-android.

curliq avatar curliq commented on May 29, 2024

Hey absolutely!

MainActivity.java:

//No changes from the original sample
     //@InjectView...
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity);
        ButterKnife.inject(this);


        if (toolbar != null) {
            setSupportActionBar(toolbar);
            getSupportActionBar().setTitle(null);
        }

        View guillotineMenu = LayoutInflater.from(this).inflate(R.layout.guillotine, null);
        root.addView(guillotineMenu);

        new GuillotineAnimation.GuillotineBuilder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger)
                .setStartDelay(RIPPLE_DURATION)
                .setActionBarViewForAnimation(toolbar)
                .setClosedOnStart(true)
                .build();

    }

The guillotine.xml and activity.xml layouts are just like in the original sample, with the hamburgers in the right side of the ActionBar and the GUILLOTINE_CLOSED_ANGLE as 90f.

I created an activity class for the guillotine.xml layout:

public class GuillotineActivity extends AppCompatActivity {

    @InjectView(R.id.button1)
    Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.guillotine);
        ButterKnife.inject(this);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(GuillotineActivity.this, MainActivity.class));
            }
        });
    }
}

My problem is, simple things as a button calling startActivity won't work inside the Guillotine activity making it nothing more than a layout instead of an activity.
I haven't change anything in the library expect the GUILLOTINE_CLOSED_ANGLE float.
Any thoughts of how to turn it into a real activity?

from guillotinemenu-android.

dmytroDenysenko avatar dmytroDenysenko commented on May 29, 2024

Well, if I understand correctly, what you want is to encapsulate some logic inside class of navigation menu, so it won't be just a layout. If this is the case, then you can extend View, use this layout and put all the logic you need inside. Then add your custom View to your MainActivity instead of inflating layout.

But if you want both elements to be activities and have this kind of animation, then this lib won't satisfy your needs completely. You can look into http://developer.android.com/training/material/animations.html to achieve similar behaviour

from guillotinemenu-android.

Related Issues (20)

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.