| | |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.view.animation.Animation; |
| | | import android.view.animation.Transformation; |
| | | import android.widget.FrameLayout; |
| | | import androidx.annotation.NonNull; |
| | | import androidx.databinding.DataBindingUtil; |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.GrowthExperienceBean; |
| | | import com.application.zhangshi_app_android.bean.GrowthExperienceRelationshipBean; |
| | | import com.application.zhangshi_app_android.databinding.ItemGrowthExperienceRelationshipBinding; |
| | | import com.application.zhangshi_app_android.ui.function.GrowthExperienceActivity; |
| | | import com.application.zhangshi_app_android.ui.function.GrowthExperienceActivityViewModel; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Gss |
| | | * @date 2023.04.08. 17:08 |
| | | * @date 2023.04.07. 21:31 |
| | | * @desc 成长经历(家庭成员及主要社会关系情况) recyclerView 的 adapter |
| | | */ |
| | | public class GrowthExperienceRelationshipRvAdapter extends BaseRVAdapter<GrowthExperienceBean, ItemGrowthExperienceRelationshipBinding, GrowthExperienceRelationshipRvAdapter.ViewHolder> { |
| | | public class GrowthExperienceRelationshipRvAdapter extends BaseRVAdapter<GrowthExperienceRelationshipBean, ItemGrowthExperienceRelationshipBinding, GrowthExperienceRelationshipRvAdapter.ViewHolder> { |
| | | |
| | | private GrowthExperienceActivityViewModel viewModel; |
| | | |
| | |
| | | this.viewModel = viewModel; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected int getLayoutId() { |
| | | return R.layout.item_growth_experience_relationship; |
| | | } |
| | | |
| | | @Override |
| | | protected ViewHolder getViewHolder(ItemGrowthExperienceRelationshipBinding itemBind) { |
| | | protected ViewHolder getViewHolder(ItemGrowthExperienceRelationshipBinding itemBind,int viewType) { |
| | | return new ViewHolder(itemBind); |
| | | } |
| | | |
| | |
| | | protected void onBind(ViewHolder holder, int position) { |
| | | holder.getBinding().setBean(mDataList.get(position)); |
| | | if (position % 2 != 0){ |
| | | holder.getBinding().cardView.setCardBackgroundColor(mContext.getColor(R.color.color_card_blue)); |
| | | holder.getBinding().cardView.setCardBackgroundColor(mContext.getColor(R.color.color_card_green)); |
| | | }else { |
| | | holder.getBinding().cardView.setCardBackgroundColor(mContext.getColor(R.color.color_card_pink)); |
| | | } |
| | |
| | | } |
| | | } |
| | | }); |
| | | holder.getBinding().layoutContent.setOnClickListener(v -> { |
| | | AppManager.getAppManager().startActivity( |
| | | new Intent(getRecyclerView().getContext(), GrowthExperienceActivity.class) |
| | | .putExtra("bean",mDataList.get(position))); |
| | | }); |
| | | |
| | | } |
| | | |
| | | public static class ViewHolder extends BaseViewHolder<ItemGrowthExperienceRelationshipBinding>{ |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |