Optimized adapter. Flag to determine is adapter for grid or list view.