update files
This commit is contained in:
parent
f6c2218850
commit
e8cad4dea3
@ -1,10 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleHome" value="/usr/share/java/gradle" />
|
||||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
<option name="resolveExternalAnnotations" value="false" />
|
<option name="resolveExternalAnnotations" value="false" />
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -3,13 +3,13 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace 'com.example.geoquizchapter1'
|
namespace 'com.calebfontenot.quizchapter2'
|
||||||
compileSdk 32
|
compileSdk 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.example.geoquizchapter1"
|
applicationId "com.calebfontenot.quizchapter2"
|
||||||
minSdk 21
|
minSdk 30
|
||||||
targetSdk 32
|
targetSdk 34
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
@ -30,8 +30,8 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.5.1'
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||||
implementation 'com.google.android.material:material:1.7.0'
|
implementation 'com.google.android.material:material:1.11.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
package com.example.geoquizchapter1;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import androidx.test.platform.app.InstrumentationRegistry;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instrumented 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()
|
|
||||||
{
|
|
||||||
// Context of the app under test.
|
|
||||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
|
||||||
assertEquals("com.example.geoquizchapter1", appContext.getPackageName());
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,15 +10,11 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.GeoQuizChapter1"
|
android:theme="@style/Theme.QuizChapter2"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
<activity
|
||||||
android:name=".CheatActivity"
|
android:name=".CheatActivity"
|
||||||
android:exported="false">
|
android:exported="false" />
|
||||||
<meta-data
|
|
||||||
android:name="android.app.lib_name"
|
|
||||||
android:value="" />
|
|
||||||
</activity>
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
@ -27,10 +23,6 @@
|
|||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="android.app.lib_name"
|
|
||||||
android:value="" />
|
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@ -0,0 +1,94 @@
|
|||||||
|
package com.calebfontenot.quizchapter2;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class CheatActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private Button cheatButton;
|
||||||
|
private Question currentQuestion;
|
||||||
|
//private boolean hasCheatingBeenActivated;
|
||||||
|
private boolean mAnswerIsTrue;
|
||||||
|
private TextView mAnswerTextView;
|
||||||
|
private static final String CURRENT_QUESTION = "com.calebfontenot.quizchapter2.currentQuestion";
|
||||||
|
private static final String EXTRA_ANSWER_SHOWN = "com.calebfontenot.quizchapter2.answer_shown";
|
||||||
|
private final String TAG = "CheatActivity";
|
||||||
|
//private static final String CHEATING_STATE = "this variable determines whether or not the user is currently in a cheating state.";
|
||||||
|
public static Intent newIntent(Context packageContext, Question currentQuestion) {
|
||||||
|
Intent intent = new Intent(packageContext, CheatActivity.class);
|
||||||
|
intent.putExtra(CURRENT_QUESTION, currentQuestion);
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
public static boolean wasAnswerShown(Intent result) {
|
||||||
|
return result.getBooleanExtra(EXTRA_ANSWER_SHOWN,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_cheat);
|
||||||
|
mAnswerTextView = (TextView)
|
||||||
|
findViewById(R.id.answer_text_view);
|
||||||
|
cheatButton = findViewById(R.id.cheat_button);
|
||||||
|
Question currentQuestion = getIntent().getParcelableExtra(CURRENT_QUESTION);
|
||||||
|
Log.i(TAG, currentQuestion.toString() + " " + currentQuestion.hashCode());
|
||||||
|
setAnswerShownResult(false);
|
||||||
|
mAnswerIsTrue = currentQuestion.ismAnswerTrue();
|
||||||
|
if (currentQuestion.isHasCheated()) {
|
||||||
|
if (mAnswerIsTrue) {
|
||||||
|
mAnswerTextView.setText(R.string.cheat_reveal_true);
|
||||||
|
} else {
|
||||||
|
mAnswerTextView.setText(R.string.cheat_reveal_false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
//if (savedInstanceState != null) {
|
||||||
|
//hasCheatingBeenActivated = savedInstanceState.getBoolean(CHEATING_STATE);
|
||||||
|
if (mAnswerIsTrue) {
|
||||||
|
mAnswerTextView.setText(R.string.cheat_reveal_true);
|
||||||
|
} else {
|
||||||
|
mAnswerTextView.setText(R.string.cheat_reveal_false);
|
||||||
|
}
|
||||||
|
//} else {
|
||||||
|
hasCheatingBeenActivated = false;
|
||||||
|
//}
|
||||||
|
*/
|
||||||
|
cheatButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
//hasCheatingBeenActivated = true;
|
||||||
|
|
||||||
|
//Toast.makeText(CheatActivity.this, R.string.cheat_toast, Toast.LENGTH_LONG).show();
|
||||||
|
if (mAnswerIsTrue) {
|
||||||
|
mAnswerTextView.setText(R.string.cheat_reveal_true);
|
||||||
|
} else {
|
||||||
|
mAnswerTextView.setText(R.string.cheat_reveal_false);
|
||||||
|
}
|
||||||
|
currentQuestion.setHasCheated(true);
|
||||||
|
setAnswerShownResult(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putBoolean(CHEATING_STATE, hasCheatingBeenActivated) ;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
private void setAnswerShownResult(boolean isAnswerShown) {
|
||||||
|
Intent data = new Intent();
|
||||||
|
data.putExtra(EXTRA_ANSWER_SHOWN,
|
||||||
|
isAnswerShown);
|
||||||
|
setResult(RESULT_OK, data);
|
||||||
|
}
|
||||||
|
}
|
@ -1,48 +0,0 @@
|
|||||||
package com.example.geoquizchapter1;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class CheatActivity extends AppCompatActivity
|
|
||||||
{
|
|
||||||
boolean bAnswer ;
|
|
||||||
Button btShownAnswer;
|
|
||||||
boolean bHasCheated;
|
|
||||||
TextView tvAnswer;
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState)
|
|
||||||
{
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_cheat);
|
|
||||||
Intent i = this.getIntent();
|
|
||||||
boolean isTrue = i.getBooleanExtra("key_from_main", false);
|
|
||||||
this.bAnswer = isTrue;
|
|
||||||
this.tvAnswer = findViewById( R.id.answer_text_view );
|
|
||||||
this.btShownAnswer = findViewById( R.id.show_answer_button );
|
|
||||||
this.btShownAnswer.setOnClickListener(new View.OnClickListener()
|
|
||||||
{
|
|
||||||
@Override public void onClick(View view) {
|
|
||||||
if ( bAnswer == true) {
|
|
||||||
CheatActivity.this.tvAnswer.setText("The answer is true.");
|
|
||||||
Toast.makeText(CheatActivity.this, "The answer is true.",
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
CheatActivity.this.tvAnswer.setText("The answer is false.");
|
|
||||||
Toast.makeText(CheatActivity.this, "The answer is false.", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
bHasCheated = true;
|
|
||||||
Intent i = new Intent();
|
|
||||||
i.putExtra("888", bHasCheated);
|
|
||||||
setResult( 33, i );
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,191 +0,0 @@
|
|||||||
package com.example.geoquizchapter1;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity
|
|
||||||
{
|
|
||||||
private static final String TAG = "MainActivity";
|
|
||||||
private int currentIndex = 0;
|
|
||||||
private Button trueButton;
|
|
||||||
private Button falseButton;
|
|
||||||
private Button nextButton;
|
|
||||||
private TextView questionTextView;
|
|
||||||
|
|
||||||
private Question[] questionBank = new Question[]
|
|
||||||
{
|
|
||||||
new Question( R.string.question_australia, true),
|
|
||||||
new Question(R.string.question_africa, false),
|
|
||||||
new Question(R.string.question_asia , true),
|
|
||||||
new Question(R.string.question_americas , true),
|
|
||||||
new Question(R.string.question_mideast , false)
|
|
||||||
};
|
|
||||||
private Button cheatButton;
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState)
|
|
||||||
{
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
Log.d(TAG, "onCreate(Bundle) called");
|
|
||||||
setContentView( R.layout.activity_main );
|
|
||||||
if ( savedInstanceState != null )
|
|
||||||
{
|
|
||||||
Log.d(TAG, "onCreate(Bundle) savedInstanceState not null:" + savedInstanceState.toString());
|
|
||||||
this.currentIndex = savedInstanceState.getInt("KEY_CURRENT_INDEX", 0);
|
|
||||||
}
|
|
||||||
questionTextView = this.findViewById(R.id.question_text_view);
|
|
||||||
nextButton = this.findViewById(R.id.next_button);
|
|
||||||
//trueButton = this.findViewById(R.id.button_true);
|
|
||||||
trueButton = this.findViewById(R.id.button_true);
|
|
||||||
falseButton = this.findViewById(R.id.button_false);
|
|
||||||
|
|
||||||
int questionID = questionBank[ currentIndex ].getTextResId();
|
|
||||||
questionTextView.setText( questionID );
|
|
||||||
|
|
||||||
nextButton.setOnClickListener(new View.OnClickListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onClick(View view)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
currentIndex = (currentIndex + 1) % questionBank.length;
|
|
||||||
int question = questionBank[currentIndex].getTextResId();
|
|
||||||
|
|
||||||
questionTextView.setText(question);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
trueButton.setOnClickListener(new View.OnClickListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onClick(View view)
|
|
||||||
{
|
|
||||||
|
|
||||||
if ( MainActivity.this.questionBank[MainActivity.this.currentIndex].isAnswerTrue() )
|
|
||||||
|
|
||||||
Toast.makeText(MainActivity.this, "correct!", Toast.LENGTH_SHORT).show();
|
|
||||||
else
|
|
||||||
Toast.makeText(MainActivity.this, "incorrect!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
falseButton.setOnClickListener(new View.OnClickListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onClick(View view)
|
|
||||||
{
|
|
||||||
|
|
||||||
if ( MainActivity.this.questionBank[MainActivity.this.currentIndex].isAnswerTrue() == false )
|
|
||||||
|
|
||||||
Toast.makeText(MainActivity.this, "correct!", Toast.LENGTH_SHORT).show();
|
|
||||||
else
|
|
||||||
Toast.makeText(MainActivity.this, "incorrect!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cheatButton = findViewById(R.id.cheat_button);
|
|
||||||
cheatButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Intent intent = new Intent(
|
|
||||||
MainActivity.this,
|
|
||||||
CheatActivity.class);
|
|
||||||
|
|
||||||
intent.putExtra("key_from_main",
|
|
||||||
questionBank[MainActivity.this.currentIndex].isAnswerTrue());
|
|
||||||
//MainActivity.this.startActivity(intent);
|
|
||||||
MainActivity.this.startActivityForResult(intent, 888);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStart()
|
|
||||||
{
|
|
||||||
super.onStart();
|
|
||||||
Log.d(TAG, "onStart() called");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
* <p>
|
|
||||||
* Dispatch onResume() to fragments. Note that for better inter-operation
|
|
||||||
* with older versions of the platform, at the point of this call the
|
|
||||||
* fragments attached to the activity are <em>not</em> resumed.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onResume()
|
|
||||||
{
|
|
||||||
super.onResume();
|
|
||||||
Log.d(TAG, "onResume() called");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
* <p>
|
|
||||||
* Dispatch onPause() to fragments.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void onPause()
|
|
||||||
{
|
|
||||||
super.onPause();
|
|
||||||
Log.d(TAG, "onPause() called");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStop()
|
|
||||||
{
|
|
||||||
super.onStop();
|
|
||||||
Log.d(TAG, "onStop() called");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy()
|
|
||||||
{
|
|
||||||
super.onDestroy();
|
|
||||||
Log.d(TAG, "onDestroy() called");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSaveInstanceState(@NonNull Bundle outState)
|
|
||||||
{
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
Log.d(TAG, "onSaveInstanceState() called");
|
|
||||||
outState.putInt("KEY_CURRENT_INDEX", this.currentIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent i)
|
|
||||||
{
|
|
||||||
super.onActivityResult(requestCode, resultCode, i);
|
|
||||||
|
|
||||||
if (resultCode != 33)
|
|
||||||
return;
|
|
||||||
Log.d("request code" , Integer.toString(requestCode));
|
|
||||||
boolean bCheated =
|
|
||||||
i.getBooleanExtra( Integer.toString(requestCode), false);
|
|
||||||
if (bCheated )
|
|
||||||
Toast.makeText(MainActivity.this, "Cheating is bad!", Toast.LENGTH_LONG).show();
|
|
||||||
else
|
|
||||||
Toast.makeText(MainActivity.this, "Good! You did not cheat!",
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package com.example.geoquizchapter1;
|
|
||||||
|
|
||||||
public class Question
|
|
||||||
{
|
|
||||||
private int textResId;
|
|
||||||
private boolean answerTrue;
|
|
||||||
|
|
||||||
public Question(int textResId, boolean answerTrue)
|
|
||||||
{
|
|
||||||
this.textResId = textResId;
|
|
||||||
this.answerTrue = answerTrue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTextResId()
|
|
||||||
{
|
|
||||||
return textResId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTextResId(int textResId)
|
|
||||||
{
|
|
||||||
this.textResId = textResId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAnswerTrue()
|
|
||||||
{
|
|
||||||
return answerTrue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAnswerTrue(boolean answerTrue)
|
|
||||||
{
|
|
||||||
this.answerTrue = answerTrue;
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB |
@ -1,60 +1,83 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="fill_parent"
|
||||||
tools:context=".MainActivity">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/question_text_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:padding="24dp"
|
|
||||||
android:text="Hello World" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center_horizontal|center_vertical"
|
android:gravity="center"
|
||||||
android:orientation="horizontal">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/button_true"
|
android:id="@+id/question_text_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="100dp"
|
android:padding="10dp"
|
||||||
android:layout_marginEnd="150dp"
|
android:text="Tap next or previous to begin."/>
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/button_true" />
|
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@+id/button_false"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="-100dp"
|
android:gravity="center"
|
||||||
android:layout_marginEnd="60dp"
|
android:orientation="horizontal">
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/button_false" />
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="130px"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/previous_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableLeft="@drawable/arrow_left"
|
||||||
|
android:drawablePadding="4dp"
|
||||||
|
android:text="@string/previous_button" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/true_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/true_button" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/false_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/false_button" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/next_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableRight="@drawable/arrow_right"
|
||||||
|
android:drawablePadding="4dp"
|
||||||
|
android:text="@string/next_button" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/activate_cheat_button"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Cheat!" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/score_counter"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/cheat_button"
|
android:id="@+id/reset_score_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content" android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_gravity="bottom|center_horizontal"
|
android:layout_marginBottom="10dp"
|
||||||
android:text="@string/cheat_button" />
|
android:text="Reset Score"/>
|
||||||
<Button
|
|
||||||
android:id="@+id/next_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="right|bottom"
|
|
||||||
android:text="@string/next_button"
|
|
||||||
android:drawableRight="@drawable/arrow_right"
|
|
||||||
android:drawablePadding="4dp"
|
|
||||||
|
|
||||||
/>
|
</RelativeLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
|
@ -1,26 +1,43 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
tools:context=".CheatActivity">
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context=".CheatActivity">
|
<LinearLayout
|
||||||
<TextView
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/textView"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:gravity="center"
|
||||||
android:layout_height="wrap_content"
|
android:orientation="vertical">
|
||||||
android:padding="24dp"
|
|
||||||
android:text="@string/warning_text" />
|
<TextView
|
||||||
<TextView
|
android:id="@+id/textView"
|
||||||
android:id="@+id/answer_text_view"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:text="Are you sure you want to cheat?" />
|
||||||
android:padding="24dp"
|
|
||||||
android:text="Answer" />
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
<Button
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/show_answer_button"
|
android:layout_height="50dp">
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:text="@string/show_answer_button" />
|
<TextView
|
||||||
</LinearLayout>
|
android:id="@+id/answer_text_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:gravity="center"
|
||||||
|
/>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cheat_button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="CHEAT!" />
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
@ -1,60 +1,92 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center|top"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
tools:context=".MainActivity">
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/question_text_view"
|
android:id="@+id/question_text_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="24dp"
|
android:padding="24dp"
|
||||||
android:text="Hello World" />
|
android:text="Tap next or previous to begin."/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@+id/button_true"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="130px"
|
||||||
android:layout_height="wrap_content"
|
android:gravity="center">
|
||||||
android:layout_marginStart="100dp"
|
|
||||||
android:layout_marginEnd="150dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/button_true" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_false"
|
android:id="@+id/true_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="-100dp"
|
android:text="@string/true_button" />
|
||||||
android:layout_marginEnd="60dp"
|
|
||||||
android:layout_weight="1"
|
<Button
|
||||||
android:text="@string/button_false" />
|
android:id="@+id/false_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/false_button" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="130px"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/previous_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/previous_button"
|
||||||
|
android:drawableLeft="@drawable/arrow_left"
|
||||||
|
android:drawablePadding="4dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/activate_cheat_button"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Cheat!" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/next_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/next_button"
|
||||||
|
android:drawableRight="@drawable/arrow_right"
|
||||||
|
android:drawablePadding="4dp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/cheat_button"
|
android:id="@+id/score_counter"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|center_horizontal"
|
|
||||||
android:text="@string/cheat_button" />
|
|
||||||
<Button
|
|
||||||
android:id="@+id/next_button"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/next_button"
|
android:padding="24dp"
|
||||||
android:drawableRight="@drawable/arrow_right"
|
android:text=""
|
||||||
android:drawablePadding="4dp"
|
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/reset_score_button"
|
||||||
|
android:layout_height="wrap_content" android:layout_width="fill_parent"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:text="Reset Score"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -2,4 +2,5 @@
|
|||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
@ -2,4 +2,5 @@
|
|||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.GeoQuizChapter1" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.QuizChapter2" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_200</item>
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
@ -1,18 +1,27 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">GeoQuizChapter1</string>
|
<string name="app_name">MP1_CalebFontenot</string>
|
||||||
|
<string name="true_button">True</string>
|
||||||
|
<string name="false_button">False</string>
|
||||||
|
<string name="next_button">Next</string>
|
||||||
|
<string name="previous_button">Previous</string>
|
||||||
|
<string name="correct_toast">Correct!</string>
|
||||||
|
<string name="incorrect_toast">Sorry, try again.</string>
|
||||||
|
<string name="cheat_toast">"Cheating is wrong. You should feel bad. \uD83D\uDE20 Cheaters also don't get points. 🙃"</string>
|
||||||
|
<string name="cheat_reveal_true">"The answer is true."</string>
|
||||||
|
<string name="cheat_reveal_false">"The answer is false."</string>
|
||||||
|
|
||||||
<string name="next_button"> Next </string>
|
<string name="question_australia">Canberra is the
|
||||||
<string name="button_true"> True </string>
|
capital of Australia.</string>
|
||||||
<string name="button_false"> False </string>
|
<string name="question_oceans">The Pacific Ocean is
|
||||||
<string name="question_australia">Canberra is the capital of Australia.</string>
|
larger than
|
||||||
<string name="question_oceans">The Pacific Ocean is larger thanthe Atlantic Ocean.</string>
|
the Atlantic Ocean.</string>
|
||||||
<string name="question_mideast">The Suez Canal connects the Red Sea and the Indian Ocean.</string>
|
<string name="question_mideast">The Suez Canal
|
||||||
<string name="question_africa">The source of the Nile River is in Egypt.</string>
|
connects the Red Sea
|
||||||
<string name="question_americas">The Amazon River is the longest river in the Americas.</string>
|
and the Indian Ocean.</string>
|
||||||
|
<string name="question_africa">The source of the Nile
|
||||||
|
River is in Egypt.</string>
|
||||||
|
<string name="question_americas">The Amazon River is
|
||||||
|
the longest river
|
||||||
|
in the Americas.</string>
|
||||||
<string name="question_asia">Lake Baikal is the world\'s oldest and deepest freshwater lake.</string>
|
<string name="question_asia">Lake Baikal is the world\'s oldest and deepest freshwater lake.</string>
|
||||||
|
|
||||||
<string name="warning_text">Are you sure you want to do this?</string>
|
|
||||||
<string name="show_answer_button">Show Answer</string>
|
|
||||||
<string name="cheat_button">Cheat!</string>
|
|
||||||
<string name="judgment_toast">Cheating is wrong.</string>
|
|
||||||
</resources>
|
</resources>
|
@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.GeoQuizChapter1" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.QuizChapter2" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_500</item>
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
package com.example.geoquizchapter1;
|
|
||||||
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
assertEquals(4, 2 + 2);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version '7.3.1' apply false
|
id 'com.android.application' version '8.2.2' apply false
|
||||||
id 'com.android.library' version '7.3.1' apply false
|
id 'com.android.library' version '8.2.2' apply false
|
||||||
}
|
}
|
@ -18,4 +18,5 @@ android.useAndroidX=true
|
|||||||
# Enables namespacing of each library's R class so that its R class includes only the
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
# resources declared in the library itself and none from the library's dependencies,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
|
android.nonFinalResIds=false
|
@ -1,6 +1,6 @@
|
|||||||
#Wed Jan 11 09:33:01 CST 2023
|
#Fri Jan 19 11:12:34 CST 2024
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
0
Assignments/GeoQuizChapter5_TwoActivities/gradlew
vendored
Normal file → Executable file
0
Assignments/GeoQuizChapter5_TwoActivities/gradlew
vendored
Normal file → Executable file
@ -1,8 +1,8 @@
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
@ -12,5 +12,6 @@ dependencyResolutionManagement {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rootProject.name = "GeoQuizChapter1"
|
rootProject.name = "MP1_CalebFontenot"
|
||||||
|
include ':app'
|
||||||
include ':app'
|
include ':app'
|
||||||
|
Loading…
Reference in New Issue
Block a user