android.databinding.ViewDataBinding Java Examples

The following examples show how to use android.databinding.ViewDataBinding. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListBindingAdapters.java    From android-ui-toolkit-demos with Apache License 2.0 7 votes vote down vote up
@Override
public void onItemRangeInserted(ObservableList observableList,
        int start, int count) {
    if (mLayoutId == 0) {
        return;
    }
    startTransition(mTarget);
    final int end = start + count;
    LayoutInflater inflater = (LayoutInflater) mTarget.getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    for (int i = end - 1; i >= start; i--) {
        Object entry = observableList.get(i);
        ViewDataBinding binding =
                bindLayout(inflater, mTarget, mLayoutId, entry);
        mTarget.addView(binding.getRoot(), start);
    }
}
 
Example #2
Source File: ListBindingAdapters.java    From views-widgets-samples with Apache License 2.0 7 votes vote down vote up
@Override
public void onItemRangeInserted(ObservableList observableList,
        int start, int count) {
    if (mLayoutId == 0) {
        return;
    }
    startTransition(mTarget);
    final int end = start + count;
    LayoutInflater inflater = (LayoutInflater) mTarget.getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    for (int i = end - 1; i >= start; i--) {
        Object entry = observableList.get(i);
        ViewDataBinding binding =
                bindLayout(inflater, mTarget, mLayoutId, entry);
        mTarget.addView(binding.getRoot(), start);
    }
}
 
Example #3
Source File: WeatherDailyAdapter.java    From MVVMArms with Apache License 2.0 6 votes vote down vote up
@Override
protected void convert(BaseBindHolder helper, WeatherDailyResponse.DailyResult.Daily item) {
    ViewDataBinding binding = helper.getBinding();
    binding.setVariable(BR.daily, item);
    binding.executePendingBindings();

    SuperTextView superTextView = helper.getView(R.id.super_item_daily);
    ArmsUtils.INSTANCE.obtainArmsComponent(mContext).imageLoader()
            .loadImage(mContext,
                    ImageConfigImpl.builder()
                            .url(String.format(Locale.CHINESE, Api.API_WEATHER_ICON_URL, item.getCodeDay()))
                            .placeholder(R.mipmap.ic_placeholder)
                            .errorPic(R.mipmap.weather_unknown)
                            .transformation(new FitCenter())
                            .imageView(superTextView.getRightIconIV())
                            .build());
}
 
Example #4
Source File: ScatterChart2Model.java    From JZAndroidChart with Apache License 2.0 6 votes vote down vote up
@Override protected void setDataBindingVariables(ViewDataBinding binding) {

    if (binding instanceof LayoutScatterChartBinding) {

      Drawable drawable = AppCompatResources.getDrawable(binding.getRoot().getContext(),
                                                         R.drawable.shape_circle);
      scatterDataSet.setShape(drawable);

      LayoutScatterChartBinding bd = (LayoutScatterChartBinding) binding;

      bd.combineChart.getAxisBottom().setGridCount(1);
      bd.combineChart.getAxisLeft().setGridCount(1);
      bd.combineChart.addDataSet(scatterDataSet);

      bd.combineChart.setOnEntryClickListener(new OnEntryClickListener() {
        @Override public void onEntryClick(Chart chart, int position) {
          if (position >= 0) {
            Toast.makeText(chart.getContext(), textList.get(position), Toast.LENGTH_SHORT).show();
          }
        }
      });
    }

  }
 
Example #5
Source File: SearchPlacesAndCategoriesView.java    From droidkaigi2016 with Apache License 2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(BindingHolder<ViewDataBinding> holder, int position) {
    SearchGroup searchGroup = getItem(position);
    switch (searchGroup.getType()) {
        case CATEGORY:
            ItemSearchCategoryBinding categoryBinding = (ItemSearchCategoryBinding) holder.binding;
            categoryBinding.setCategory((Category) searchGroup);
            categoryBinding.getRoot().setOnClickListener(v -> showSearchedSessions(searchGroup));
            break;
        case PLACE:
            ItemSearchPlaceBinding placeBinding = (ItemSearchPlaceBinding) holder.binding;
            placeBinding.setPlace((Place) searchGroup);
            placeBinding.getRoot().setOnClickListener(v -> showSearchedSessions(searchGroup));
            break;
        default:
            ItemSearchTitleBinding titleBinding = (ItemSearchTitleBinding) holder.binding;
            titleBinding.txtTitle.setText(searchGroup.getName());
            break;
    }
}
 
Example #6
Source File: OpenAPISAdapter.java    From WanAndroid with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected View getItemView(int layoutResId, ViewGroup parent) {
    ViewDataBinding binding;
    if (layoutResId == R.layout.item_open_api) {
        ItemOpenApiBinding b1 = DataBindingUtil.inflate(mLayoutInflater, layoutResId, parent, false);
        b1.setCallback((GeneralClickCallback<ThreeAPIBean.LinkBean>) mViewModel.mClickChildEvent::setValue);
        binding = b1;
    } else if (layoutResId == R.layout.item_open_api_section) {
        ItemOpenApiSectionBinding b2 = DataBindingUtil.inflate(mLayoutInflater, layoutResId, parent, false);
        binding = b2;
    } else {
        return super.getItemView(layoutResId, parent);
    }

    View view = binding.getRoot();
    view.setTag(com.xujiaji.mvvmquick.R.id.BaseQuickAdapter_databinding_support, binding);
    return view;
}
 
Example #7
Source File: DataBinderMapperImpl.java    From Android-POS with MIT License 6 votes vote down vote up
@Override
public ViewDataBinding getDataBinder(DataBindingComponent component, View[] views, int layoutId) {
  if(views == null || views.length == 0) {
    return null;
  }
  int localizedLayoutId = INTERNAL_LAYOUT_ID_LOOKUP.get(layoutId);
  if(localizedLayoutId > 0) {
    final Object tag = views[0].getTag();
    if(tag == null) {
      throw new RuntimeException("view must have a tag");
    }
    switch(localizedLayoutId) {
    }
  }
  return null;
}
 
Example #8
Source File: BoxOfficeAdapter.java    From GracefulMovies with Apache License 2.0 6 votes vote down vote up
@Override
protected void onBind(@NonNull ViewDataBinding binding, BoxOfficeEntity item, int position) {
    super.onBind(binding, item, position);

    ItemBoxOfficeBinding binding_ = (ItemBoxOfficeBinding) binding;
    if ("1".equals(item.getIrank())) {
        binding_.boRankIv.setVisibility(View.VISIBLE);
        binding_.boRankIv.setImageResource(R.drawable.svg_ic_gold_medal);
        binding_.boRankTv.setText("");
    } else if ("2".equals(item.getIrank())) {
        binding_.boRankIv.setVisibility(View.VISIBLE);
        binding_.boRankIv.setImageResource(R.drawable.svg_ic_silver_medal);
        binding_.boRankTv.setText("");
    } else if ("3".equals(item.getIrank())) {
        binding_.boRankIv.setVisibility(View.VISIBLE);
        binding_.boRankIv.setImageResource(R.drawable.svg_ic_bronze_medal);
        binding_.boRankTv.setText("");
    } else {
        binding_.boRankIv.setVisibility(View.INVISIBLE);
        binding_.boRankTv.setText(item.getIrank());
    }
}
 
Example #9
Source File: SearchPlacesAndCategoriesView.java    From droidkaigi2016 with Apache License 2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(BindingHolder<ViewDataBinding> holder, int position) {
    SearchGroup searchGroup = getItem(position);
    switch (searchGroup.getType()) {
        case CATEGORY:
            ItemSearchCategoryBinding categoryBinding = (ItemSearchCategoryBinding) holder.binding;
            categoryBinding.setCategory((Category) searchGroup);
            categoryBinding.getRoot().setOnClickListener(v -> showSearchedSessions(searchGroup));
            break;
        case PLACE:
            ItemSearchPlaceBinding placeBinding = (ItemSearchPlaceBinding) holder.binding;
            placeBinding.setPlace((Place) searchGroup);
            placeBinding.getRoot().setOnClickListener(v -> showSearchedSessions(searchGroup));
            break;
        default:
            ItemSearchTitleBinding titleBinding = (ItemSearchTitleBinding) holder.binding;
            titleBinding.txtTitle.setText(searchGroup.getName());
            break;
    }
}
 
Example #10
Source File: SingleBindingAdapter.java    From all-base-adapter with Apache License 2.0 6 votes vote down vote up
/**
 * 不必关心从缓存取 还是inflate
 *
 * @param parent
 * @param layoutId
 * @return
 */
@Override
public ViewHolder getViewHolderByType(ViewGroup parent, int layoutId) {
    ViewHolder holder = mViewCache.get(layoutId);
    if (holder == null) {
        Log.d("TAG", "创建");
        ViewDataBinding binding = DataBindingUtil.inflate(mInflater, layoutId, parent, false);
        View itemView = binding.getRoot();
        ViewHolder holder2 = new ViewHolder(itemView, layoutId);
        itemView.setTag(R.id.zxt_tag_vh, holder2);
        itemView.setTag(R.id.zxt_tag_vdb, binding);
        return holder2;
    }
    Log.d("TAG", "复用");
    return holder;
}
 
Example #11
Source File: ListBindingAdapters.java    From android-ui-toolkit-demos with Apache License 2.0 6 votes vote down vote up
/**
 * Clears all Views in {@code parent} and fills it with a View for
 * each item in {@code entries}, bound to the item. If layoutId
 * is 0, no Views will be added.
 *
 * @param parent The ViewGroup to contain the list of items.
 * @param layoutId The layout ID to inflate for the child Views.
 * @param entries The list of items to bind to the inflated Views. Each
 *                item will be bound to a different child View.
 */
private static void resetViews(ViewGroup parent, int layoutId,
        List entries) {
    parent.removeAllViews();
    if (layoutId == 0) {
        return;
    }
    LayoutInflater inflater = (LayoutInflater) parent.getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    for (int i = 0; i < entries.size(); i++) {
        Object entry = entries.get(i);
        ViewDataBinding binding = bindLayout(inflater, parent,
                layoutId, entry);
        parent.addView(binding.getRoot());
    }
}
 
Example #12
Source File: DataBindingLayoutPresenters.java    From agera with Apache License 2.0 5 votes vote down vote up
@Override
public void bind(@NonNull final View view) {
  final ViewDataBinding viewDataBinding = DataBindingUtil.bind(view);
  for (int i = 0; i < handlers.size(); i++) {
    final int variableId = handlers.keyAt(i);
    viewDataBinding.setVariable(variableId, handlers.get(variableId));
  }
  viewDataBinding.executePendingBindings();
}
 
Example #13
Source File: SingleBindingAdapter.java    From all-base-adapter with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(ViewGroup parent, int pos, D data) {
    ViewHolder holder = getViewHolderByType(parent, mItemLayoutId);
    ViewDataBinding binding = (ViewDataBinding) holder.itemView.getTag(R.id.zxt_tag_vdb);
    onBindViewHolder(parent, holder, data, pos);
    binding.setVariable(BR.data, data);
    binding.setVariable(BR.itemP, ItemPresenter);
    return holder.itemView;
}
 
Example #14
Source File: HeaderedRecyclerViewDatabindingAdapter.java    From Android-App-Architecture-MVVM-Databinding with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(final RecyclerViewDatabindingAdapter<ItemTypeT>.BindingHolder holder,
                             final int position) {
    if (position == 0) {
        final ViewDataBinding itemBinding = holder.getBinding();
        itemBinding.setVariable(headerParams.headerDataBrId, headerParams.headerData);
        itemBinding.executePendingBindings();
        return;
    }

    super.onBindViewHolder(holder, position);
}
 
Example #15
Source File: RecyclerViewDatabindingAdapter.java    From Android-App-Architecture-MVVM-Databinding with Apache License 2.0 5 votes vote down vote up
@Override
public BindingHolder onCreateViewHolder(final ViewGroup parent, final int viewType) {
    final ViewDataBinding itemBinding =
            DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), itemLayoutId, parent, false);
    final BindingHolder holder = new BindingHolder(itemBinding.getRoot());
    holder.setBinding(itemBinding);
    return holder;
}
 
Example #16
Source File: BindingRecyclerViewAdapter.java    From SimpleFTP with MIT License 5 votes vote down vote up
/**
 * Called when the view holder is created.
 * @param viewGroup The view group.
 * @param layoutId The id of the layout used to display items.
 * @return The built view holder.
 */
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int layoutId)
{
    if (inflater == null)
    {
        inflater = LayoutInflater.from(viewGroup.getContext());
    }

    ViewDataBinding binding = DataBindingUtil.inflate(inflater, layoutId, viewGroup, false);
    return new ViewHolder(binding);
}
 
Example #17
Source File: TimetableAddActivity.java    From Sunshine with Apache License 2.0 5 votes vote down vote up
private void initWeekView() {
    LinearLayoutManager weekLayoutManager = new LinearLayoutManager(this);
    weekLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);

    binding.includeWeek.recyclerView.setLayoutManager(weekLayoutManager);
    final BaseAdapter weekAdapter = new BaseAdapter<>(R.layout.item_ordinal, BR.ordinal, viewModel.getWeeks());
    binding.includeWeek.recyclerView.setAdapter(weekAdapter);
    weekAdapter.setOnItemHandler(
            new BaseAdapter.OnItemHandler() {
                @Override
                public void onItemHandler(ViewDataBinding viewDataBinding, final int position) {
                    final ItemOrdinalBinding itemBinding = (ItemOrdinalBinding) viewDataBinding;
                    if (viewModel.getWeeks().get(position).isSelected()) {
                        Logger.e("被选中的周" + viewModel.getWeeks().get(position).getId());
                        itemBinding.getRoot().setSelected(true);
                    } else {
                        //由于RecyclerView的布局重用机制,这里必须将其他的布局设置为未选中状态
                        itemBinding.getRoot().setSelected(false);
                    }

                    itemBinding.getRoot().setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            viewModel.getWeeks().get(weekPosition).setSelected(false);
                            viewModel.getWeeks().get(position).setSelected(true);
                            weekPosition = position;
                            weekAdapter.notifyDataSetChanged();
                        }
                    });
                }
            }
    );
}
 
Example #18
Source File: TimetableAddActivity.java    From Sunshine with Apache License 2.0 5 votes vote down vote up
private void initTimeView() {
    LinearLayoutManager timeLayoutManager = new LinearLayoutManager(this);
    timeLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    binding.includeTime.recyclerView.setLayoutManager(timeLayoutManager);
    final BaseAdapter timeAdapter = new BaseAdapter<>(R.layout.item_ordinal, BR.ordinal, viewModel.getTime());
    binding.includeTime.recyclerView.setAdapter(timeAdapter);
    timeAdapter.setOnItemHandler(
            new BaseAdapter.OnItemHandler() {
                @Override
                public void onItemHandler(ViewDataBinding viewDataBinding, final int position) {
                    final ItemOrdinalBinding itemBinding = (ItemOrdinalBinding) viewDataBinding;
                    if (viewModel.getTime().get(position).isSelected()) {
                        Logger.e("被选中的课程" + position);
                        itemBinding.getRoot().setSelected(true);
                    } else {
                        //由于RecyclerView的布局重用机制,这里必须将其他的布局设置为未选中状态
                        itemBinding.getRoot().setSelected(false);
                    }

                    itemBinding.getRoot().setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            viewModel.getTime().get(position).setSelected(!viewModel.getTime().get(position).isSelected());
                            timeAdapter.notifyDataSetChanged();
                        }
                    });
                }
            }
    );
}
 
Example #19
Source File: ViewPagerAdapterTest.java    From android-mvvm with Apache License 2.0 5 votes vote down vote up
@Test
@UiThreadTest
public void instantiateItemAddsBindedView() throws Exception {
    ViewGroup container = new LinearLayout(InstrumentationRegistry.getContext());
    sut.instantiateItem(container, 0);
    View child = container.getChildAt(0);

    ViewDataBinding binding = DataBindingUtil.bind(child);

    assertEquals(1, container.getChildCount());
    assertEquals("com.manaschaudhari.android_mvvm.test.databinding.LayoutTestBinding", binding.getClass().getName());
    assertTrue(testBinder.lastBinding == binding);
    assertTrue(testBinder.lastViewModel == viewModelsSource.getValue().get(0));
}
 
Example #20
Source File: BaseExpandableAdapter.java    From ExpandableRecyclerview-Databinding with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(BindingViewHolder holder, int position) {
    Object o = mDataList.get(position);
    ViewDataBinding binding = holder.getBinding();
    binding.setVariable(getVariable(o, position), o);
    binding.executePendingBindings();
    if (o instanceof BaseExpandableObservable) {
        BaseExpandableObservable baseExpandableObservable = (BaseExpandableObservable) o;
        ObservableArrayList<Object> childList = baseExpandableObservable.getChildList();
        if (childList != null && !childList.isEmpty())
            baseExpandableObservable.setItemListExpandCollapseListener(this);
    }
}
 
Example #21
Source File: MulTypeBindngAdapter.java    From all-base-adapter with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(ViewGroup parent, int pos, T data) {
    ViewHolder holder = getViewHolderByType(parent, data.getItemLayoutId());
    ViewDataBinding binding = (ViewDataBinding) holder.itemView.getTag(R.id.zxt_tag_vdb);
    onBindViewHolder(parent, holder, data, pos);
    binding.setVariable(BR.data, data);
    binding.setVariable(BR.itemP, ItemPresenter);
    return holder.itemView;
}
 
Example #22
Source File: CurrencyDetailsActivity.java    From exchange-rates-mvvm with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ViewDataBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_currency_details);
    binding.setVariable(BR.model, mViewModel);
    if (!isRetained(savedInstanceState)) {
        final String currencyCode = getIntent().getStringExtra(INTENT_EXTRA_PARAM_CURRENCY_CODE);
        Bundle bundle = new Bundle();
        bundle.putString(CurrencyDetailsViewModel.KEY_CURRENCY_CODE, currencyCode);
        mViewModel.onLoad(bundle);
    }
}
 
Example #23
Source File: ViewPagerAdapterTest.java    From android-mvvm with Apache License 2.0 5 votes vote down vote up
@Test
@UiThreadTest
public void destroyItemUnbindsAndRemovesChildView() throws Exception {
    ViewGroup container = new LinearLayout(InstrumentationRegistry.getContext());
    Object pagerObject = sut.instantiateItem(container, 0);
    View child = container.getChildAt(0);
    ViewDataBinding binding = DataBindingUtil.bind(child);

    sut.destroyItem(container, 0, pagerObject);

    assertEquals(0, container.getChildCount());
    assertTrue(testBinder.lastBinding == binding);
    assertTrue(testBinder.lastViewModel == null);
}
 
Example #24
Source File: SpinnerResourceAdapter.java    From moserp with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view;
    if (convertView == null) {
        LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
        view = layoutInflater.inflate(layoutId, parent, false);
    } else {
        view = convertView;
    }
    final ViewDataBinding binding =
            DataBindingUtil.bind(view);
    binding.setVariable(BR.item, getResource(position));
    binding.executePendingBindings();
    return view;
}
 
Example #25
Source File: DBMultypeSingleItemActivity.java    From all-base-adapter with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mBinding = ActivityDbBinding.inflate(getLayoutInflater());
    setContentView(mBinding.getRoot());

    mDatas = initDatas();
    mAdapter = new BaseMulTypeBindingAdapter<MulTypeSingleBean>(this, mDatas) {
        @Override
        public void onBindViewHolder(BaseBindingVH<ViewDataBinding> holder, int position) {
            super.onBindViewHolder(holder, position);
            //如果有特殊需求,可传入数据结构的泛型,避免强转
            MulTypeSingleBean data = mDatas.get(position);
            //Binding类 不可避免的需要强转了
            ViewDataBinding binding = holder.getBinding();
            switch (data.getItemLayoutId()) {
                case R.layout.item_db_mul_1:
                    ItemDbMul1Binding itemDbMul1Binding = (ItemDbMul1Binding) binding;
                    break;
                case R.layout.item_db_mul_2:
                    ItemDbMul2Binding itemDbMul2Binding = (ItemDbMul2Binding) binding;
                    break;
            }

        }
    };

    //设置点击事件
    mAdapter.setItemPresenter(new SingleBeanPresenter());

    mBinding.rv.setAdapter(mAdapter);
    mBinding.rv.setLayoutManager(new LinearLayoutManager(this));

}
 
Example #26
Source File: AsyncImageLoader.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
public static void LoadAudioCover(final Callable<Bitmap> loader, final ViewDataBinding binding, final Activity activity){
    final Callbacks updater = new Callbacks() {

        @Override
        public Bitmap getImage() {
            try {
                return loader.call();
            } catch (Exception ignored) {
                return null;
            }
        }

        @Override
        public void updateImage(final Bitmap bitmap, View target) {
            if (bitmap != null && activity != null) {
                activity.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        binding.setVariable(BR.cover, new BitmapDrawable(VLCApplication.getAppResources(), bitmap));
                        binding.executePendingBindings();
                    }
                });
            }

        }
    };
    LoadImage(updater, null);
}
 
Example #27
Source File: ViewPagerAdapter.java    From android-mvvm with Apache License 2.0 5 votes vote down vote up
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    ViewDataBinding binding = (ViewDataBinding) object;
    binder.bind(binding, null);
    binding.executePendingBindings();
    container.removeView(binding.getRoot());
}
 
Example #28
Source File: DataBinderMapper.java    From Small with Apache License 2.0 5 votes vote down vote up
public ViewDataBinding getDataBinder(DataBindingComponent bindingComponent, View view, int layoutId) {
    DataBinderMappable subMapper = getSubMapper(layoutId);
    if (subMapper == null) {
        return null;
    }

    layoutId = subMapper.getLayoutId((String) view.getTag());
    if (layoutId == 0) {
        bindingPackageName = null;
        throw new IllegalArgumentException("View is not a binding layout");
    }

    return subMapper.getDataBinder(bindingComponent, view, layoutId);
}
 
Example #29
Source File: ActorsAdapter.java    From GracefulMovies with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBind(@NonNull ViewDataBinding binding, Actor item, int position) {
    super.onBind(binding, item, position);

    binding.getRoot().setOnClickListener(v -> {
        ArrayList<String> urls = new ArrayList<>();
        for (Actor actor : getData()) {
            urls.add(actor.img);
        }

        ((MovieDetailActivity) getContext()).gotoPreviewImages(urls, position);
    });
}
 
Example #30
Source File: EventLogActivity.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindBinding(ViewDataBinding binding, int bindingVariable, @LayoutRes int layoutId, int position, T item) {
    super.onBindBinding(binding, bindingVariable, layoutId, position, item);
    lastScrollPosition = position;
    updateToTopButtonVisibility(false);
    final TextView tv = binding.getRoot().findViewById(R.id.event_log_item_text);
    if (tv != null) tv.setTextColor(model.colorForPosition(position));
}