mirror of
https://github.com/hmalik144/Udacity_Project-3---Quizapp.git
synced 2025-12-10 03:05:33 +00:00
Initial commit
This commit is contained in:
1
app/.gitignore
vendored
Normal file
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
29
app/build.gradle
Normal file
29
app/build.gradle
Normal file
@@ -0,0 +1,29 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 24
|
||||
buildToolsVersion "25.0.0"
|
||||
defaultConfig {
|
||||
applicationId "com.example.h_mal.quizapp"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 24
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
compile 'com.android.support:appcompat-v7:24.2.1'
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
17
app/proguard-rules.pro
vendored
Normal file
17
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\Users\h_mal\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.example.h_mal.quizapp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumentation test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("com.example.h_mal.quizapp", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
20
app/src/main/AndroidManifest.xml
Normal file
20
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.h_mal.quizapp">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
312
app/src/main/java/com/example/h_mal/quizapp/MainActivity.java
Normal file
312
app/src/main/java/com/example/h_mal/quizapp/MainActivity.java
Normal file
@@ -0,0 +1,312 @@
|
||||
package com.example.h_mal.quizapp;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial score quantity set as public
|
||||
*/
|
||||
int quantity = 0;
|
||||
boolean isCorrectQ1, isCorrectQ2, isCorrectQ3, isCorrectQ4, isCorrectQ5, isCorrectQ6, isCorrectQ7, isCorrectQ8, isCorrectQ9;
|
||||
|
||||
/**
|
||||
* Radioboxes controls defined
|
||||
*/
|
||||
public void QOne(View view) {
|
||||
boolean checked = ((RadioButton) view).isChecked();
|
||||
switch (view.getId()) {
|
||||
case R.id.QOneYes:
|
||||
if (checked) {
|
||||
isCorrectQ1 = true;
|
||||
Toast.makeText(MainActivity.this, "Correct",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
case R.id.QOneNo:
|
||||
if (checked) {
|
||||
isCorrectQ1 = false;
|
||||
RadioGroup questionOneRG = (RadioGroup) findViewById(R.id.QOneGroup);
|
||||
questionOneRG.clearCheck();
|
||||
Toast.makeText(MainActivity.this, "INCORRECT",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void QTwo(View view) {
|
||||
boolean checked = ((RadioButton) view).isChecked();
|
||||
switch (view.getId()) {
|
||||
case R.id.QTwoYes:
|
||||
if (checked) {
|
||||
isCorrectQ2 = false;
|
||||
RadioGroup questionOneRG = (RadioGroup) findViewById(R.id.QTwoGroup);
|
||||
questionOneRG.clearCheck();
|
||||
Toast.makeText(MainActivity.this, "INCORRECT",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
case R.id.QTwoNo:
|
||||
if (checked) {
|
||||
isCorrectQ2 = true;
|
||||
Toast.makeText(MainActivity.this, "Correct",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void QThree(View view) {
|
||||
boolean checked = ((RadioButton) view).isChecked();
|
||||
switch (view.getId()) {
|
||||
case R.id.QThreeYes:
|
||||
if (checked) {
|
||||
isCorrectQ3 = true;
|
||||
Toast.makeText(MainActivity.this, "Correct",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
case R.id.QThreeNo:
|
||||
if (checked) {
|
||||
isCorrectQ3 = false;
|
||||
RadioGroup questionOneRG = (RadioGroup) findViewById(R.id.QThreeGroup);
|
||||
questionOneRG.clearCheck();
|
||||
Toast.makeText(MainActivity.this, "INCORRECT",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void QFour(View view) {
|
||||
boolean checked = ((RadioButton) view).isChecked();
|
||||
switch (view.getId()) {
|
||||
case R.id.QFourYes:
|
||||
if (checked) {
|
||||
isCorrectQ4 = false;
|
||||
RadioGroup questionOneRG = (RadioGroup) findViewById(R.id.QFourGroup);
|
||||
questionOneRG.clearCheck();
|
||||
Toast.makeText(MainActivity.this, "INCORRECT",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
case R.id.QFourNo:{
|
||||
isCorrectQ4 = true;
|
||||
Toast.makeText(MainActivity.this, "Correct",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void QFive(View view) {
|
||||
boolean checked = ((RadioButton) view).isChecked();
|
||||
switch (view.getId()) {
|
||||
case R.id.QFiveYes:
|
||||
if (checked) {
|
||||
isCorrectQ5 = true;
|
||||
Toast.makeText(MainActivity.this, "Correct",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
case R.id.QFiveNo:
|
||||
if (checked) {
|
||||
isCorrectQ5 = false;
|
||||
RadioGroup questionOneRG = (RadioGroup) findViewById(R.id.QFiveGroup);
|
||||
questionOneRG.clearCheck();
|
||||
Toast.makeText(MainActivity.this, "INCORRECT",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void QSix(View view) {
|
||||
boolean checked = ((RadioButton) view).isChecked();
|
||||
switch (view.getId()) {
|
||||
case R.id.QSixYes:
|
||||
if (checked) {
|
||||
isCorrectQ6 = false;
|
||||
RadioGroup questionOneRG = (RadioGroup) findViewById(R.id.QSixGroup);
|
||||
questionOneRG.clearCheck();
|
||||
Toast.makeText(MainActivity.this, "INCORRECT",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
case R.id.QSixNo:
|
||||
if (checked) {
|
||||
isCorrectQ6 = true;
|
||||
Toast.makeText(MainActivity.this, "Correct",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void QSeven(View view) {
|
||||
boolean checked = ((RadioButton) view).isChecked();
|
||||
switch (view.getId()) {
|
||||
case R.id.QSevenYes:
|
||||
if (checked) {
|
||||
isCorrectQ7 = true;
|
||||
Toast.makeText(MainActivity.this, "Correct",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
case R.id.QSevenNo:
|
||||
if (checked) {
|
||||
isCorrectQ7 = false;
|
||||
RadioGroup questionOneRG = (RadioGroup) findViewById(R.id.QSevenGroup);
|
||||
questionOneRG.clearCheck();
|
||||
Toast.makeText(MainActivity.this, "INCORRECT",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void QEight (View view) {
|
||||
EditText answerEight = (EditText) findViewById(R.id.QuestionEightAnswer);
|
||||
String QEightAnswer = answerEight.getText().toString();
|
||||
if (QEightAnswer.equals("Continent")) {
|
||||
Toast.makeText(MainActivity.this, "Correct",
|
||||
Toast.LENGTH_LONG).show();
|
||||
isCorrectQ8 = true;
|
||||
}else{ Toast.makeText(MainActivity.this, "INCORRECT",
|
||||
Toast.LENGTH_LONG).show();
|
||||
isCorrectQ8 = true;
|
||||
answerEight.setText("");}
|
||||
}
|
||||
|
||||
public void QNine (View view){
|
||||
CheckBox checkboxA = (CheckBox) findViewById(R.id.checkboxA);
|
||||
boolean boxA = checkboxA.isChecked();
|
||||
|
||||
CheckBox checkboxB = (CheckBox) findViewById(R.id.checkboxB);
|
||||
boolean boxB = checkboxB.isChecked();
|
||||
|
||||
CheckBox checkboxC = (CheckBox) findViewById(R.id.checkboxC);
|
||||
boolean boxC = checkboxC.isChecked();
|
||||
|
||||
CheckBox checkboxD = (CheckBox) findViewById(R.id.checkboxD);
|
||||
boolean boxD = checkboxD.isChecked();
|
||||
|
||||
if (boxA & boxB & !boxC & !boxD) {Toast.makeText(MainActivity.this, "Correct",
|
||||
Toast.LENGTH_LONG).show();
|
||||
isCorrectQ9= true;
|
||||
|
||||
|
||||
} else {
|
||||
Toast.makeText(MainActivity.this, "INCORRECT",
|
||||
Toast.LENGTH_LONG).show();
|
||||
isCorrectQ9= false;
|
||||
CheckBox answerA = (CheckBox) findViewById(R.id.checkboxA);
|
||||
answerA.setChecked(false);
|
||||
CheckBox answerB = (CheckBox) findViewById(R.id.checkboxB);
|
||||
answerB.setChecked(false);
|
||||
CheckBox answerC = (CheckBox) findViewById(R.id.checkboxC);
|
||||
answerC.setChecked(false);
|
||||
CheckBox answerD = (CheckBox) findViewById(R.id.checkboxD);
|
||||
answerD.setChecked(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void submitScore(View view) {
|
||||
String review = createReviewSummary();
|
||||
Toast.makeText(MainActivity.this, review,
|
||||
Toast.LENGTH_LONG).show();
|
||||
/**
|
||||
Resetting score and checkboxes
|
||||
*/
|
||||
quantity = 0;
|
||||
isCorrectQ1 = false;
|
||||
isCorrectQ2 = false;
|
||||
isCorrectQ3 = false;
|
||||
isCorrectQ4 = false;
|
||||
isCorrectQ5 = false;
|
||||
isCorrectQ6 = false;
|
||||
isCorrectQ7 = false;
|
||||
isCorrectQ8 = false;
|
||||
isCorrectQ9 = false;
|
||||
|
||||
RadioGroup questionOneRG = (RadioGroup) findViewById(R.id.QOneGroup);
|
||||
questionOneRG.clearCheck();
|
||||
RadioGroup questionTwoRG = (RadioGroup) findViewById(R.id.QTwoGroup);
|
||||
questionTwoRG.clearCheck();
|
||||
RadioGroup questionThreeRG = (RadioGroup) findViewById(R.id.QThreeGroup);
|
||||
questionThreeRG.clearCheck();
|
||||
RadioGroup questionFourRG = (RadioGroup) findViewById(R.id.QFourGroup);
|
||||
questionFourRG.clearCheck();
|
||||
RadioGroup questionFiveRG = (RadioGroup) findViewById(R.id.QFiveGroup);
|
||||
questionFiveRG.clearCheck();
|
||||
RadioGroup questionSixRG = (RadioGroup) findViewById(R.id.QSixGroup);
|
||||
questionSixRG.clearCheck();
|
||||
RadioGroup questionSevenRG = (RadioGroup) findViewById(R.id.QSevenGroup);
|
||||
questionSevenRG.clearCheck();
|
||||
EditText answerEight = (EditText) findViewById(R.id.QuestionEightAnswer);
|
||||
answerEight.setText("");
|
||||
CheckBox answerA = (CheckBox) findViewById(R.id.checkboxA);
|
||||
answerA.setChecked(false);
|
||||
CheckBox answerB = (CheckBox) findViewById(R.id.checkboxB);
|
||||
answerB.setChecked(false);
|
||||
CheckBox answerC = (CheckBox) findViewById(R.id.checkboxC);
|
||||
answerC.setChecked(false);
|
||||
CheckBox answerD = (CheckBox) findViewById(R.id.checkboxD);
|
||||
answerD.setChecked(false);
|
||||
}
|
||||
|
||||
|
||||
private String createReviewSummary() {
|
||||
if(isCorrectQ1){quantity++;}
|
||||
if(isCorrectQ2){quantity++;}
|
||||
if(isCorrectQ3){quantity++;}
|
||||
if(isCorrectQ4){quantity++;}
|
||||
if(isCorrectQ5){quantity++;}
|
||||
if(isCorrectQ6){quantity++;}
|
||||
if(isCorrectQ7){quantity++;}
|
||||
if(isCorrectQ8){quantity++;}
|
||||
if(isCorrectQ9){quantity++;}
|
||||
String review = "Score = " + quantity + "/" + "9";
|
||||
return review;
|
||||
}
|
||||
|
||||
private String createEmailContent() {
|
||||
EditText nameField = (EditText) findViewById(R.id.name_field);
|
||||
String name = nameField.getText().toString();
|
||||
String email = "I Just completed the Quiz on H's Quizapp \n \nYou should try it out yourself \nfrom " + name;
|
||||
return email;
|
||||
}
|
||||
|
||||
public void shareEmail(View view) {
|
||||
String email = createEmailContent();
|
||||
Intent intent = new Intent(Intent.ACTION_SENDTO);
|
||||
intent.setData(Uri.parse("mailto:")); // only email apps should handle this
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, "Quizapp");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, email);
|
||||
if (intent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
338
app/src/main/res/layout/activity_main.xml
Normal file
338
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,338 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="com.example.h_mal.quizapp.MainActivity">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<!--Insert name in this section-->
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPersonName"
|
||||
android:hint="Name"
|
||||
android:ems="10"
|
||||
android:id="@+id/name_field"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
<!--Question one section-->
|
||||
<TextView
|
||||
android:text="Question 1"
|
||||
style="@style/HeaderTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<TextView
|
||||
android:text="What is the capital of England?"
|
||||
style="@style/QuestionTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:id="@+id/QOneGroup">
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="QOne"
|
||||
android:id="@+id/QOneYes"
|
||||
android:text="London"
|
||||
android:layout_marginRight="8dp"
|
||||
/>
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Manchester"
|
||||
android:id="@+id/QOneNo"
|
||||
android:onClick="QOne"/>
|
||||
</RadioGroup>
|
||||
<!--Question two section-->
|
||||
<TextView
|
||||
android:text="Question 2"
|
||||
style="@style/HeaderTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<TextView
|
||||
android:text="When did UK leave the EU?"
|
||||
style="@style/QuestionTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:id="@+id/QTwoGroup">
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1996"
|
||||
android:onClick="QTwo"
|
||||
android:id="@+id/QTwoYes"
|
||||
android:layout_marginRight="8dp"
|
||||
/>
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="QTwo"
|
||||
android:id="@+id/QTwoNo"
|
||||
android:text="2016"/>
|
||||
</RadioGroup>
|
||||
<!--Question three section-->
|
||||
<TextView
|
||||
android:text="Question 3"
|
||||
style="@style/HeaderTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<TextView
|
||||
android:text="When did WWII end?"
|
||||
style="@style/QuestionTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:id="@+id/QThreeGroup">
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1945"
|
||||
android:layout_marginRight="8dp"
|
||||
android:onClick="QThree"
|
||||
android:id="@+id/QThreeYes"
|
||||
/>
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1941"
|
||||
android:onClick="QThree"
|
||||
android:id="@+id/QThreeNo"/>
|
||||
</RadioGroup>
|
||||
|
||||
<!--Question Four section-->
|
||||
<TextView
|
||||
android:text="Question 4"
|
||||
style="@style/HeaderTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<TextView
|
||||
android:text="Who is the Russian President?"
|
||||
style="@style/QuestionTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:id="@+id/QFourGroup">
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lenin"
|
||||
android:layout_marginRight="8dp"
|
||||
android:onClick="QFour"
|
||||
android:id="@+id/QFourYes"/>
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Putin"
|
||||
android:onClick="QFour"
|
||||
android:id="@+id/QFourNo"/>
|
||||
</RadioGroup>
|
||||
|
||||
<!--Question Five section-->
|
||||
<TextView
|
||||
android:text="Question 5"
|
||||
style="@style/HeaderTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<TextView
|
||||
android:text="Europe is not the largest Continent. True or False?"
|
||||
style="@style/QuestionTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:id="@+id/QFiveGroup">
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="True"
|
||||
android:layout_marginRight="8dp"
|
||||
android:onClick="QFive"
|
||||
android:id="@+id/QFiveYes"/>
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="False"
|
||||
android:onClick="QFive"
|
||||
android:id="@+id/QFiveNo"/>
|
||||
</RadioGroup>
|
||||
|
||||
<!--Question Six section-->
|
||||
<TextView
|
||||
android:text="Question 6"
|
||||
style="@style/HeaderTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<TextView
|
||||
android:text="Where did Mercedes Benz originate from?"
|
||||
style="@style/QuestionTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:id="@+id/QSixGroup">
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="France"
|
||||
android:layout_marginRight="8dp"
|
||||
android:onClick="QSix"
|
||||
android:id="@+id/QSixYes"/>
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Germany"
|
||||
android:onClick="QSix"
|
||||
android:id="@+id/QSixNo"/>
|
||||
</RadioGroup>
|
||||
|
||||
<!--Question Seven section-->
|
||||
<TextView
|
||||
android:text="Question 7"
|
||||
style="@style/HeaderTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<TextView
|
||||
android:text="Is Finland part of the EU?"
|
||||
style="@style/QuestionTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:id="@+id/QSevenGroup">
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Yes"
|
||||
android:layout_marginRight="8dp"
|
||||
android:onClick="QSeven"
|
||||
android:id="@+id/QSevenYes"/>
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="No"
|
||||
android:onClick="QSeven"
|
||||
android:id="@+id/QSevenNo"/>
|
||||
</RadioGroup>
|
||||
|
||||
<!--Question Eight section-->
|
||||
<TextView
|
||||
android:text="Question 8"
|
||||
style="@style/HeaderTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<TextView
|
||||
android:text="Europe is a ____ (Answer either 'Continent' or 'Country') "
|
||||
style="@style/QuestionTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPersonName"
|
||||
android:hint="Answer Here"
|
||||
android:ems="10"
|
||||
android:id="@+id/QuestionEightAnswer"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Submit Q8"
|
||||
android:id="@+id/Submit_QEight"
|
||||
android:onClick="QEight"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<!--Question Nine section-->
|
||||
<TextView
|
||||
android:text="Question 9"
|
||||
style="@style/HeaderTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<TextView
|
||||
android:text="Which countries are not in the EU? (Pick two)"
|
||||
style="@style/QuestionTextStyles"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2">
|
||||
<CheckBox
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="A - Norway"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/checkboxA"
|
||||
android:layout_marginRight="16dp"/>
|
||||
<CheckBox
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="B - Turkey"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/checkboxB" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2">
|
||||
<CheckBox
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="C - Spain"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/checkboxC"
|
||||
android:layout_marginRight="16dp"/>
|
||||
<CheckBox
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="D - Luxembourg"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/checkboxD"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:text="Submit Q9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/submitNine"
|
||||
android:onClick="QNine"
|
||||
android:layout_marginBottom="16dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<!--Last two buttons-->
|
||||
<Button
|
||||
android:text="Submit"
|
||||
style="@style/ButtonStyles"
|
||||
android:id="@+id/Submit_button"
|
||||
android:onClick="submitScore"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<Button
|
||||
android:text="Share"
|
||||
style="@style/ButtonStyles"
|
||||
android:id="@+id/Share_button"
|
||||
android:onClick="shareEmail" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
6
app/src/main/res/values-w820dp/dimens.xml
Normal file
6
app/src/main/res/values-w820dp/dimens.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||
(such as screen margins) for screens with more than 820dp of available width. This
|
||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||
</resources>
|
||||
6
app/src/main/res/values/colors.xml
Normal file
6
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
</resources>
|
||||
5
app/src/main/res/values/dimens.xml
Normal file
5
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
</resources>
|
||||
3
app/src/main/res/values/strings.xml
Normal file
3
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">Quiz app</string>
|
||||
</resources>
|
||||
38
app/src/main/res/values/styles.xml
Normal file
38
app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">#795548</item>
|
||||
<item name="colorPrimaryDark">#5D4037</item>
|
||||
<item name="colorAccent">#607D8B</item>
|
||||
</style>
|
||||
|
||||
<style name="HeaderTextStyles">
|
||||
<!-- something something something -->
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
<item name="android:textColor">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="QuestionTextStyles">
|
||||
<!-- something something something -->
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:gravity">center_vertical</item>
|
||||
<item name="android:textColor">@android:color/darker_gray</item>
|
||||
<item name="android:textSize">15sp</item>
|
||||
</style>
|
||||
|
||||
<style name="ButtonStyles">
|
||||
<!-- something something something -->
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:background">#835b4c</item>
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.example.h_mal.quizapp;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user