public DrawerView addItem ( DrawerItem item ) { if ( item . getId ( ) <= 0 ) { item . setId ( System . nanoTime ( ) * 100 + Math . round ( Math . random ( ) * 100 ) ) ; } for ( DrawerItem oldItem : mAdapter . getItems ( ) ) { if ( oldItem . getId ( ) == item . getId ( ) ) { mAdapter . remove ( oldItem ) ; break ; } } item . attachTo ( mAdapter ) ; mAdapter . add ( item ) ; updateList ( ) ; return this ; }
Adds an item to the drawer view