Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to addSubMenu ? #8

Open
liufsd opened this issue Jun 27, 2013 · 4 comments
Open

how to addSubMenu ? #8

liufsd opened this issue Jun 27, 2013 · 4 comments

Comments

@liufsd
Copy link

liufsd commented Jun 27, 2013

hi man!
i mean how can i to add the menu item just like this 👍
SubMenu rootMenu = menu.addSubMenu("");
MenuItem rootMenuItem = rootMenu.getItem();
rootMenuItem.setIcon(R.drawable.actionbar_icon_overflow);
rootMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
rootMenu.add(android.view.Menu.NONE, 1, android.view.Menu.NONE, "1");
rootMenu.add(android.view.Menu.NONE, 2, android.view.Menu.NONE, "2");
when i select "1",i need the top bar show progress ,just like your StyledActivity! ( mSaveButton.showProgress(true);)

@ManuelPeinado
Copy link
Owner

Let me see if I understand. You want to have the "refresh" action in the overflow menu instead of having it as an icon in the action bar? And you want the progress indicator to appear in the action bar when you click on the "refresh" menu item?

In case your progress indicator is indeterminate you can do it quite easily without using my library, just do as this SO answer says:

http://stackoverflow.com/a/9060543/244576

In case you need a determinate progress indicator like the one in my library (it looks like a pie), then let me know and I might consider adding support for that. In fact it's a possibility that had already crossed my mind.

@liufsd
Copy link
Author

liufsd commented Jun 27, 2013

yeah ! i solve it by myself !
when it select the item ,it will change the action bar view (invalidateOptionsMenu call the onCreateOptionsMenu, and use your bar library),so i can show progress. ok. if the task return the result ,it will call the dismiss just like this " mRefreshActionItem.showProgress(false);" and invalidateOptionsMenu! so the will show my action bar !
however ,maybe it not a good idea for it!
Do you have some good idea ?
Thanks!

@liufsd
Copy link
Author

liufsd commented Jun 27, 2013

just like two menu switch ? the task start ,call your library and then call my action bar item when task finish! just call android api "invalidateOptionsMenu", and you can control the switch in the "onCreateOptionsMenu" method (return different action bar item)

@liufsd
Copy link
Author

liufsd commented Jun 27, 2013

if you got it .please tell me! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants