private OnItemClickListener createItemClickListener ( ) { return new OnItemClickListener ( ) { @ Override public void onItemClick ( final AdapterView < ? > parent , final View view , final int position , final long id ) { if ( itemClickListener != null && ! rootView . isDragging ( ) && ! rootView . isAnimationRunning ( ) ) { int index = position ; if ( adapter . containsDividers ( ) ) { for ( int i = position ; i >= 0 ; i -- ) { if ( adapter . getItem ( i ) == null || ( adapter . getItem ( i ) instanceof Divider && i % adapter . getColumnCount ( ) > 0 ) ) { index -- ; } } } itemClickListener . onItemClick ( parent , view , index , getId ( position ) ) ; } dismiss ( ) ; } } ; }
Creates and returns a listener which allows to observe when the items of a bottom sheet have been clicked .