public void setShowMoreTimeItems ( boolean enable ) { if ( enable && ! showMoreTimeItems ) { // create the noon and late night item: final Resources res = getResources ( ) ; // switch the afternoon item to 2pm: insertAdapterItem ( new TimeItem ( res . getString ( R . string . time_afternoon_2 ) , formatTime ( 14 , 0 ) , 14 , 0 , R . id . time_afternoon_2 ) , 2 ) ; removeAdapterItemById ( R . id . time_afternoon ) ; // noon item: insertAdapterItem ( new TimeItem ( res . getString ( R . string . time_noon ) , formatTime ( 12 , 0 ) , 12 , 0 , R . id . time_noon ) , 1 ) ; // late night item: addAdapterItem ( new TimeItem ( res . getString ( R . string . time_late_night ) , formatTime ( 23 , 0 ) , 23 , 0 , R . id . time_late_night ) ) ; } else if ( ! enable && showMoreTimeItems ) { // switch back the afternoon item: insertAdapterItem ( new TimeItem ( getResources ( ) . getString ( R . string . time_afternoon ) , formatTime ( 13 , 0 ) , 13 , 0 , R . id . time_afternoon ) , 3 ) ; removeAdapterItemById ( R . id . time_afternoon_2 ) ; removeAdapterItemById ( R . id . time_noon ) ; removeAdapterItemById ( R . id . time_late_night ) ; } showMoreTimeItems = enable ; }
Toggles showing more time items . If enabled a noon and a late night time item are shown .