ankidroid/Anki-Android — pull request #276 by agrueneberg (2014-04-11 00:10:42+00:00)
Title: Convert menus to XML

After converting the card browser menu to XML, here are the other ones (with the exception of the multimedia card editor, this code is being worked on in some other branch anyway?).

With the action bar `onPrepareOptions` is not called anymore. You're supposed to call `invalidateOptionsMenu` from your code instead whenever something changes. Unfortunately, We have a couple of dynamic menu items where this is not easy, e.g. *Sync* is enabled or disabled depending on whether an SD card is inserted or not. As a workaround I used the `onMenuOpened` method to invalidate the action bar every time the menu is opened.

I hope I got everything right, please test.

More changes:
* The previously introduced `action_add_card` was renamed to `action_add_card_from_card_browser`.
* The `ic_menu_view` icon introduced with the addition of the preview button to the action bar was included because it referenced `android.R.drawable`.
* All references to icons of menu items that are not the action bar were removed. Menu items in the action bar menu don't have icons anymore, even on pre-ICS devices. In the future, we could delete the unused ones.
* Items in `onMenuItemClicked` were reordered to match the order in the XML descriptions.
* The method `onCreateOptionsMenu`, `onMenuOpened`, and `onMenuItemClicked` were put close together and in the same order in every activity.