Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

setSection is not working in 1.3.3 #248

Closed
vangliana opened this issue Mar 24, 2015 · 5 comments
Closed

setSection is not working in 1.3.3 #248

vangliana opened this issue Mar 24, 2015 · 5 comments

Comments

@vangliana
Copy link

Looking at the bellow code, if(section == currentSection) will always return true as syncSectionsState(section); will mark the target section as the current section which means that the section will never be switched.

public void setSection(MaterialSection section) {
        section.select();
        syncSectionsState(section);

        switch (section.getTarget()) {
            case MaterialSection.TARGET_FRAGMENT:
                // se l'utente clicca sulla stessa schermata in cui si trova si chiude il drawer e basta
                if(section == currentSection) {
                    if(!deviceSupportMultiPane())
                        layout.closeDrawer(drawer);
                    return;
                }
                changeToolbarColor(section);
                setFragment((Fragment) section.getTargetFragment(), section.getTitle(), (Fragment) currentSection.getTargetFragment());
                afterFragmentSetted((Fragment) section.getTargetFragment(),section.getTitle());
                break;
            case MaterialSection.TARGET_ACTIVITY:
                this.startActivity(section.getTargetIntent());
                if (!deviceSupportMultiPane())
                    layout.closeDrawer(drawer);
                break;
            case MaterialSection.TARGET_LISTENER:
                // call the section listener
                section.getTargetListener().onClick(section);
                if (!deviceSupportMultiPane())
                    layout.closeDrawer(drawer);

            default:
                break;
        }

        // se il target e' un activity la sezione corrente rimane quella precedente
        if(section.getTarget() != MaterialSection.TARGET_ACTIVITY ) {
            syncSectionsState(section);
        }
    }
@tatianagrange
Copy link

I have the same problem in 1.3.3.
I downgrade in 1.3.2, but there are another problem: setSection can be call in onChangeAccount, but I can't use this function in other place.

@raylee4204
Copy link

I'm having the same issue

@david-perez
Copy link

I'm having the same issue. I want to setSection() to a default one every time onChangeAccount is called, but setSection() does not work.

@Foivos-Stamopoulos
Copy link

I'm having the same issue..

Please fix :)

@xianglonghan
Copy link

Same here.

A quick work around would be
this.setSection(section);
this.changeToolbarColor(section);
this.setFragment(section.getTargetFragment(), section.getTitle());

this won't update the child fragment though, but works for me now.

@neokree neokree closed this as completed Dec 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants