Deponentlanadigan materiallarning titul varag‘i ehm uchun dastur



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

}
}
}
class AnotherViewHolder(val binding: LearninganotherrecyclerviewItemBinding):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.MainActivity3
import com.example.enlishforkidsbeginner.MainActivity5Learing
import com.example.enlishforkidsbeginner.databinding.RecyclerviewlearningBinding
import com.example.enlishforkidsbeginner.model.Learning

class LearningAdapter constructor(


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

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


val view = RecyclerviewlearningBinding.inflate(LayoutInflater.from(context))
return LearningViewHolder(view)
}

override fun getItemCount(): Int {


return learningarraylist.size
}

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


holder.binding.apply {
textviewrecycleritemlearning.text=learningarraylist.get(position).name
imageviewlearningitem.setImageResource(learningarraylist.get(position).images)

linearlayoutitemlearning.setOnClickListener {


val intent =Intent(context, MainActivity5Learing::class.java)
intent.putExtra("titlename",textviewrecycleritemlearning.text.toString())
context.startActivity(intent)
}
}

}

class LearningViewHolder(var binding: RecyclerviewlearningBinding):ViewHolder(binding.root)


}

package com.example.enlishforkidsbeginner.adapters

import android.annotation.SuppressLint
import android.content.Context
import android.media.MediaPlayer
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.example.enlishforkidsbeginner.databinding.LearningrecyclerviewItemBinding
import com.example.enlishforkidsbeginner.model.LearningModel

class LearningAlphabetAdapter constructor(


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

@SuppressLint("SuspiciousIndentation")


override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LearningAlphabetViewHolder {
val view = LearningrecyclerviewItemBinding.inflate(LayoutInflater.from(context))
return LearningAlphabetViewHolder(view)
}

override fun getItemCount(): Int {


return arrayList.size
}

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


holder.binding.apply {
textviewletter.text= arrayList.get(position).text
imageviewletter.setImageResource(arrayList.get(position).image)

linearlayoutmedia.setOnClickListener {


val mediaPlayer=MediaPlayer.create(context,arrayList.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