Skip to content

Commit

Permalink
Changes in Quizime
Browse files Browse the repository at this point in the history
Fixed small issues with this application..
  • Loading branch information
theyashgrover committed Sep 4, 2021
1 parent 5592b5c commit 8602e1b
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Quizime/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<activity android:name=".ResultActivity"></activity>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.quizime
package com.example.quizime

import android.content.Intent
import android.graphics.Color
Expand Down Expand Up @@ -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 -> {
Expand All @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
android:textColor="#363A43"
android:textSize="22sp"
android:text="What anime does this char. belong to ?"/>

<ImageView
android:id="@+id/iv_image"
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion Quizime/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<foreground android:drawable="@drawable/ic_trophy" />
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<foreground android:drawable="@drawable/ic_trophy" />
</adaptive-icon>
Binary file modified Quizime/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified Quizime/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified Quizime/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified Quizime/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified Quizime/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit 8602e1b

Please sign in to comment.