Пример #1
0
 @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();
 }
Пример #2
0
  @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);
  }
Пример #3
0
    public ItemViewBindingHolder(ItemPostBinding itemPostBinding) {
      super(itemPostBinding.getRoot());

      this.itemPostBinding = itemPostBinding;
    }