pakying
This commit is contained in:
parent
e9acdb15ab
commit
7cf75975f0
|
|
@ -13,9 +13,15 @@
|
||||||
android:theme="@style/Theme.AndroidProjectCollection"
|
android:theme="@style/Theme.AndroidProjectCollection"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MenuExercise"
|
android:name=".MidtermActiivityGameScreen"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".MidtermActivityStartScreen"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
/>
|
android:theme="@style/Theme.AndroidProjectCollection"/>
|
||||||
|
<activity
|
||||||
|
android:name=".MenuExercise"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity_passing_intents_exercise2"
|
android:name=".activity_passing_intents_exercise2"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
|
|
||||||
ArrayList<String> choppedList = new ArrayList<>();
|
ArrayList<String> choppedList = new ArrayList<>();
|
||||||
|
|
||||||
boolean justOpped = false, decimaled = false;
|
boolean justOpped = false, decimaled = false,canEqual =false;
|
||||||
int opCount = 0;
|
int opCount = 0;
|
||||||
|
|
||||||
double reserved;
|
double reserved;
|
||||||
|
|
@ -65,9 +65,11 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
if(justOpped){
|
if(justOpped){
|
||||||
if (pressed_Equal){
|
if (pressed_Equal){
|
||||||
eqView.setText("");
|
eqView.setText("");
|
||||||
|
choppedList.clear();
|
||||||
pressed_Equal = false;
|
pressed_Equal = false;
|
||||||
}
|
}
|
||||||
justOpped = false;
|
justOpped = false;
|
||||||
|
canEqual = true;
|
||||||
inpView.setText("");
|
inpView.setText("");
|
||||||
inpView.append("0");
|
inpView.append("0");
|
||||||
}else {
|
}else {
|
||||||
|
|
@ -79,8 +81,10 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
if(justOpped){
|
if(justOpped){
|
||||||
if (pressed_Equal){
|
if (pressed_Equal){
|
||||||
eqView.setText("");
|
eqView.setText("");
|
||||||
|
choppedList.clear();
|
||||||
pressed_Equal = false;
|
pressed_Equal = false;
|
||||||
}
|
}
|
||||||
|
canEqual = true;
|
||||||
justOpped = false;
|
justOpped = false;
|
||||||
inpView.setText("");
|
inpView.setText("");
|
||||||
inpView.append("1");
|
inpView.append("1");
|
||||||
|
|
@ -93,8 +97,10 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
if(justOpped){
|
if(justOpped){
|
||||||
if (pressed_Equal){
|
if (pressed_Equal){
|
||||||
eqView.setText("");
|
eqView.setText("");
|
||||||
|
choppedList.clear();
|
||||||
pressed_Equal = false;
|
pressed_Equal = false;
|
||||||
}
|
}
|
||||||
|
canEqual = true;
|
||||||
justOpped = false;
|
justOpped = false;
|
||||||
inpView.setText("");
|
inpView.setText("");
|
||||||
inpView.append("2");
|
inpView.append("2");
|
||||||
|
|
@ -107,8 +113,10 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
if(justOpped){
|
if(justOpped){
|
||||||
if (pressed_Equal){
|
if (pressed_Equal){
|
||||||
eqView.setText("");
|
eqView.setText("");
|
||||||
|
choppedList.clear();
|
||||||
pressed_Equal = false;
|
pressed_Equal = false;
|
||||||
}
|
}
|
||||||
|
canEqual = true;
|
||||||
justOpped = false;
|
justOpped = false;
|
||||||
inpView.setText("");
|
inpView.setText("");
|
||||||
inpView.append("3");
|
inpView.append("3");
|
||||||
|
|
@ -121,8 +129,10 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
if(justOpped){
|
if(justOpped){
|
||||||
if (pressed_Equal){
|
if (pressed_Equal){
|
||||||
eqView.setText("");
|
eqView.setText("");
|
||||||
|
choppedList.clear();
|
||||||
pressed_Equal = false;
|
pressed_Equal = false;
|
||||||
}
|
}
|
||||||
|
canEqual = true;
|
||||||
justOpped = false;
|
justOpped = false;
|
||||||
inpView.setText("");
|
inpView.setText("");
|
||||||
inpView.append("4");
|
inpView.append("4");
|
||||||
|
|
@ -135,8 +145,10 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
if(justOpped){
|
if(justOpped){
|
||||||
if (pressed_Equal){
|
if (pressed_Equal){
|
||||||
eqView.setText("");
|
eqView.setText("");
|
||||||
|
choppedList.clear();
|
||||||
pressed_Equal = false;
|
pressed_Equal = false;
|
||||||
}
|
}
|
||||||
|
canEqual = true;
|
||||||
justOpped = false;
|
justOpped = false;
|
||||||
inpView.setText("");
|
inpView.setText("");
|
||||||
inpView.append("5");
|
inpView.append("5");
|
||||||
|
|
@ -149,8 +161,10 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
if(justOpped){
|
if(justOpped){
|
||||||
if (pressed_Equal){
|
if (pressed_Equal){
|
||||||
eqView.setText("");
|
eqView.setText("");
|
||||||
|
choppedList.clear();
|
||||||
pressed_Equal = false;
|
pressed_Equal = false;
|
||||||
}
|
}
|
||||||
|
canEqual = true;
|
||||||
justOpped = false;
|
justOpped = false;
|
||||||
inpView.setText("");
|
inpView.setText("");
|
||||||
inpView.append("6");
|
inpView.append("6");
|
||||||
|
|
@ -163,8 +177,10 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
if(justOpped){
|
if(justOpped){
|
||||||
if (pressed_Equal){
|
if (pressed_Equal){
|
||||||
eqView.setText("");
|
eqView.setText("");
|
||||||
|
choppedList.clear();
|
||||||
pressed_Equal = false;
|
pressed_Equal = false;
|
||||||
}
|
}
|
||||||
|
canEqual = true;
|
||||||
justOpped = false;
|
justOpped = false;
|
||||||
inpView.setText("");
|
inpView.setText("");
|
||||||
inpView.append("7");
|
inpView.append("7");
|
||||||
|
|
@ -177,8 +193,10 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
if(justOpped){
|
if(justOpped){
|
||||||
if (pressed_Equal){
|
if (pressed_Equal){
|
||||||
eqView.setText("");
|
eqView.setText("");
|
||||||
|
choppedList.clear();
|
||||||
pressed_Equal = false;
|
pressed_Equal = false;
|
||||||
}
|
}
|
||||||
|
canEqual = true;
|
||||||
justOpped = false;
|
justOpped = false;
|
||||||
inpView.setText("");
|
inpView.setText("");
|
||||||
inpView.append("8");
|
inpView.append("8");
|
||||||
|
|
@ -191,8 +209,10 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
if(justOpped){
|
if(justOpped){
|
||||||
if (pressed_Equal){
|
if (pressed_Equal){
|
||||||
eqView.setText("");
|
eqView.setText("");
|
||||||
|
choppedList.clear();
|
||||||
pressed_Equal = false;
|
pressed_Equal = false;
|
||||||
}
|
}
|
||||||
|
canEqual = true;
|
||||||
justOpped = false;
|
justOpped = false;
|
||||||
inpView.setText("");
|
inpView.setText("");
|
||||||
inpView.append("9");
|
inpView.append("9");
|
||||||
|
|
@ -244,9 +264,16 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
|
|
||||||
if(opCount >= 1){
|
if(opCount >= 1){
|
||||||
inpView.setText(ArrAnswerer());
|
inpView.setText(ArrAnswerer());
|
||||||
|
canEqual = true;
|
||||||
|
|
||||||
}else {
|
}else if(pressed_Equal){
|
||||||
|
choppedList.clear();
|
||||||
|
opActionner("/",justOpped);
|
||||||
|
canEqual = false;
|
||||||
|
pressed_Equal =false;}
|
||||||
|
else {
|
||||||
opCount++;
|
opCount++;
|
||||||
|
canEqual = false;
|
||||||
}
|
}
|
||||||
btDecimal.setEnabled(true);
|
btDecimal.setEnabled(true);
|
||||||
});
|
});
|
||||||
|
|
@ -257,8 +284,15 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
|
|
||||||
if(opCount >= 1){
|
if(opCount >= 1){
|
||||||
inpView.setText(ArrAnswerer());
|
inpView.setText(ArrAnswerer());
|
||||||
}else {
|
canEqual = true;
|
||||||
|
}else if(pressed_Equal){
|
||||||
|
choppedList.clear();
|
||||||
|
opActionner("/",justOpped);
|
||||||
|
canEqual = false;
|
||||||
|
pressed_Equal =false;}
|
||||||
|
else {
|
||||||
opCount++;
|
opCount++;
|
||||||
|
canEqual = false;
|
||||||
}
|
}
|
||||||
btDecimal.setEnabled(true);
|
btDecimal.setEnabled(true);
|
||||||
});
|
});
|
||||||
|
|
@ -269,8 +303,15 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
|
|
||||||
if(opCount >= 1){
|
if(opCount >= 1){
|
||||||
inpView.setText(ArrAnswerer());
|
inpView.setText(ArrAnswerer());
|
||||||
}else {
|
canEqual = true;
|
||||||
|
}else if(pressed_Equal){
|
||||||
|
choppedList.clear();
|
||||||
|
opActionner("/",justOpped);
|
||||||
|
canEqual = false;
|
||||||
|
pressed_Equal =false;}
|
||||||
|
else {
|
||||||
opCount++;
|
opCount++;
|
||||||
|
canEqual = false;
|
||||||
}
|
}
|
||||||
btDecimal.setEnabled(true);
|
btDecimal.setEnabled(true);
|
||||||
});
|
});
|
||||||
|
|
@ -282,19 +323,32 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
|
|
||||||
if(opCount >= 1){
|
if(opCount >= 1){
|
||||||
inpView.setText(ArrAnswerer());
|
inpView.setText(ArrAnswerer());
|
||||||
|
canEqual = true;
|
||||||
|
}else if(pressed_Equal){
|
||||||
|
choppedList.clear();
|
||||||
|
opActionner("/",justOpped);
|
||||||
|
canEqual = false;
|
||||||
|
pressed_Equal =false;
|
||||||
}else {
|
}else {
|
||||||
opCount++;
|
opCount++;
|
||||||
|
canEqual = false;
|
||||||
}
|
}
|
||||||
btDecimal.setEnabled(true);
|
btDecimal.setEnabled(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
btEqual.setOnClickListener(v -> {
|
btEqual.setOnClickListener(v -> {
|
||||||
|
if(canEqual){
|
||||||
choppedList.add(String.valueOf(inpView.getText()));
|
choppedList.add(String.valueOf(inpView.getText()));
|
||||||
inpView.setText(EqualAnswer(decimaled));
|
inpView.setText(EqualAnswer(decimaled));
|
||||||
reserved = Double.parseDouble(EqualAnswer(decimaled));
|
reserved = Double.parseDouble(EqualAnswer(decimaled));
|
||||||
pressed_Equal = true;
|
pressed_Equal = true;
|
||||||
|
canEqual = false;
|
||||||
justOpped = true;
|
justOpped = true;
|
||||||
|
opCount = 0;
|
||||||
btDecimal.setEnabled(true);
|
btDecimal.setEnabled(true);
|
||||||
|
}else {
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -310,7 +364,13 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
opCount -= 1;
|
opCount -= 1;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if (!choppedList.isEmpty()){
|
if(pressed_Equal){
|
||||||
|
choppedList.clear();
|
||||||
|
choppedList.add(String.valueOf(inpView.getText()));
|
||||||
|
choppedList.add(operation);
|
||||||
|
pressed_Equal = false;
|
||||||
|
}
|
||||||
|
else if (!choppedList.isEmpty()){
|
||||||
choppedList.remove(choppedList.size()-1);
|
choppedList.remove(choppedList.size()-1);
|
||||||
choppedList.add(operation);
|
choppedList.add(operation);
|
||||||
}else {
|
}else {
|
||||||
|
|
@ -344,6 +404,7 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
public String ArrAnswerer(){
|
public String ArrAnswerer(){
|
||||||
double op1=Double.parseDouble(choppedList.get(0));
|
double op1=Double.parseDouble(choppedList.get(0));
|
||||||
double op2;
|
double op2;
|
||||||
|
boolean trip =false;
|
||||||
String Operation = "";
|
String Operation = "";
|
||||||
for (int i = 1 ; i <= choppedList.size()-1; i++){
|
for (int i = 1 ; i <= choppedList.size()-1; i++){
|
||||||
if (i % 2 == 0){
|
if (i % 2 == 0){
|
||||||
|
|
@ -363,6 +424,7 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
return "Not gonna happen.";
|
return "Not gonna happen.";
|
||||||
}else {
|
}else {
|
||||||
op1/=op2;
|
op1/=op2;
|
||||||
|
trip = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -371,7 +433,10 @@ public class CalculatorExercise extends AppCompatActivity {
|
||||||
Operation = choppedList.get(i);
|
Operation = choppedList.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (trip){
|
||||||
|
DecimalFormat dc = new DecimalFormat("0.00");
|
||||||
|
return dc.format(op1);
|
||||||
|
}
|
||||||
return String.valueOf(op1);
|
return String.valueOf(op1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
Button btn1,btn2,btn3,btn4,btn5,btn6;
|
Button btn1,btn2,btn3,btn4,btn5,btn6,btn7;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
@ -77,6 +77,15 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
btn7 = findViewById(R.id.btnMtGm);
|
||||||
|
btn7.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent startPI1 = new Intent(MainActivity.this, MidtermActivityStartScreen.class);
|
||||||
|
startActivity(startPI1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,296 @@
|
||||||
|
package com.example.androidprojectcollection;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
public class MidtermActiivityGameScreen extends AppCompatActivity {
|
||||||
|
|
||||||
|
Button[] btns = new Button[9];
|
||||||
|
LinearLayout[] ln = new LinearLayout[3];
|
||||||
|
int Player = 1;
|
||||||
|
int[] table = {0,0,0,0,0,0,0,0,0};
|
||||||
|
TextView txv;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
setContentView(R.layout.activity_midterm_actiivity_game_screen);
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
txv = findViewById(R.id.PlayerDisp);
|
||||||
|
ln[0] = findViewById(R.id.L1);
|
||||||
|
ln[1] = findViewById(R.id.L2);
|
||||||
|
ln[2] = findViewById(R.id.L3);
|
||||||
|
|
||||||
|
btns[0] = findViewById(R.id.btn1);
|
||||||
|
btns[1] = findViewById(R.id.btn2);
|
||||||
|
btns[2] = findViewById(R.id.btn3);
|
||||||
|
btns[3] = findViewById(R.id.btn4);
|
||||||
|
btns[4] = findViewById(R.id.btn5);
|
||||||
|
btns[5] = findViewById(R.id.btn6);
|
||||||
|
btns[6] = findViewById(R.id.btn7);
|
||||||
|
btns[7] = findViewById(R.id.btn8);
|
||||||
|
btns[8] = findViewById(R.id.btn9);
|
||||||
|
Button reset = findViewById(R.id.Rst);
|
||||||
|
|
||||||
|
PlayerDisplayer();
|
||||||
|
for (int i = 0 ; i < 9 ; i++){
|
||||||
|
table[i] = 0;
|
||||||
|
btns[i].setText("");
|
||||||
|
btns[i].setBackgroundColor(Color.parseColor("#B2B1AF"));
|
||||||
|
}
|
||||||
|
|
||||||
|
btns[0].setOnClickListener(view -> {
|
||||||
|
btns[0]=playerCheck(btns[0],1);
|
||||||
|
btns[0].setEnabled(false);
|
||||||
|
WinCheck();
|
||||||
|
});
|
||||||
|
|
||||||
|
btns[1].setOnClickListener(view -> {
|
||||||
|
btns[1]=playerCheck(btns[1],2);
|
||||||
|
btns[1].setEnabled(false);
|
||||||
|
WinCheck();
|
||||||
|
});
|
||||||
|
|
||||||
|
btns[2].setOnClickListener(view -> {
|
||||||
|
btns[2]=playerCheck(btns[2],3);
|
||||||
|
btns[2].setEnabled(false);
|
||||||
|
WinCheck();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
btns[3].setOnClickListener(view -> {
|
||||||
|
btns[3]=playerCheck(btns[3],4);
|
||||||
|
btns[3].setEnabled(false);
|
||||||
|
WinCheck();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
btns[4].setOnClickListener(view -> {
|
||||||
|
btns[4]=playerCheck(btns[4],5);
|
||||||
|
btns[4].setEnabled(false);
|
||||||
|
WinCheck();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
btns[5].setOnClickListener(view -> {
|
||||||
|
btns[5]=playerCheck(btns[5],6);
|
||||||
|
btns[5].setEnabled(false);
|
||||||
|
WinCheck();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
btns[6].setOnClickListener(view -> {
|
||||||
|
btns[6]=playerCheck(btns[6],7);
|
||||||
|
btns[6].setEnabled(false);
|
||||||
|
WinCheck();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
btns[7].setOnClickListener(view -> {
|
||||||
|
btns[7]=playerCheck(btns[7],8);
|
||||||
|
btns[7].setEnabled(false);
|
||||||
|
WinCheck();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
btns[8].setOnClickListener(view -> {
|
||||||
|
btns[8]=playerCheck(btns[8],9);
|
||||||
|
btns[8].setEnabled(false);
|
||||||
|
WinCheck();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
reset.setOnClickListener(view -> {
|
||||||
|
Toast.makeText(getApplicationContext(),"Player Table Reset!",Toast.LENGTH_SHORT).show();
|
||||||
|
ButtonEnabler(true);
|
||||||
|
Player = 1;
|
||||||
|
for (int i = 0 ; i < 9 ; i++){
|
||||||
|
table[i] = 0;
|
||||||
|
btns[i].setText("");
|
||||||
|
btns[i].setBackgroundColor(Color.parseColor("#B2B1AF"));
|
||||||
|
}
|
||||||
|
PlayerDisplayer();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
public Button playerCheck(Button btn, int idx){
|
||||||
|
idx--;
|
||||||
|
|
||||||
|
if(Player == 1){
|
||||||
|
btn.setText("O");
|
||||||
|
btn.setTextColor(Color.WHITE);
|
||||||
|
btn.setBackgroundColor(Color.parseColor("#FF6200EE"));
|
||||||
|
table[idx] = 1;
|
||||||
|
Player++;
|
||||||
|
PlayerDisplayer();
|
||||||
|
}else {
|
||||||
|
btn.setText("X");
|
||||||
|
btn.setTextColor(Color.WHITE);
|
||||||
|
btn.setBackgroundColor(Color.parseColor("#FF6200EE"));
|
||||||
|
table[idx] = 2;
|
||||||
|
Player--;
|
||||||
|
PlayerDisplayer();
|
||||||
|
}
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
public void PlayerDisplayer(){
|
||||||
|
if (Player == 1) {
|
||||||
|
Colorer();
|
||||||
|
txv.setText("Player O's Turn");
|
||||||
|
}else{
|
||||||
|
Colorer();
|
||||||
|
txv.setText("Player X' Turn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
public void WinCheck(){
|
||||||
|
boolean flag = true;
|
||||||
|
if((table[0] == table[1] && table[1] == table[2]) && table[0] != 0){
|
||||||
|
if(table[0] == 1){
|
||||||
|
txv.setText("Player O Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 1",Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
txv.setText("Player X Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 2",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
ButtonEnabler(false);
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
} else if ((table[0] == table[4] && table[4] == table[8]) && table[0] != 0) {
|
||||||
|
|
||||||
|
if(table[0] == 1){
|
||||||
|
txv.setText("Player O Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 1",Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
txv.setText("Player X Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 2",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
ButtonEnabler(false);
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
}else if ((table[0] == table[3] && table[3] == table[6]) && table[0] != 0){
|
||||||
|
|
||||||
|
if(table[0] == 1){
|
||||||
|
txv.setText("Player O Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 1",Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
txv.setText("Player X Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 2",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
ButtonEnabler(false);
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
}else if ((table[3] == table[4] && table[4] == table[5]) && table[3] != 0){
|
||||||
|
|
||||||
|
if(table[3] == 1){
|
||||||
|
txv.setText("Player O Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 1",Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
txv.setText("Player X Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 2",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
ButtonEnabler(false);
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
}else if ((table[6] == table[7] && table[7] == table[8]) && table[6] != 0){
|
||||||
|
|
||||||
|
if(table[6] == 1){
|
||||||
|
txv.setText("Player O Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 1",Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
txv.setText("Player X Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 2",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
ButtonEnabler(false);
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
}else if ((table[6] == table[4] && table[4] == table[2]) && table[6] != 0){
|
||||||
|
|
||||||
|
if(table[6] == 1){
|
||||||
|
txv.setText("Player O Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 1",Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
txv.setText("Player X Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 2",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
ButtonEnabler(false);
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
}else if ((table[1] == table[4] && table[4] == table[7]) && table[1] != 0){
|
||||||
|
|
||||||
|
if(table[1] == 1){
|
||||||
|
txv.setText("Player O Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 1",Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
txv.setText("Player X Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 2",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
ButtonEnabler(false);
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
}else if ((table[2] == table[5] && table[5] == table[8]) && table[2] != 0){
|
||||||
|
|
||||||
|
if(table[2] == 1){
|
||||||
|
txv.setText("Player O Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 1",Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
txv.setText("Player X Wins");
|
||||||
|
Toast.makeText(getApplicationContext(),"You Won Player 2",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
ButtonEnabler(false);
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
}else {
|
||||||
|
|
||||||
|
for(int i = 0 ;i < 9 ; i++){
|
||||||
|
if (table[i] == 0) {
|
||||||
|
flag = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(flag){
|
||||||
|
txv.setText("Stalemate");
|
||||||
|
Toast.makeText(getApplicationContext(),"It's a Stalemate.",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ButtonEnabler(boolean state){
|
||||||
|
for (int i = 0 ; i < 9 ; i++){
|
||||||
|
btns[i].setEnabled(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Colorer(){
|
||||||
|
if(Player == 1){
|
||||||
|
for (int i = 0 ; i < 3 ; i++){
|
||||||
|
ln[i].setBackgroundColor(Color.BLUE);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
for (int i = 0 ; i < 3 ; i++){
|
||||||
|
ln[i].setBackgroundColor(Color.RED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.example.androidprojectcollection;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
public class MidtermActivityStartScreen extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
setContentView(R.layout.activity_midterm_start_screen);
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
Button btn = findViewById(R.id.PlyBtn);
|
||||||
|
|
||||||
|
|
||||||
|
btn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent tttPlay = new Intent(
|
||||||
|
MidtermActivityStartScreen.this,
|
||||||
|
MidtermActiivityGameScreen.class
|
||||||
|
|
||||||
|
);
|
||||||
|
Toast.makeText(getApplicationContext(),"Brian Steve Pila -- Tic Tac Toe",Toast.LENGTH_SHORT).show();
|
||||||
|
startActivity(tttPlay);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
package com.example.androidprojectcollection;
|
package com.example.androidprojectcollection;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
@ -10,6 +16,26 @@ import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
public class activity_passing_intents_exercise extends AppCompatActivity {
|
public class activity_passing_intents_exercise extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
|
String firstNamE;
|
||||||
|
String lastNamE;
|
||||||
|
String gendeR;
|
||||||
|
String birthDatE;
|
||||||
|
String agE;
|
||||||
|
String emaiL;
|
||||||
|
String nationalitY;
|
||||||
|
String homeAddresS;
|
||||||
|
String placeOfBirtH;
|
||||||
|
String religioN;
|
||||||
|
String maritalStatuS;
|
||||||
|
|
||||||
|
TextView firstName,lastName;
|
||||||
|
RadioGroup gender;
|
||||||
|
TextView birthDate,age,email,nationality,homeAddress,placeOfBirth,religion;
|
||||||
|
RadioGroup maritalStatus;
|
||||||
|
Button clear,submit;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
@ -20,5 +46,97 @@ public class activity_passing_intents_exercise extends AppCompatActivity {
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
firstName = findViewById(R.id.TbFirstName);
|
||||||
|
lastName = findViewById(R.id.TbLastName);
|
||||||
|
gender = findViewById(R.id.rgGender);
|
||||||
|
birthDate = findViewById(R.id.TbBirthDate);
|
||||||
|
age = findViewById(R.id.TbAge);
|
||||||
|
email = findViewById(R.id.TbEmail);
|
||||||
|
nationality = findViewById(R.id.TbNationality);
|
||||||
|
homeAddress = findViewById(R.id.TbHomeAddress);
|
||||||
|
placeOfBirth = findViewById(R.id.TbPlaceOfBirth);
|
||||||
|
religion = findViewById(R.id.TbReligion);
|
||||||
|
maritalStatus = findViewById(R.id.rgMaritalStatus);
|
||||||
|
clear = findViewById(R.id.btnClear);
|
||||||
|
submit = findViewById(R.id.btnSubmit);
|
||||||
|
|
||||||
|
submit.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
firstNamE = String.valueOf(firstName.getText());
|
||||||
|
lastNamE = String.valueOf(lastName.getText());
|
||||||
|
|
||||||
|
birthDatE = String.valueOf(birthDate.getText());
|
||||||
|
agE = String.valueOf(age.getText());
|
||||||
|
emaiL = String.valueOf(email.getText());
|
||||||
|
nationalitY = String.valueOf(nationality.getText());
|
||||||
|
homeAddresS = String.valueOf(homeAddress.getText());
|
||||||
|
placeOfBirtH = String.valueOf(placeOfBirth.getText());
|
||||||
|
religioN = String.valueOf(religion.getText());
|
||||||
|
maritalStatuS = String.valueOf(maritalStatus.getCheckedRadioButtonId());
|
||||||
|
|
||||||
|
if(gender.getCheckedRadioButtonId() == R.id.rbMale){
|
||||||
|
gendeR = "Male";
|
||||||
|
} else if (gender.getCheckedRadioButtonId() == R.id.rbFemale) {
|
||||||
|
gendeR = "Female";
|
||||||
|
}else {
|
||||||
|
gendeR = "Others";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(maritalStatus.getCheckedRadioButtonId() == R.id.rbSingle){
|
||||||
|
maritalStatuS = "Single";
|
||||||
|
} else if (maritalStatus.getCheckedRadioButtonId() == R.id.rbMarried) {
|
||||||
|
maritalStatuS = "Married";
|
||||||
|
} else if (maritalStatus.getCheckedRadioButtonId() == R.id.rbDivorced) {
|
||||||
|
maritalStatuS = "Divorced";
|
||||||
|
}else {
|
||||||
|
maritalStatuS = "Widowed";
|
||||||
|
}
|
||||||
|
Intent intent = new Intent(
|
||||||
|
activity_passing_intents_exercise.this, activity_passing_intents_exercise2.class
|
||||||
|
);
|
||||||
|
intent.putExtra("FirstName",firstNamE);
|
||||||
|
intent.putExtra("LastName",lastNamE);
|
||||||
|
intent.putExtra("Gender",gendeR);
|
||||||
|
intent.putExtra("BirthDate",birthDatE);
|
||||||
|
intent.putExtra("Age",agE);
|
||||||
|
intent.putExtra("Email",emaiL);
|
||||||
|
intent.putExtra("Nationality",nationalitY);
|
||||||
|
intent.putExtra("HomeAddress",homeAddresS);
|
||||||
|
intent.putExtra("PlaceOfBirth",placeOfBirtH);
|
||||||
|
intent.putExtra("Religion",religioN);
|
||||||
|
intent.putExtra("MaritalStatus",maritalStatuS);
|
||||||
|
|
||||||
|
if (firstNamE.isEmpty() || lastNamE.isEmpty()|| birthDatE.isEmpty()||agE.isEmpty()||
|
||||||
|
emaiL.isEmpty()|| nationalitY.isEmpty()|| homeAddresS.isEmpty()||placeOfBirtH.isEmpty()||religioN.isEmpty()
|
||||||
|
){
|
||||||
|
Toast.makeText(getApplicationContext(),"Lol",Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
clear.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
firstName.setText("");
|
||||||
|
lastName.setText("");
|
||||||
|
gender.clearCheck();
|
||||||
|
birthDate.setText("");
|
||||||
|
age.setText("");
|
||||||
|
email.setText("");
|
||||||
|
nationality.setText("");
|
||||||
|
homeAddress.setText("");
|
||||||
|
placeOfBirth.setText("");
|
||||||
|
religion.setText("");
|
||||||
|
maritalStatus.clearCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,9 +7,15 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.graphics.Insets;
|
import androidx.core.graphics.Insets;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
public class activity_passing_intents_exercise2 extends AppCompatActivity {
|
public class activity_passing_intents_exercise2 extends AppCompatActivity {
|
||||||
|
|
||||||
|
TextView firstName, lastName, gender, maritalStatus, age, birthDate, nationality, homeAddress, emailAddress,placeofBirth,religion;
|
||||||
|
Button btnReturn;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
@ -21,6 +27,35 @@ public class activity_passing_intents_exercise2 extends AppCompatActivity {
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
firstName = findViewById(R.id.formFirstName);
|
||||||
|
lastName = findViewById(R.id.formLastName);
|
||||||
|
gender = findViewById(R.id.formGender);
|
||||||
|
maritalStatus = findViewById(R.id.formMaritalStatus);
|
||||||
|
age = findViewById(R.id.formAge);
|
||||||
|
birthDate = findViewById(R.id.formBirthDate);
|
||||||
|
nationality = findViewById(R.id.formNationality);
|
||||||
|
homeAddress = findViewById(R.id.formHomeAddress);
|
||||||
|
emailAddress = findViewById(R.id.formEmailAddress);
|
||||||
|
placeofBirth = findViewById(R.id.formPlaceofBirth);
|
||||||
|
religion = findViewById(R.id.formReligion);
|
||||||
|
|
||||||
|
|
||||||
|
btnReturn = findViewById(R.id.btnPassingIntentsReturn);
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
|
||||||
|
firstName.setText(intent.getStringExtra("FirstName"));
|
||||||
|
lastName.setText(intent.getStringExtra("LastName"));
|
||||||
|
gender.setText(intent.getStringExtra("Gender"));
|
||||||
|
maritalStatus.setText(intent.getStringExtra("MaritalStatus"));
|
||||||
|
age.setText(intent.getStringExtra("Age"));
|
||||||
|
birthDate.setText(intent.getStringExtra("BirthDate"));
|
||||||
|
nationality.setText(intent.getStringExtra("Nationality"));
|
||||||
|
homeAddress.setText(intent.getStringExtra("HomeAddress"));
|
||||||
|
emailAddress.setText(intent.getStringExtra("Email"));
|
||||||
|
religion.setText(intent.getStringExtra("Religion"));
|
||||||
|
placeofBirth.setText(intent.getStringExtra("PlaceOfBirth"));
|
||||||
|
|
||||||
|
btnReturn.setOnClickListener(view -> finish());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -492,7 +492,7 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button3"
|
android:id="@+id/btnMtGm"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/main"
|
android:id="@+id/main"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Calculator (Under Construction)"
|
android:text="Calculator"
|
||||||
app:cornerRadius="20dp" />
|
app:cornerRadius="20dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
@ -75,12 +75,12 @@
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button3"
|
android:id="@+id/btnMtGm"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Midterm"
|
android:text="Midterm Activity"
|
||||||
app:cornerRadius="20dp" />
|
app:cornerRadius="20dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Fragments" />
|
android:text="Fragments (It's Actually Empty)" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,174 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MidtermActiivityGameScreen">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:weightSum="5">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/PlayerDisp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Player ? Turn"
|
||||||
|
android:textSize="50sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/L1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="3">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="50sp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="50sp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="50sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/L2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="3">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn4"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="50sp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn5"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="50sp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn6"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="50sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/L3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="3">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn7"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="50sp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn8"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="50sp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn9"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="50sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="3">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/Rst"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Restart" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
35
app/src/main/res/layout/activity_midterm_start_screen.xml
Normal file
35
app/src/main/res/layout/activity_midterm_start_screen.xml
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MidtermActivityStartScreen">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center|center_horizontal|center_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-50dp"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Play Tic-Tac-Toe" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/PlyBtn"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Play" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
android:weightSum="2">
|
android:weightSum="2">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/TbFname"
|
android:id="@+id/TbFirstName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
android:inputType="text" />
|
android:inputType="text" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editTextText3"
|
android:id="@+id/TbLastName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
|
@ -115,7 +115,7 @@
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editTextDate"
|
android:id="@+id/TbBirthDate"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
|
|
@ -139,7 +139,7 @@
|
||||||
android:text="Age " />
|
android:text="Age " />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/edtAge"
|
android:id="@+id/TbAge"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
|
|
@ -164,7 +164,7 @@
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/edtEmail"
|
android:id="@+id/TbEmail"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
|
|
@ -189,7 +189,7 @@
|
||||||
android:text="Nationality" />
|
android:text="Nationality" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/edt"
|
android:id="@+id/TbNationality"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
|
|
@ -205,7 +205,7 @@
|
||||||
android:weightSum="1">
|
android:weightSum="1">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/LblBdate"
|
android:id="@+id/LbHomeAddress"
|
||||||
android:layout_width="61dp"
|
android:layout_width="61dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
|
|
@ -214,7 +214,7 @@
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editTextDate"
|
android:id="@+id/TbHomeAddress"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
|
|
@ -238,7 +238,7 @@
|
||||||
android:text="Place of Birth" />
|
android:text="Place of Birth" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editTextNumber"
|
android:id="@+id/TbPlaceOfBirth"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.6"
|
android:layout_weight="0.6"
|
||||||
|
|
@ -263,7 +263,7 @@
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/EdtReligion"
|
android:id="@+id/TbReligion"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
|
|
@ -285,6 +285,7 @@
|
||||||
android:text="Marital Status" />
|
android:text="Marital Status" />
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
|
android:id="@+id/rgMaritalStatus"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,218 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".activity_passing_intents_exercise2">
|
tools:context=".activity_passing_intents_exercise2">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Student Profile"
|
||||||
|
android:textSize="40dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelFirstName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="First Name"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelLastName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Last Name"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelGender"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Gender"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelMaritalStatus"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Marital Status"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelAge"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Age"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelBirthDate"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Birth Date"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelNationality"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Nationality"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelHomeAddress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Home Address"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelEmailAddress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Email Address"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelPlaceofBirth"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Place of Birth"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/labelReligion"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Religion"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="10dp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formFirstName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formLastName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formGender"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formMaritalStatus"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formAge"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formBirthDate"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formNationality"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formHomeAddress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formEmailAddress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formPlaceofBirth"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/formReligion"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="TextView" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnPassingIntentsReturn"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Return" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Loading…
Reference in New Issue
Block a user