Read instructions step header from resources

This commit is contained in:
Kirill Kamakin
2021-11-20 20:21:46 +03:00
parent ff4be6807f
commit 1d2c5584a8
2 changed files with 5 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import gq.kirmanak.mealient.R
import gq.kirmanak.mealient.data.recipes.db.entity.RecipeInstructionEntity
import gq.kirmanak.mealient.databinding.ViewHolderInstructionBinding
@@ -29,7 +30,9 @@ class RecipeInstructionsAdapter :
class RecipeInstructionViewHolder(private val binding: ViewHolderInstructionBinding) :
RecyclerView.ViewHolder(binding.root) {
fun bind(item: RecipeInstructionEntity, position: Int) {
binding.step.text = "Step: ${position + 1}"
binding.step.text = binding.root.resources.getString(
R.string.view_holder_recipe_instructions_step, position + 1
)
binding.instruction.text = item.text
}
}