Deponentlanadigan materiallarning titul varag‘i ehm uchun dastur



Yüklə 118,5 Kb.
səhifə6/8
tarix03.05.2023
ölçüsü118,5 Kb.
#107053
1   2   3   4   5   6   7   8
dep-materiallar-varaq

}
}
}

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()

Yüklə 118,5 Kb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin