diff --git a/Quizime/app/src/main/AndroidManifest.xml b/Quizime/app/src/main/AndroidManifest.xml index 6933386..b15c777 100644 --- a/Quizime/app/src/main/AndroidManifest.xml +++ b/Quizime/app/src/main/AndroidManifest.xml @@ -6,7 +6,7 @@ android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" - android:roundIcon="@mipmap/ic_launcher_round" + android:roundIcon="@mipmap/ic_launcher" android:supportsRtl="true" android:theme="@style/Theme.Quizime"> diff --git a/Quizime/app/src/main/java/com/example/quizime/QuizQuestionsActivity.kt b/Quizime/app/src/main/java/com/example/quizime/QuizQuestionsActivity.kt index f56c1a9..da38bf1 100644 --- a/Quizime/app/src/main/java/com/example/quizime/QuizQuestionsActivity.kt +++ b/Quizime/app/src/main/java/com/example/quizime/QuizQuestionsActivity.kt @@ -1,4 +1,4 @@ -package com.example.quizime + package com.example.quizime import android.content.Intent import android.graphics.Color @@ -71,65 +71,63 @@ class QuizQuestionsActivity : AppCompatActivity() , View.OnClickListener{ for(option in options){ option.setTextColor(Color.parseColor("#7A8089")) - option.typeface = Typeface.DEFAULT + option.typeface = Typeface.DEFAULT //setting the typeface (bold/italic/default appearance) option.background = ContextCompat.getDrawable(this , R.drawable.default_shape) } } override fun onClick(v: View?) { - when(v?.id){ + when (v?.id) { R.id.tv_option_one -> { - selectedOptionView(tv_option_one , 1) + selectedOptionView(tv_option_one, 1) } R.id.tv_option_two -> { - selectedOptionView(tv_option_two , 2) + selectedOptionView(tv_option_two, 2) } R.id.tv_option_three -> { - selectedOptionView(tv_option_three , 3) + selectedOptionView(tv_option_three, 3) } R.id.tv_option_four -> { - selectedOptionView(tv_option_four , 4) + selectedOptionView(tv_option_four, 4) } R.id.quesubmit -> { - if(mSelectedOptionPosition==0){ + if (mSelectedOptionPosition == 0) { mCurrentPosition++ - } - when{ - mCurrentPosition <= mQuestionsList!!.size-> - { - setQuestion() - } - else->{ - val intent = Intent(this , ResultActivity::class.java) - intent.putExtra(Constants.USER_NAME , mUserName) - intent.putExtra(Constants.CORRECT_ANSWERS , mCorrectAnswers) - intent.putExtra(Constants.TOTAL_QUESTIONS , mQuestionsList!!.size) - startActivity(intent) - finish() - } - } - } - else->{ - val question = mQuestionsList?.get(mCurrentPosition-1) + when { + mCurrentPosition <= mQuestionsList!!.size -> { + setQuestion() + } + else -> { + val intent = Intent(this, ResultActivity::class.java) + intent.putExtra(Constants.USER_NAME, mUserName) + intent.putExtra(Constants.CORRECT_ANSWERS, mCorrectAnswers) + intent.putExtra(Constants.TOTAL_QUESTIONS, mQuestionsList!!.size) + startActivity(intent) + finish() + } + + } + } else { + val question = mQuestionsList?.get(mCurrentPosition - 1) if(question!!.correctAnswer != mSelectedOptionPosition){ - answerCorrectView(mSelectedOptionPosition , R.drawable.wrong_option_border) + answerCorrectView(mSelectedOptionPosition,R.drawable.wrong_option_border) } else{ mCorrectAnswers++ - } - answerCorrectView(mSelectedOptionPosition , R.drawable.correct_option_border) + answerCorrectView(mSelectedOptionPosition,R.drawable.correct_option_border) + } - if(mCurrentPosition == mQuestionsList!!.size){ - quesubmit.text == "FINISH" - }else{ - quesubmit.text == "GO TO NEXT QUESTION" + if (mCurrentPosition == mQuestionsList!!.size) { + quesubmit.text == "FINISH" + } else { + quesubmit.text == "GO TO NEXT QUESTION" + } + mSelectedOptionPosition = 0 + } + } } - mSelectedOptionPosition = 0 - } -} } - private fun answerCorrectView(answer :Int , drawableView :Int){ when(answer){ 1 -> { @@ -155,7 +153,7 @@ class QuizQuestionsActivity : AppCompatActivity() , View.OnClickListener{ } private fun selectedOptionView(tv: TextView , selectedOptionNum : Int){ - defaultOptionsView() + defaultOptionsView() //resett ing to the default view mSelectedOptionPosition = selectedOptionNum tv.setTextColor(Color.parseColor("#363A43")) diff --git a/Quizime/app/src/main/res/layout/activity_quiz_questions.xml b/Quizime/app/src/main/res/layout/activity_quiz_questions.xml index 3dbd48f..fe08db2 100644 --- a/Quizime/app/src/main/res/layout/activity_quiz_questions.xml +++ b/Quizime/app/src/main/res/layout/activity_quiz_questions.xml @@ -22,7 +22,6 @@ android:textColor="#363A43" android:textSize="22sp" android:text="What anime does this char. belong to ?"/> - - + \ No newline at end of file diff --git a/Quizime/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/Quizime/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index eca70cf..2af3588 100644 --- a/Quizime/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/Quizime/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/Quizime/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Quizime/app/src/main/res/mipmap-hdpi/ic_launcher.png index a571e60..dc4a317 100644 Binary files a/Quizime/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/Quizime/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/Quizime/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/Quizime/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 61da551..0000000 Binary files a/Quizime/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/Quizime/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Quizime/app/src/main/res/mipmap-mdpi/ic_launcher.png index c41dd28..bb4af26 100644 Binary files a/Quizime/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/Quizime/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/Quizime/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/Quizime/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index db5080a..0000000 Binary files a/Quizime/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/Quizime/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Quizime/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 6dba46d..d80b31f 100644 Binary files a/Quizime/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/Quizime/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/Quizime/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/Quizime/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index da31a87..0000000 Binary files a/Quizime/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/Quizime/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Quizime/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 15ac681..73bdb9c 100644 Binary files a/Quizime/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/Quizime/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/Quizime/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/Quizime/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index b216f2d..0000000 Binary files a/Quizime/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/Quizime/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Quizime/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index f25a419..cd09e48 100644 Binary files a/Quizime/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/Quizime/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/Quizime/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/Quizime/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index e96783c..0000000 Binary files a/Quizime/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ