Search in sources :

Example 1 with ItemCategoryBinding

use of com.google.samples.apps.topeka.databinding.ItemCategoryBinding in project android-topeka by googlesamples.

the class CategoryAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
    ItemCategoryBinding binding = holder.getBinding();
    Category category = mCategories.get(position);
    binding.setCategory(category);
    binding.executePendingBindings();
    setCategoryIcon(category, binding.categoryIcon);
    holder.itemView.setBackgroundColor(getColor(category.getTheme().getWindowBackgroundColor()));
    binding.categoryTitle.setTextColor(getColor(category.getTheme().getTextPrimaryColor()));
    binding.categoryTitle.setBackgroundColor(getColor(category.getTheme().getPrimaryColor()));
    holder.itemView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mOnItemClickListener.onClick(v, holder.getAdapterPosition());
        }
    });
}
Also used : ItemCategoryBinding(com.google.samples.apps.topeka.databinding.ItemCategoryBinding) Category(com.google.samples.apps.topeka.model.Category) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 ItemCategoryBinding (com.google.samples.apps.topeka.databinding.ItemCategoryBinding)1 Category (com.google.samples.apps.topeka.model.Category)1