Added quiz
This commit is contained in:
parent
5614a44517
commit
ef069a7030
|
@ -28,7 +28,7 @@ public class QuickPlayMenu extends AppCompatActivity {
|
|||
|
||||
private Button jumble;
|
||||
private Button tilematch;
|
||||
private Button game3;
|
||||
private Button quiz;
|
||||
private Button game4;
|
||||
private long jumble_elapsed_millis = 0;
|
||||
private String username;
|
||||
|
@ -44,10 +44,12 @@ public class QuickPlayMenu extends AppCompatActivity {
|
|||
|
||||
jumble = findViewById(R.id.jumble);
|
||||
tilematch = findViewById(R.id.tilematch);
|
||||
quiz = (Button) findViewById(R.id.quiz);
|
||||
|
||||
Intent intent = getIntent();
|
||||
username = intent.getStringExtra(login.EXTRA_TEXT);
|
||||
username_text = findViewById(R.id.username);
|
||||
username_text.setText("username : "+ username + " " + jumble_elapsed_millis);
|
||||
//username_text = findViewById(R.id.username);
|
||||
//username_text.setText("username : "+ username);
|
||||
|
||||
jumble.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -68,6 +70,16 @@ public class QuickPlayMenu extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
quiz.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(QuickPlayMenu.this,QuizStartingPage.class);
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Button back = (Button) findViewById(R.id.back);
|
||||
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -77,20 +89,6 @@ public class QuickPlayMenu extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (requestCode == 1) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
jumble_elapsed_millis = data.getLongExtra("jumble_elapsed_millis", 0);
|
||||
username_text.setText("username : "+ username + " " + jumble_elapsed_millis);
|
||||
|
||||
if(jumble_elapsed_millis != 0) {
|
||||
|
||||
Response.Listener<String> responseListener = new Response.Listener<String>() {
|
||||
|
@ -104,7 +102,7 @@ public class QuickPlayMenu extends AppCompatActivity {
|
|||
startActivity(intent);
|
||||
} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(QuickPlayMenu.this);
|
||||
builder.setMessage("game time save Failed")
|
||||
builder.setMessage("Register Failed")
|
||||
.setNegativeButton("Retry", null)
|
||||
.create()
|
||||
.show();
|
||||
|
@ -120,6 +118,18 @@ public class QuickPlayMenu extends AppCompatActivity {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (requestCode == 1) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
jumble_elapsed_millis = data.getLongExtra("jumble_elapsed_millis", 0);
|
||||
|
||||
|
||||
|
||||
}
|
||||
if (resultCode == RESULT_CANCELED) {
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.example.alzapp;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class QuizQuestionPage extends AppCompatActivity {
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_quiz_question_page);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.example.alzapp;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class QuizStartingPage extends AppCompatActivity {
|
||||
|
||||
|
||||
private Button quizStart;
|
||||
|
||||
@Override
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_quiz_question_page);
|
||||
|
||||
quizStart = (Button) findViewById(R.id.start_quiz);
|
||||
quizStart.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(QuizStartingPage.this, QuizQuestionPage.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -58,19 +58,6 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/tilematch"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginVertical="@dimen/cardview_compat_inset_shadow"
|
||||
android:orientation="vertical"
|
||||
android:paddingVertical="@dimen/activity_vertical_margin"
|
||||
android:textSize="50dp"
|
||||
tools:layout_editor_absoluteX="-26dp"
|
||||
tools:layout_editor_absoluteY="520dp"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/jumble"
|
||||
android:layout_width="140dp"
|
||||
|
@ -88,13 +75,13 @@
|
|||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/game3"
|
||||
android:id="@+id/quiz"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="140dp"
|
||||
android:layout_marginStart="36dp"
|
||||
android:layout_marginTop="29dp"
|
||||
android:background="@drawable/box_design"
|
||||
android:text="Game 3"
|
||||
android:text="quiz"
|
||||
android:textSize="16sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/bg_gradient2"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/quiz_score"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="SCORE : 0"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/quiz_question_counter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="QUESTIONS : 1/x"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="24sp"
|
||||
android:layout_below="@+id/quiz_score" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="00:30"
|
||||
android:layout_alignParentRight="true"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="35sp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="30dp"/>
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/quiz_question"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Here will be the question text \nHere will be the question text \nHere will be the question text"
|
||||
android:textSize="25sp"
|
||||
android:textColor="@android:color/black"
|
||||
android:layout_above="@id/quiz_radio_group"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:textAlignment="center"/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/quiz_radio_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radioButton30"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Option 1"
|
||||
android:textSize="22sp"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radioButton31"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Option 1"
|
||||
android:textSize="22sp"/>
|
||||
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radioButton32"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Option 1"
|
||||
android:textSize="22sp"/>
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/quiz_question_next"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="next"
|
||||
android:background="@drawable/button_menu"
|
||||
android:layout_below="@id/quiz_radio_group"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/bg_gradient2"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Welcome to the quiz"
|
||||
android:textSize="35sp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="60dp"
|
||||
android:textColor="@android:color/black" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="High Score"
|
||||
android:textSize="20dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="160dp"
|
||||
android:textColor="@android:color/black" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/start_quiz"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="Start quiz"
|
||||
android:background="@drawable/button_menu"
|
||||
android:layout_marginTop="500dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
/>
|
||||
</RelativeLayout>
|
Loading…
Reference in New Issue