Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
PuyaDaily/PlmQuiz.kt
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
177 lines (136 sloc)
4.48 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.puyadaily | |
import android.graphics.Color | |
import android.os.Build | |
import androidx.appcompat.app.AppCompatActivity | |
import android.os.Bundle | |
import android.view.View | |
import android.widget.HorizontalScrollView | |
import android.widget.ScrollView | |
import android.widget.TextView | |
import androidx.annotation.RequiresApi | |
import androidx.core.view.isVisible | |
import kotlinx.android.synthetic.main.activity_plm_quiz.* | |
class PlmQuiz : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_plm_quiz) | |
} | |
var res1=0; | |
var res2=0; | |
var res3=0; | |
fun chose11(view: View) | |
{ | |
res1++; | |
layout1.setBackgroundColor(Color.GRAY) | |
btn_1_1.setBackgroundColor(Color.TRANSPARENT) | |
btn_1_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_1_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose12(view: View) | |
{ | |
res2++; | |
layout1.setBackgroundColor(Color.GRAY) | |
btn_1_1.setBackgroundColor(Color.TRANSPARENT) | |
btn_1_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_1_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose13(view: View) | |
{ | |
res3++; | |
layout1.setBackgroundColor(Color.GRAY) | |
btn_1_1.setBackgroundColor(Color.TRANSPARENT) | |
btn_1_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_1_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose21(view: View) | |
{ | |
res1++; | |
layout2.setBackgroundColor(Color.GRAY) | |
btn_2_1.setBackgroundColor(Color.TRANSPARENT) | |
btn_2_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_2_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose22(view: View) | |
{ | |
res2++; | |
layout2.setBackgroundColor(Color.GRAY) | |
btn_2_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_2_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_2_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose23(view: View) | |
{ | |
res3++; | |
layout2.setBackgroundColor(Color.GRAY) | |
btn_2_1.setBackgroundColor(Color.TRANSPARENT) | |
btn_2_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_2_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose31(view: View) | |
{ | |
res1++; | |
layout3.setBackgroundColor(Color.GRAY) | |
btn_3_1.setBackgroundColor(Color.TRANSPARENT) | |
btn_3_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_3_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose32(view: View) | |
{ | |
res2++; | |
layout3.setBackgroundColor(Color.GRAY) | |
btn_3_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_3_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_3_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose33(view: View) | |
{ | |
res3++; | |
layout3.setBackgroundColor(Color.GRAY) | |
btn_3_1.setBackgroundColor(Color.TRANSPARENT) | |
btn_3_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_3_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose41(view: View) | |
{ | |
res1++; | |
layout4.setBackgroundColor(Color.GRAY) | |
btn_4_1.setBackgroundColor(Color.TRANSPARENT) | |
btn_4_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_4_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose42(view: View) | |
{ | |
res2++; | |
layout4.setBackgroundColor(Color.GRAY) | |
btn_4_1.setBackgroundColor(Color.TRANSPARENT) | |
btn_4_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_4_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun chose43(view: View) | |
{ | |
res3++; | |
layout4.setBackgroundColor(Color.GRAY) | |
btn_4_1.setBackgroundColor(Color.TRANSPARENT) | |
btn_4_2.setBackgroundColor(Color.TRANSPARENT) | |
btn_4_3.setBackgroundColor(Color.TRANSPARENT) | |
} | |
fun resFun(view: View) | |
{ | |
scroll.visibility = View.INVISIBLE | |
if(res1>=res2) | |
{ | |
if(res1>=res3) { | |
results.setBackgroundResource(R.drawable.unu) | |
} | |
else | |
results.setBackgroundResource(R.drawable.trei) | |
} | |
else{ | |
if(res2>=res3) { | |
results.setBackgroundResource(R.drawable.doi) | |
} | |
else | |
results.setBackgroundResource(R.drawable.trei) | |
} | |
} | |
} |