This commit is contained in:
2024-01-24 16:22:53 -06:00
parent 75ab169397
commit e2915f99a3
1057 changed files with 134028 additions and 2 deletions

View File

@@ -1,7 +1,9 @@
package com.calebfontenot.quizchapter2;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@@ -29,9 +31,58 @@ public class MainActivity extends AppCompatActivity {
};
private int mCurrentIndex = 0;
@Override
@Override
public void onConfigurationChanged(Configuration newConfig) {
Log.d(TAG, "onConfigurationChanged() called");
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
setContentView(R.layout.activity_main);
}
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
setContentView(R.layout.activity_main_landscape);
}
}
@Override
protected void onStart() {
super.onStart();
Log.d(TAG,"onStart() called");
if (this.getRequestedOrientation() == ActivityInfo.CORIENTATION_PORTRAIT) {
setContentView(R.layout.activity_main);
}
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
setContentView(R.layout.activity_main_landscape);
}
}
@Override
protected void onResume() {
super.onResume();
Log.d(TAG,"onResume() called");
}
@Override
protected void onPause() {
super.onPause();
Log.d(TAG,"onPause() called");
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.d(TAG,"onDestroy() called");
}
@Override
protected void onStop() {
super.onStop();
Log.d(TAG,"onCreate(Bundle) called");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG,"Calling onCreate...");
Log.d(TAG,"onCreate(Bundle) called");
mQuestionTextView = (TextView)
findViewById(R.id.question_text_view);
int question =

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/question_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="24dp"
android:text="Tap next or previous to begin."/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="130px"
android:gravity="center">
<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" />
</LinearLayout>
<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:text="@string/previous_button"
android:drawableLeft="@drawable/arrow_left"
android:drawablePadding="4dp"
/>
<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>
<TextView
android:id="@+id/score_counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="24dp"
android:text=""
/>
</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>