コード例 #1
0
 @Override
 public void onBindVH(@NonNull CategoryVH holder, int position) {
   String label = getItem(position).getLabel();
   String firstWord = null;
   if (label.length() > 0) {
     firstWord = label.substring(0, 1);
   } else {
     firstWord = "N";
   }
   holder.txtName.setText(getItem(position).getLabel());
   holder.txtPicturesNum.setText(getItem(position).getPhotosNumber() + "");
   if (getItem(position).isCheck()) {
     holder.itemView.setBackgroundResource(R.drawable.selector_check_item_navigation);
     holder.imgLogo.setImageDrawable(
         TextDrawable.builder()
             .buildRound(firstWord, AppCompat.getColor(R.color.red_colorPrimary, getContext())));
     holder.txtName.setTextColor(AppCompat.getColor(R.color.red_colorPrimary, getContext()));
     holder.txtPicturesNum.setTextColor(
         AppCompat.getColor(R.color.red_colorPrimary, getContext()));
   } else {
     holder.itemView.setBackgroundResource(R.drawable.selector_no_check_item_navigation);
     holder.imgLogo.setImageDrawable(
         TextDrawable.builder().buildRound(firstWord, mColor.getColor(firstWord)));
     holder.txtName.setTextColor(AppCompat.getColor(R.color.txt_black, getContext()));
     holder.txtPicturesNum.setTextColor(AppCompat.getColor(R.color.txt_gray, getContext()));
   }
 }
コード例 #2
0
 private void initToolBarUI() {
   setSupportActionBar(mToolbar);
   mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
   AppCompat.setElevation(mToolbar, getResources().getDimension(R.dimen.ui_elevation));
 }