File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,16 +48,22 @@ function WindowStack() {
4848 _window . fireEvent ( 'open' ) ;
4949
5050 // Generate Android menu
51- if ( _window . hasOwnProperty ( 'onCreateOptionsMenu' ) ) {
52- var activity = drawer . window . getActivity ( ) ;
53- activity . onCreateOptionsMenu = _window . onCreateOptionsMenu ;
54-
55- // Try to refresh menus
56- try {
57- activity . invalidateOptionsMenu ( ) ;
58- } catch ( e ) {
59- Ti . API . warn ( 'Maybe we still do not have activity to update the menu, it works now by the way' ) ;
51+ var activity = drawer . window . getActivity ( ) ;
52+
53+ activity . onCreateOptionsMenu = function ( e ) {
54+ // Clean up all items from any other controller
55+ e . menu . clear ( ) ;
56+
57+ if ( _window . hasOwnProperty ( 'onCreateOptionsMenu' ) ) {
58+ _window . onCreateOptionsMenu ( e ) ;
6059 }
60+ } ;
61+
62+ // Try to refresh menus if the activity created
63+ try {
64+ activity . invalidateOptionsMenu ( ) ;
65+ } catch ( e ) {
66+ Ti . API . warn ( 'Maybe we still do not have activity to update the menu, it works now by the way' ) ;
6167 }
6268
6369 drawer . setCenterWindow ( _window ) ;
You can’t perform that action at this time.
0 commit comments