Merge branch 'master' of https://codefirst.iut.uca.fr/git/jade.van_brabandt/3.01-QCM_MuscuMaths
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
f416910ed8
@ -0,0 +1,64 @@
|
|||||||
|
package com.example.mathseduc
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.CountDownTimer
|
||||||
|
import android.widget.Button
|
||||||
|
import android.widget.ProgressBar
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
|
||||||
|
class QuizMultiActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
private lateinit var countDownTimer: CountDownTimer
|
||||||
|
|
||||||
|
var progressBarValue : Int = 0
|
||||||
|
var chronoValue : Int = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_quiz_multi)
|
||||||
|
|
||||||
|
var progressBar1 = findViewById<ProgressBar>(R.id.progressBar1)
|
||||||
|
var chrono = findViewById<ProgressBar>(R.id.chrono)
|
||||||
|
|
||||||
|
progressBar1.max = 100
|
||||||
|
chrono.max = 30
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var incrementeButton = findViewById<Button>(R.id.buttonValider)
|
||||||
|
|
||||||
|
// Initialiser le CountDownTimer
|
||||||
|
countDownTimer = object : CountDownTimer(30*1000, 1000) {
|
||||||
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
|
// Incrémenter la valeur de la ProgressBar chaque seconde
|
||||||
|
chronoValue++
|
||||||
|
chrono.progress = chronoValue
|
||||||
|
progressBarValue++
|
||||||
|
progressBar1.progress = progressBarValue
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFinish() {
|
||||||
|
// Code à exécuter lorsque le timer est terminé
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
incrementeButton.setOnClickListener {
|
||||||
|
progressBarValue += 10
|
||||||
|
progressBar1.progress = progressBarValue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Démarrer le CountDownTimer
|
||||||
|
countDownTimer.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
// Arrêter le CountDownTimer pour éviter les fuites de mémoire
|
||||||
|
countDownTimer.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,36 @@
|
|||||||
package com.example.mathseduc.models
|
package com.example.mathseduc.models
|
||||||
|
|
||||||
|
import android.os.Parcel
|
||||||
|
import android.os.Parcelable
|
||||||
|
|
||||||
data class Player(
|
data class Player(
|
||||||
val id: Int,
|
val id: Int,
|
||||||
val nickname: String,
|
val nickname: String,
|
||||||
val password: String
|
val password: String
|
||||||
|
) : Parcelable {
|
||||||
|
constructor(parcel: Parcel) : this(
|
||||||
|
parcel.readInt(),
|
||||||
|
parcel.readString() ?: "",
|
||||||
|
parcel.readString() ?: ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||||
|
parcel.writeInt(id)
|
||||||
|
parcel.writeString(nickname)
|
||||||
|
parcel.writeString(password)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun describeContents(): Int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object CREATOR : Parcelable.Creator<Player> {
|
||||||
|
override fun createFromParcel(parcel: Parcel): Player {
|
||||||
|
return Player(parcel)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun newArray(size: Int): Array<Player?> {
|
||||||
|
return arrayOfNulls(size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:id="@android:id/background">
|
||||||
|
<shape android:shape="ring"
|
||||||
|
android:thickness="10dp"
|
||||||
|
android:useLevel="false">
|
||||||
|
|
||||||
|
<solid android:color="@color/black"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:id="@+id/chrono">
|
||||||
|
|
||||||
|
<shape android:shape="ring"
|
||||||
|
android:thickness="10dp"
|
||||||
|
android:useLevel="true">
|
||||||
|
|
||||||
|
<solid android:color="@color/white"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
|
|
||||||
|
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</layer-list>
|
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<!-- View border color and width -->
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="@color/white" >
|
||||||
|
</stroke>
|
||||||
|
|
||||||
|
<!-- The radius makes the corners rounded -->
|
||||||
|
<corners
|
||||||
|
android:radius="2dp" >
|
||||||
|
</corners>
|
||||||
|
|
||||||
|
</shape>
|
@ -0,0 +1,204 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar1"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar2"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar3"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar4"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/chrono"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
android:paddingHorizontal="10dp"
|
||||||
|
style="?android:attr/progressBarStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:indeterminateOnly="false"
|
||||||
|
android:rotation="-90"
|
||||||
|
android:progressDrawable="@drawable/chrono"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:paddingVertical="20dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@drawable/question_border"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Question"
|
||||||
|
android:layout_weight="5"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/blue"
|
||||||
|
android:text="Answer1" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.5" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/green"
|
||||||
|
android:text="Answer2" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button3"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/orange"
|
||||||
|
android:text="Answer3" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.5" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button4"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/purple_500"
|
||||||
|
android:text="Answer4" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonPasser"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/red"
|
||||||
|
android:text="Passer" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25" />
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonValider"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/green"
|
||||||
|
android:text="Valider" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
Loading…
Reference in new issue