Giter VIP home page Giter VIP logo

Comments (6)

madcyph3r avatar madcyph3r commented on August 17, 2024

Normally you must add this, to your activity, if you don't want to reload the activity in change;
android:configChanges="orientation|screenSize">

from advancedmaterialdrawer.

croccio avatar croccio commented on August 17, 2024

ok already know it, but if i set multi pane with menu always open on landscape on portrait it still opened and not slide

from advancedmaterialdrawer.

madcyph3r avatar madcyph3r commented on August 17, 2024

Ok, i know what you mean.

You need a method, which you must called on orientation change. In this method you must reinit the drawer like this:

if (deviceSupportMultiPane()) {
            drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN, drawerViewGroup);
            DrawerLayout.LayoutParams params = new DrawerLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
            params.setMargins((int) (320 * displayDensity), 0, 0, 0);
            contentViewGroup.setLayoutParams(params);
            drawerLayout.setScrimColor(Color.TRANSPARENT);
            drawerLayout.openDrawer(drawerViewGroup);
            drawerLayout.setMultipaneSupport(true);
            //drawerLayout.requestDisallowInterceptTouchEvent(true);
        } else {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setHomeButtonEnabled(true);

            // don't use the constructor with toolbar, or onOptionsItemSelected() method will not be called
            actionBarToggle = new ActionBarDrawerToggle(this, drawerLayout/*, toolbar*/, R.string.nothing, R.string.nothing) {

                public void onDrawerClosed(View view) {
                    invalidateOptionsMenu();

                    drawerTouchLocked = false;

                    if (drawerStateListener != null)
                        drawerStateListener.onDrawerClosed(view);
                }

                public void onDrawerOpened(View drawerView) {
                    invalidateOptionsMenu();

                    if (drawerStateListener != null)
                        drawerStateListener.onDrawerOpened(drawerView);
                }

                @Override
                public void onDrawerSlide(View drawerView, float slideOffset) {
                    // if user wants the sliding arrow it compare
                    if (slidingDrawerEffect)
                        super.onDrawerSlide(drawerView, slideOffset);
                    else
                        super.onDrawerSlide(drawerView, 0);

                    if (drawerStateListener != null)
                        drawerStateListener.onDrawerSlide(drawerView, slideOffset);
                }

                @Override
                public void onDrawerStateChanged(int newState) {
                    super.onDrawerStateChanged(newState);

                    if (drawerStateListener != null)
                        drawerStateListener.onDrawerStateChanged(newState);
                }
            };

            //actionBarToggle.setToolbarNavigationClickListener(toolbarToggleListener);

            drawerLayout.setDrawerListener(actionBarToggle);
            drawerLayout.setMultipaneSupport(false);
        }

I can outsource the code to a method, so you can call it on change.

https://github.com/madcyph3r/AdvancedMaterialDrawer/blob/master/materialDrawer/src/main/java/de/madcyph3r/materialnavigationdrawer/MaterialNavigationDrawer.java
See line 377 until 434.
You must outsource thos code to a method and then call it on change.

from advancedmaterialdrawer.

croccio avatar croccio commented on August 17, 2024

great! i'll try it next week :D

from advancedmaterialdrawer.

madcyph3r avatar madcyph3r commented on August 17, 2024

And worked it?

from advancedmaterialdrawer.

madcyph3r avatar madcyph3r commented on August 17, 2024

I close it for now. If the problem not gone, then post it.

from advancedmaterialdrawer.

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.