/** * Checks whether the passed view type is a group's one. * * @param rawViewType raw view type value (return value of {@link androidx.recyclerview.widget.RecyclerView.ViewHolder#getItemViewType()}) * @return True for the a group view type, otherwise false */ public static boolean isGroupViewType(int rawViewType) { return ItemViewTypeComposer.isExpandableGroup(rawViewType); }
@Test public void isExpandableGroup() throws Exception { // zero assertThat(ItemViewTypeComposer.isExpandableGroup(0), is(false)); // not group - 1 assertThat(ItemViewTypeComposer.isExpandableGroup(ItemViewTypeComposer.BIT_MASK_SEGMENT), is(false)); // not group - 2 assertThat(ItemViewTypeComposer.isExpandableGroup(ItemViewTypeComposer.BIT_MASK_WRAPPED_VIEW_TYPE), is(false)); // is group - 1 assertThat(ItemViewTypeComposer.isExpandableGroup(ItemViewTypeComposer.BIT_MASK_EXPANDABLE_FLAG), is(true)); // is group - 2 assertThat(ItemViewTypeComposer.isExpandableGroup(ItemViewTypeComposer.BIT_MASK_EXPANDABLE_FLAG | ItemViewTypeComposer.BIT_MASK_SEGMENT | ItemViewTypeComposer.BIT_MASK_WRAPPED_VIEW_TYPE), is(true)); }