public DrawerView addProfile ( DrawerProfile profile ) { if ( profile . getId ( ) <= 0 ) { profile . setId ( System . nanoTime ( ) * 100 + Math . round ( Math . random ( ) * 100 ) ) ; } for ( DrawerProfile oldProfile : mProfileAdapter . getItems ( ) ) { if ( oldProfile . getId ( ) == profile . getId ( ) ) { mProfileAdapter . remove ( oldProfile ) ; break ; } } profile . attachTo ( this ) ; mProfileAdapter . add ( profile ) ; if ( mProfileAdapter . getCount ( ) == 1 ) { selectProfile ( profile ) ; } updateProfile ( ) ; return this ; }
Adds a profile to the drawer view