Deponentlanadigan materiallarning titul varag‘i ehm uchun dastur


} textviewanswer1.setOnClickListener {



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

}
textviewanswer1.setOnClickListener {
checkanswers(questionModel,textviewanswer1,relAnswer1)
}
textviewanswer2.setOnClickListener {
checkanswers(questionModel,textviewanswer2, relAnswer2)
}
textviewanswer3.setOnClickListener {
checkanswers(questionModel,textviewanswer3, relAnswer3)
}
textviewanswer4.setOnClickListener {
checkanswers(questionModel,textviewanswer4, reAnswer4)
}
}


}
fun setQuestions() {
binding.apply {
checkanswerlimit()
imageviewtest.setImageResource(questionModel.image)
// textviewquestion.text=questionModel.question
val arraylist= arrayListOf(
questionModel.answer1,
questionModel.answer2,
questionModel.answer3,
questionModel.answer4,
)
arraylist.shuffle()
textviewanswer1.text = arraylist.get(0)
textviewanswer2.text = arraylist.get(1)
textviewanswer3.text = arraylist.get(2)
textviewanswer4.text = arraylist.get(3)
clearcheckcolor()
cheked=true
}
}

fun checkanswerlimit() {


title="count=${count}, q}"

if (count < arrayList.size) {


questionModel=arrayList.get(count)
title="count=${count},"
}
if (count==arrayList.size-1){
binding.textviewnext.text="finish"
}

if (count==arrayList.size){


endgame()
}
if (count==arrayList.size+1){
restart()
}
count++

}

fun endgame(){


binding.apply {
//linearlay1.gone()
//pieChart.visible()
textviewnext.text="restart ?"
// textviewtrueorfalseanswer.visible()

var all:Float=trueanswer.toFloat()+falseanswer.toFloat()


var t:Float=trueanswer.toFloat()/arrayList.size
var f:Float=falseanswer.toFloat()/arrayList.size
var b=(arrayList.size-all)/arrayList.size

// textviewtrueorfalseanswer.text="True $trueanswer\nFalse $falseanswer t=$t f=$f"

// pieChart.slices = listOf(
// PieChart.Slice(t.toFloat(), Color.GREEN),
// PieChart.Slice(b, Color.YELLOW),
// PieChart.Slice(f.toFloat(), Color.RED),
// )
// raitingbar.visible()
// raitingbar.numStars=arrayList.size-1
// raitingbar.rating=trueanswer.toFloat()-1


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