| | |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.util.TypedValue; |
| | | import android.view.View; |
| | | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.manager.AppManager; |
| | |
| | | @Override |
| | | protected void onBind(BaseViewHolder<ItemPetBinding> holder, int position) { |
| | | holder.getBinding().setBean(mDataList.get(position)); |
| | | //根据主题选择对应卡片背景色 |
| | | TypedValue typedValue1 = new TypedValue(); |
| | | mContext.getTheme().resolveAttribute(R.attr.cardBackgroundColorFirst, typedValue1, true); |
| | | TypedValue typedValue2 = new TypedValue(); |
| | | mContext.getTheme().resolveAttribute(R.attr.cardBackgroundColorSecond, typedValue2, true); |
| | | if (position % 2 != 0){ |
| | | holder.getBinding().cardView.setCardBackgroundColor(mContext.getColor(R.color.color_card_blue)); |
| | | holder.getBinding().cardView.setCardBackgroundColor(typedValue1.data); |
| | | }else { |
| | | holder.getBinding().cardView.setCardBackgroundColor(mContext.getColor(R.color.color_card_pink)); |
| | | holder.getBinding().cardView.setCardBackgroundColor(typedValue2.data); |
| | | } |
| | | if (mDataList.get(position).getOwnData() == 1){ |
| | | holder.getBinding().ivFlower.setVisibility(View.VISIBLE); |
| | | }else { |
| | | holder.getBinding().ivFlower.setVisibility(View.GONE); |
| | | } |
| | | holder.getBinding().layoutTitle.setOnClickListener(v -> { |
| | | AppManager.getAppManager().startActivity( |