@ -0,0 +1,15 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
@ -0,0 +1 @@
|
|||||||
|
/build
|
@ -0,0 +1,40 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
id 'org.jetbrains.kotlin.android'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace 'fr.iut.pm.quiz'
|
||||||
|
compileSdk 33
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "fr.iut.pm.quiz"
|
||||||
|
minSdk 16
|
||||||
|
targetSdk 33
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '1.8'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'androidx.core:core-ktx:1.9.0'
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.5.1'
|
||||||
|
implementation 'com.google.android.material:material:1.6.1'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
@ -0,0 +1,24 @@
|
|||||||
|
package fr.iut.pm.quiz
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
fun useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
assertEquals("fr.iut.pm.quiz", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.Quiz"
|
||||||
|
tools:targetApi="33">
|
||||||
|
<activity
|
||||||
|
android:name=".QuizActivity"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name=".CheatActivity" />
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
@ -0,0 +1,59 @@
|
|||||||
|
package fr.iut.pm.quiz
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.widget.Button
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
|
||||||
|
|
||||||
|
private const val EXTRA_ANSWER_IS_TRUE = "fr.iut.pm.quiz.answer_is_true"
|
||||||
|
private const val EXTRA_ANSWER_SHOWN = "fr.iut.pm.quiz.answer_shown"
|
||||||
|
|
||||||
|
class CheatActivity : AppCompatActivity() {
|
||||||
|
private var answerIsTrue = false
|
||||||
|
private var answerShown = false
|
||||||
|
|
||||||
|
private lateinit var textViewAnswer : TextView
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newIntent(context: Context, answerIsTrue: Boolean) =
|
||||||
|
Intent(context, CheatActivity::class.java).apply {
|
||||||
|
putExtra(EXTRA_ANSWER_IS_TRUE, answerIsTrue)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun wasAnswerShown(result: Intent) = result.getBooleanExtra(EXTRA_ANSWER_SHOWN, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_cheat)
|
||||||
|
|
||||||
|
textViewAnswer = findViewById(R.id.textView_answer)
|
||||||
|
|
||||||
|
answerIsTrue = intent.getBooleanExtra(EXTRA_ANSWER_IS_TRUE, false)
|
||||||
|
savedInstanceState?.let {
|
||||||
|
answerShown = it.getBoolean(EXTRA_ANSWER_SHOWN)
|
||||||
|
if (answerShown) showAnswer()
|
||||||
|
}
|
||||||
|
findViewById<Button>(R.id.button_show_answer).setOnClickListener { showAnswer() }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showAnswer() {
|
||||||
|
answerShown = true
|
||||||
|
textViewAnswer.setText(if (answerIsTrue) R.string.text_button_true else R.string.text_button_false)
|
||||||
|
setHasCheated()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setHasCheated() {
|
||||||
|
val data = Intent().apply { putExtra(EXTRA_ANSWER_SHOWN, true) }
|
||||||
|
setResult(Activity.RESULT_OK, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
super.onSaveInstanceState(outState)
|
||||||
|
outState.putBoolean(EXTRA_ANSWER_SHOWN, answerShown)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
package fr.iut.pm.quiz
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.widget.Button
|
||||||
|
import android.widget.TextView
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import fr.iut.pm.quiz.question.TrueFalseQuestion
|
||||||
|
|
||||||
|
|
||||||
|
private const val CURRENT_QUESTION_INDEX = "fr.iut.pm.quiz.currentQuestionIndex"
|
||||||
|
private const val IS_CHEATER = "fr.iut.pm.quiz.isCheater"
|
||||||
|
|
||||||
|
class QuizActivity : AppCompatActivity() {
|
||||||
|
private lateinit var questions: List<TrueFalseQuestion>
|
||||||
|
private var currentQuestionIndex = 0
|
||||||
|
private var isCheater = false
|
||||||
|
|
||||||
|
private lateinit var textViewQuestion: TextView
|
||||||
|
|
||||||
|
|
||||||
|
private val cheatLauncher = registerForActivityResult(StartActivityForResult()) { result ->
|
||||||
|
if (result.resultCode == Activity.RESULT_OK)
|
||||||
|
result.data?.let { isCheater = CheatActivity.wasAnswerShown(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_quiz)
|
||||||
|
|
||||||
|
textViewQuestion = findViewById(R.id.textView_question)
|
||||||
|
|
||||||
|
currentQuestionIndex = savedInstanceState?.getInt(CURRENT_QUESTION_INDEX) ?: 0
|
||||||
|
isCheater = savedInstanceState?.getBoolean(IS_CHEATER) ?: false
|
||||||
|
|
||||||
|
questions = createQuestionStub(resources)
|
||||||
|
updateQuestion()
|
||||||
|
initButtons()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun updateQuestion() {
|
||||||
|
textViewQuestion.text = questions[currentQuestionIndex].questionText
|
||||||
|
supportActionBar?.subtitle = getString(R.string.subtitle_format, currentQuestionIndex + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun initButtons() {
|
||||||
|
findViewById<Button>(R.id.button_true).setOnClickListener { checkAnswer(true) }
|
||||||
|
findViewById<Button>(R.id.button_false).setOnClickListener { checkAnswer(false) }
|
||||||
|
findViewById<Button>(R.id.button_next).setOnClickListener {
|
||||||
|
currentQuestionIndex = ++currentQuestionIndex % questions.size
|
||||||
|
isCheater = false
|
||||||
|
updateQuestion()
|
||||||
|
}
|
||||||
|
findViewById<Button>(R.id.button_cheat).setOnClickListener {
|
||||||
|
cheatLauncher.launch(
|
||||||
|
CheatActivity.newIntent(
|
||||||
|
this,
|
||||||
|
questions[currentQuestionIndex].isAnswerTrue
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun checkAnswer(givenAnswer: Boolean) {
|
||||||
|
val messageResId = if (isCheater) {
|
||||||
|
R.string.text_cheat_judgment
|
||||||
|
} else {
|
||||||
|
if (questions[currentQuestionIndex].isAnswerTrue == givenAnswer)
|
||||||
|
R.string.text_right_answer
|
||||||
|
else
|
||||||
|
R.string.text_wrong_answer
|
||||||
|
}
|
||||||
|
Toast.makeText(this, messageResId, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
super.onSaveInstanceState(outState)
|
||||||
|
outState.putInt(CURRENT_QUESTION_INDEX, currentQuestionIndex)
|
||||||
|
outState.putBoolean(IS_CHEATER, isCheater)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package fr.iut.pm.quiz
|
||||||
|
|
||||||
|
import android.content.res.Resources
|
||||||
|
import fr.iut.pm.quiz.question.TrueFalseQuestion
|
||||||
|
|
||||||
|
fun createQuestionStub(resources: Resources) = mutableListOf<TrueFalseQuestion>().apply {
|
||||||
|
val questionsRes = resources.getStringArray(R.array.text_questions)
|
||||||
|
val answersRes = resources.getStringArray(R.array.answers)
|
||||||
|
|
||||||
|
for (i in questionsRes.indices) {
|
||||||
|
add(TrueFalseQuestion(questionsRes[i], answersRes[i].toBoolean()))
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
package fr.iut.pm.quiz.question
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Une classe représentant une question à laquelle on peut répondre par Vrai ou Faux
|
||||||
|
*/
|
||||||
|
data class TrueFalseQuestion(val questionText: String, val isAnswerTrue: Boolean)
|
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="?attr/colorOnPrimary"
|
||||||
|
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
|
||||||
|
</vector>
|
@ -0,0 +1,24 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="837.8182"
|
||||||
|
android:viewportHeight="837.8182">
|
||||||
|
<group android:translateX="162.90909"
|
||||||
|
android:translateY="162.90909">
|
||||||
|
<path
|
||||||
|
android:pathData="M433.398,67.678C385.562,27.772 322.558,5.795 256,5.795c-66.554,0 -129.554,21.977 -177.394,61.883C27.918,109.963 0,167.037 0,228.38c0,61.348 27.918,118.418 78.606,160.703c44.289,36.946 101.57,58.52 162.641,61.52l56.422,44.062c9.734,7.602 21.57,11.539 33.531,11.539c6.886,0 13.817,-1.305 20.41,-3.969c18.039,-7.293 30.82,-23.66 33.523,-42.93l5.848,-41.672C465.442,377.494 512,306.045 512,228.38C512,167.037 484.086,109.963 433.398,67.678zM331.054,451.627l-70.718,-55.222c-1.446,0.027 -2.879,0.094 -4.336,0.094c-111.301,0 -201.531,-75.27 -201.531,-168.118c0,-92.847 90.23,-168.121 201.531,-168.121c111.305,0 201.535,75.274 201.535,168.121c0,16.844 -2.973,33.102 -8.5,48.438c-0.102,0.286 -0.23,0.559 -0.336,0.84c-1.258,3.426 -2.633,6.813 -4.141,10.141c-0.668,1.465 -1.445,2.894 -2.16,4.34c-1.062,2.156 -2.094,4.328 -3.262,6.438c-0.973,1.766 -2.066,3.476 -3.114,5.206c-1.078,1.786 -2.109,3.594 -3.262,5.344c-1.023,1.558 -2.16,3.062 -3.242,4.59c-1.347,1.902 -2.656,3.829 -4.09,5.68c-0.82,1.058 -1.722,2.07 -2.57,3.117c-1.855,2.282 -3.703,4.57 -5.687,6.774c-0.359,0.398 -0.758,0.778 -1.122,1.172c-19.656,21.398 -45.304,38.77 -74.898,50.301l-6.625,47.211l-2.305,16.046L331.054,451.627z"
|
||||||
|
android:fillColor="#374149"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M184.254,258.361c0.805,-2.328 1.387,-4.851 1.746,-7.578c0.355,-2.73 0.578,-5.706 0.668,-8.922c0.09,-3.222 0.137,-6.754 0.137,-10.602c0,-4.562 -0.066,-8.676 -0.203,-12.344c-0.133,-3.664 -0.519,-7.038 -1.137,-10.125c-0.633,-3.09 -1.59,-5.926 -2.89,-8.519c-1.297,-2.59 -3.149,-5.098 -5.566,-7.516c-3.215,-3.214 -6.883,-5.699 -11,-7.445c-4.114,-1.746 -8.946,-2.614 -14.489,-2.614c-5.542,0 -10.374,0.867 -14.488,2.614c-4.117,1.746 -7.824,4.23 -11.137,7.445c-2.41,2.418 -4.27,4.926 -5.566,7.516c-1.301,2.594 -2.234,5.43 -2.816,8.519c-0.238,1.242 -0.274,2.742 -0.434,4.082c-0.062,0.531 -0.122,1.066 -0.172,1.613c-0.145,1.492 -0.41,2.828 -0.469,4.43c-0.137,3.668 -0.203,7.782 -0.203,12.344c0,4.562 0.066,8.676 0.203,12.344c0.058,1.609 0.324,2.942 0.469,4.434c0.05,0.546 0.11,1.082 0.172,1.609c0.16,1.34 0.195,2.84 0.434,4.082c0.582,3.09 1.515,5.93 2.816,8.523c1.297,2.594 3.156,5.098 5.566,7.516c3.313,3.214 7.02,5.695 11.137,7.442c4.114,1.746 8.946,2.613 14.488,2.613c3.848,0 7.356,-0.445 10.528,-1.336c3.175,-0.894 6.062,-2.152 8.66,-3.758l8.582,8.317l9.797,-9.794l-8.183,-8.183C182.332,262.924 183.45,260.685 184.254,258.361zM167.82,242.998c-0.183,2.461 -0.574,4.519 -1.086,6.347c-0.137,0.383 -0.218,0.817 -0.379,1.176l-7.191,-7.183l-9.66,9.797l-0.02,0.015l0,0l-0.109,0.114l6.914,6.809l1.367,1.39c-1.777,1.145 -3.828,1.726 -6.137,1.726c-2.598,0 -4.894,-0.492 -6.906,-1.477c-2.016,-0.98 -3.734,-2.23 -5.172,-3.758c-0.891,-0.98 -1.629,-2.078 -2.207,-3.285c-0.586,-1.207 -1.054,-2.77 -1.414,-4.692c-0.355,-1.926 -0.602,-4.382 -0.738,-7.378c-0.13,-2.996 -0.196,-6.778 -0.196,-11.34c0,-4.562 0.066,-8.336 0.196,-11.336c0.136,-2.996 0.382,-5.477 0.738,-7.446c0.36,-1.965 0.829,-3.554 1.414,-4.766c0.578,-1.202 1.316,-2.297 2.207,-3.285c1.438,-1.519 3.156,-2.746 5.172,-3.687c2.011,-0.942 4.308,-1.41 6.906,-1.41c2.59,0 4.895,0.469 6.91,1.41c2.012,0.941 3.691,2.168 5.031,3.687c0.89,0.988 1.629,2.082 2.215,3.285c0.578,1.211 1.046,2.801 1.402,4.766c0.359,1.969 0.629,4.45 0.805,7.446c0.179,3 0.269,6.774 0.269,11.336C168.152,236.088 168.039,240.002 167.82,242.998z"
|
||||||
|
android:fillColor="#374149"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M256.187,183.502L256.187,183.502h-0.164v62.117c0,5.543 -1.5,9.856 -4.492,12.938c-2.996,3.094 -7.047,4.633 -12.145,4.633c-5.098,0 -9.121,-1.539 -12.07,-4.633c-2.954,-3.082 -4.43,-7.394 -4.43,-12.938v-62.117h-18.43h-0.058l0,0h-0.156v62.781c0,5.102 0.914,9.707 2.75,13.825c1.828,4.113 4.336,7.621 7.508,10.527c3.176,2.906 6.89,5.164 11.137,6.777c4.246,1.61 8.832,2.41 13.75,2.41c4.918,0 9.504,-0.801 13.75,-2.41c4.254,-1.613 7.961,-3.87 11.137,-6.777c3.172,-2.906 5.679,-6.414 7.515,-10.527c1.836,-4.118 2.75,-8.723 2.75,-13.825v-62.781h-18.297H256.187z"
|
||||||
|
android:fillColor="#374149"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M295.496,183.502l0,0l-0.16,0l0,95.519l18.645,0l0,-95.519l-18.431,0z"
|
||||||
|
android:fillColor="#374149"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M393.266,262.388l-26.88,0l-13.984,-0.085l40.864,-64.047l0,-14.754l-60.696,0l-0.184,0l0,0l-0.16,0l0,16.426l0,0.05l0,0l0,0.161l25.575,0l13.414,0.085l-40.734,63.77l0,15.027l62.785,0z"
|
||||||
|
android:fillColor="#374149"/>
|
||||||
|
</group>
|
||||||
|
</vector>
|
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/white"
|
||||||
|
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
|
||||||
|
</vector>
|
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".CheatActivity">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_show_answer"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/text_button_show_answer"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/text_textView_cheat"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/button_show_answer"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_answer"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/button_show_answer"
|
||||||
|
tools:text="True" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".QuizActivity">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/icon_text_gap"
|
||||||
|
android:layout_marginRight="@dimen/icon_text_gap"
|
||||||
|
android:text="@string/text_button_true"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/button_false"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="packed"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView_question" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_false"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/icon_text_gap"
|
||||||
|
android:layout_marginLeft="@dimen/icon_text_gap"
|
||||||
|
android:text="@string/text_button_false"
|
||||||
|
app:layout_constraintBaseline_toBaselineOf="@+id/button_true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/button_true" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_next"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableEnd="@drawable/ic_navigate_next"
|
||||||
|
android:drawableRight="@drawable/ic_navigate_next"
|
||||||
|
android:drawablePadding="@dimen/icon_text_gap"
|
||||||
|
android:text="@string/text_button_next"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/button_false"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/button_false"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/button_false" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_cheat"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/icon_text_gap"
|
||||||
|
android:layout_marginRight="@dimen/icon_text_gap"
|
||||||
|
android:text="@string/text_button_cheat"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_question"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/button_cheat"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/button_false"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/button_false"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="Is it OK to use hard coded string by using XML namespace 'tools' in the layout file?" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/white" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/white" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 14 KiB |
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Quiz</string>
|
||||||
|
<string name="text_button_true">Vrai</string>
|
||||||
|
<string name="text_button_false">Faux</string>
|
||||||
|
<string name="text_right_answer">Correct</string>
|
||||||
|
<string name="text_wrong_answer">Incorrect</string>
|
||||||
|
<string name="text_button_next">Suivante</string>
|
||||||
|
<string name="text_button_cheat">Tricher</string>
|
||||||
|
<string name="text_textView_cheat">Êtes-vous sûr de voulaire faire ça ?</string>
|
||||||
|
<string name="text_button_show_answer">Oui afficher la réponse</string>
|
||||||
|
<string name="text_cheat_judgment">Tricher c\'est mal</string>
|
||||||
|
<string name="subtitle_format">Question %d</string>
|
||||||
|
|
||||||
|
<string-array name="text_questions">
|
||||||
|
<item>La réponse à la grande question sur la vie l\'univers et le reste est 42 ?</item>
|
||||||
|
<item>Saturne est la plus proche planète de la Terre ?</item>
|
||||||
|
<item>L\'Amazone est le plus long fleuve des Amériques ?</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
@ -0,0 +1,16 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Theme.Quiz" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/black</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor" tools:targetApi="21">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
|
<color name="purple_500">#FF6200EE</color>
|
||||||
|
<color name="purple_700">#FF3700B3</color>
|
||||||
|
<color name="teal_200">#FF03DAC5</color>
|
||||||
|
<color name="teal_700">#FF018786</color>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
</resources>
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<dimen name="icon_text_gap">8dp</dimen>
|
||||||
|
</resources>
|
@ -0,0 +1,25 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">Quiz</string>
|
||||||
|
<string name="text_button_true">True</string>
|
||||||
|
<string name="text_button_false">False</string>
|
||||||
|
<string name="text_right_answer">You\'re right</string>
|
||||||
|
<string name="text_wrong_answer">You\'re wrong</string>
|
||||||
|
<string name="text_button_next">Next</string>
|
||||||
|
<string name="text_button_cheat">Cheat</string>
|
||||||
|
<string name="text_textView_cheat">Are you sure you want to do this?</string>
|
||||||
|
<string name="text_button_show_answer">Yes show the answer</string>
|
||||||
|
<string name="text_cheat_judgment">Cheating is evil</string>
|
||||||
|
<string name="subtitle_format">Question %d</string>
|
||||||
|
|
||||||
|
<string-array name="text_questions">
|
||||||
|
<item>The answer to the ultimate question of life, the universe, and everything is 42?</item>
|
||||||
|
<item>Saturn is the closest planet to the Earth?</item>
|
||||||
|
<item>The Amazon River is the longest river in the Americas?</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="answers">
|
||||||
|
<item>true</item>
|
||||||
|
<item>false</item>
|
||||||
|
<item>true</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
@ -0,0 +1,16 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Theme.Quiz" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor" tools:targetApi="21">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample backup rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/guide/topics/data/autobackup
|
||||||
|
for details.
|
||||||
|
Note: This file is ignored for devices older that API 31
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
<!--
|
||||||
|
<include domain="sharedpref" path="."/>
|
||||||
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
|
-->
|
||||||
|
</full-backup-content>
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample data extraction rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||||
|
for details.
|
||||||
|
-->
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
-->
|
||||||
|
</cloud-backup>
|
||||||
|
<!--
|
||||||
|
<device-transfer>
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
</device-transfer>
|
||||||
|
-->
|
||||||
|
</data-extraction-rules>
|
@ -0,0 +1,17 @@
|
|||||||
|
package fr.iut.pm.quiz
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
fun addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
plugins {
|
||||||
|
id 'com.android.application' version '7.3.0' apply false
|
||||||
|
id 'com.android.library' version '7.3.0' apply false
|
||||||
|
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
# Project-wide Gradle settings.
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app's APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
|
kotlin.code.style=official
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
@ -0,0 +1,6 @@
|
|||||||
|
#Tue Oct 04 00:09:12 CEST 2022
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
@ -0,0 +1,185 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
@ -0,0 +1,16 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rootProject.name = "Quiz"
|
||||||
|
include ':app'
|