Deponentlanadigan materiallarning titul varag‘i ehm uchun dastur


} } fun restart(){ count=0 setQuestions() trueanswer=0 falseanswer=0 binding.apply {



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

}
}

fun restart(){


count=0
setQuestions()
trueanswer=0
falseanswer=0
binding.apply {
// linearlay1.visible()
// pieChart.gone()
textviewnext.text="next"
// textviewtrueorfalseanswer.gone()
}
}

fun checkanswers(questionModel: QuestionModel,view: TextView, layout: RelativeLayout){


binding.apply {
if (view.text.toString()==questionModel.answer){
//showtoast(this@MainActivity,"true")
ltAnimationRigt.visibility= View.VISIBLE
ltAnimationRigt.playAnimation()
checkcolor(true,view,layout)
if (cheked){
ltAnimationRigt.visibility= View.GONE
ltAnimationRigt.cancelAnimation()
trueanswer++
cheked=false
}
}else{
//showtoast(this@MainActivity,"false")
ltAnimationWrong.visibility = View.VISIBLE
ltAnimationWrong.playAnimation()
checkcolor(false,view,layout)
if (cheked){
ltAnimationWrong.visibility = View.GONE
ltAnimationWrong.cancelAnimation()
cheked=false
falseanswer++
}

}

}


}

fun checkcolor(trueorfalse:Boolean,view: TextView, layout: RelativeLayout){


if (trueorfalse){
view.background= ContextCompat.getDrawable(this@MainActivity6Test,R.drawable.background_green)
layout.background = getDrawable(R.drawable.background_green)

}else{
view.background=ContextCompat.getDrawable(this@MainActivity6Test,R.drawable.background_red)


layout.background = getDrawable(R.drawable.background_red)
}
}

fun clearcheckcolor(){


binding.apply {
textviewanswer1.background=ContextCompat.getDrawable(this@MainActivity6Test,R.drawable.bg_ansverrelative)
relAnswer1.background=ContextCompat.getDrawable(this@MainActivity6Test,R.drawable.bg_ansverrelative)
textviewanswer2.background=ContextCompat.getDrawable(this@MainActivity6Test,R.drawable.bg_ansverrelative)
relAnswer2.background=ContextCompat.getDrawable(this@MainActivity6Test,R.drawable.bg_ansverrelative)
textviewanswer3.background=ContextCompat.getDrawable(this@MainActivity6Test,R.drawable.bg_ansverrelative)
relAnswer3.background=ContextCompat.getDrawable(this@MainActivity6Test,R.drawable.bg_ansverrelative)
textviewanswer4.background=ContextCompat.getDrawable(this@MainActivity6Test,R.drawable.bg_ansverrelative)
reAnswer4.background=ContextCompat.getDrawable(this@MainActivity6Test,R.drawable.bg_ansverrelative)

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