public void RefreshTotalChecked(
      TextView totalCheckedTextView, TextView tvName, LinearLayout layout, int position) {
    ShoppingList shoppingList = shoppingLists.get(position);
    String text =
        DataManager.shoppingListGetChecked(shoppingList) + "/" + shoppingList.getItems().size();
    totalCheckedTextView.setText(text);

    boolean shoppingListIsChecked = DataManager.shoppingListIsChecked(shoppingList);
    if (shoppingListIsChecked) {
      DataManager.setShoppingListIsChecked(shoppingList, true);
      layout
          .getBackground()
          .setColorFilter(
              context.getResources().getColor(R.color.itemListBackgroundChecked),
              PorterDuff.Mode.MULTIPLY);
      tvName.setPaintFlags(tvName.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      DataManager.setShoppingListIsChecked(shoppingList, false);
      layout
          .getBackground()
          .setColorFilter(
              context.getResources().getColor(R.color.itemListBackground),
              PorterDuff.Mode.MULTIPLY);
      tvName.setPaintFlags(tvName.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }
  }
  @Override
  public void onBindViewHolder(final ShoppingListHolder holder, final int position) {
    final ShoppingList shoppingList = shoppingLists.get(position);

    holder.mTextView_shopping_list_name.setText(shoppingList.getName());
    holder.mLayoutName.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            DataManager.toggleExpanded(shoppingList);
            notifyDataSetChanged();
          }
        });
    holder.mLayoutName.setOnLongClickListener(
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            final ShoppingListRenameDialog myDialogFragment = new ShoppingListRenameDialog();
            myDialogFragment.mOldName = holder.mTextView_shopping_list_name.getText().toString();
            myDialogFragment.show(
                ((Activity) context).getFragmentManager(), "ShoppingListRenameDialog");
            myDialogFragment.mListener =
                new ShoppingListRenameDialog.ShoppingListRenameDialogListener() {
                  @Override
                  public void onDialogPositiveClick(DialogFragment dialog, String text) {
                    if (!text.equals("")) {
                      holder.mTextView_shopping_list_name.setText(text);
                      DataManager.setNameShoppingList(
                          shoppingList, holder.mTextView_shopping_list_name.getText().toString());
                    }
                  }
                };
            return false;
          }
        });
    // устанавливаем background
    if (shoppingList.isExpanded()) {
      holder.mItemLayout.setBackgroundResource(R.drawable.rectangle_rounded_some);
    } else {
      holder.mItemLayout.setBackgroundResource(R.drawable.rectangle_rounded_all);
    }
    RefreshTotalChecked(
        holder.mTotalChecked, holder.mTextView_shopping_list_name, holder.mItemLayout, position);

    if (shoppingList.isFavorite()) {
      holder.mButton_favorite.setBackgroundResource(R.drawable.ic_action_favorite);
    } else {
      holder.mButton_favorite.setBackgroundResource(R.drawable.ic_action_favorite_out);
    }

    holder.mButton_favorite.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            DataManager.toggleFavorite(shoppingList);
            notifyItemChanged(position);
          }
        });
    holder.mButton_edit.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onShoppingListEdit.onShoppingListEdit(shoppingList.getId());
          }
        });
    final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    holder.mRecyclerView.setLayoutManager(linearLayoutManager);
    List<ShoppingListItem> values =
        shoppingList.getItems().where().findAllSorted("position", Sort.DESCENDING);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

    Resources r = context.getResources();
    int height =
        (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 54, r.getDisplayMetrics());

    if (shoppingList.isExpanded()) {
      params.height = height * values.size();
    } else {
      params.height = 0;
    }
    holder.mRecyclerView.setLayoutParams(params);
    ShoppingListItemRecyclerAdapter adapter =
        new ShoppingListItemRecyclerAdapter(
            values,
            false,
            this,
            holder.mItemLayout,
            mShoppingListItemAdapterCallback,
            position,
            context,
            null);
    holder.mRecyclerView.setAdapter(adapter);
  }