@Override public void onBindViewHolder( @NonNull List<Object> items, int position, @NonNull RecyclerView.ViewHolder holder) { ItemPostBinding binding = ((ItemViewBindingHolder) holder).itemPostBinding; binding.getPostViewModel().post.set((Post) items.get(position)); binding.executePendingBindings(); }
@NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent) { ItemPostBinding itemPostBinding = DataBindingUtil.inflate(mLayoutInflater, R.layout.item_post, parent, false); itemPostBinding.setEventBus(mEventBus); itemPostBinding.setDownloadPreferencesManager(mDownloadPreferencesManager); itemPostBinding.setDrawableRequestBuilder(mAvatarRequestBuilder); itemPostBinding.setPostViewModel(new PostViewModel()); return new ItemViewBindingHolder(itemPostBinding); }
public ItemViewBindingHolder(ItemPostBinding itemPostBinding) { super(itemPostBinding.getRoot()); this.itemPostBinding = itemPostBinding; }