@Override public void bindView(ViewHolder viewHolder, List payloads) { super.bindView(viewHolder, payloads); Context ctx = viewHolder.itemView.getContext(); //set the identifier from the drawerItem here. It can be used to run tests viewHolder.itemView.setId(hashCode()); //define this item to be not clickable nor enabled viewHolder.view.setClickable(false); viewHolder.view.setEnabled(false); //define the text color viewHolder.name.setTextColor(ColorHolder.color(getTextColor(), ctx, R.attr.material_drawer_secondary_text, R.color.material_drawer_secondary_text)); //set the text for the name StringHolder.applyTo(this.getName(), viewHolder.name); //define the typeface for our textViews if (getTypeface() != null) { viewHolder.name.setTypeface(getTypeface()); } //hide the divider if we do not need one if (this.hasDivider()) { viewHolder.divider.setVisibility(View.VISIBLE); } else { viewHolder.divider.setVisibility(View.GONE); } //set the color for the divider viewHolder.divider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(ctx, R.attr.material_drawer_divider, R.color.material_drawer_divider)); //call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required) onPostBindView(this, viewHolder.itemView); }
@Override public void bindView(RecyclerView.ViewHolder holder) { Context ctx = holder.itemView.getContext(); //get our viewHolder ViewHolder viewHolder = (ViewHolder) holder; //set the identifier from the drawerItem here. It can be used to run tests holder.itemView.setId(getIdentifier()); //define this item to be not clickable nor enabled viewHolder.view.setClickable(false); viewHolder.view.setEnabled(false); //define the text color viewHolder.name.setTextColor(ColorHolder.color(getTextColor(), ctx, R.attr.material_drawer_secondary_text, R.color.material_drawer_secondary_text)); //set the text for the name StringHolder.applyTo(this.getName(), viewHolder.name); //hide the divider if we do not need one if (this.hasDivider()) { viewHolder.divider.setVisibility(View.VISIBLE); } else { viewHolder.divider.setVisibility(View.GONE); } //set the color for the divider viewHolder.divider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(ctx, R.attr.material_drawer_divider, R.color.material_drawer_divider)); //call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required) onPostBindView(this, holder.itemView); }