├── .gitignore ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── android │ │ └── quizapplication │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── android │ │ │ └── quizapplication │ │ │ ├── BiologyActivity.java │ │ │ ├── ChemistryActivity.java │ │ │ ├── HowTo.java │ │ │ ├── MainActivity.java │ │ │ ├── PhysicsActivity.java │ │ │ └── PlayActivity.java │ └── res │ │ ├── anim │ │ ├── fab_close.xml │ │ ├── fab_open.xml │ │ ├── rotate_backward.xml │ │ └── rotate_forward.xml │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── app_icon.png │ │ ├── biology.png │ │ ├── bullet.png │ │ ├── chemistry.png │ │ ├── custom_border.xml │ │ ├── hawking.jpg │ │ ├── how.png │ │ ├── ic_add.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_loop.xml │ │ ├── ic_send.xml │ │ ├── ic_share.xml │ │ ├── physics.png │ │ ├── play.png │ │ └── share.png │ │ ├── layout │ │ ├── activity_biology.xml │ │ ├── activity_chemistry.xml │ │ ├── activity_how_to.xml │ │ ├── activity_main.xml │ │ ├── activity_physics.xml │ │ ├── activity_play.xml │ │ ├── content_floating.xml │ │ └── popup.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── ic_launcher_background.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── example │ └── android │ └── quizapplication │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/libraries 5 | /.idea/modules.xml 6 | /.idea/workspace.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Quiz App 2 | This is the Quiz App made as a part of Udacity-Google Android Basics Nanodegree Project. 3 | 4 | Some of the app screenshots: 5 | 6 | ![Alt text](https://i.imgur.com/MU7Rzjnl.png) ![Alt text](https://i.imgur.com/3mnR0Rjl.png) 7 | ![Alt text](https://i.imgur.com/2wBbiTHl.png) 8 | ![Alt text](https://i.imgur.com/UnQNxvGl.png) 9 | ![Alt text](https://i.imgur.com/eckFUtxl.png) 10 | ![Alt text](https://i.imgur.com/ybJiUXil.png) 11 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | applicationId "com.example.android.quizapplication" 7 | minSdkVersion 15 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'com.android.support:appcompat-v7:27.1.1' 24 | implementation 'com.android.support.constraint:constraint-layout:1.1.2' 25 | implementation 'com.android.support:cardview-v7:27.1.1' 26 | compile 'com.android.support:design:27.1.1' 27 | testImplementation 'junit:junit:4.12' 28 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 29 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 30 | } 31 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/android/quizapplication/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.android.quizapplication; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.android.quizapplication", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/quizapplication/BiologyActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.android.quizapplication; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.graphics.drawable.ColorDrawable; 6 | import android.os.Bundle; 7 | import android.support.design.widget.FloatingActionButton; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.view.Gravity; 10 | import android.view.LayoutInflater; 11 | import android.view.MotionEvent; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.view.animation.Animation; 15 | import android.view.animation.AnimationUtils; 16 | import android.widget.CheckBox; 17 | import android.widget.EditText; 18 | import android.widget.PopupWindow; 19 | import android.widget.RadioButton; 20 | import android.widget.RadioGroup; 21 | import android.widget.ScrollView; 22 | import android.widget.TextView; 23 | import android.widget.Toast; 24 | 25 | public class BiologyActivity extends AppCompatActivity { 26 | 27 | String doBetter = "You can do better!" + System.getProperty("line.separator") + System.getProperty("line.separator") + "Try again?"; 28 | String poor = "Brush up your knowledge, maybe?"; 29 | String congrats = "Well done!" + System.getProperty("line.separator") + "You are awesome!"; 30 | // Question 1 31 | RadioButton question1_choice1; 32 | RadioButton question1_choice2; 33 | RadioButton question1_choice3; 34 | RadioButton question1_choice4; 35 | // Question 2 36 | RadioButton question2_choice1; 37 | RadioButton question2_choice2; 38 | RadioButton question2_choice3; 39 | RadioButton question2_choice4; 40 | // Question 3 41 | CheckBox question3_choice1; 42 | CheckBox question3_choice2; 43 | CheckBox question3_choice3; 44 | CheckBox question3_choice4; 45 | // Question 4 46 | EditText question4_answer; 47 | // Question 5 48 | CheckBox question5_choice1; 49 | CheckBox question5_choice2; 50 | CheckBox question5_choice3; 51 | CheckBox question5_choice4; 52 | // Question 6 53 | EditText question6_answer; 54 | // Question 7 55 | RadioButton question7_choice1; 56 | RadioButton question7_choice2; 57 | RadioButton question7_choice3; 58 | RadioButton question7_choice4; 59 | // Question 8 60 | EditText question8_answer; 61 | // Question 9 62 | RadioButton question9_choice1; 63 | RadioButton question9_choice2; 64 | RadioButton question9_choice3; 65 | RadioButton question9_choice4; 66 | // Question 10 67 | RadioButton question10_choice1; 68 | RadioButton question10_choice2; 69 | RadioButton question10_choice3; 70 | RadioButton question10_choice4; 71 | int final_score = 0; 72 | private Boolean isFabOpen = false; 73 | private FloatingActionButton fab, fab1, fab2, fab3; 74 | private Animation fab_open, fab_close, rotate_forward, rotate_backward; 75 | 76 | @Override 77 | protected void onCreate(Bundle savedInstanceState) { 78 | super.onCreate(savedInstanceState); 79 | setContentView(R.layout.activity_biology); 80 | fab = findViewById(R.id.fab); 81 | fab1 = findViewById(R.id.fab1); 82 | fab2 = findViewById(R.id.fab2); 83 | fab3 = findViewById(R.id.fab3); 84 | question1_choice1 = findViewById(R.id.question1_choice1); 85 | question1_choice2 = findViewById(R.id.question1_choice2); 86 | question1_choice3 = findViewById(R.id.question1_choice3); 87 | question1_choice4 = findViewById(R.id.question1_choice4); 88 | question2_choice1 = findViewById(R.id.question2_choice1); 89 | question2_choice2 = findViewById(R.id.question2_choice2); 90 | question2_choice3 = findViewById(R.id.question2_choice3); 91 | question2_choice4 = findViewById(R.id.question2_choice4); 92 | question3_choice1 = findViewById(R.id.question3_choice1); 93 | question3_choice2 = findViewById(R.id.question3_choice2); 94 | question3_choice3 = findViewById(R.id.question3_choice3); 95 | question3_choice4 = findViewById(R.id.question3_choice4); 96 | question4_answer = findViewById(R.id.question4_answer); 97 | question5_choice1 = findViewById(R.id.question5_choice1); 98 | question5_choice2 = findViewById(R.id.question5_choice2); 99 | question5_choice3 = findViewById(R.id.question5_choice3); 100 | question5_choice4 = findViewById(R.id.question5_choice4); 101 | question6_answer = findViewById(R.id.question6_answer); 102 | question7_choice1 = findViewById(R.id.question7_choice1); 103 | question7_choice2 = findViewById(R.id.question7_choice2); 104 | question7_choice3 = findViewById(R.id.question7_choice3); 105 | question7_choice4 = findViewById(R.id.question7_choice4); 106 | question8_answer = findViewById(R.id.question8_answer); 107 | question9_choice1 = findViewById(R.id.question9_choice1); 108 | question9_choice2 = findViewById(R.id.question9_choice2); 109 | question9_choice3 = findViewById(R.id.question9_choice3); 110 | question9_choice4 = findViewById(R.id.question9_choice4); 111 | question10_choice1 = findViewById(R.id.question10_choice1); 112 | question10_choice2 = findViewById(R.id.question10_choice2); 113 | question10_choice3 = findViewById(R.id.question10_choice3); 114 | question10_choice4 = findViewById(R.id.question10_choice4); 115 | ScrollView view = findViewById(R.id.scroll_view); 116 | view.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS); 117 | view.setFocusable(true); 118 | view.setFocusableInTouchMode(true); 119 | view.setOnTouchListener(new View.OnTouchListener() { 120 | @Override 121 | public boolean onTouch(View v, MotionEvent event) { 122 | v.requestFocusFromTouch(); 123 | return false; 124 | } 125 | }); 126 | fab_open = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fab_open); 127 | fab_close = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fab_close); 128 | rotate_forward = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_forward); 129 | rotate_backward = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_backward); 130 | 131 | fab.setOnClickListener(new View.OnClickListener() { 132 | @Override 133 | public void onClick(View v) { 134 | if (isFabOpen) { 135 | fab.startAnimation(rotate_backward); 136 | fab1.startAnimation(fab_close); 137 | fab2.startAnimation(fab_close); 138 | fab3.startAnimation(fab_close); 139 | fab1.setClickable(false); 140 | fab2.setClickable(false); 141 | fab3.setClickable(false); 142 | isFabOpen = false; 143 | } else { 144 | 145 | fab.startAnimation(rotate_forward); 146 | fab1.startAnimation(fab_open); 147 | fab2.startAnimation(fab_open); 148 | fab3.startAnimation(fab_open); 149 | fab1.setClickable(true); 150 | fab2.setClickable(true); 151 | fab3.setClickable(true); 152 | isFabOpen = true; 153 | } 154 | } 155 | }); 156 | fab1.setOnClickListener(new View.OnClickListener() { 157 | @Override 158 | public void onClick(View v) { 159 | //------------------------------------------------------------------------------------------ 160 | // Question 1 - Correct Answer is #4 161 | //------------------------------------------------------------------------------------------ 162 | if (question1_choice4.isChecked()) 163 | final_score++; 164 | //------------------------------------------------------------------------------------------ 165 | // Question 2 - Correct Answer is #1 166 | //------------------------------------------------------------------------------------------ 167 | if (question2_choice1.isChecked()) 168 | final_score++; 169 | //------------------------------------------------------------------------------------------ 170 | // Question 3 - Correct Answer is #1 and #2 171 | //------------------------------------------------------------------------------------------ 172 | if (question3_choice1.isChecked() && question3_choice2.isChecked()) 173 | final_score++; 174 | //------------------------------------------------------------------------------------------ 175 | // Question 4 - Correct Answer is Deoxyribo Nucleic Acid 176 | //------------------------------------------------------------------------------------------ 177 | if (question4_answer.getText().toString().toLowerCase().equals("deoxyribo nucleic acid")) 178 | final_score++; 179 | //------------------------------------------------------------------------------------------ 180 | // Question 5 - Correct Answer is #1, #2 and #3 181 | //------------------------------------------------------------------------------------------ 182 | if (question5_choice1.isChecked() && question5_choice2.isChecked() && question5_choice3.isChecked() && !question5_choice4.isChecked()) 183 | final_score++; 184 | //------------------------------------------------------------------------------------------ 185 | // Question 6 - Correct Answer is Robert Brown 186 | //------------------------------------------------------------------------------------------ 187 | if (question6_answer.getText().toString().toLowerCase().equals("robert brown")) 188 | final_score++; 189 | //------------------------------------------------------------------------------------------ 190 | // Question 7 - Correct Answer is #2 191 | //------------------------------------------------------------------------------------------ 192 | if (question7_choice2.isChecked()) 193 | final_score++; 194 | //------------------------------------------------------------------------------------------ 195 | // Question 8 - Correct Answer is Eyes/Eye 196 | //------------------------------------------------------------------------------------------ 197 | if (question8_answer.getText().toString().toLowerCase().equals("eye") || question8_answer.getText().toString().toLowerCase().equals("eyes")) 198 | final_score++; 199 | //------------------------------------------------------------------------------------------ 200 | // Question 9 - Correct Answer is #1 201 | //------------------------------------------------------------------------------------------ 202 | if (question9_choice1.isChecked()) 203 | final_score++; 204 | //------------------------------------------------------------------------------------------ 205 | // Question 10 - Correct Answer is #2 206 | //------------------------------------------------------------------------------------------ 207 | if (question10_choice2.isChecked()) 208 | final_score++; 209 | //Gets the instance of the LayoutInflater, uses the context of this activity 210 | LayoutInflater inflater = (LayoutInflater) BiologyActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 211 | //Inflate the view from a predefined XML layout (no need for root id, using entire layout) 212 | View layout = inflater.inflate(R.layout.popup, null); 213 | 214 | if (final_score <= 3) { 215 | ((TextView) layout.findViewById(R.id.popup)).setText(poor); 216 | } else if (final_score >= 4 && final_score <= 9) { 217 | ((TextView) layout.findViewById(R.id.popup)).setText(doBetter); 218 | } else { 219 | ((TextView) layout.findViewById(R.id.popup)).setText(congrats); 220 | } 221 | //Get the devices screen density to calculate correct pixel sizes 222 | float density = BiologyActivity.this.getResources().getDisplayMetrics().density; 223 | // create a focusable PopupWindow with the given layout and correct size 224 | final PopupWindow pw = new PopupWindow(layout, (int) density * 350, (int) density * 400, true); 225 | pw.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); 226 | pw.setTouchInterceptor(new View.OnTouchListener() { 227 | public boolean onTouch(View v, MotionEvent event) { 228 | if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { 229 | pw.dismiss(); 230 | return true; 231 | } 232 | return false; 233 | } 234 | }); 235 | pw.setOutsideTouchable(true); 236 | // display the pop-up in the center 237 | pw.showAtLocation(layout, Gravity.CENTER, 0, 0); 238 | Context context = getApplicationContext(); 239 | CharSequence text = "Your Score: " + final_score; 240 | int duration = Toast.LENGTH_LONG; 241 | Toast toast = Toast.makeText(context, text, duration); 242 | toast.show(); 243 | } 244 | }); 245 | fab2.setOnClickListener(new View.OnClickListener() { 246 | @Override 247 | public void onClick(View v) { 248 | if (question1_choice1.isChecked() || question1_choice2.isChecked() || question1_choice3.isChecked() || question1_choice4.isChecked() || question2_choice1.isChecked() || question2_choice2.isChecked() || question2_choice3.isChecked() || question2_choice4.isChecked() || question3_choice1.isChecked() || question3_choice2.isChecked() || question3_choice3.isChecked() || question3_choice4.isChecked() || !question4_answer.getText().toString().equals("") || question5_choice1.isChecked() || question5_choice2.isChecked() || question5_choice3.isChecked() || question5_choice4.isChecked() || !question6_answer.getText().toString().equals("") || question7_choice1.isChecked() || question7_choice2.isChecked() || question7_choice3.isChecked() || question7_choice4.isChecked() || !question8_answer.getText().toString().equals("") || question9_choice1.isChecked() || question9_choice2.isChecked() || question9_choice3.isChecked() || question9_choice4.isChecked() || question10_choice1.isChecked() || question10_choice2.isChecked() || question10_choice3.isChecked() || question10_choice4.isChecked()) { 249 | RadioGroup radioGroup1 = findViewById(R.id.radiogroup1); 250 | radioGroup1.clearCheck(); 251 | RadioGroup radioGroup2 = findViewById(R.id.radiogroup2); 252 | radioGroup2.clearCheck(); 253 | question3_choice1.setChecked(false); 254 | question3_choice2.setChecked(false); 255 | question3_choice3.setChecked(false); 256 | question3_choice4.setChecked(false); 257 | question4_answer.setText(null); 258 | question5_choice1.setChecked(false); 259 | question5_choice2.setChecked(false); 260 | question5_choice3.setChecked(false); 261 | question5_choice4.setChecked(false); 262 | question6_answer.setText(null); 263 | RadioGroup radioGroup7 = findViewById(R.id.radiogroup7); 264 | radioGroup7.clearCheck(); 265 | question8_answer.setText(null); 266 | RadioGroup radioGroup9 = findViewById(R.id.radiogroup9); 267 | radioGroup9.clearCheck(); 268 | RadioGroup radioGroup10 = findViewById(R.id.radiogroup10); 269 | radioGroup10.clearCheck(); 270 | final_score = 0; 271 | Toast.makeText(BiologyActivity.this, "Answers reset", Toast.LENGTH_SHORT).show(); 272 | } 273 | } 274 | }); 275 | fab3.setOnClickListener(new View.OnClickListener() { 276 | @Override 277 | public void onClick(View v) { 278 | Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 279 | sharingIntent.setType("text/plain"); 280 | String shareBody = "Hey! Love Quizzes? My highscore is " + final_score + " on Biology\nCan you beat me?\nDownload the app from https://twitter.com/Swapnilsrkr"; 281 | sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); 282 | startActivity(Intent.createChooser(sharingIntent, "Share via")); 283 | } 284 | }); 285 | } 286 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/quizapplication/ChemistryActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.android.quizapplication; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.graphics.drawable.ColorDrawable; 6 | import android.os.Bundle; 7 | import android.support.design.widget.FloatingActionButton; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.view.Gravity; 10 | import android.view.LayoutInflater; 11 | import android.view.MotionEvent; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.view.animation.Animation; 15 | import android.view.animation.AnimationUtils; 16 | import android.widget.CheckBox; 17 | import android.widget.EditText; 18 | import android.widget.PopupWindow; 19 | import android.widget.RadioButton; 20 | import android.widget.RadioGroup; 21 | import android.widget.ScrollView; 22 | import android.widget.TextView; 23 | import android.widget.Toast; 24 | 25 | public class ChemistryActivity extends AppCompatActivity { 26 | 27 | String doBetter = "You can do better!" + System.getProperty("line.separator") + System.getProperty("line.separator") + "Try again?"; 28 | String poor = "Brush up your knowledge, maybe?"; 29 | String congrats = "Well done!" + System.getProperty("line.separator") + "You are awesome!"; 30 | // Question 1 31 | RadioButton question1_choice1; 32 | RadioButton question1_choice2; 33 | RadioButton question1_choice3; 34 | RadioButton question1_choice4; 35 | // Question 2 36 | RadioButton question2_choice1; 37 | RadioButton question2_choice2; 38 | RadioButton question2_choice3; 39 | RadioButton question2_choice4; 40 | // Question 3 41 | CheckBox question3_choice1; 42 | CheckBox question3_choice2; 43 | CheckBox question3_choice3; 44 | CheckBox question3_choice4; 45 | // Question 4 46 | EditText question4_answer; 47 | // Question 5 48 | CheckBox question5_choice1; 49 | CheckBox question5_choice2; 50 | CheckBox question5_choice3; 51 | CheckBox question5_choice4; 52 | // Question 6 53 | EditText question6_answer; 54 | // Question 7 55 | RadioButton question7_choice1; 56 | RadioButton question7_choice2; 57 | RadioButton question7_choice3; 58 | RadioButton question7_choice4; 59 | // Question 8 60 | EditText question8_answer; 61 | // Question 9 62 | RadioButton question9_choice1; 63 | RadioButton question9_choice2; 64 | RadioButton question9_choice3; 65 | RadioButton question9_choice4; 66 | // Question 10 67 | RadioButton question10_choice1; 68 | RadioButton question10_choice2; 69 | RadioButton question10_choice3; 70 | RadioButton question10_choice4; 71 | int final_score = 0; 72 | private Boolean isFabOpen = false; 73 | private FloatingActionButton fab, fab1, fab2, fab3; 74 | private Animation fab_open, fab_close, rotate_forward, rotate_backward; 75 | 76 | @Override 77 | protected void onCreate(Bundle savedInstanceState) { 78 | super.onCreate(savedInstanceState); 79 | setContentView(R.layout.activity_chemistry); 80 | fab = findViewById(R.id.fab); 81 | fab1 = findViewById(R.id.fab1); 82 | fab2 = findViewById(R.id.fab2); 83 | fab3 = findViewById(R.id.fab3); 84 | question1_choice1 = findViewById(R.id.question1_choice1); 85 | question1_choice2 = findViewById(R.id.question1_choice2); 86 | question1_choice3 = findViewById(R.id.question1_choice3); 87 | question1_choice4 = findViewById(R.id.question1_choice4); 88 | question2_choice1 = findViewById(R.id.question2_choice1); 89 | question2_choice2 = findViewById(R.id.question2_choice2); 90 | question2_choice3 = findViewById(R.id.question2_choice3); 91 | question2_choice4 = findViewById(R.id.question2_choice4); 92 | question3_choice1 = findViewById(R.id.question3_choice1); 93 | question3_choice2 = findViewById(R.id.question3_choice2); 94 | question3_choice3 = findViewById(R.id.question3_choice3); 95 | question3_choice4 = findViewById(R.id.question3_choice4); 96 | question4_answer = findViewById(R.id.question4_answer); 97 | question5_choice1 = findViewById(R.id.question5_choice1); 98 | question5_choice2 = findViewById(R.id.question5_choice2); 99 | question5_choice3 = findViewById(R.id.question5_choice3); 100 | question5_choice4 = findViewById(R.id.question5_choice4); 101 | question6_answer = findViewById(R.id.question6_answer); 102 | question7_choice1 = findViewById(R.id.question7_choice1); 103 | question7_choice2 = findViewById(R.id.question7_choice2); 104 | question7_choice3 = findViewById(R.id.question7_choice3); 105 | question7_choice4 = findViewById(R.id.question7_choice4); 106 | question8_answer = findViewById(R.id.question8_answer); 107 | question9_choice1 = findViewById(R.id.question9_choice1); 108 | question9_choice2 = findViewById(R.id.question9_choice2); 109 | question9_choice3 = findViewById(R.id.question9_choice3); 110 | question9_choice4 = findViewById(R.id.question9_choice4); 111 | question10_choice1 = findViewById(R.id.question10_choice1); 112 | question10_choice2 = findViewById(R.id.question10_choice2); 113 | question10_choice3 = findViewById(R.id.question10_choice3); 114 | question10_choice4 = findViewById(R.id.question10_choice4); 115 | ScrollView view = findViewById(R.id.scroll_view); 116 | view.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS); 117 | view.setFocusable(true); 118 | view.setFocusableInTouchMode(true); 119 | view.setOnTouchListener(new View.OnTouchListener() { 120 | @Override 121 | public boolean onTouch(View v, MotionEvent event) { 122 | v.requestFocusFromTouch(); 123 | return false; 124 | } 125 | }); 126 | fab_open = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fab_open); 127 | fab_close = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fab_close); 128 | rotate_forward = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_forward); 129 | rotate_backward = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_backward); 130 | fab.setOnClickListener(new View.OnClickListener() { 131 | @Override 132 | public void onClick(View v) { 133 | if (isFabOpen) { 134 | fab.startAnimation(rotate_backward); 135 | fab1.startAnimation(fab_close); 136 | fab2.startAnimation(fab_close); 137 | fab3.startAnimation(fab_close); 138 | fab1.setClickable(false); 139 | fab2.setClickable(false); 140 | fab3.setClickable(false); 141 | isFabOpen = false; 142 | } else { 143 | 144 | fab.startAnimation(rotate_forward); 145 | fab1.startAnimation(fab_open); 146 | fab2.startAnimation(fab_open); 147 | fab3.startAnimation(fab_open); 148 | fab1.setClickable(true); 149 | fab2.setClickable(true); 150 | fab3.setClickable(true); 151 | isFabOpen = true; 152 | } 153 | } 154 | }); 155 | fab1.setOnClickListener(new View.OnClickListener() { 156 | @Override 157 | public void onClick(View v) { 158 | //------------------------------------------------------------------------------------------ 159 | // Question 1 - Correct Answer is #3 160 | //------------------------------------------------------------------------------------------ 161 | if (question1_choice3.isChecked()) 162 | final_score++; 163 | //------------------------------------------------------------------------------------------ 164 | // Question 2 - Correct Answer is #2 165 | //------------------------------------------------------------------------------------------ 166 | if (question2_choice2.isChecked()) 167 | final_score++; 168 | //------------------------------------------------------------------------------------------ 169 | // Question 3 - Correct Answer is #1, #2, #3 and #4 170 | //------------------------------------------------------------------------------------------ 171 | if (question3_choice1.isChecked() && question3_choice2.isChecked() && question3_choice3.isChecked() && question3_choice4.isChecked()) 172 | final_score++; 173 | //------------------------------------------------------------------------------------------ 174 | // Question 4 - Correct Answer is Dmitri Mendeleev 175 | //------------------------------------------------------------------------------------------ 176 | if (question4_answer.getText().toString().toLowerCase().equals("dmitri mendeleev")) 177 | final_score++; 178 | //------------------------------------------------------------------------------------------ 179 | // Question 5 - Correct Answer is #1, #2 180 | //------------------------------------------------------------------------------------------ 181 | if (question5_choice1.isChecked() && question5_choice2.isChecked()) 182 | final_score++; 183 | //------------------------------------------------------------------------------------------ 184 | // Question 6 - Correct Answer is Gold 185 | //------------------------------------------------------------------------------------------ 186 | if (question6_answer.getText().toString().toLowerCase().equals("gold")) 187 | final_score++; 188 | //------------------------------------------------------------------------------------------ 189 | // Question 7 - Correct Answer is #1 190 | //------------------------------------------------------------------------------------------ 191 | if (question7_choice1.isChecked()) 192 | final_score++; 193 | //------------------------------------------------------------------------------------------ 194 | // Question 8 - Correct Answer is Ethylene 195 | //------------------------------------------------------------------------------------------ 196 | if (question8_answer.getText().toString().toLowerCase().equals("ethylene")) 197 | final_score++; 198 | //------------------------------------------------------------------------------------------ 199 | // Question 9 - Correct Answer is #4 200 | //------------------------------------------------------------------------------------------ 201 | if (question9_choice4.isChecked()) 202 | final_score++; 203 | //------------------------------------------------------------------------------------------ 204 | // Question 10 - Correct Answer is #2 205 | //------------------------------------------------------------------------------------------ 206 | if (question10_choice4.isChecked()) 207 | final_score++; 208 | //Gets the instance of the LayoutInflater, uses the context of this activity 209 | LayoutInflater inflater = (LayoutInflater) ChemistryActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 210 | //Inflate the view from a predefined XML layout (no need for root id, using entire layout) 211 | View layout = inflater.inflate(R.layout.popup, null); 212 | if (final_score <= 3) { 213 | ((TextView) layout.findViewById(R.id.popup)).setText(poor); 214 | } else if (final_score >= 4 && final_score <= 9) { 215 | ((TextView) layout.findViewById(R.id.popup)).setText(doBetter); 216 | } else { 217 | ((TextView) layout.findViewById(R.id.popup)).setText(congrats); 218 | } 219 | //Get the devices screen density to calculate correct pixel sizes 220 | float density = ChemistryActivity.this.getResources().getDisplayMetrics().density; 221 | // create a focusable PopupWindow with the given layout and correct size 222 | final PopupWindow pw = new PopupWindow(layout, (int) density * 350, (int) density * 400, true); 223 | pw.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); 224 | pw.setTouchInterceptor(new View.OnTouchListener() { 225 | public boolean onTouch(View v, MotionEvent event) { 226 | if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { 227 | pw.dismiss(); 228 | return true; 229 | } 230 | return false; 231 | } 232 | }); 233 | pw.setOutsideTouchable(true); 234 | // display the pop-up in the center 235 | pw.showAtLocation(layout, Gravity.CENTER, 0, 0); 236 | Context context = getApplicationContext(); 237 | CharSequence text = "Your Score: " + final_score; 238 | int duration = Toast.LENGTH_LONG; 239 | Toast toast = Toast.makeText(context, text, duration); 240 | toast.show(); 241 | } 242 | }); 243 | fab2.setOnClickListener(new View.OnClickListener() { 244 | @Override 245 | public void onClick(View v) { 246 | if (question1_choice1.isChecked() || question1_choice2.isChecked() || question1_choice3.isChecked() || question1_choice4.isChecked() || question2_choice1.isChecked() || question2_choice2.isChecked() || question2_choice3.isChecked() || question2_choice4.isChecked() || question3_choice1.isChecked() || question3_choice2.isChecked() || question3_choice3.isChecked() || question3_choice4.isChecked() || !question4_answer.getText().toString().equals("") || question5_choice1.isChecked() || question5_choice2.isChecked() || question5_choice3.isChecked() || question5_choice4.isChecked() || !question6_answer.getText().toString().equals("") || question7_choice1.isChecked() || question7_choice2.isChecked() || question7_choice3.isChecked() || question7_choice4.isChecked() || !question8_answer.getText().toString().equals("") || question9_choice1.isChecked() || question9_choice2.isChecked() || question9_choice3.isChecked() || question9_choice4.isChecked() || question10_choice1.isChecked() || question10_choice2.isChecked() || question10_choice3.isChecked() || question10_choice4.isChecked()) { 247 | RadioGroup radioGroup1 = findViewById(R.id.radiogroup1); 248 | radioGroup1.clearCheck(); 249 | RadioGroup radioGroup2 = findViewById(R.id.radiogroup2); 250 | radioGroup2.clearCheck(); 251 | question3_choice1.setChecked(false); 252 | question3_choice2.setChecked(false); 253 | question3_choice3.setChecked(false); 254 | question3_choice4.setChecked(false); 255 | question4_answer.setText(null); 256 | question5_choice1.setChecked(false); 257 | question5_choice2.setChecked(false); 258 | question5_choice3.setChecked(false); 259 | question5_choice4.setChecked(false); 260 | question6_answer.setText(null); 261 | RadioGroup radioGroup4 = findViewById(R.id.radiogroup7); 262 | radioGroup4.clearCheck(); 263 | question8_answer.setText(null); 264 | RadioGroup radioGroup5 = findViewById(R.id.radiogroup9); 265 | radioGroup5.clearCheck(); 266 | RadioGroup radioGroup6 = findViewById(R.id.radiogroup10); 267 | radioGroup6.clearCheck(); 268 | final_score = 0; 269 | Toast.makeText(ChemistryActivity.this, "Answers reset", Toast.LENGTH_SHORT).show(); 270 | } 271 | } 272 | }); 273 | fab3.setOnClickListener(new View.OnClickListener() { 274 | @Override 275 | public void onClick(View v) { 276 | Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 277 | sharingIntent.setType("text/plain"); 278 | String shareBody = "Hey! Love Quizzes? My highscore is " + final_score + " on Chemistry\nCan you beat me?\nDownload the app from https://twitter.com/Swapnilsrkr"; 279 | sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); 280 | startActivity(Intent.createChooser(sharingIntent, "Share via")); 281 | } 282 | }); 283 | } 284 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/quizapplication/HowTo.java: -------------------------------------------------------------------------------- 1 | package com.example.android.quizapplication; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | public class HowTo extends AppCompatActivity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_how_to); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/quizapplication/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.android.quizapplication; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.CardView; 7 | import android.view.View; 8 | 9 | public class MainActivity extends AppCompatActivity { 10 | 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | 17 | CardView play = findViewById(R.id.cardview1); 18 | // Set a click listener on that View 19 | play.setOnClickListener(new View.OnClickListener() { 20 | // The code in this method will be executed when the numbers category is clicked on. 21 | @Override 22 | public void onClick(View view) { 23 | Intent playIntent = new Intent(MainActivity.this, PlayActivity.class); 24 | // Start the new activity 25 | startActivity(playIntent); 26 | } 27 | }); 28 | 29 | CardView howTo = findViewById(R.id.cardview2); 30 | // Set a click listener on that View 31 | howTo.setOnClickListener(new View.OnClickListener() { 32 | // The code in this method will be executed when the numbers category is clicked on. 33 | @Override 34 | public void onClick(View view) { 35 | Intent howToIntent = new Intent(MainActivity.this, HowTo.class); 36 | // Start the new activity 37 | startActivity(howToIntent); 38 | } 39 | }); 40 | } 41 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/quizapplication/PhysicsActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.android.quizapplication; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.graphics.drawable.ColorDrawable; 6 | import android.os.Bundle; 7 | import android.support.constraint.ConstraintLayout; 8 | import android.support.design.widget.FloatingActionButton; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.view.Gravity; 11 | import android.view.LayoutInflater; 12 | import android.view.MotionEvent; 13 | import android.view.View; 14 | import android.view.ViewGroup; 15 | import android.view.animation.Animation; 16 | import android.view.animation.AnimationUtils; 17 | import android.widget.CheckBox; 18 | import android.widget.EditText; 19 | import android.widget.PopupWindow; 20 | import android.widget.RadioButton; 21 | import android.widget.RadioGroup; 22 | import android.widget.ScrollView; 23 | import android.widget.TextView; 24 | import android.widget.Toast; 25 | 26 | public class PhysicsActivity extends AppCompatActivity { 27 | 28 | String doBetter = "You can do better!" + System.getProperty("line.separator") + System.getProperty("line.separator") + "Try again?"; 29 | String poor = "Brush up your knowledge, maybe?"; 30 | String congrats = "Well done!" + System.getProperty("line.separator") + System.getProperty("line.separator") + "You are awesome!"; 31 | // Question 1 32 | RadioButton question1_choice1; 33 | RadioButton question1_choice2; 34 | RadioButton question1_choice3; 35 | RadioButton question1_choice4; 36 | // Question 2 37 | RadioButton question2_choice1; 38 | RadioButton question2_choice2; 39 | RadioButton question2_choice3; 40 | RadioButton question2_choice4; 41 | // Question 3 42 | CheckBox question3_choice1; 43 | CheckBox question3_choice2; 44 | CheckBox question3_choice3; 45 | CheckBox question3_choice4; 46 | // Question 4 47 | EditText question4_answer; 48 | // Question 5 49 | RadioButton question5_choice1; 50 | RadioButton question5_choice2; 51 | RadioButton question5_choice3; 52 | RadioButton question5_choice4; 53 | // Question 6 54 | EditText question6_answer; 55 | // Question 7 56 | RadioButton question7_choice1; 57 | RadioButton question7_choice2; 58 | RadioButton question7_choice3; 59 | RadioButton question7_choice4; 60 | // Question 8 61 | EditText question8_answer; 62 | // Question 9 63 | RadioButton question9_choice1; 64 | RadioButton question9_choice2; 65 | RadioButton question9_choice3; 66 | RadioButton question9_choice4; 67 | // Question 10 68 | RadioButton question10_choice1; 69 | RadioButton question10_choice2; 70 | RadioButton question10_choice3; 71 | RadioButton question10_choice4; 72 | int final_score = 0; 73 | private Boolean isFabOpen = false; 74 | private FloatingActionButton fab, fab1, fab2, fab3; 75 | private Animation fab_open, fab_close, rotate_forward, rotate_backward; 76 | ConstraintLayout scroll; 77 | 78 | @Override 79 | protected void onCreate(Bundle savedInstanceState) { 80 | super.onCreate(savedInstanceState); 81 | setContentView(R.layout.activity_physics); 82 | fab = findViewById(R.id.fab); 83 | fab1 = findViewById(R.id.fab1); 84 | fab2 = findViewById(R.id.fab2); 85 | fab3 = findViewById(R.id.fab3); 86 | question1_choice1 = findViewById(R.id.question1_choice1); 87 | question1_choice2 = findViewById(R.id.question1_choice2); 88 | question1_choice3 = findViewById(R.id.question1_choice3); 89 | question1_choice4 = findViewById(R.id.question1_choice4); 90 | question2_choice1 = findViewById(R.id.question2_choice1); 91 | question2_choice2 = findViewById(R.id.question2_choice2); 92 | question2_choice3 = findViewById(R.id.question2_choice3); 93 | question2_choice4 = findViewById(R.id.question2_choice4); 94 | question3_choice1 = findViewById(R.id.question3_choice1); 95 | question3_choice2 = findViewById(R.id.question3_choice2); 96 | question3_choice3 = findViewById(R.id.question3_choice3); 97 | question3_choice4 = findViewById(R.id.question3_choice4); 98 | question4_answer = findViewById(R.id.question4_answer); 99 | question5_choice1 = findViewById(R.id.question5_choice1); 100 | question5_choice2 = findViewById(R.id.question5_choice2); 101 | question5_choice3 = findViewById(R.id.question5_choice3); 102 | question5_choice4 = findViewById(R.id.question5_choice4); 103 | question6_answer = findViewById(R.id.question6_answer); 104 | question7_choice1 = findViewById(R.id.question7_choice1); 105 | question7_choice2 = findViewById(R.id.question7_choice2); 106 | question7_choice3 = findViewById(R.id.question7_choice3); 107 | question7_choice4 = findViewById(R.id.question7_choice4); 108 | question8_answer = findViewById(R.id.question8_answer); 109 | question9_choice1 = findViewById(R.id.question9_choice1); 110 | question9_choice2 = findViewById(R.id.question9_choice2); 111 | question9_choice3 = findViewById(R.id.question9_choice3); 112 | question9_choice4 = findViewById(R.id.question9_choice4); 113 | question10_choice1 = findViewById(R.id.question10_choice1); 114 | question10_choice2 = findViewById(R.id.question10_choice2); 115 | question10_choice3 = findViewById(R.id.question10_choice3); 116 | question10_choice4 = findViewById(R.id.question10_choice4); 117 | ScrollView view = findViewById(R.id.scroll_view); 118 | view.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS); 119 | view.setFocusable(true); 120 | view.setFocusableInTouchMode(true); 121 | view.setOnTouchListener(new View.OnTouchListener() { 122 | @Override 123 | public boolean onTouch(View v, MotionEvent event) { 124 | v.requestFocusFromTouch(); 125 | return false; 126 | } 127 | }); 128 | fab_open = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fab_open); 129 | fab_close = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fab_close); 130 | rotate_forward = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_forward); 131 | rotate_backward = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_backward); 132 | fab.setOnClickListener(new View.OnClickListener() { 133 | @Override 134 | public void onClick(View v) { 135 | if (isFabOpen) { 136 | fab.startAnimation(rotate_backward); 137 | fab1.startAnimation(fab_close); 138 | fab2.startAnimation(fab_close); 139 | fab3.startAnimation(fab_close); 140 | fab1.setClickable(false); 141 | fab2.setClickable(false); 142 | fab3.setClickable(false); 143 | isFabOpen = false; 144 | } else { 145 | fab.startAnimation(rotate_forward); 146 | fab1.startAnimation(fab_open); 147 | fab2.startAnimation(fab_open); 148 | fab3.startAnimation(fab_open); 149 | fab1.setClickable(true); 150 | fab2.setClickable(true); 151 | fab3.setClickable(true); 152 | isFabOpen = true; 153 | } 154 | } 155 | }); 156 | fab1.setOnClickListener(new View.OnClickListener() { 157 | @Override 158 | public void onClick(View v) { 159 | //------------------------------------------------------------------------------------------ 160 | // Question 1 - Correct Answer is #2 161 | //------------------------------------------------------------------------------------------ 162 | if (question1_choice2.isChecked()) final_score++; 163 | //------------------------------------------------------------------------------------------ 164 | // Question 2 - Correct Answer is #1 165 | //------------------------------------------------------------------------------------------ 166 | if (question2_choice2.isChecked()) 167 | final_score++; 168 | //------------------------------------------------------------------------------------------ 169 | // Question 3 - Correct Answer is #1 and #2 170 | //------------------------------------------------------------------------------------------ 171 | if (question3_choice1.isChecked() && question3_choice2.isChecked() && question3_choice3.isChecked()) 172 | final_score++; 173 | //------------------------------------------------------------------------------------------ 174 | // Question 4 - Correct Answer is Stephen Hawking 175 | //------------------------------------------------------------------------------------------ 176 | if (question4_answer.getText().toString().toLowerCase().equals("stephen hawking")) 177 | final_score++; 178 | //------------------------------------------------------------------------------------------ 179 | // Question 5 - Correct Answer is #2 180 | //------------------------------------------------------------------------------------------ 181 | if (question5_choice2.isChecked()) 182 | final_score++; 183 | //------------------------------------------------------------------------------------------ 184 | // Question 6 - Correct Answer is Scattering 185 | //------------------------------------------------------------------------------------------ 186 | if (question6_answer.getText().toString().toLowerCase().equals("scattering")) 187 | final_score++; 188 | //------------------------------------------------------------------------------------------ 189 | // Question 7 - Correct Answer is #3 190 | //------------------------------------------------------------------------------------------ 191 | if (question7_choice3.isChecked()) 192 | final_score++; 193 | //------------------------------------------------------------------------------------------ 194 | // Question 8 - Correct Answer is Sound Navigation and Ranging 195 | //------------------------------------------------------------------------------------------ 196 | if (question8_answer.getText().toString().toLowerCase().equals("sound navigation and ranging")) 197 | final_score++; 198 | //------------------------------------------------------------------------------------------ 199 | // Question 9 - Correct Answer is #3 200 | //------------------------------------------------------------------------------------------ 201 | if (question9_choice3.isChecked()) 202 | final_score++; 203 | //------------------------------------------------------------------------------------------ 204 | // Question 10 - Correct Answer is #4 205 | //------------------------------------------------------------------------------------------ 206 | if (question10_choice4.isChecked()) 207 | final_score++; 208 | //Gets the instance of the LayoutInflater, uses the context of this activity 209 | LayoutInflater inflater = (LayoutInflater) PhysicsActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 210 | //Inflate the view from a predefined XML layout (no need for root id, using entire layout) 211 | View layout = inflater.inflate(R.layout.popup, null); 212 | if (final_score <= 3) { 213 | ((TextView) layout.findViewById(R.id.popup)).setText(poor); 214 | } else if (final_score >= 4 && final_score <= 9) { 215 | ((TextView) layout.findViewById(R.id.popup)).setText(doBetter); 216 | } else { 217 | ((TextView) layout.findViewById(R.id.popup)).setText(congrats); 218 | } 219 | //Get the devices screen density to calculate correct pixel sizes 220 | float density = PhysicsActivity.this.getResources().getDisplayMetrics().density; 221 | // create a focusable PopupWindow with the given layout and correct size 222 | final PopupWindow pw = new PopupWindow(layout, (int) density * 350, (int) density * 400, true); 223 | pw.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); 224 | pw.setTouchInterceptor(new View.OnTouchListener() { 225 | public boolean onTouch(View v, MotionEvent event) { 226 | if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { 227 | pw.dismiss(); 228 | return true; 229 | } 230 | return false; 231 | } 232 | }); 233 | pw.setOutsideTouchable(true); 234 | // display the pop-up in the center 235 | pw.showAtLocation(layout, Gravity.CENTER, 0, 0); 236 | Context context = getApplicationContext(); 237 | CharSequence text = "Your Score: " + final_score; 238 | int duration = Toast.LENGTH_LONG; 239 | Toast toast = Toast.makeText(context, text, duration); 240 | toast.show(); 241 | } 242 | }); 243 | fab2.setOnClickListener(new View.OnClickListener() { 244 | @Override 245 | public void onClick(View v) { 246 | if (question1_choice1.isChecked() || question1_choice2.isChecked() || question1_choice3.isChecked() || question1_choice4.isChecked() || question2_choice1.isChecked() || question2_choice2.isChecked() || question2_choice3.isChecked() || question2_choice4.isChecked() || question3_choice1.isChecked() || question3_choice2.isChecked() || question3_choice3.isChecked() || question3_choice4.isChecked() || !question4_answer.getText().toString().equals("") || question5_choice1.isChecked() || question5_choice2.isChecked() || question5_choice3.isChecked() || question5_choice4.isChecked() || !question6_answer.getText().toString().equals("") || question7_choice1.isChecked() || question7_choice2.isChecked() || question7_choice3.isChecked() || question7_choice4.isChecked() || !question8_answer.getText().toString().equals("") || question9_choice1.isChecked() || question9_choice2.isChecked() || question9_choice3.isChecked() || question9_choice4.isChecked() || question10_choice1.isChecked() || question10_choice2.isChecked() || question10_choice3.isChecked() || question10_choice4.isChecked()) { 247 | RadioGroup radioGroup1 = findViewById(R.id.radiogroup1); 248 | radioGroup1.clearCheck(); 249 | RadioGroup radioGroup2 = findViewById(R.id.radiogroup2); 250 | radioGroup2.clearCheck(); 251 | question4_answer.setText(null); 252 | question5_choice1.setChecked(false); 253 | question5_choice2.setChecked(false); 254 | question5_choice3.setChecked(false); 255 | question5_choice4.setChecked(false); 256 | question6_answer.setText(null); 257 | RadioGroup radioGroup7 = findViewById(R.id.radiogroup7); 258 | radioGroup7.clearCheck(); 259 | question8_answer.setText(null); 260 | RadioGroup radioGroup9 = findViewById(R.id.radiogroup9); 261 | radioGroup9.clearCheck(); 262 | RadioGroup radioGroup10 = findViewById(R.id.radiogroup10); 263 | radioGroup10.clearCheck(); 264 | final_score=0; 265 | Toast.makeText(PhysicsActivity.this, "Options Reset", Toast.LENGTH_SHORT).show(); 266 | } 267 | } 268 | }); 269 | fab3.setOnClickListener(new View.OnClickListener() { 270 | @Override 271 | public void onClick(View v) { 272 | Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 273 | sharingIntent.setType("text/plain"); 274 | String shareBody = "Hey! Love Quizzes? My highscore is " + final_score + " on Physics\nCan you beat me?\nDownload the app from https://twitter.com/Swapnilsrkr"; 275 | sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); 276 | startActivity(Intent.createChooser(sharingIntent, "Share via")); 277 | } 278 | }); 279 | } 280 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/quizapplication/PlayActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.android.quizapplication; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.support.v7.widget.CardView; 8 | import android.view.View; 9 | import android.widget.Toast; 10 | 11 | public class PlayActivity extends AppCompatActivity { 12 | 13 | @Override 14 | protected void onCreate(Bundle savedInstanceState) { 15 | super.onCreate(savedInstanceState); 16 | setContentView(R.layout.activity_play); 17 | 18 | CardView phy = findViewById(R.id.phy_card); 19 | // Set a click listener on that View 20 | phy.setOnClickListener(new View.OnClickListener() { 21 | @Override 22 | public void onClick(View view) { 23 | Intent phyIntent = new Intent(PlayActivity.this, PhysicsActivity.class); 24 | startActivity(phyIntent); 25 | } 26 | }); 27 | 28 | CardView chem = findViewById(R.id.chem_card); 29 | // Set a click listener on that View 30 | chem.setOnClickListener(new View.OnClickListener() { 31 | @Override 32 | public void onClick(View view) { 33 | Intent chemIntent = new Intent(PlayActivity.this, ChemistryActivity.class); 34 | startActivity(chemIntent); 35 | } 36 | }); 37 | 38 | CardView bio = findViewById(R.id.bio_card); 39 | // Set a click listener on that View 40 | bio.setOnClickListener(new View.OnClickListener() { 41 | @Override 42 | public void onClick(View view) { 43 | Intent bioIntent = new Intent(PlayActivity.this, BiologyActivity.class); 44 | startActivity(bioIntent); 45 | } 46 | }); 47 | 48 | CardView more = findViewById(R.id.more_card); 49 | more.setOnClickListener(new View.OnClickListener() { 50 | @Override 51 | public void onClick(View v) { 52 | Context context = getApplicationContext(); 53 | CharSequence text = "Patience is the key"; 54 | int duration = Toast.LENGTH_SHORT; 55 | Toast toast = Toast.makeText(context, text, duration); 56 | toast.show(); 57 | } 58 | }); 59 | } 60 | } -------------------------------------------------------------------------------- /app/src/main/res/anim/fab_close.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 14 | 15 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fab_open.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 14 | 15 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/anim/rotate_backward.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/anim/rotate_forward.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/drawable/app_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/biology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/drawable/biology.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/drawable/bullet.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/chemistry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/drawable/chemistry.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/custom_border.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/hawking.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/drawable/hawking.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/how.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/drawable/how.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_add.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_loop.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_send.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_share.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/physics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/drawable/physics.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/drawable/play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/drawable/share.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_biology.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 19 | 20 | 36 | 37 | 40 | 41 | 54 | 55 | 64 | 65 | 72 | 73 | 80 | 81 | 88 | 89 | 96 | 97 | 98 | 99 | 100 | 116 | 117 | 120 | 121 | 134 | 135 | 144 | 145 | 152 | 153 | 160 | 161 | 168 | 169 | 176 | 177 | 178 | 179 | 180 | 196 | 197 | 200 | 201 | 214 | 215 | 225 | 226 | 235 | 236 | 245 | 246 | 255 | 256 | 257 | 258 | 274 | 275 | 278 | 279 | 292 | 293 | 302 | 303 | 304 | 305 | 321 | 322 | 325 | 326 | 339 | 340 | 350 | 351 | 360 | 361 | 370 | 371 | 380 | 381 | 382 | 383 | 399 | 400 | 403 | 404 | 417 | 418 | 427 | 428 | 429 | 430 | 446 | 447 | 450 | 451 | 464 | 465 | 474 | 475 | 482 | 483 | 490 | 491 | 498 | 499 | 506 | 507 | 508 | 509 | 510 | 526 | 527 | 530 | 531 | 544 | 545 | 554 | 555 | 556 | 557 | 573 | 574 | 577 | 578 | 591 | 592 | 601 | 602 | 609 | 610 | 617 | 618 | 625 | 626 | 633 | 634 | 635 | 636 | 637 | 653 | 654 | 657 | 658 | 671 | 672 | 681 | 682 | 689 | 690 | 697 | 698 | 705 | 706 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 726 | 727 | 731 | 732 | 733 | 734 | 735 | 748 | 749 | 762 | 763 | 776 | 777 | 787 | 788 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_chemistry.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 19 | 20 | 36 | 37 | 40 | 41 | 54 | 55 | 64 | 65 | 72 | 73 | 80 | 81 | 88 | 89 | 96 | 97 | 98 | 99 | 100 | 101 | 117 | 118 | 121 | 122 | 135 | 136 | 145 | 146 | 153 | 154 | 161 | 162 | 169 | 170 | 177 | 178 | 179 | 180 | 181 | 197 | 198 | 201 | 202 | 215 | 216 | 226 | 227 | 236 | 237 | 246 | 247 | 256 | 257 | 258 | 259 | 275 | 276 | 279 | 280 | 293 | 294 | 303 | 304 | 305 | 306 | 322 | 323 | 326 | 327 | 340 | 341 | 351 | 352 | 361 | 362 | 371 | 372 | 381 | 382 | 383 | 384 | 400 | 401 | 404 | 405 | 418 | 419 | 428 | 429 | 430 | 431 | 447 | 448 | 451 | 452 | 465 | 466 | 475 | 476 | 483 | 484 | 491 | 492 | 499 | 500 | 507 | 508 | 509 | 510 | 511 | 512 | 528 | 529 | 532 | 533 | 546 | 547 | 556 | 557 | 558 | 559 | 575 | 576 | 579 | 580 | 593 | 594 | 603 | 604 | 611 | 612 | 619 | 620 | 627 | 628 | 635 | 636 | 637 | 638 | 639 | 655 | 656 | 659 | 660 | 673 | 674 | 683 | 684 | 691 | 692 | 699 | 700 | 707 | 708 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 728 | 729 | 733 | 734 | 735 | 736 | 737 | 750 | 751 | 764 | 765 | 778 | 779 | 789 | 790 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_how_to.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 26 | 27 | 31 | 32 | 41 | 42 | 47 | 48 | 54 | 55 | 63 | 64 | 65 | 69 | 70 | 76 | 77 | 85 | 86 | 87 | 91 | 92 | 98 | 99 | 107 | 108 | 109 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 15 | 16 | 26 | 27 | 40 | 41 | 45 | 46 | 52 | 53 | 63 | 64 | 65 | 66 | 78 | 79 | 83 | 84 | 90 | 91 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_play.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 26 | 27 | 31 | 32 | 41 | 42 | 46 | 47 | 52 | 53 | 63 | 64 | 65 | 66 | 67 | 76 | 77 | 81 | 82 | 87 | 88 | 98 | 99 | 100 | 101 | 110 | 111 | 115 | 116 | 121 | 122 | 132 | 133 | 134 | 135 | 144 | 145 | 149 | 150 | 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content_floating.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/popup.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwapnilSrkr/QuizApplication/4d93ba8922b610a7575ca3dc355a2c34c5d43c18/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #6D4C41 5 | #000000 6 | #FFCA28 7 | #7986CB 8 | #69F0AE 9 | #FF8A65 10 | #BA68C8 11 | #42A5F5 12 | #FFA726 13 | #4CAF50 14 | #F48FB1 15 | #D4E157 16 | #FFCA28 17 | #7E57C2 18 | #66BB6A 19 | #8D6E63 20 | #ef5350 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 200dp 4 | 4dp 5 | 28dp 6 | 5dp 7 | 8dp 8 | 18sp 9 | 6dp 10 | 15sp 11 | 8dp 12 | 110dp 13 | 20dp 14 | 12dp 15 | 90dp 16 | 0dp 17 | 160dp 18 | 18dp 19 | 300dp 20 | 10dp 21 | 70sp 22 | 65dp 23 | 70dp 24 | 14dp 25 | 24sp 26 | 18dp 27 | 50dp 28 | 200dp 29 | 200dp 30 | 100dp 31 | 55dp 32 | 200dp 33 | 40dp 34 | 25dp 35 | 30sp 36 | 14dp 37 | 36dp 38 | 13dp 39 | 300dp 40 | 18dp 41 | 18dp 42 | 264dp 43 | 200dp 44 | 100dp 45 | 100dp 46 | 10dp 47 | 40sp 48 | 16dp 49 | 230dp 50 | 350dp 51 | 400dp 52 | 40dp 53 | 100dp 54 | 50sp 55 | 20dp 56 | 30dp 57 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #304FFE 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Quiz Application 3 | FloatingActivity 4 | The absorption of ink by blotting paper involves 5 | viscosity of ink 6 | capillary action phenomenon 7 | diffusion of ink through the blotting 8 | siphon action 9 | Light year is a unit of 10 | time 11 | distance 12 | light 13 | intensity of light 14 | Which physical quantities have the same dimensions? 15 | Distance 16 | Displacement 17 | Amplitude 18 | Young\'s Modulus 19 | Who is this scientist? 20 | Stars which appear single to the naked eye but are double when seen through a telescope are 21 | novas and supernovas 22 | binaries 23 | asteroids 24 | quasars 25 | Sir C.V. Raman was awarded Nobel Prize for his work connected with which of the following phenomenon of radiation? 26 | Of the four locations mentioned below the highest inside temperature will be attained in the pressure cooker operated with the pressure valve open 27 | at sea level 28 | at the top of Mt. Everest 29 | at a place in a valley below sea level 30 | in an aeroplane flying at a height of 10,000 m with inside pressure maintained at the sea level 31 | What is the full form of SONAR? 32 | Supersonic plane fly with the speed 33 | less than the speed of sound 34 | of sound 35 | greater than the speed of sound 36 | of light 37 | Rainbow is due to 38 | absorption of sunlight in minute water droplets 39 | diffusion of sunlight through water droplets 40 | ionisation of water deposits 41 | refraction and reflection of sunlight by water droplets 42 | The most commonly used bleaching agent is 43 | alcohol 44 | carbon dioxide 45 | chlorine 46 | sodium chlorine 47 | The main use of salt in the diet is to 48 | make the taste of food better 49 | produce in small amounts the hydrochloric acid required for the digestion of food 50 | ease the process of cooking 51 | increase the solubility of food particles in water 52 | What are the allotropes of Carbon? 53 | Diamond 54 | Graphite 55 | Lonsdaleite 56 | Buckminsterfullerene 57 | Who formulated the Periodic Law? 58 | Unique properties of carbon are 59 | catenation 60 | has 4 valence electrons 61 | has 2 isotopes 62 | none of these 63 | The most malleable metal is 64 | The high reactivity of fluorine is due to 65 | its high electro negativity 66 | small size of fluorine atom 67 | availability of d-orbitals 68 | strong F - F bond 69 | The gas used for artificial ripening of green fruit is 70 | The mineral containing both magnesium and calcium is 71 | magnesite 72 | calcite 73 | carnallite 74 | dolomite 75 | The hottest part of the gas flame is known as 76 | luminous zone 77 | dark zone 78 | blue zone 79 | non-luminous zone 80 | Ordinary table salt is sodium chloride. What is baking soda? 81 | Potassium chloride 82 | Potassium carbonate 83 | Potassium hydroxide 84 | Sodium bicarbonate 85 | Movement of cell against concentration gradient is called 86 | osmosis 87 | active transport 88 | diffusion 89 | passive transport 90 | Most fish do not sink in water because of the presence of 91 | swim bladder 92 | air bladder 93 | air sacs 94 | air in spongy bones 95 | Full form of DNA is 96 | Prokaryotic cells lack 97 | nucleolus 98 | nuclear membrane 99 | membrane bound by organelles 100 | ribosomes 101 | Nucleus, the genetic material containing rounded body in each cell, was first discovered in 1831 by 102 | Other than spreading malaria, anopheles mosquitoes are also vectors of 103 | dengue fever 104 | filariasis 105 | encephalitis 106 | yellow fever 107 | Myopia is connected with 108 | Most abundant tissues of our body are 109 | muscular 110 | epithelial 111 | connective 112 | nervous 113 | Number of chromosomes in Down\'s syndrome is 114 | 46 115 | 47 116 | 48 117 | 49 118 | How to? 119 | Choose a category 120 | Each category contains 10 questions 121 | Answer the questions 122 | Play! 123 | Physics 124 | Chemistry 125 | Biology 126 | More topics coming soon! 127 | That\'s it! 128 | 129 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 |