This commit is contained in:
louiscklaw
2025-01-31 19:15:17 +08:00
parent 09adae8c8e
commit 6c60a73f30
1546 changed files with 286918 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package com.example.itp4501assignment;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* 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.getTargetContext();
assertEquals("com.example.itp4501assignment", appContext.getPackageName());
}
}

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.itp4501assignment">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".GameMenuActivity"></activity>
<activity android:name=".GameStartAcivity"></activity>
<activity android:name=".UpdateInformation"></activity>
<activity android:name=".PieChartActivity"></activity>
<activity android:name=".GameLoadingActivity"></activity>
<activity android:name=".GameGuessActivity"></activity>
<activity android:name=".GameResultActivity"></activity>
<activity android:name=".LoadForResult"></activity>
</application>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>

View File

@@ -0,0 +1,148 @@
package com.example.itp4501assignment;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
public class GameGuessActivity extends AppCompatActivity {
int guess;
String name;
TextView tvRound;
Intent i;
LinearLayout lyQuestion, lyZero, lyFive, lyTen, lyfift, lyTwe;
LinearLayout[] layouts;
Animation animation;
Handler handler = new Handler();
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.gamegues_main);// get Design layout in layout/gamegues_main
animation= AnimationUtils.loadAnimation(this,R.anim.bounce); // instance the animation
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
lyQuestion=findViewById(R.id.lyQuestion);// set variable to adapter lyQuestion
lyZero=findViewById(R.id.lyZero);// set variable to adapter lyZero
lyFive=findViewById(R.id.lyFive);// set variable to adapter lyFive
lyTen=findViewById(R.id.lyTen);// set variable to adapter lyTen
lyfift=findViewById(R.id.lyfift);// set variable to adapter lyfift
lyTwe=findViewById(R.id.lyTwe);// set variable to adapter lyTwe
i = new Intent(this, LoadForResult.class); //instance the Intent
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
// get the Intent is not original
tvRound = findViewById(R.id.textRound);// set variable to adapter textRound
tvRound.setText("Round: "+getIntent().getIntExtra("Round",0));
//set the round text
name=getIntent().getStringExtra("name"); //get the Intent value and store in name variable
}
public void onWindowFocusChanged(boolean hasFocus) { //when start the activity
super.onWindowFocusChanged(hasFocus);
if(hasFocus){
lyZero.startAnimation(animation); //layout lyZero start the animation
lyFive.startAnimation(animation);//layout lyFive start the animation
lyTen.startAnimation(animation);//layout lyTen start the animation
lyfift.startAnimation(animation);//layout lyfift start the animation
lyTwe.startAnimation(animation);//layout lyTwe start the animation
lyQuestion.startAnimation(animation);//layout lyQuestion start the animation
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);// Confirm get the Intent and set the Intent is not original
}
public void onClick(View view){
if(view.getId()==R.id.lyZero || view.getId()==R.id.txtZero){ //check onClick value
guess = 0; //store the onclick value to variable
}else if (view.getId()==R.id.lyFive || view.getId()==R.id.txtFive){//check onClick value
guess = 5; //store the onclick value to variable
}else if (view.getId()==R.id.lyTen || view.getId()==R.id.txtTen){//check onClick value
guess = 10; //store the onclick value to variable
}else if (view.getId()==R.id.lyfift || view.getId()==R.id.txtfift){//check onClick value
guess =15; //store the onclick value to variable
}else if(view.getId()==R.id.lyTwe || view.getId()==R.id.txtTwe){//check onClick value
guess =20; //store the onclick value to variable
}
i.putExtra("id", getIntent().getStringExtra("id"));//put the Extra value to intent with the id key
i.putExtra("Left", getIntent().getIntExtra("Left",0));//put the Extra value to intent with the Left key
i.putExtra("Right", getIntent().getIntExtra("Right",0));//put the Extra value to intent with the Right key
i.putExtra("startTime",getIntent().getLongExtra("startTime",0));//put the Extra value to intent with the startTime key
i.putExtra("name",name);//put the Extra value to intent with the name key
i.putExtra("Round",getIntent().getIntExtra("Round",0));//put the Extra value to intent with the Round key
i.putExtra("guess",guess);//put the Extra value to intent with the guess key
startActivity(i); //start intent
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
// display with animation
finish(); //quit the game
}
public void finish() {
super.finish();
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
//display with aniamtion
}
@Override
public void onBackPressed() {//when not finish the game will display the alert message
new AlertDialog.Builder(this) // set the alert message
.setIcon(android.R.drawable.ic_dialog_alert) // display the wronging icon
.setTitle("Closing Game") // set the alert message title
.setMessage("Are you sure you want to quit this game?\nYou may Lost this game")
// set the message description
.setPositiveButton("Yes", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which) {//Yes button
insertDate(); // onClick the yes button will call the insertDate method
finish(); // quit the activity
}
})
.setNegativeButton("No", null) // NO button
.show(); // show the alert message
}
public void insertDate(){
SQLiteDatabase db;
try {
db = SQLiteDatabase.openDatabase("/data/data/com.example.itp4501assignment/GamesLog",
null, SQLiteDatabase.OPEN_READWRITE);//open database
String sql = "INSERT INTO GamesLog(gameTime, opponentName, winOrLost) values"
+ "(?, ?, ?)"; // insert sql with the parameter
db.execSQL(sql, new String[]{0 + "", name, 0 + ""}); // execute the SQL with the ags
db.close(); // database close
}catch (SQLiteException e){
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); //show Error message
}
}
}

View File

@@ -0,0 +1,136 @@
package com.example.itp4501assignment;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class GameLoadingActivity extends AppCompatActivity {
Intent intent;
RelativeLayout relLayoutTop, relLayoutBottom;
String name, id, country;
FetchPagetask task=null;
TextView tvLoading, tvName, tvCountry;
Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
public void run() { // set the runnable (thread)
relLayoutTop.setVisibility(View.VISIBLE); // display top relative Layout
relLayoutBottom.setVisibility(View.VISIBLE); // display bottom relative Layout
}
};
Runnable start = new Runnable() {
@Override
public void run() {// set the runnable (thread)
intent.putExtra("id",id); // put the id to intent with id key
intent.putExtra("name",name); // put the name to intent with name key
startActivity(intent); // start activity
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
//display with the animation
finish();
//quit the activity
}
};
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gameload_main);// get Design layout in layout/gameload_main
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
tvLoading = findViewById(R.id.tvMatching);// set variable to adapter tvMatching
tvName = findViewById(R.id.tvName);// set variable to adapter tvName
tvCountry = findViewById(R.id.tvCountry);// set variable to adapter tvCountry
relLayoutTop = findViewById(R.id.relLayoutTop);// set variable to adapter relLayoutTop
relLayoutBottom = findViewById(R.id.relLayoutBottom);// set variable to adapter relLayoutBottom
intent= new Intent(this, GameStartAcivity.class);//instance the intent object
if(task ==null ||
task.getStatus().equals(AsyncTask.Status.FINISHED)){ // check the task is nul
task = new FetchPagetask();
task.execute("https://4qm49vppc3.execute-api.us-east-1.amazonaws.com/Prod/itp4501_api/opponent/0");
//send the api url to FetchPagetask class
}
}
private class FetchPagetask extends AsyncTask<String, Integer, String> {
@Override
protected String doInBackground(String... values) {
InputStream inputStream = null;
String result = "";
URL url = null;
try {
url = new URL(values[0]);// get the url in LoadForResult class
HttpURLConnection con = (HttpURLConnection) url.openConnection(); //open the connection with the url
con.setRequestMethod("GET"); // use the GET method
con.connect(); //start to connect
inputStream = con.getInputStream(); // get the InputStream
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); //set the bufferedReader with the bytes
String line = ""; // instance the get value
while ((line = bufferedReader.readLine()) != null)
result += line; // get the value in the API and store the string to variable result
inputStream.close(); // close the input Stream
} catch (Exception e) {
result = e.getMessage(); // show the Error message
}
return result;
}
protected void onPostExecute(String result) { //after the execute DoInBackground get the result variable
try {
JSONObject jObj = new JSONObject(result); // get the JSON
id = jObj.getString("id");// get value in JSON with the id key
name = jObj.getString("name");// get value in JSON with the name key
country = jObj.getString("country");// get value in JSON with the country key
tvName.setText("Name: "+ name); //set text of the Name
tvCountry.setText("Country: "+ country);//set text of the Country
tvLoading.setText("Matched");//set text of the Loading
handler.postDelayed(runnable, 1000); //1000 is the timeout for the animation
handler.postDelayed(start,3000);//3000 is the timeout for the start the activity
} catch (Exception e) {
result = e.getMessage(); // show the error message
}
}
}
}

View File

@@ -0,0 +1,49 @@
package com.example.itp4501assignment;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class GameMenuActivity extends AppCompatActivity {
Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gamemenu_main);// get Design layout in layout/gamemenu_main
}
public void onClick(View view){
if(view.getId()==R.id.btnCancel){//if click cancel button
finish(); // quit the game
}else if(view.getId()==R.id.btnUpdateInf){//if click btnUpdateInf button
intent = new Intent(this, UpdateInformation.class);
// intent of UpdateInformation class
startActivity(intent); //start Activity
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
//display with the animation
}else if(view.getId()==R.id.btnStart){//if click btnStart button
intent = new Intent(this, GameLoadingActivity.class);
// intent of GameLoadingActivity class
startActivity(intent);//start Activity
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
//display with the animation
}else if(view.getId() == R.id.btnGraphic){//if click btnGraphic button
intent = new Intent(this, PieChartActivity.class);
// intent of GameLoadingActivity class
startActivity(intent);//start Activity
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
//display with the animation
}
}
public void finish() {
super.finish();
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
//display with the animation when quit this activity
}
}

View File

@@ -0,0 +1,215 @@
package com.example.itp4501assignment;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class GameResultActivity extends AppCompatActivity {
Intent i;
TextView txtOpName, txtName, txtWinOrLost, txtGuess;
ImageView imgOpLeft, imgOpRight, imgLeft, imgRight;
Button btnResultContine, btnResultQuit;
public static final String SHARED_PREFS = "RegPrefe";
SharedPreferences sharedPreferences;
int opLeft,opRight,opGuess,left,right,guess,round;
long startTime;
long endTime =System.currentTimeMillis();
String name, second, id;
SQLiteDatabase db;
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.gameresult_main);// get Design layout in layout/gameresult_main
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
opLeft=getIntent().getExtras().getInt("opLeft");// set variable to get intent string opLeft
opRight=getIntent().getExtras().getInt("opRight");// set variable to get intent string opRight
opGuess=getIntent().getExtras().getInt("opGuess");// set variable to get intent string opGuess
name =getIntent().getExtras().getString("name");// set variable to get intent string name
left= getIntent().getExtras().getInt("Left");// set variable to get intent string Left
right=getIntent().getExtras().getInt("Right");// set variable to get intent string Right
guess=getIntent().getExtras().getInt("guess");// set variable to get intent string guess
round = getIntent().getExtras().getInt("Round");// set variable to get intent string Round
id=getIntent().getExtras().getString("id");// set variable to get intent string id
startTime = getIntent().getExtras().getLong("startTime");// set variable to get intent string startTime
txtOpName = findViewById(R.id.txtOpName);// set variable to adapter txtOpName
txtName = findViewById(R.id.txtName);// set variable to adapter txtName
txtWinOrLost = findViewById(R.id.txtWinOrLose);// set variable to adapter txtWinOrLose
imgOpLeft = findViewById(R.id.imgOpLeft);// set variable to adapter imgOpLeft
imgOpRight = findViewById(R.id.imgOpRight);// set variable to adapter imgOpRight
imgLeft = findViewById(R.id.imgLeft);// set variable to adapter imgLeft
imgRight = findViewById(R.id.imgRight);// set variable to adapter imgRight
txtGuess = findViewById(R.id.txtGuess);// set variable to adapter txtGuess
txtOpName.setText(name); //set Text of the opName
txtName.setText(sharedPreferences.getString("regName",""));// set Text of owner name
btnResultContine = findViewById(R.id.btnResultContine);// set variable to adapter btnResultContine
btnResultQuit = findViewById(R.id.btnResultQuit);// set variable to adapter btnResultQuit
if(left==0) //display left 0 image
imgLeft.setImageResource(R.drawable.left);
else if(left==5)//display left 5 image
imgLeft.setImageResource(R.drawable.left_5);
if(right==0)//display right 0 image
imgRight.setImageResource(R.drawable.right);
else if(right==5)//display right 5 image
imgRight.setImageResource(R.drawable.right_5);
if(opLeft==0)//display opponents left 0 image
imgOpLeft.setImageResource(R.drawable.opright);
else if(opLeft==5)//display opponents left 5 image
imgOpLeft.setImageResource(R.drawable.opright_5);
if(opRight==0)//display opponents right 0 image
imgOpRight.setImageResource(R.drawable.opleft);
else if(opRight==5)//display opponents right 5 image
imgOpRight.setImageResource(R.drawable.opleft_5);
if(round==1 || round%2!=0) { // check use who guess
txtGuess.setText("Your Guess: "+guess); // set txtGuess value
if (opLeft + opRight + left + right == guess){ // if win
txtWinOrLost.setText("You Win"); //set the Win Text
btnResultContine.setText("Next Game"); //and display the button text
insertData(true); // call the insert method
}else{
txtWinOrLost.setText("Deuce Round"); //print the Text of Deuce when Deuce Round
}
}else{
txtGuess.setText("Opponent Guess: "+opGuess);// set txtGuess value of Opponent guess
if(opLeft+opRight+left+right==opGuess) { // if Opponent win
txtWinOrLost.setText("You Lose"); //set the Lose Text
btnResultContine.setText("Next Game"); //and display the button text
insertData(false);// call the insert method
}else{
txtWinOrLost.setText("Deuce Round");//print the Text of Deuce when Deuce Round
}
}
}
public void insertData(boolean winOrLost){ // insert data win or lost
int changeWinLostVal;
if(winOrLost) //check the value is lost or win and check to the integer
changeWinLostVal = 1; // if win
else
changeWinLostVal = 0; // if lost
try {
second = ((endTime - startTime) / 1000) + ""; // finsih the game time
db = SQLiteDatabase.openDatabase("/data/data/com.example.itp4501assignment/GamesLog",
null, SQLiteDatabase.OPEN_READWRITE); //open database
String sql = "INSERT INTO GamesLog(gameTime, opponentName, winOrLost) values"
+ "(?, ?, ?)"; // insert game result SQL with the parameter
db.execSQL(sql, new String[]{second, name, changeWinLostVal + ""}); // Run the SQL
db.close(); // database close
}catch (Exception e){
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
//Show the Error Message
}
}
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);// Confirm get the Intent and set the Intent is not original
setIntent(intent);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
public void onClick(View view){
if(view.getId()==R.id.btnResultContine) {
if (txtWinOrLost.getText().toString() == "You Win" || txtWinOrLost.getText().toString() == "You Lose") {
//check if Lose or WIn
i = new Intent(this, GameLoadingActivity.class);
//will have the button to play next game
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
} else if (txtWinOrLost.getText().toString() == "Deuce Round") {
//check the game is not win or lost
i = new Intent(this, GameStartAcivity.class);
//will have the button to continue the game
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
// get the Intent is not original
i.putExtra("Round", round + 1);
//put the Extra value to intent with the Round key
i.putExtra("name", name);
//put the Extra value to intent with the name key
i.putExtra("id", id);
//put the Extra value to intent with the id key
}
startActivity(i);
//start Activity with animation
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
finish();// quit the game
}else if(view.getId()==R.id.btnResultQuit &&txtWinOrLost.getText().toString() == "Deuce Round"){
onBackPressed();
}else if(view.getId()==R.id.btnResultQuit){
// check round is not finish
finish();
}
}
@Override
public void onBackPressed() {
if(txtWinOrLost.getText().toString()=="Deuce Round") { // if Game is not finish and the user want to quit the game
new AlertDialog.Builder(this) // set alert message
.setIcon(android.R.drawable.ic_dialog_alert) // set the alert icon
.setTitle("Closing Game") // set the Title in alert message
.setMessage("Are you sure you want to quit this game?\nYou may Lost this game") //set the message
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) { // when click yes button
insertDate(); // call the insert method
finish(); // quit the activity
}
})
.setNegativeButton("No", null) // No button
.show(); // show message
}else {
finish(); //quit the activity
}
}
public void insertDate(){
SQLiteDatabase db;
try {
db = SQLiteDatabase.openDatabase("/data/data/com.example.itp4501assignment/GamesLog",
null, SQLiteDatabase.OPEN_READWRITE);//open database
String sql = "INSERT INTO GamesLog(gameTime, opponentName, winOrLost) values"
+ "(?, ?, ?)";// set the insert sql with parameter
db.execSQL(sql, new String[]{0 + "", name, 0 + ""});//execute SQL with args
db.close(); //database close
}catch (SQLiteException e){
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
//Show error message
}
}
}

View File

@@ -0,0 +1,205 @@
package com.example.itp4501assignment;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
public class GameStartAcivity extends AppCompatActivity {
long startTime =System.currentTimeMillis();
ImageView btn00, btn05, btn50, btn55, selectedView;
TextView tvError, tvRound;
String name;
boolean selected = false;
int left, right, count;
Intent i;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gamestart_main);// get Design layout in layout/gamestart_main
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
btn00 = findViewById(R.id.btn00);// set variable to adapter btn00
btn05 = findViewById(R.id.btn05);// set variable to adapter btn05
btn50 = findViewById(R.id.btn50);// set variable to adapter btn50
btn55 = findViewById(R.id.btn55);
tvError = findViewById(R.id.textError);// set variable to adapter textError
tvRound = findViewById(R.id.textRound);// set variable to adapter textRound
selectedView = findViewById(R.id.imgVewSelected);// set variable to adapter imgVewSelected
tvRound = findViewById(R.id.textRound);// set variable to adapter textRound
name=getIntent().getStringExtra("name");// set variable to get intent string name
if(getIntent().hasExtra("Round"))// check whether new round
count = getIntent().getIntExtra("Round",0); // not new round get round number
else
count=1; // new round set 1
tvRound.setText("Round: "+count); // setText with Round
}
public void onClick(View view) {
if (view.getId() == R.id.btn00) { // if select the image will display bigger size img
btn00.setImageResource(R.drawable.gamestart_00sel); // selected img button img change
btn05.setImageResource(R.drawable.gamestart_05); // default img
btn50.setImageResource(R.drawable.gamestart_50); // default img
btn55.setImageResource(R.drawable.gamestart_55); // default img
left = 0; //set the left value
right = 0; // set the right value
selected = true; //set selected
selectedView.setImageResource(R.drawable.gamestart_cardpin_00);
// display the selected image
} else if (view.getId() == R.id.btn05) {
btn05.setImageResource(R.drawable.gamestart_05sel); // selected img button img change
btn50.setImageResource(R.drawable.gamestart_50);// default img
btn55.setImageResource(R.drawable.gamestart_55);// default img
btn00.setImageResource(R.drawable.gamestart_00);// default img
left = 0;//set the left value
right = 5;// set the right value
selected = true;//set selected
selectedView.setImageResource(R.drawable.gamestart_cardpin_05);
} else if (view.getId() == R.id.btn50) {
btn50.setImageResource(R.drawable.gamestart_50sel); // selected img button img change
btn55.setImageResource(R.drawable.gamestart_55);// default img
btn00.setImageResource(R.drawable.gamestart_00);// default img
btn05.setImageResource(R.drawable.gamestart_05);// default img
selected = true;//set selected
left = 5;//set the left value
right = 0;// set the right value
selectedView.setImageResource(R.drawable.gamestart_cardpin_50);
} else if (view.getId() == R.id.btn55) {
btn55.setImageResource(R.drawable.gamestart_55sel); // selected img button img change
btn00.setImageResource(R.drawable.gamestart_00);// default img
btn05.setImageResource(R.drawable.gamestart_05);// default img
btn50.setImageResource(R.drawable.gamestart_50);// default img
selected = true;//set selected
selectedView.setImageResource(R.drawable.gamestart_cardpin_55);
left = 5;//set the left value
right = 5;// set the right value
}
}
public void finish() {
super.finish();
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
// if quit the activity will use this animation
}
public void next(View view){
if (!selected) //check whether select one
tvError.setText("You should choice one"); //display error message
else {
if (count == 1 || count % 2 != 0) { // check round no
i = new Intent(this, GameGuessActivity.class);
// should choice the guess
} else {
i = new Intent(this, LoadForResult.class);
// not choice the guess
}
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
// get the Intent is not original
i.putExtra("id", getIntent().getStringExtra("id"));
//put the Extra value to intent with the id key
i.putExtra("Left", left);
//put the Extra value to intent with the Left key
i.putExtra("Right", right);
//put the Extra value to intent with the Right key
i.putExtra("startTime", startTime);
//put the Extra value to intent with the startTime key
i.putExtra("Round", count);
//put the Extra value to intent with the Round key
i.putExtra("name",name);
//put the Extra value to intent with the name key
startActivity(i);
// start the activity
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
// start the activity with the animation
finish();
// quit the activity
}
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);// Confirm get the Intent and set the Intent is not original
}
@Override
public void onBackPressed() {//when not finish the game will display the alert message
new AlertDialog.Builder(this) // set the alert message
.setIcon(android.R.drawable.ic_dialog_alert) // display the wronging icon
.setTitle("Closing Game") // set the alert message title
.setMessage("Are you sure you want to quit this game?\nYou may Lost this game")
// set the message description
.setPositiveButton("Yes", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which) {//Yes button
insertDate(); // onClick the yes button will call the insertDate method
finish(); // quit the activity
}
})
.setNegativeButton("No", null) // NO button
.show(); // show the alert message
}
public void insertDate(){
SQLiteDatabase db;
try {
db = SQLiteDatabase.openDatabase("/data/data/com.example.itp4501assignment/GamesLog",
null, SQLiteDatabase.OPEN_READWRITE);//open database
String sql = "INSERT INTO GamesLog(gameTime, opponentName, winOrLost) values"
+ "(?, ?, ?)"; // insert sql with the parameter
db.execSQL(sql, new String[]{0 + "", name, 0 + ""}); // execute the SQL with the ags
db.close(); // database close
}catch (SQLiteException e){
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); //show Error message
}
}
}

View File

@@ -0,0 +1,160 @@
package com.example.itp4501assignment;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class LoadForResult extends AppCompatActivity {
FetchPagetask task=null;
String id, name;
int opLeft, opRight, opGuess;
Intent i;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.loadforresult_main);// get Design layout in layout/loadforresult_main
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
id = getIntent().getStringExtra("id"); // set the variable to store the Intent value
name=getIntent().getStringExtra("name");// set the variable to store the Intent value
i =new Intent(LoadForResult.this, GameResultActivity.class);// instance the Intent
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); // NOT GET THE orgial Intent
if(task ==null ||
task.getStatus().equals(AsyncTask.Status.FINISHED)){ // check task whether null
task = new FetchPagetask(); // instance the FetchPagetask Class
task.execute("https://4qm49vppc3.execute-api.us-east-1.amazonaws.com/Prod/itp4501_api/opponent/"+id);
//send the API url to FetchPagetask class
}
}
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent); // Confirm get the Intent and set the Intent is not original
}
@Override
public void onBackPressed() { //when not finish the game will display the alert message
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle("Closing Game") // alert message Title
.setMessage("Are you sure you want to quit this game?\nYou may Lost this game") // alert message Description
.setPositiveButton("Yes", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which) { // Yes button
insertDate(); //onClick the Yes button will call the insertDate method
finish(); // end the activity
}
})
.setNegativeButton("No", null) // NO button
.show(); // show alert message
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
public void insertDate(){
SQLiteDatabase db;
try {
db = SQLiteDatabase.openDatabase("/data/data/com.example.itp4501assignment/GamesLog",
null, SQLiteDatabase.OPEN_READWRITE); //open Database
String sql = "INSERT INTO GamesLog(gameTime, opponentName, winOrLost) values"
+ "(?, ?, ?)"; //insert the lose sql with parameter
db.execSQL(sql, new String[]{0 + "", name, 0 + ""});
// execute the SQL and include the opp name
db.close();//database close
}catch (SQLiteException e){
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); //show error message
}
}
private class FetchPagetask extends AsyncTask<String, Integer, String> {
@Override
protected String doInBackground(String... values) {
InputStream inputStream = null;
String result = "";
URL url = null;
try {
url = new URL(values[0]);// get the url in LoadForResult class
HttpURLConnection con = (HttpURLConnection) url.openConnection(); //open the connection with the url
con.setRequestMethod("GET"); // use the GET method
con.connect(); //start to connect
inputStream = con.getInputStream(); // get the InputStream
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); //set the bufferedReader with the bytes
String line = ""; // instance the get value
while ((line = bufferedReader.readLine()) != null)
result += line; // get the value in the API and store the string to variable result
inputStream.close(); // close the input Stream
} catch (Exception e) {
result = e.getMessage(); // show the Error message
}
return result;
}
protected void onPostExecute(String result) { //after the execute DoInBackground get the result variable
try {
JSONObject jObj = new JSONObject(result); // get the JSON
opLeft = jObj.getInt("left"); // get value in JSON with the left key
opRight = jObj.getInt("right"); // get value in JSON with the right key
opGuess = jObj.getInt("guess"); // get value in JSON with the guess key
i.putExtra("id", getIntent().getExtras().getString("id")); //put the Extra value to intent with the id key
i.putExtra("Left", getIntent().getExtras().getInt("Left"));//put the Extra value to intent with the Left key
i.putExtra("Right", getIntent().getExtras().getInt("Right"));//put the Extra value to intent with the Right key
i.putExtra("startTime",getIntent().getExtras().getLong("startTime"));//put the Extra value to intent with the startTime key
i.putExtra("Round",getIntent().getExtras().getInt("Round"));//put the Extra value to intent with the Round key
i.putExtra("name",name);//put the Extra value to intent with the name key
if(getIntent().hasExtra("guess")) // get the guess
i.putExtra("guess",getIntent().getExtras().getInt("guess"));//put the Extra value to intent with the guess key
i.putExtra("opLeft",opLeft);//put the Extra value to intent with the opLeft key
i.putExtra("opRight",opRight);//put the Extra value to intent with the opRight key
i.putExtra("opGuess",opGuess);//put the Extra value to intent with the opGuess key
startActivity(i); // start int intent
finish(); // quit the finish
} catch (JSONException e) {
result = e.getMessage(); //show the error message
}
}
}
}

View File

@@ -0,0 +1,144 @@
package com.example.itp4501assignment;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.graphics.drawable.AnimationDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.DatePicker;
import android.widget.Toast;
import java.text.DateFormat;
import java.util.Calendar;
public class MainActivity extends AppCompatActivity {
LinearLayout layoutRegbg;
AnimationDrawable animationDrawable;
DateFormat fmtDate = DateFormat.getDateInstance(DateFormat.MEDIUM);
EditText etDate;
EditText etName;
EditText etEmail;
EditText etPhone;
Button btnSubmit;
Calendar myCalendar= Calendar.getInstance(); // Instance the DataTime Picker
DatePickerDialog.OnDateSetListener d = new
DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
myCalendar.set(Calendar.YEAR, year); // set the year
myCalendar.set(Calendar.MONTH, monthOfYear); // set the Month
myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); // set the Dat
updateLabel();
}
};
public static final String SHARED_PREFS = "RegPrefe"; // Instance the SharedPreferences FIle Name
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); // set the design layout
layoutRegbg = findViewById(R.id.bg_reg_layout); // set the adapter of the drawable file
animationDrawable =(AnimationDrawable) layoutRegbg.getBackground(); // and to the variable
animationDrawable.setEnterFadeDuration(3000); // set the start anim with Fade in
animationDrawable.setExitFadeDuration(3000); // and set the end anim with Fade out
animationDrawable.start(); // start the animation
SharedPreferences loginPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE); //instance the sharedPreferences
String userName = loginPreferences.getString("regName",null); // try to get reg Name in sharedPreferences
if(userName!=null){ // if have the Name, that mean users is registed
Intent intent = new Intent(this, GameMenuActivity.class); // new the intent of the Game Menu class
startActivity(intent); // display the GameMenu Class
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); // and display with this animation
finish(); // Quit this class
}
etDate = findViewById(R.id.regDate); // set the variable to connect the Date TextView
etName = findViewById(R.id.regName); // set the variable to connect the Name TextView
etEmail = findViewById(R.id.regEmail); // set the variable to connect the Email TextView
etPhone = findViewById(R.id.regPhone); // set the variable to connect the Phone TextView
btnSubmit = findViewById(R.id.btnSubmit); // set the variable to connect the submit Button
etDate.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { // set the Date Picker to set the Date Format
new DatePickerDialog(MainActivity.this, d,
myCalendar.get(Calendar.YEAR), // set the Year
myCalendar.get(Calendar.MONTH), // set the month
myCalendar.get(Calendar.DAY_OF_MONTH)).show(); //set the day
updateLabel(); // update the TextView of selected Date
}
});
}
private void updateLabel() {
etDate.setText(fmtDate.format(myCalendar.getTime()));
} // update the editText of the selected Date value
public void onClick(View view){
if(TextUtils.isEmpty(etName.getText())) // check the Name editText whether null
etName.setError( "Name is required!" ); // display the require message
else if(TextUtils.isEmpty(etDate.getText())) // check the Date whether null
etDate.setError("Date is required!"); // display the require message
else if(TextUtils.isEmpty(etPhone.getText())) // check the phone whether null
etPhone.setError("Phone is required!"); //display the require message
else if (TextUtils.isEmpty(etEmail.getText())) // check the email whether null
etEmail.setError("Email is required!");// display the require message
else {
//Not the editText is null will instance the SharedPreferences
SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("regName", etName.getText().toString());
//put the Name editText value to SharedPreferences with "regName" key
editor.putString("regDate", etDate.getText().toString());
//put the Date editText value to SharedPreferences with "regDate" key
editor.putString("regEmail", etEmail.getText().toString());
//put the Email editText value to SharedPreferences with "regEmail" key
editor.putString("regPhone", etPhone.getText().toString());
//put the regPhone editText value to SharedPreferences with "regPhone" key
editor.commit(); // commit the sharedPreferences
createTable(); // when the registed the game will create the database
Intent intent = new Intent(this, GameMenuActivity.class);
// set the intent to connect the GameMenuActivity class
startActivity(intent);
// Show the GameMenuActivity Class
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
// show the class with the animation
finish(); // quit the class
}
}
public void createTable(){
try{
SQLiteDatabase db; // set the variable of Database
db=SQLiteDatabase.openDatabase("/data/data/com.example.itp4501assignment/GamesLog",
null, SQLiteDatabase.CREATE_IF_NECESSARY); //create the Database will the patch
String sql = "DROP TABLE if exists GamesLog;"; //Drop the Table SQL avoid exception occured
db.execSQL(sql); // run SQL
sql = "CREATE TABLE GamesLog( ID INTEGER PRIMARY KEY AUTOINCREMENT, gameDate DATETIME DEFAULT CURRENT_DATE,"+
"gameTime text, opponentName text, winOrLost INT); ";// CREATE Table SQL
db.execSQL(sql); // run SQL
db.close(); // close the database
} catch (SQLiteException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); //show the error message with Toast
}
}
}

View File

@@ -0,0 +1,176 @@
package com.example.itp4501assignment;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import java.text.DecimalFormat;
public class PieChartActivity extends AppCompatActivity {
SQLiteDatabase db;
int countTRUE;
int countFALSE;
float countTruePre = 0, countFalsePre = 0;
DecimalFormat decimalFormat = new DecimalFormat("0.00"); // set the val format with 0.00
Cursor cursor = null;
String sql;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new Panel(this));
try {
// Create a database if it does not exist
db = SQLiteDatabase.openDatabase("/data/data/com.example.itp4501assignment/GamesLog",
null, SQLiteDatabase.OPEN_READONLY); // open the Database with the path
cursor = db.rawQuery("SELECT COUNT(*) FROM GamesLog WHERE winOrLost=0",null); // COUNT the Lose SQL
if (cursor.moveToNext()) //check the sql whether have the result
countFALSE = cursor.getInt(0); // put the result to variable
else
countFALSE = 0; // if not result put the zero to variable
cursor = db.rawQuery("SELECT COUNT(*) FROM GamesLog WHERE winOrLost=1",null); // COUNT the WIN SQL
if (cursor.moveToNext()) // check the sql whether have the result
countTRUE = cursor.getInt(0); //put the result to variable
else
countTRUE = 0;// if not result put the zero to variable
if(countTRUE==0)
countTruePre=0;
else
countTruePre = countTRUE / (float) (countTRUE + countFALSE); // calculate the Win percentage
if(countFALSE==0)
countFalsePre=0;
else
countFalsePre = countFALSE / (float) (countTRUE + countFALSE); // calculate the Lose percentage
} catch (SQLiteException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); // show the error message
// if the exception occured set the default value
countFALSE = 0;
countTRUE = 0;
countTruePre = (float) 0;
countFalsePre = (float) 0;
}
}
class Panel extends View {
public Panel(Context context) {
super(context); // set the panel to draw
}
public void onDraw(Canvas c) {
super.onDraw(c);
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL); //set the paint is Fill
paint.setColor(Color.WHITE); // set the background is white
paint.setAntiAlias(true); // set the draw the shape is antiAlias
paint.setColor(Color.BLACK);
paint.setStrokeWidth(2);
//drawLine(float startX, float startY, float stopX, float stopY, Paint paint)
c.drawLine(150, 150, 150, 850, paint);// draw the bar chart Y line
c.drawLine(150, 850, 980, 850, paint); // draw the bar chary X line
//Rect TRUE //(150-848)/100*countTruePre
paint.setColor(Color.GREEN); // set the draw color is green
c.drawRect(284, (848 - 150) - ((848 - 150) * countTruePre) + 150, 484, 848, paint);
// draw the win Rectangle
c.drawCircle(300, 1090, 90, paint);
// draw the win Circle
paint.setColor(Color.RED); // set the draw color is red
c.drawRect(634, (848 - 150) - ((848 - 150) * countFalsePre) + 150, 834, 848, paint);
// draw the Lose Rectangle
c.drawCircle(300, 1330, 90, paint);
// draw the Lose Circle
// %
paint.setColor(Color.BLACK);
paint.setStyle(Paint.Style.FILL);
paint.setTextSize(30); //set the draw text text size is 30
paint.setTypeface(Typeface.SERIF);// font family is SERID
c.drawText(decimalFormat.format(countTruePre * 100 )+ "%", 336, (848 - 150) - ((848 - 150) * countTruePre) + 120, paint);
//draw the bar chart of WIN %
c.drawText(decimalFormat.format(countFalsePre * 100) + "%", 679, (848 - 150) - ((848 - 150) * countFalsePre) + 120, paint);
//draw the bar chart of Lose %
paint.setTextSize(35);//set the draw text text size is 35
c.drawText("Count: " + countTRUE + ",", 420, 1088, paint); //draw the count vale in circle right side
c.drawText("Percentage: " + decimalFormat.format(countTruePre * 100) + "%", 420, 1135, paint);
// draw the win Percentage val in the circle right side
c.drawText("Count: " + countFALSE + ",", 420, 1338, paint);
//draw the lose Percentage val in the circle right side
c.drawText("Percentage: " + decimalFormat.format(countFalsePre * 100) + "%", 420, 1385, paint);
// draw the lose Percentage val in the circle right side
//set the font family
paint.setTypeface(Typeface.create("Arial", Typeface.BOLD));
c.drawText("WIN", 350, 900, paint); // draw the Win in bar chart X title
c.drawText("LOSE", 693, 900, paint); // draw the LOSE in bar chart Y title
paint.setTextSize(50); //set Text Size is 50
c.drawText("WIN", 254, 1110, paint); // draw the WIN in Circle
c.drawText("LOSE", 243, 1352, paint); // draw the LOSE in Circle
c.drawText("GameDate", 75, 1575, paint); // draw the GameDate column title
c.drawText("OpponentName", 355, 1575, paint); // draw the OpponentName title
c.drawText("winOrLost", 760, 1575, paint); // draw the winOrLost column title
paint.setStyle(Paint.Style.FILL);
paint.setTypeface(Typeface.DEFAULT); // set the default font family
int locationY=1575+70; // set the row margin-bottom
String winOrLost;
try {
cursor = null;
cursor = db.rawQuery("SELECT * FROM GamesLog ORDER BY gameDate DESC limit 3", null);
//GET the least 3 Game LOG information SQL
while (cursor.moveToNext()) {
String gameDate = cursor.getString(cursor.getColumnIndex("gameDate"));
//get the Column gameDate val and store to gameDate variable
String opponentName = cursor.getString(cursor.getColumnIndex("opponentName"));
//get the Column opponentName val and store to opponentName variable
int checkval = cursor.getInt(cursor.getColumnIndex("winOrLost"));
//get the winOrLost val and store to checkval variable
c.drawText(gameDate, 70, locationY, paint); // draw the gameDate
c.drawText(opponentName, 465, locationY, paint); // draw the opponent Name
if(checkval == 0) // check the winORLost Val
winOrLost = "LOST"; // if 0 equal to LOST
else
winOrLost = "WINS"; // NOT 0 is Win
c.drawText(winOrLost, 805, locationY, paint); //draw the win OR Lost
locationY+=70; // set the margin-bottom
}
} catch (SQLiteException e) {
}
paint.setTextSize(30);
c.drawText("Last 3 Game History", 70, locationY-20, paint); //draw the hits of last 4 game history
}
}
public void finish() {
super.finish();
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right); // set the animation of quit the class
}
}

View File

@@ -0,0 +1,100 @@
package com.example.itp4501assignment;
import android.app.DatePickerDialog;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.text.DateFormat;
import java.util.Calendar;
public class UpdateInformation extends AppCompatActivity {
EditText etDate;
EditText etName;
EditText etEmail;
EditText etPhone;
DateFormat fmtDate = DateFormat.getDateInstance(DateFormat.MEDIUM); // set the Date Format
String sharedPetName, sharedPetDate, sharedPetEmail, sharedPetPhone;
TextView tvUsername;
public static final String SHARED_PREFS = "RegPrefe";// instance the sharedPreferences
SharedPreferences sharedPreferences;
Calendar dtCalendar= Calendar.getInstance(); //set the Date picker
DatePickerDialog.OnDateSetListener d = new
DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
dtCalendar.set(Calendar.YEAR, year);
dtCalendar.set(Calendar.MONTH, monthOfYear);
dtCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
updateLabel();
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.update_inf_main); // set the design interface of layout/update_inf_main
sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE); // getSharedPreferences
etDate = findViewById(R.id.txtDate);// set variable to connect the editText
etName = findViewById(R.id.txtName);// set variable to connect the editText
etEmail = findViewById(R.id.txtEmail);// set variable to connect the editText
etPhone = findViewById(R.id.txtPhone);// set variable to connect the editText
tvUsername = findViewById(R.id.lblUserName);// set variable to connect the editText
sharedPetName =sharedPreferences.getString("regName","") ;
// get the sharedPreference value of the regName key and store to variable
sharedPetDate = sharedPreferences.getString("regDate","");
// get the sharedPreference value of the regDate key and store to variable
sharedPetEmail = sharedPreferences.getString("regEmail","");
// get the sharedPreference value of the regEmail key and store to variable
sharedPetPhone = sharedPreferences.getString("regPhone","");
// get the sharedPreference value of the regPhone key and store to variable
etName.setText(sharedPetName); // set the text to the editText Name
etDate.setText(sharedPetDate);// set the text to the editText Date
etEmail.setText(sharedPetEmail);// set the text to the editText Email
etPhone.setText(sharedPetPhone);// set the text to the editText Phone
tvUsername.setText(sharedPetName+", Hello!"); // set the text to the TextView
etDate.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { // Date picker
new DatePickerDialog(UpdateInformation.this, d,
dtCalendar.get(Calendar.YEAR),//year
dtCalendar.get(Calendar.MONTH),//month
dtCalendar.get(Calendar.DAY_OF_MONTH)).show();//day
updateLabel(); // picked will call the updateLable method
}
});
}
private void updateLabel() {
etDate.setText(fmtDate.format(dtCalendar.getTime()));// set the etDate Edittext value
}
public void onClick(View view){
if(view.getId()==R.id.btnUpdate){//if onclick the update button
SharedPreferences.Editor editor = sharedPreferences.edit(); // instance the sharedPreferences editor
editor.putString("regName", etName.getText().toString()); // put the new value to the regName key value
editor.putString("regDate", etDate.getText().toString());// put the new value to the regDate key value
editor.putString("regEmail", etEmail.getText().toString());// put the new value to the regEmail key value
editor.putString("regPhone", etPhone.getText().toString());// put the new value to the regPhone key value
editor.commit();// sharedPreferences commit
if(etName.getText().toString()!=sharedPetName ||etDate.getText().toString()!=sharedPetDate || etEmail.getText().toString()!=sharedPetEmail ||etPhone.getText().toString()!=sharedPetPhone)
Toast.makeText(getBaseContext(), "Updated", Toast.LENGTH_LONG).show(); // check the EditText whether change, and when check will display the Toast
finish(); //Quit the Activity
}
}
public void finish() {
super.finish();
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);//when Quit the activity will use the animation
}
}

View File

@@ -0,0 +1,11 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/bounce_interpolator">
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="0.0"
android:toXScale="1.0"
android:toYScale="1.0" />
</set>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="-100%p"
android:toXDelta="0" />
</set>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="100%p"
android:toXDelta="0" />
</set>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="0"
android:toXDelta="-100%p" />
</set>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="0"
android:toXDelta="100%p" />
</set>

View File

@@ -0,0 +1,34 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/first_layer"
android:duration="4000"/>
<item
android:drawable="@drawable/second_layer"
android:duration="4000"/>
<item
android:drawable="@drawable/third_layer"
android:duration="4000"/>
</animation-list>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#3F51B5"
android:endColor="#34dfbd"
android:angle="-90"/>
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#72BEBEBE"/>
<corners android:radius="50dp"/>
<stroke android:color="#80FFFFFF"/>
<stroke android:width="3dp"/>
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#000"/>
<corners android:radius="50dp"/>
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#6c50ec"
android:endColor="#DD5292"
android:angle="-90"/>
</shape>

View File

@@ -0,0 +1,5 @@
<vector android:height="40dp" android:tint="#303AA6"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M3,5v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2L5,3c-1.11,0 -2,0.9 -2,2zM15,9c0,1.66 -1.34,3 -3,3s-3,-1.34 -3,-3 1.34,-3 3,-3 3,1.34 3,3zM6,17c0,-2 4,-3.1 6,-3.1s6,1.1 6,3.1v1L6,18v-1z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="150dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="150dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,5c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM12,19.2c-2.5,0 -4.71,-1.28 -6,-3.22 0.03,-1.99 4,-3.08 6,-3.08 1.99,0 5.97,1.09 6,3.08 -1.29,1.94 -3.5,3.22 -6,3.22z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="40dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,5c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM12,19.2c-2.5,0 -4.71,-1.28 -6,-3.22 0.03,-1.99 4,-3.08 6,-3.08 1.99,0 5.97,1.09 6,3.08 -1.29,1.94 -3.5,3.22 -6,3.22z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="35dp" android:tint="#303AA6"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M9,11L7,11v2h2v-2zM13,11h-2v2h2v-2zM17,11h-2v2h2v-2zM19,4h-1L18,2h-2v2L8,4L8,2L6,2v2L5,4c-1.11,0 -1.99,0.9 -1.99,2L3,20c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,6c0,-1.1 -0.9,-2 -2,-2zM19,20L5,20L5,9h14v11z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="35dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M9,11L7,11v2h2v-2zM13,11h-2v2h2v-2zM17,11h-2v2h2v-2zM19,4h-1L18,2h-2v2L8,4L8,2L6,2v2L5,4c-1.11,0 -1.99,0.9 -1.99,2L3,20c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,6c0,-1.1 -0.9,-2 -2,-2zM19,20L5,20L5,9h14v11z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="35dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z"/>
</vector>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="35dp" android:tint="#303AA6"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,18L4,18L4,8l8,5 8,-5v10zM12,11L4,6h16l-8,5z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="150dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="150dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="40dp" android:tint="#303AA6"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0 -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="35dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0 -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z"/>
</vector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#3F51B5"
android:endColor="#3F51B5" />
</shape>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFF"/>
<corners android:radius="50dp"/>
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#51FFFFFF"/>
<corners android:radius="50dp"/>
</shape>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#345bdb"
android:endColor="#db348b"
android:angle="-90"/>
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#3F51B5"
android:endColor="#CC1A56"
android:angle="-90"/>
</shape>

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:id="@+id/bg_reg_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_reg_anim"
android:gravity="center"
android:onClick="onClick"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageView
android:id="@+id/imAccount"
android:layout_width="match_parent"
android:layout_height="150dp"
app:srcCompat="@drawable/regtitle" />
<EditText
android:id="@+id/regName"
android:layout_width="325dp"
android:layout_height="60dp"
android:layout_marginTop="25dp"
android:background="@drawable/reg_edittext"
android:drawableLeft="@drawable/ic_account_circle_white_40x35dp"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textSize="18sp" />
<EditText
android:id="@+id/regDate"
android:layout_width="325dp"
android:layout_height="60dp"
android:layout_marginTop="20dp"
android:background="@drawable/reg_edittext"
android:drawableLeft="@drawable/ic_date_range_white_40x35dp"
android:ems="10"
android:focusable="false"
android:hint="Date of Birth"
android:inputType="date"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textSize="18sp" />
<EditText
android:id="@+id/regPhone"
android:layout_width="325dp"
android:layout_height="60dp"
android:layout_marginTop="20dp"
android:background="@drawable/reg_edittext"
android:drawableLeft="@drawable/ic_phone_white_40x35dp"
android:ems="10"
android:hint="Phone"
android:inputType="phone"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textSize="18sp" />
<EditText
android:id="@+id/regEmail"
android:layout_width="325dp"
android:layout_height="60dp"
android:layout_marginTop="20dp"
android:background="@drawable/reg_edittext"
android:drawableLeft="@drawable/ic_email_white_40x35dp"
android:ems="10"
android:hint="Email"
android:inputType="textEmailAddress"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textSize="18sp" />
<Button
android:id="@+id/btnSubmit"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:background="@drawable/reg_button"
android:onClick="onClick"
android:text="Submit" />
</LinearLayout>

View File

@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gamestart_background"
android:orientation="vertical">
<LinearLayout
android:id="@+id/lyQuestion"
android:layout_width="318dp"
android:layout_height="197dp"
android:layout_gravity="center"
android:layout_marginTop="140dp"
android:background="@drawable/gamestart_cardblue"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/txtQuestion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="6dp"
android:text="What is your guess?"
android:textAlignment="center"
android:textColor="#332FA2"
android:textSize="26sp" />
<TextView
android:id="@+id/textRound"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:lineSpacingExtra="6dp"
android:text="Round:"
android:textAlignment="center"
android:textColor="#000"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="175dp"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:padding="10dp">
<LinearLayout
android:id="@+id/lyZero"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginRight="15dp"
android:background="@drawable/gamestart_cardblue"
android:onClick="onClick"
android:orientation="vertical">
<TextView
android:id="@+id/txtZero"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:lineSpacingExtra="6dp"
android:onClick="onClick"
android:text="0"
android:textAlignment="center"
android:textColor="#332FA2"
android:textSize="26sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/lyFive"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginRight="15dp"
android:background="@drawable/gamestart_cardblue"
android:onClick="onClick"
android:orientation="vertical">
<TextView
android:id="@+id/txtFive"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:lineSpacingExtra="6dp"
android:onClick="onClick"
android:text="5"
android:textAlignment="center"
android:textColor="#332FA2"
android:textSize="26sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/lyTen"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginRight="15dp"
android:background="@drawable/gamestart_cardblue"
android:onClick="onClick"
android:orientation="vertical">
<TextView
android:id="@+id/txtTen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:lineSpacingExtra="6dp"
android:onClick="onClick"
android:text="10"
android:textAlignment="center"
android:textColor="#332FA2"
android:textSize="26sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/lyfift"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginRight="15dp"
android:background="@drawable/gamestart_cardblue"
android:onClick="onClick"
android:orientation="vertical">
<TextView
android:id="@+id/txtfift"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:lineSpacingExtra="6dp"
android:onClick="onClick"
android:text="15"
android:textAlignment="center"
android:textColor="#332FA2"
android:textSize="26sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/lyTwe"
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/gamestart_cardblue"
android:onClick="onClick"
android:orientation="vertical">
<TextView
android:id="@+id/txtTwe"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:lineSpacingExtra="6dp"
android:onClick="onClick"
android:text="20"
android:textAlignment="center"
android:textColor="#332FA2"
android:textSize="26sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="#000"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp">
<TextView
android:id="@+id/tvMatching"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Matching..."
android:textColor="@android:color/white"
android:textSize="30sp"
android:textStyle="bold" />
<RelativeLayout
android:id="@+id/relLayoutTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tvMatching"
android:visibility="gone">
<ImageView
android:id="@+id/img_person"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_person_white_150dp" />
<LinearLayout
android:id="@+id/linlay1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/img_person"
android:layout_marginTop="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="Name:"
android:textAllCaps="true"
android:textColor="#FFF"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tvCountry"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="Password"
android:textAllCaps="true"
android:textColor="#FFF"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relLayoutBottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:visibility="gone"/>
</RelativeLayout>

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/btnStart"
android:layout_width="240dp"
android:layout_height="60dp"
android:layout_marginTop="30dp"
android:background="@drawable/gamemenu_button"
android:onClick="onClick"
android:text="Start Game" />
<Button
android:id="@+id/btnGraphic"
android:layout_width="240dp"
android:layout_height="60dp"
android:layout_marginTop="30dp"
android:background="@drawable/gamemenu_button"
android:onClick="onClick"
android:text="Analysis" />
<Button
android:id="@+id/btnUpdateInf"
android:layout_width="240dp"
android:layout_height="60dp"
android:layout_marginTop="30dp"
android:background="@drawable/gamemenu_button"
android:onClick="onClick"
android:text="Update Information" />
<Button
android:id="@+id/btnCancel"
android:layout_width="114dp"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="@drawable/gamemenu_quitbutton"
android:onClick="onClick"
android:text="Quit"
android:textColor="@android:color/white"
android:textSize="18sp" />
</LinearLayout>

View File

@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gamestart_background"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="181dp"
android:layout_height="79dp"
android:layout_gravity="left"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:background="@drawable/gameresult_name"
android:gravity="left"
android:orientation="vertical">
<TextView
android:id="@+id/txtOpTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:text="Opponent"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/txtOpName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:text="Name"
android:textSize="24sp" />
</LinearLayout>
<LinearLayout
android:layout_width="247dp"
android:layout_height="227dp"
android:layout_gravity="center"
android:layout_marginTop="25dp"
android:background="@drawable/gameresult_result"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_marginTop="10dp"
android:layout_marginRight="7dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/imgOpLeft"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="18dp"
android:layout_marginRight="29dp"
android:layout_weight="0"
tools:srcCompat="@tools:sample/avatars[0]" />
<ImageView
android:id="@+id/imgOpRight"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="15dp"
android:layout_weight="0"
tools:srcCompat="@tools:sample/avatars[0]" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_marginTop="40dp"
android:layout_marginRight="7dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/imgLeft"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="18dp"
android:layout_marginRight="29dp"
android:layout_weight="0"
tools:srcCompat="@tools:sample/avatars[0]" />
<ImageView
android:id="@+id/imgRight"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="15dp"
android:layout_weight="0"
tools:srcCompat="@tools:sample/avatars[0]" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/txtGuess"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="Guess"
android:textColor="@android:color/white"
android:textSize="18sp" />
<LinearLayout
android:layout_width="180dp"
android:layout_height="80dp"
android:layout_gravity="right"
android:layout_marginRight="20dp"
android:background="@drawable/gameresult_namepur"
android:orientation="vertical">
<TextView
android:id="@+id/txtTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:text="Owner"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/txtName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:text="Name"
android:textSize="24sp" />
</LinearLayout>
<TextView
android:id="@+id/txtWinOrLose"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center"
android:text="WinOrLose"
android:textColor="@android:color/white"
android:textSize="36sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="40dp"
android:layout_marginRight="30dp"
android:orientation="horizontal">
<Button
android:id="@+id/btnResultQuit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:layout_weight="1"
android:background="@drawable/gamemenu_quitbutton"
android:onClick="onClick"
android:text="Quit"
android:textColor="@android:color/white" />
<Button
android:id="@+id/btnResultContine"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="1"
android:background="@drawable/reg_button"
android:onClick="onClick"
android:text="Continue" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gamestart_background"
android:orientation="vertical">
<TextView
android:id="@+id/gameTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="casual"
android:gravity="center"
android:text='" 15,20 "'
android:textColor="#FFF"
android:textSize="36sp" />
<LinearLayout
android:layout_width="318dp"
android:layout_height="197dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:background="@drawable/gamestart_cardblue"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/txtQuestion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="6dp"
android:text="What is your choice?"
android:textAlignment="center"
android:textColor="#332FA2"
android:textSize="26sp" />
<TextView
android:id="@+id/textError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:lineSpacingExtra="6dp"
android:textAlignment="center"
android:textColor="#FD0000"
android:textSize="14sp" />
<TextView
android:id="@+id/textRound"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:lineSpacingExtra="6dp"
android:text="Round:"
android:textAlignment="center"
android:textColor="#000"
android:textSize="14sp" />
</LinearLayout>
<ImageView
android:id="@+id/imgVewSelected"
android:layout_width="200dp"
android:layout_height="114dp"
android:layout_gravity="center"
app:srcCompat="@drawable/gamestart_cardpin" />
<TextView
android:id="@+id/textTitle"
android:layout_width="match_parent"
android:layout_height="39dp"
android:layout_marginLeft="28dp"
android:layout_marginTop="10dp"
android:layout_marginRight="28dp"
android:text="SELECT "
android:textColor="#FFF"
android:textSize="24sp" />
<LinearLayout
android:layout_width="350dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:id="@+id/btn00"
android:layout_width="119dp"
android:layout_height="73dp"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:layout_marginRight="30dp"
android:background="@drawable/gamestart_00"
android:onClick="onClick" />
<ImageView
android:id="@+id/btn55"
android:layout_width="119dp"
android:layout_height="73dp"
android:layout_gravity="right|center_horizontal|fill_horizontal"
android:background="@drawable/gamestart_55"
android:onClick="onClick" />
</LinearLayout>
<LinearLayout
android:layout_width="350dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:id="@+id/btn05"
android:layout_width="119dp"
android:layout_height="73dp"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:layout_marginRight="30dp"
android:background="@drawable/gamestart_05"
android:onClick="onClick" />
<ImageView
android:id="@+id/btn50"
android:layout_width="119dp"
android:layout_height="73dp"
android:layout_gravity="right|center_horizontal|fill_horizontal"
android:background="@drawable/gamestart_50"
android:onClick="onClick" />
</LinearLayout>
<Button
android:id="@+id/btnNext"
android:layout_width="109dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="@drawable/reg_button"
android:onClick="next"
android:text="NEXT" />
</LinearLayout>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/gamestart_background"
android:gravity="center"
android:orientation="vertical"
app:layout_anchorGravity="center">
<ProgressBar
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="102dp"
android:layout_gravity="center"
android:foregroundGravity="center" />
<TextView
android:id="@+id/txtWaitSelect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Waiting the opponents select"
android:textColor="@android:color/white"
android:textSize="24sp" />
</LinearLayout>

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="280dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_marginBottom="0dp"
android:background="@drawable/inf_toplayout"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/imAccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_account_circle_white_120dp" />
<TextView
android:id="@+id/lblUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="UserName"
android:textColor="#FFFFFF"
android:textSize="24sp" />
</LinearLayout>
</RelativeLayout>
<EditText
android:id="@+id/txtName"
android:layout_width="275dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:drawableLeft="@drawable/ic_account_box_blue_30dp"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName"
android:textColorHighlight="#3039A0" />
<EditText
android:id="@+id/txtDate"
android:layout_width="275dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:drawableLeft="@drawable/ic_date_range_blue_40dp"
android:focusable="false"
android:ems="10"
android:hint="Date"
android:inputType="textPersonName" />
<EditText
android:id="@+id/txtEmail"
android:layout_width="275dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:drawableLeft="@drawable/ic_mail_outline_blue_30dp"
android:ems="10"
android:hint="Email"
android:inputType="textPersonName" />
<EditText
android:id="@+id/txtPhone"
android:layout_width="275dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:drawableLeft="@drawable/ic_phone_blue_40dp"
android:ems="10"
android:hint="Phone Number"
android:inputType="textPersonName" />
<Button
android:id="@+id/btnUpdate"
android:layout_width="126dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="60dp"
android:background="@drawable/gamemenu_quitbutton"
android:onClick="onClick"
android:text="Update"
android:textColor="#FFFFFF" />
</LinearLayout>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#3F51B5</color>
<color name="colorAccent">#3F51B5</color>
</resources>

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">ITP4501Assignment</string>
</resources>

View File

@@ -0,0 +1,13 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@@ -0,0 +1,17 @@
package com.example.itp4501assignment;
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);
}
}