Deponentlanadigan materiallarning titul varag‘i ehm uchun dastur



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

}
}
}

class LearningAlphabetViewHolder(val binding: LearningrecyclerviewItemBinding):ViewHolder(binding.root)


}

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.LearningrecyclerviewItemNumberBinding
import com.example.enlishforkidsbeginner.model.LearningModel

class NumberAdapter(


val context: Context,
val numberarray: ArrayList

):RecyclerView.Adapter(){

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NumberViewHolder {
val view = LearningrecyclerviewItemNumberBinding.inflate(LayoutInflater.from(context))
return NumberViewHolder(view)
}
override fun getItemCount(): Int {
return numberarray.size
}

override fun onBindViewHolder(holder: NumberViewHolder, position: Int) {


holder.binding.apply {
textviewnumber.text=numberarray.get(position).text
imageviewnumber.setImageResource(numberarray.get(position).image)

imageviewnumber.setOnClickListener {


val mediaPlayer=MediaPlayer.create(context,numberarray.get(position).music)
mediaPlayer.start()
}
}
}
class NumberViewHolder(val binding: LearningrecyclerviewItemNumberBinding):RecyclerView.ViewHolder(binding.root)
}

package com.example.enlishforkidsbeginner.adapters

import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.example.enlishforkidsbeginner.MainActivity6Test
import com.example.enlishforkidsbeginner.databinding.RecyclerviewtestBinding
import com.example.enlishforkidsbeginner.model.Learning

class TestAdapter constructor(


val context: Context,
val arrayList: ArrayList
):RecyclerView.Adapter(){

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TestViewHolder {


val view = RecyclerviewtestBinding.inflate(LayoutInflater.from(context))
return TestViewHolder(view)
}

override fun getItemCount(): Int {


return arrayList.size
}

override fun onBindViewHolder(holder: TestViewHolder, position: Int) {


holder.binding.apply {
textviewrecycleritemtest.text=arrayList.get(position).name
imageviewtestitem.setImageResource(arrayList.get(position).images)

linearlayouttest.setOnClickListener {


context.startActivity(Intent(context,MainActivity6Test::class.java))
}
}
}

class TestViewHolder(val binding: RecyclerviewtestBinding):ViewHolder(binding.root)


}



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