copy from app/src/main/java/com/application/zhangshi_app_android/adapter/PetRvAdapter.java
copy to app/src/main/java/com/application/zhangshi_app_android/adapter/PetMemoRvAdapter.java
| File was copied from app/src/main/java/com/application/zhangshi_app_android/adapter/PetRvAdapter.java |
| | |
| | | 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.CleanStorageBean; |
| | | import com.application.zhangshi_app_android.bean.PetBean; |
| | | import com.application.zhangshi_app_android.databinding.ItemCleanStorageBinding; |
| | | import com.application.zhangshi_app_android.databinding.ItemPetBinding; |
| | | import com.application.zhangshi_app_android.bean.PetMemoBean; |
| | | import com.application.zhangshi_app_android.databinding.ItemPetMemoBinding; |
| | | import com.application.zhangshi_app_android.ui.function.CleanStorageDetailActivity; |
| | | import com.application.zhangshi_app_android.ui.function.PetMemoDetailActivity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | |
| | | * @date 2023.04.17. 18:40 |
| | | * @desc |
| | | */ |
| | | public class PetRvAdapter extends BaseRVAdapter<PetBean, ItemPetBinding, PetRvAdapter.ViewHolder> { |
| | | public PetRvAdapter(Context context) { |
| | | public class PetMemoRvAdapter extends BaseRVAdapter<PetMemoBean, ItemPetMemoBinding, PetMemoRvAdapter.ViewHolder> { |
| | | public PetMemoRvAdapter(Context context) { |
| | | super(context); |
| | | } |
| | | |
| | | @Override |
| | | protected int getLayoutId() { |
| | | return R.layout.item_pet; |
| | | return R.layout.item_pet_memo; |
| | | } |
| | | |
| | | @Override |
| | | protected ViewHolder getViewHolder(ItemPetBinding itemBind, int viewType) { |
| | | protected ViewHolder getViewHolder(ItemPetMemoBinding itemBind, int viewType) { |
| | | return new ViewHolder(itemBind); |
| | | } |
| | | |
| | |
| | | }); |
| | | holder.getBinding().layoutContent.setOnClickListener(v -> { |
| | | AppManager.getAppManager().startActivity( |
| | | new Intent(getRecyclerView().getContext(), CleanStorageDetailActivity.class) |
| | | new Intent(getRecyclerView().getContext(), PetMemoDetailActivity.class) |
| | | .putExtra("bean",mDataList.get(position))); |
| | | }); |
| | | |
| | | ImageRvAdapter adapter = new ImageRvAdapter(mContext); |
| | | holder.getBinding().rvImage.setLayoutManager(new GridLayoutManager(mContext,3)); |
| | | holder.getBinding().rvImage.setAdapter(adapter); |
| | | String url = mDataList.get(position).getUrl(); |
| | | if (url == null||url.isEmpty()){ |
| | | return; |
| | | } |
| | | List<String> list; |
| | | if (url.contains(",")){ |
| | | String[] split = url.split(","); |
| | | list = new ArrayList<>(Arrays.asList(split)); |
| | | }else { |
| | | list = new ArrayList<>(); |
| | | list.add(url); |
| | | } |
| | | adapter.setData(list); |
| | | |
| | | } |
| | | |
| | | public static class ViewHolder extends BaseRVAdapter.BaseViewHolder<ItemPetBinding> { |
| | | public static class ViewHolder extends BaseRVAdapter.BaseViewHolder<ItemPetMemoBinding> { |
| | | private boolean isExpended; |
| | | |
| | | public ViewHolder(ItemPetBinding binding) { |
| | | public ViewHolder(ItemPetMemoBinding binding) { |
| | | super(binding); |
| | | } |
| | | } |