}
}
}
package com.example.enlishforkidsbeginner
import com.example.enlishforkidsbeginner.model.QuestionModel
class QuestionRepository {
fun getAllQuestions():ArrayList = arrayListOf(
QuestionModel(R.drawable.father,R.raw.aa,"Father","Mother", "Sister","Brother","Father"),
QuestionModel(R.drawable.mother,R.raw.aa,"Mother","Father", "Sister","Brother","Mother"),
QuestionModel(R.drawable.sister,R.raw.aa,"Sister","Mother", "Father","Brother","Sister"),
QuestionModel(R.drawable.father,R.raw.aa,"Brother","Mother", "Sister","Father","Brother"),
)
}
package com.example.enlishforkidsbeginner.adapters
import android.content.Context
import android.media.MediaPlayer
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.enlishforkidsbeginner.databinding.LearninganotherrecyclerviewItemBinding
import com.example.enlishforkidsbeginner.model.LearningAnotherModel
class AnotherAdapter(
val context: Context,
val anotherarray: ArrayList
):RecyclerView.Adapter(){
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AnotherViewHolder {
val view = LearninganotherrecyclerviewItemBinding.inflate(LayoutInflater.from(context))
return AnotherViewHolder(view)
}
override fun getItemCount(): Int {
return anotherarray.size
}
override fun onBindViewHolder(holder: AnotherViewHolder, position: Int) {
holder.binding.apply {
textviewanother.text = anotherarray.get(position).text
imageviewanother.setImageResource(anotherarray.get(position).image)
linearlayoutanother.setOnClickListener {
val mediaPlayer = MediaPlayer.create(context,anotherarray.get(position).music)
mediaPlayer.start()
Dostları ilə paylaş: |