zirouan / NavigationDrawer-MaterialDesign

Library Navigation drawer material design
1.06k stars 272 forks source link

Change mList menu #45

Closed johngamarra closed 8 years ago

johngamarra commented 9 years ago

Hi,

Is there an easy way to change the mList, when some action is made in the header, I can change it creating a new adapter, BUT, the selection status is lost in the mList

        ListView mList = this.getListView();
        List<Integer> mListExtra = new ArrayList<>();
        mListExtra.add(0, mNewSelector);
        mListExtra.add(1, mColorDefault);
        mListExtra.add(2, mColorIcon);
        mListExtra.add(3, mColorName);
        mListExtra.add(4, mColorSeparator);

        NavigationLiveoAdapter mNavigationAdapter = new NavigationLiveoAdapter(this, NavigationLiveoList.getNavigationAdapter(mListNameItem, null,
                null, null, mColorSelected, mRemoveSelector, this), mRemoveAlpha, mListExtra);

        mList.setAdapter(mNavigationAdapter);
johngamarra commented 9 years ago

@rudsonlive can you help me with this? I'm sure It's something simple

zirouan commented 9 years ago

you can use the "01" method to get the last position in the list and then re-create your list u can set the position in the method "02"

01: public int getCurrentPosition(){} 02: public void setDefaultStartPositionNavigation(int position){}

2015-04-13 17:43 GMT-03:00 John Gamarra notifications@github.com:

@rudsonlive https://github.com/rudsonlive can you help me with this? I'm sure It's something simple

— Reply to this email directly or view it on GitHub https://github.com/rudsonlive/NavigationDrawer-MaterialDesign/issues/45#issuecomment-92492851 .

Rudson Lima ( live-O ) Desenvolvedor Android Contato +55 85 87050560* - Fortaleza-ce Google Play CepLive-O e Navigation Drawer - Live-O https://play.google.com/store/apps/developer?id=Rudson+Lima *Social facebook https://www.facebook.com/rudsonlive | google+ http://google.com/+RudsonLima-O | linkedin http://br.linkedin.com/in/rudsonlive/

johngamarra commented 9 years ago

Still not working, as I said, I can recreate the list using the code in the original post, but, the gray item selection is lost, do you know why?

there is no way to delete a item in the list?

johngamarra commented 9 years ago

hello @rudsonlive?

johngamarra commented 9 years ago

I think this can be easily solved if you add a way to repaint the mList, by adapter, please consider this enhacement, thanks.

zirouan commented 9 years ago

Now you can customize your list in version 2.3.2.

//{optional} - List Customization "If you remove these methods and the list will take his white standard color" .selectorCheck(R.drawable.selector_check) //Inform the background of the selected item color .colorItemDefault(R.color.nliveo_blue_colorPrimary) //Inform the standard color name, icon and counter .colorItemSelected(R.color.nliveo_purple_colorPrimary) //State the name of the color, icon and meter when it is selected .backgroundList(R.color.nliveo_black_light) //Inform the list of background color .colorLineSeparator(R.color.nliveo_transparent) //Inform the color of the subheader line

johngamarra commented 9 years ago

I think you didn't understand me,

I need to do this:

For example my Drawer is like this:

[header] Inbox trash [footer]

I need to change it like this (a totally diferent list)

[header] something another [footer]

don't care about color or other stuff, I need to change the list @rudsonlive

zirouan commented 9 years ago

Mine is built on "HelpLiveo", then the order you create the object is the order that will be your menu

The header and footer is standard, so their interaction is only with the list items.

ex;

HelpLiveo mHelpLiveo HelpLiveo = new (); mHelpLiveo.add (Icon, "something"); mHelpLiveo.add (getString (icon, "another");

Then just tell your mHelpLiveo the method addAllHelpItem

ex with (this) // default theme is dark .startingPosition (0) // Starting position in the list .addAllHelpItem (mHelpLiveo.getHelp ())

I hope this helps.

2015-07-18 13:17 GMT-03:00 John Gamarra notifications@github.com:

I think you didn't understand me,

I need to do this:

For example my Drawer is like this:

[header] Inbox trash [footer]

I need to change it like this (a totally diferent list)

[header] something another [footer]

don't care about color or other stuff, I need to change the list @rudsonlive https://github.com/rudsonlive

— Reply to this email directly or view it on GitHub https://github.com/rudsonlive/NavigationDrawer-MaterialDesign/issues/45#issuecomment-122560848 .

Rudson Lima ( live-O ) Desenvolvedor Android Contato +55 85 87050560* - Fortaleza-ce Google Play CepLive-O e Navigation Drawer - Live-O https://play.google.com/store/apps/developer?id=Rudson+Lima *Social facebook https://www.facebook.com/rudsonlive | google+ http://google.com/+RudsonLima-O | linkedin http://br.linkedin.com/in/rudsonlive/

johngamarra commented 9 years ago

Unfortunately it does not work

I'm calling this in init

   mHelpLiveo = new HelpLiveo();
    mHelpLiveo.add(getString(R.string.inbox));
    mHelpLiveo.add(getString(R.string.trash));

    with(this, Navigation.THEME_LIGHT).
            with(this)
            .startingPosition(0)
            .addAllHelpItem(mHelpLiveo.getHelp())
            .footerItem(R.string.log_out, R.drawable.ic_logout_black_48dp)
            .customHeader(mCustomHeader)
            .setOnPrepareOptionsMenu(onPrepare)
            .setOnClickFooter(onClickFooter)
            .build();

and everything is OK, then in onClick on a button I'm calling this:

public void onClick(View v) {

        mHelpLiveo = new HelpLiveo();
        mHelpLiveo.add("something");
        mHelpLiveo.add("another");

        with(MainActivity.this)
                .startingPosition(0)
                .addAllHelpItem(mHelpLiveo.getHelp());
    }

NavigationDrawer is gone, lost.... it does not work

zirouan commented 9 years ago

Friend, now that understands your situation and I apologize for the confusion.

Unfortunately today it is not possible.

We will soon release a new version and try to implement this functionality.

Once again I apologize and thank you for contact.

2015-07-18 13:58 GMT-03:00 John Gamarra notifications@github.com:

Unfortunately it does not work

I'm calling this in init

mHelpLiveo = new HelpLiveo(); mHelpLiveo.add(getString(R.string.inbox)); mHelpLiveo.add(getString(R.string.trash));

with(this, Navigation.THEME_LIGHT).
        with(this)
        .startingPosition(0)
        .addAllHelpItem(mHelpLiveo.getHelp())
        .footerItem(R.string.log_out, R.drawable.ic_logout_black_48dp)
        .customHeader(mCustomHeader)
        .setOnPrepareOptionsMenu(onPrepare)
        .setOnClickFooter(onClickFooter)
        .build();

and everything is OK, then in onClick on a button I'm calling this:

public void onClick(View v) {

    mHelpLiveo = new HelpLiveo();
    mHelpLiveo.add("something");
    mHelpLiveo.add("another");

    with(MainActivity.this)
            .startingPosition(0)
            .addAllHelpItem(mHelpLiveo.getHelp());
}

NavigationDrawer is gone, lost.... it does not work

— Reply to this email directly or view it on GitHub https://github.com/rudsonlive/NavigationDrawer-MaterialDesign/issues/45#issuecomment-122563873 .

Rudson Lima ( live-O ) Desenvolvedor Android Contato +55 85 87050560* - Fortaleza-ce Google Play CepLive-O e Navigation Drawer - Live-O https://play.google.com/store/apps/developer?id=Rudson+Lima *Social facebook https://www.facebook.com/rudsonlive | google+ http://google.com/+RudsonLima-O | linkedin http://br.linkedin.com/in/rudsonlive/