@Test public void testClickingSupplementalAction() { final boolean[] clicked = {false}; TextListItem item0 = new TextListItem(mActivity); item0.setAction("action", true, v -> clicked[0] = true); List<TextListItem> items = Arrays.asList(item0); setupPagedListView(items); onView(withId(R.id.recycler_view)).perform( actionOnItemAtPosition(0, clickChildViewWithId(R.id.action1))); assertTrue(clicked[0]); }
public void setAction(String text, boolean showDivider, View.OnClickListener listener) { if (TextUtils.isEmpty(text)) { throw new IllegalArgumentException("Action text cannot be empty."); } if (listener == null) { throw new IllegalArgumentException("Action OnClickListener cannot be null."); } mSupplementalActionType = SUPPLEMENTAL_ACTION_ONE_ACTION; mAction1Text = text; mAction1OnClickListener = listener; mShowAction1Divider = showDivider; markDirty(); }
TextListItem extends ListItem<TextListItem.ViewHolder> { public void setAction(String text, boolean showDivider, View.OnClickListener listener) { if (TextUtils.isEmpty(text)) { throw new IllegalArgumentException("Action text cannot be empty."); } if (listener == null) { throw new IllegalArgumentException("Action OnClickListener cannot be null."); } mSupplementalActionType = SUPPLEMENTAL_ACTION_ONE_ACTION; mAction1Text = text; mAction1OnClickListener = listener; mShowAction1Divider = showDivider; markDirty(); } }
TextListItem extends ListItem<TextListItem.ViewHolder> { public void setAction(String text, boolean showDivider, View.OnClickListener listener) { if (TextUtils.isEmpty(text)) { throw new IllegalArgumentException("Action text cannot be empty."); } if (listener == null) { throw new IllegalArgumentException("Action OnClickListener cannot be null."); } mSupplementalActionType = SUPPLEMENTAL_ACTION_ONE_ACTION; mAction1Text = text; mAction1OnClickListener = listener; mShowAction1Divider = showDivider; markDirty(); } TextListItem(Context context); }
TextListItem extends ListItem<TextListItem.ViewHolder> { public void setAction(String text, boolean showDivider, View.OnClickListener listener) { if (TextUtils.isEmpty(text)) { throw new IllegalArgumentException("Action text cannot be empty."); } if (listener == null) { throw new IllegalArgumentException("Action OnClickListener cannot be null."); } mSupplementalActionType = SUPPLEMENTAL_ACTION_ONE_ACTION; mAction1Text = text; mAction1OnClickListener = listener; mShowAction1Divider = showDivider; markDirty(); } TextListItem(Context context); static ViewHolder createViewHolder(View itemView); @Override int getViewType(); @Override void onBind(ViewHolder viewHolder); void setOnClickListener(View.OnClickListener listener); void setPrimaryActionIcon(@DrawableRes int iconResId, boolean useLargeIcon); void setPrimaryActionIcon(Drawable drawable, boolean useLargeIcon); void setPrimaryActionEmptyIcon(); void setPrimaryActionNoIcon(); void setTitle(String title); void setBody(String body); void setBody(String body, boolean asPrimary); void setSupplementalIcon(int iconResId, boolean showDivider); void setSupplementalIcon(Drawable drawable, boolean showDivider); void setSupplementalIcon(int iconResId, boolean showDivider,
            View.OnClickListener listener); void setSupplementalIcon(Drawable drawable, boolean showDivider,
            View.OnClickListener listener); void setAction(String text, boolean showDivider, View.OnClickListener listener); void setActions(String action1Text, boolean showAction1Divider,
            View.OnClickListener action1OnClickListener,
            String action2Text, boolean showAction2Divider,
            View.OnClickListener action2OnClickListener); void setSwitch(boolean checked, boolean showDivider,
            CompoundButton.OnCheckedChangeListener listener); void setSwitchState(boolean isChecked); }
TextListItem extends ListItem<TextListItem.ViewHolder> { public void setAction(String text, boolean showDivider, View.OnClickListener listener) { if (TextUtils.isEmpty(text)) { throw new IllegalArgumentException("Action text cannot be empty."); } if (listener == null) { throw new IllegalArgumentException("Action OnClickListener cannot be null."); } mSupplementalActionType = SUPPLEMENTAL_ACTION_ONE_ACTION; mAction1Text = text; mAction1OnClickListener = listener; mShowAction1Divider = showDivider; markDirty(); } TextListItem(Context context); static ViewHolder createViewHolder(View itemView); @Override int getViewType(); @Override void onBind(ViewHolder viewHolder); void setOnClickListener(View.OnClickListener listener); void setPrimaryActionIcon(@DrawableRes int iconResId, boolean useLargeIcon); void setPrimaryActionIcon(Drawable drawable, boolean useLargeIcon); void setPrimaryActionEmptyIcon(); void setPrimaryActionNoIcon(); void setTitle(String title); void setBody(String body); void setBody(String body, boolean asPrimary); void setSupplementalIcon(int iconResId, boolean showDivider); void setSupplementalIcon(Drawable drawable, boolean showDivider); void setSupplementalIcon(int iconResId, boolean showDivider,
            View.OnClickListener listener); void setSupplementalIcon(Drawable drawable, boolean showDivider,
            View.OnClickListener listener); void setAction(String text, boolean showDivider, View.OnClickListener listener); void setActions(String action1Text, boolean showAction1Divider,
            View.OnClickListener action1OnClickListener,
            String action2Text, boolean showAction2Divider,
            View.OnClickListener action2OnClickListener); void setSwitch(boolean checked, boolean showDivider,
            CompoundButton.OnCheckedChangeListener listener); void setSwitchState(boolean isChecked);  }