Commit 5bf28e1f authored by daniel.berrow's avatar daniel.berrow

Final

parents
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="13" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.coursework2"
minSdkVersion 27
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.example.coursework2;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.coursework2", appContext.getPackageName());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.coursework2">
<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/Theme.Coursework2">
<activity android:name=".receiptPage"></activity>
<activity android:name=".Payment" />
<activity android:name=".Souvenir" />
<activity android:name=".Cafe" />
<activity android:name=".TimeAndDate" />
<activity android:name=".bookingPage" />
<activity android:name=".CreateAccount" />
<activity android:name=".Menu" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.example.coursework2;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class Cafe extends AppCompatActivity {
//define the spinners for each item
private Spinner spinnerItemTea;
private Spinner spinnerItemWater;
private Spinner spinnerItemCoffee;
private Spinner spinnerItemFlatbread;
private Spinner spinnerItemSandwich;
private Spinner spinnerItemSweetroll;
private Spinner spinnerItemSalad;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cafe);
//assign a spinner to an id on the display
spinnerItemTea = findViewById(R.id.shirtList);
spinnerItemWater = findViewById(R.id.hatList);
spinnerItemCoffee = findViewById(R.id.snowGlobeList);
spinnerItemFlatbread = findViewById(R.id.keyChainList);
spinnerItemSandwich = findViewById(R.id.bottleList);
spinnerItemSweetroll = findViewById(R.id.mugList);
spinnerItemSalad = findViewById(R.id.coasterList);
String[] list = getResources().getStringArray(R.array.list_options);
//add array to the list of options
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, list);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerItemTea.setAdapter(adapter);
spinnerItemWater.setAdapter(adapter);
spinnerItemCoffee.setAdapter(adapter);
spinnerItemFlatbread.setAdapter(adapter);
spinnerItemSandwich.setAdapter(adapter);
spinnerItemSweetroll.setAdapter(adapter);
spinnerItemSalad.setAdapter(adapter);
}
//back to main menu
public void menu(View v){
Intent i = new Intent(this, Menu.class);
startActivity(i);
}
//go back a step
public void back(View v){
Intent i = new Intent(this, TimeAndDate.class);
Bundle j = getIntent().getExtras();
String strUsername = j.getString("StrUsername");
int fee = j.getInt("mFee");
String MN = j.getString("mName");
i.putExtra("strUsername", strUsername);
i.putExtra("mName", MN);
i.putExtra("mFee", fee);
startActivity(i);
}
//move onto the next section with the current parameters
public void book(View v){
Spinner teaSpinner = (Spinner)findViewById(R.id.shirtList);
int teaFee = Integer.parseInt(teaSpinner.getSelectedItem().toString());
Spinner waterSpinner = (Spinner)findViewById(R.id.hatList);
int waterFee = Integer.parseInt(waterSpinner.getSelectedItem().toString());
Spinner coffeeSpinner = (Spinner)findViewById(R.id.snowGlobeList);
int coffeeFee = Integer.parseInt(coffeeSpinner.getSelectedItem().toString())*2;
Spinner flatbreadSpinner = (Spinner)findViewById(R.id.keyChainList);
int flatbreadFee = Integer.parseInt(flatbreadSpinner.getSelectedItem().toString())*2;
Spinner sandwichSpinner = (Spinner)findViewById(R.id.bottleList);
int sandwichFee = Integer.parseInt(sandwichSpinner.getSelectedItem().toString())*2;
Spinner sweetbreadSpinner = (Spinner)findViewById(R.id.mugList);
int sweetbreadFee = Integer.parseInt(sweetbreadSpinner.getSelectedItem().toString())*2;
Spinner saladSpinner = (Spinner)findViewById(R.id.coasterList);
int saladFee = Integer.parseInt(saladSpinner.getSelectedItem().toString())*2;
Bundle j = getIntent().getExtras();
int fee = j.getInt("mFee");
String strUsername = j.getString("StrUsername");
String MN = j.getString("mName");
String date = j.getString("date");
String time = j.getString("time");
Intent i = new Intent(this, Souvenir.class);
i.putExtra("date", date);
i.putExtra("time", time);
i.putExtra("strUsername", strUsername);
i.putExtra("mName", MN);
i.putExtra("mFee", fee);
i.putExtra("teaFee", teaFee);
i.putExtra("waterFee", waterFee);
i.putExtra("coffeeFee", coffeeFee);
i.putExtra("flatbreadFee", flatbreadFee);
i.putExtra("sandwichFee", sandwichFee);
i.putExtra("sweetbreadFee", sweetbreadFee);
i.putExtra("saladFee", saladFee);
startActivity(i);
}
}
\ No newline at end of file
package com.example.coursework2;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class CreateAccount extends AppCompatActivity {
//define username and password fields
private EditText edUsername, edPassword, edConfPassword;
private Button createUser;
private final String CREDENTIAL_SHARED_PREF = "our_shared_pref";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_account);
//assign fields to items
edUsername = findViewById(R.id.newUser);
edPassword = findViewById(R.id.newPass);
edConfPassword = findViewById(R.id.passConf);
createUser = findViewById(R.id.createAcc);
createUser.setOnClickListener(new View.OnClickListener() {
@Override
//get the input from user and storing variables
public void onClick(View v) {
String strPassword = edPassword.getText().toString();
String strConfPassword = edConfPassword.getText().toString();
String strUsername = edUsername.getText().toString();
//checks the passwords are the same
if (strPassword != null && strPassword.equalsIgnoreCase(strConfPassword)){
SharedPreferences credentials = getSharedPreferences(CREDENTIAL_SHARED_PREF, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = credentials.edit();
//sends username and password to login page
editor.putString("user", strUsername);
editor.putString("pass", strPassword);
editor.commit();
Toast.makeText(CreateAccount.this, "login "+ strUsername + " password " + strPassword, Toast.LENGTH_SHORT).show();
CreateAccount.this.finish();
}
}
});
}
}
\ No newline at end of file
package com.example.coursework2;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.content.Intent;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
//define username and password with buttons
private EditText edUsername, edPassword;
private Button btSubmit, btCreate;
private final String CREDENTIAL_SHARED_PREF = "our_shared_pref";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//assign variables to items
edUsername = findViewById(R.id.userName);
edPassword = findViewById(R.id.passWord);
btSubmit = findViewById(R.id.login);
btCreate = findViewById(R.id.create);
btCreate.setOnClickListener(new View.OnClickListener() {
@Override
//go to create user page
public void onClick(View v) {
Intent i = new Intent(MainActivity.this, CreateAccount.class);
startActivity(i);
}
});
btSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences credentials = getSharedPreferences(CREDENTIAL_SHARED_PREF, Context.MODE_PRIVATE);
//retrieves username and password from previous page
String strUsername = credentials.getString("user", null);
String strPassword = credentials.getString("pass", null);
String username_from_ed = edUsername.getText().toString();
String password_from_ed = edPassword.getText().toString();
//checks username value is not null
if (strUsername != null && username_from_ed != null && strUsername.equalsIgnoreCase(username_from_ed)){
//checks password value is not null
if (strPassword != null && password_from_ed != null && strPassword.equalsIgnoreCase(password_from_ed)){
//allows user to progress to menu
Toast.makeText(MainActivity.this, "Successful Login, Welcome " + strUsername, Toast.LENGTH_SHORT).show();
Intent i = new Intent(MainActivity.this, Menu.class);
i.putExtra("strUsername", strUsername);
startActivity(i);
} else {
//error message
Toast.makeText(MainActivity.this, "Login Failed, Password incorrect", Toast.LENGTH_SHORT).show();
}
}else{
//error message
Toast.makeText(MainActivity.this, "Login Failed, Please enter a Username", Toast.LENGTH_SHORT).show();
}
}
});
}
}
\ No newline at end of file
This diff is collapsed.
package com.example.coursework2;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class Payment extends AppCompatActivity {
//defines math totals
public int total = 0;
private int cafeTotal = 0;
private int souvenirTotal = 0;
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_payment);
//gets all items from previous pages
Bundle j = getIntent().getExtras();
int mFee = j.getInt("mFee");
int teaFee = j.getInt("teaFee");
int waterFee = j.getInt("waterFee");
int coffeeFee = j.getInt("coffeeFee");
int flatbreadFee = j.getInt("flatbreadFee");
int sandwichFee = j.getInt("sandwichFee");
int sweetbreadFee = j.getInt("sweetbreadFee");
int saladFee = j.getInt("saladFee");
int shirtFee = j.getInt("shirtFee");
int hatFee = j.getInt("hatFee");
int snowGlobeFee = j.getInt("snowGlobeFee");
int keyChainFee = j.getInt("keyChainFee");
int bottleFee = j.getInt("bottleFee");
int mugFee = j.getInt("mugFee");
int coasterFee = j.getInt("coasterFee");
String MN = j.getString("mName");
String date = j.getString("date");
String time = j.getString("time");
//sets text on the page
((EditText)findViewById(R.id.paymentTotal)).setText("0");
((TextView)findViewById(R.id.mDetails)).setText("Museum : " + MN + "\nFee : £" + mFee);
((TextView)findViewById(R.id.TimeDetails)).setText("Date : " + date + "\nTime : " + time);
//calculates totals
cafeTotal = (teaFee+waterFee+coffeeFee+flatbreadFee+sandwichFee+sweetbreadFee+saladFee);
souvenirTotal = (shirtFee+hatFee+snowGlobeFee+keyChainFee+bottleFee+mugFee+coasterFee);
//appends to list of items purchased to display on page
StringBuilder cafePrice = new StringBuilder(300);
cafePrice.append("Cafe Total : £" + cafeTotal +"\n");
StringBuilder souvenirPrice = new StringBuilder(300);
souvenirPrice.append("Souvenir Total : £" + souvenirTotal + "\n");
//checks how many of each item are added to list
if (teaFee > 0){
cafePrice.append("Tea x" + teaFee);
}
if (waterFee > 0){
cafePrice.append(", Water x" + waterFee);
}
if (coffeeFee > 0){
cafePrice.append(", Coffee x" + coffeeFee/2);
}
if (flatbreadFee > 0){
cafePrice.append(", Flatbread x" + flatbreadFee/2);
}
if (sandwichFee > 0){
cafePrice.append(", Sandwich x" + sandwichFee/2);
}
if (sweetbreadFee > 0){
cafePrice.append(", Sweetbread x" + sweetbreadFee/2);
}
if (saladFee > 0){
cafePrice.append(", Salad x" + saladFee/2);
}
if (shirtFee > 0){
souvenirPrice.append("Shirt x").append(shirtFee / 10);
}
if (hatFee > 0){
souvenirPrice.append(", Hat x" + hatFee/5);
}
if (snowGlobeFee != 0){
souvenirPrice.append(", Snow Globe x" + snowGlobeFee/5);
}
if (keyChainFee > 0){
souvenirPrice.append(", Key Chain x" + keyChainFee/5);
}
if (bottleFee > 0){
souvenirPrice.append(", Bottle x" + bottleFee/5);
}
if (mugFee > 0){
souvenirPrice.append(", Mug x" + mugFee/5);
}
if (coasterFee > 0){
souvenirPrice.append(", Coaster x" + coasterFee/2);
}
((TextView)findViewById(R.id.cafeDetails)).setText(cafePrice);
((TextView)findViewById(R.id.souvenirDetails)).setText(souvenirPrice);
//calculates total cost
total = mFee+cafeTotal+souvenirTotal;
((TextView)findViewById(R.id.totalCost)).setText("Total Payment : £" + total);
}
//goes back to main menu
public void menu(View v){
Intent i = new Intent(this, Menu.class);
startActivity(i);
}
//goes back to previous page
public void back(View v){
Intent i = new Intent(this, Souvenir.class);
Bundle j = getIntent().getExtras();
String strUsername = j.getString("StrUsername");
int mFee = j.getInt("mFee");
int teaFee = j.getInt("teaFee");
int waterFee = j.getInt("waterFee");
int coffeeFee = j.getInt("coffeeFee");
int flatbreadFee = j.getInt("flatbreadFee");
int sandwichFee = j.getInt("sandwichFee");
int sweetbreadFee = j.getInt("sweetbreadFee");
int saladFee = j.getInt("saladFee");
String MN = j.getString("mName");
String date = j.getString("date");
String time = j.getString("time");
i.putExtra("date", date);
i.putExtra("time", time);
i.putExtra("mName", MN);
i.putExtra("mFee", mFee);
i.putExtra("strUsername", strUsername);
i.putExtra("teaFee", teaFee);
i.putExtra("waterFee", waterFee);
i.putExtra("coffeeFee", coffeeFee);
i.putExtra("flatbreadFee", flatbreadFee);
i.putExtra("sandwichFee", sandwichFee);
i.putExtra("sweetbreadFee", sweetbreadFee);
i.putExtra("saladFee", saladFee);
startActivity(i);
}
public void pay(View v){
// creates local variables of all fees
int payment = Integer.parseInt(((EditText)findViewById(R.id.paymentTotal)).getText().toString());
int change = payment - total;
int cafeFee = cafeTotal;
int souvenirFee = souvenirTotal;
int totalFee = total;
//checks if entered value is enough
if (payment < totalFee){
Toast.makeText(this, "Payment not enough", Toast.LENGTH_SHORT).show();
}
if (payment >= totalFee) {
//if value is enough moves onto next page
Toast.makeText(this, "Payment", Toast.LENGTH_SHORT).show();
Bundle j = getIntent().getExtras();
int mFee = j.getInt("mFee");
String MN = j.getString("mName");
String date = j.getString("date");
String strUsername = j.getString("StrUsername");
String time = j.getString("time");
Intent i = new Intent(this, receiptPage.class);
i.putExtra("date", date);
i.putExtra("time", time);
i.putExtra("mName", MN);
i.putExtra("mFee", mFee);
i.putExtra("strUsername", strUsername);
i.putExtra("cafeFee", cafeFee);
i.putExtra("souvenirFee", souvenirFee);
i.putExtra("totalFee", totalFee);
i.putExtra("change", change);
i.putExtra("payment", payment);
startActivity(i);
}
}
}
\ No newline at end of file
package com.example.coursework2;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class Souvenir extends AppCompatActivity {
//defines spinners for item values
private Spinner spinnerItemShirt;
private Spinner spinnerItemHat;
private Spinner spinnerItemSnowGlobe;
private Spinner spinnerItemKeyChain;
private Spinner spinnerItemBottle;
private Spinner spinnerItemMug;
private Spinner spinnerItemCoaster;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_souvenir);
Bundle j = getIntent().getExtras();
//assigns the spinners to items
spinnerItemShirt = findViewById(R.id.shirtList);
spinnerItemHat = findViewById(R.id.hatList);
spinnerItemSnowGlobe = findViewById(R.id.snowGlobeList);
spinnerItemKeyChain = findViewById(R.id.keyChainList);
spinnerItemBottle = findViewById(R.id.bottleList);
spinnerItemMug = findViewById(R.id.mugList);
spinnerItemCoaster = findViewById(R.id.coasterList);
String[] list = getResources().getStringArray(R.array.list_options);
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, list);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//adds array to the spinners
spinnerItemShirt.setAdapter(adapter);
spinnerItemHat.setAdapter(adapter);
spinnerItemSnowGlobe.setAdapter(adapter);
spinnerItemKeyChain.setAdapter(adapter);
spinnerItemBottle.setAdapter(adapter);
spinnerItemMug.setAdapter(adapter);
spinnerItemCoaster.setAdapter(adapter);
}
//goes back to main menu
public void menu(View v){
Intent i = new Intent(this, Menu.class);
startActivity(i);
}
//goes back to previous page
public void back(View v){
Intent i = new Intent(this, Cafe.class);
Bundle j = getIntent().getExtras();
int mFee = j.getInt("mFee");
String MN = j.getString("mName");
String date = j.getString("date");
String time = j.getString("time");
String strUsername = j.getString("StrUsername");
i.putExtra("date", date);
i.putExtra("time", time);
i.putExtra("mName", MN);
i.putExtra("mFee", mFee);
i.putExtra("strUsername", strUsername);
startActivity(i);
}
//goes to next page with current variables included
public void book(View v){
Spinner shirtSpinner = (Spinner)findViewById(R.id.shirtList);
int shirtFee = Integer.parseInt(shirtSpinner.getSelectedItem().toString())*10;
Spinner hatSpinner = (Spinner)findViewById(R.id.hatList);
int hatFee = Integer.parseInt(hatSpinner.getSelectedItem().toString())*5;
Spinner snowGlobeSpinner = (Spinner)findViewById(R.id.snowGlobeList);
int snowGlobeFee = Integer.parseInt(snowGlobeSpinner.getSelectedItem().toString())*5;
Spinner keyChainSpinner = (Spinner)findViewById(R.id.keyChainList);
int keyChainFee = Integer.parseInt(keyChainSpinner.getSelectedItem().toString())*5;
Spinner bottleSpinner = (Spinner)findViewById(R.id.bottleList);
int bottleFee = Integer.parseInt(bottleSpinner.getSelectedItem().toString())*5;
Spinner mugSpinner = (Spinner)findViewById(R.id.mugList);
int mugFee = Integer.parseInt(mugSpinner.getSelectedItem().toString())*5;
Spinner coasterSpinner = (Spinner)findViewById(R.id.coasterList);
int coasterFee = Integer.parseInt(coasterSpinner.getSelectedItem().toString())*2;
Bundle j = getIntent().getExtras();
int mFee = j.getInt("mFee");
int teaFee = j.getInt("teaFee");
int waterFee = j.getInt("waterFee");
int coffeeFee = j.getInt("coffeeFee");
int flatbreadFee = j.getInt("flatbreadFee");
int sandwichFee = j.getInt("sandwichFee");
int sweetbreadFee = j.getInt("sweetbreadFee");
int saladFee = j.getInt("saladFee");
String MN = j.getString("mName");
String strUsername = j.getString("StrUsername");
String date = j.getString("date");
String time = j.getString("time");
Intent i = new Intent(this, Payment.class);
i.putExtra("date", date);
i.putExtra("time", time);
i.putExtra("strUsername", strUsername);
i.putExtra("mName", MN);
i.putExtra("mFee", mFee);
i.putExtra("teaFee", teaFee);
i.putExtra("waterFee", waterFee);
i.putExtra("coffeeFee", coffeeFee);
i.putExtra("flatbreadFee", flatbreadFee);
i.putExtra("sandwichFee", sandwichFee);
i.putExtra("sweetbreadFee", sweetbreadFee);
i.putExtra("saladFee", saladFee);
i.putExtra("shirtFee", shirtFee);
i.putExtra("hatFee", hatFee);
i.putExtra("snowGlobeFee", snowGlobeFee);
i.putExtra("keyChainFee", keyChainFee);
i.putExtra("bottleFee", bottleFee);
i.putExtra("mugFee", mugFee);
i.putExtra("coasterFee", coasterFee);
startActivity(i);
}
}
\ No newline at end of file
package com.example.coursework2;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import java.util.Calendar;
public class TimeAndDate extends AppCompatActivity {
//define date information
private DatePickerDialog datePickerDialog;
private Button dateButton;
RadioGroup radioGroup;
RadioButton radioButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_time_and_date);
//assigns date picker
initDatePicker();
dateButton = findViewById(R.id.dateBut);
dateButton.setText(getTodayDate());
//assigns time selector
radioGroup = findViewById(R.id.timeSelect);
}
//goes to next page with current information
public void book(View v){
int radioId = radioGroup.getCheckedRadioButtonId();
radioButton = findViewById(radioId);
String time = (String) radioButton.getText();
String date = (String) dateButton.getText();
Bundle j = getIntent().getExtras();
String strUsername = j.getString("StrUsername");
int fee = j.getInt("mFee");
String MN = j.getString("mName");
Intent i = new Intent(this, Cafe.class);
i.putExtra("date", date);
i.putExtra("strUsername", strUsername);
i.putExtra("time", time);
i.putExtra("mName", MN);
i.putExtra("mFee", fee);
startActivity(i);
}
//gets the current date and sets the default date of button
private String getTodayDate() {
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
month = month + 1;
int day = cal.get(Calendar.DAY_OF_MONTH);
return makeDateString(day, month, year);
}
//goes back to previous page
public void back(View v){
Intent i = new Intent(this, Menu.class);
startActivity(i);
}
//defines what is in the button so that the date can be selected
private void initDatePicker(){
DatePickerDialog.OnDateSetListener dateSetListener = new DatePickerDialog.OnDateSetListener()
{
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day){
month = month + 1;
String date = makeDateString(day, month, year);
dateButton.setText(date);
}
};
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);
int style = AlertDialog.THEME_HOLO_LIGHT;
datePickerDialog = new DatePickerDialog( this, style, dateSetListener, year, month, day);
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis()-1000);
}
//shows date chosen
private String makeDateString(int day, int month, int year) {
return getMonthFormat(month) + " " + day + " " + year;
}
//changes month value from number to string equivalent month
private String getMonthFormat(int month) {
if (month == 1)
return "JAN";
if (month == 2)
return "FEB";
if (month == 3)
return "MAR";
if (month == 4)
return "APR";
if (month == 5)
return "MAY";
if (month == 6)
return "JUN";
if (month == 7)
return "JUL";
if (month == 8)
return "AUG";
if (month == 9)
return "SEP";
if (month == 10)
return "OCT";
if (month == 11)
return "NOV";
if (month == 12)
return "DEC";
//default
return "JAN";
}
public void dateSelect(View v) {
datePickerDialog.show();
}
}
\ No newline at end of file
package com.example.coursework2;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
public class bookingPage extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_booking_page);
//Get bundle from previous page
Bundle i = getIntent().getExtras();
//display related information on the page
int fee = i.getInt("mFee");
String MN = i.getString("mName");
((TextView)findViewById(R.id.mName)).setText("Name\n" + MN);
String ML = i.getString("mLocation");
((TextView)findViewById(R.id.mLocation)).setText("Location\n" + ML);
String MD = i.getString("mDescription");
((TextView)findViewById(R.id.mDesc)).setText("Description \n" + MD);
int image = i.getInt("imgID");
ImageView img = findViewById(R.id.imageView);
img.setImageResource(image);
}
//back function
public void back(View v){
Intent i = new Intent(this, Menu.class);
startActivity(i);
}
//carries information from one page to the next
public void book(View v){
Intent i = new Intent(this, TimeAndDate.class);
Bundle j = getIntent().getExtras();
String strUsername = j.getString("StrUsername");
int fee = j.getInt("mFee");
String MN = j.getString("mName");
i.putExtra("strUsername", strUsername);
i.putExtra("mName", MN);
i.putExtra("mFee", fee);
startActivity(i);
}
}
\ No newline at end of file
package com.example.coursework2;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import java.util.Random;
public class receiptPage extends AppCompatActivity {
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_receipt_page);
//get all information from previous page
Bundle j = getIntent().getExtras();
String strUsername = j.getString("StrUsername");
int mFee = j.getInt("mFee");
String MN = j.getString("mName");
String date = j.getString("date");
String time = j.getString("time");
int total = j.getInt("totalFee");
int cafeTotal = j.getInt("cafeFee");
int souvenirTotal = j.getInt("souvenirFee");
int change = j.getInt("change");
int payment = j.getInt("payment");
//display all prices together
((TextView)findViewById(R.id.mFinal)).setText("Museum : " + MN + "\nFee : £" + mFee);
((TextView)findViewById(R.id.timeFinal)).setText("Date : " + date + "\nTime : " + time);
((TextView)findViewById(R.id.cafeFinal)).setText("Cafe Total : £" + cafeTotal);
((TextView)findViewById(R.id.souvenirFinal)).setText("Souvenir Total : £" + souvenirTotal);
((TextView)findViewById(R.id.payFinal)).setText("Total : £" + total +"\nPaid : £" +payment + "\nChange : £" + change);
((TextView)findViewById(R.id.nameBook)).setText("Your Booking number is : ");
//generates random 6 digit number
int bookingNo = new Random().nextInt(999999);
String bookingNoString = String.valueOf(bookingNo);
((TextView)findViewById(R.id.bookingNumber)).setText(bookingNoString);
}
//goes back to main menu
public void menu(View v){
Intent i = new Intent(this, Menu.class);
startActivity(i);
}
}
\ No newline at end of file
<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:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
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="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<?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="#3DDC84"
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>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mPicture"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".bookingPage">
<TextView
android:id="@+id/mName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="104dp"
android:text="TextView"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.047"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/imageView"
android:layout_width="256dp"
android:layout_height="149dp"
app:layout_constraintBottom_toTopOf="@+id/mDesc"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.438"
app:layout_constraintStart_toStartOf="@+id/mName"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.983"
app:srcCompat="@drawable/ic_launcher_background" />
<TextView
android:id="@+id/mDesc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="76dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
android:text="TextView"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mLocation"
app:layout_constraintVertical_bias="0.462" />
<TextView
android:id="@+id/mLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="TextView"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.047"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mName" />
<Button
android:id="@+id/button3"
android:layout_width="96dp"
android:layout_height="51dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:onClick="book"
android:text="@string/bookingButton"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.873"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mDesc"
app:layout_constraintVertical_bias="0.925" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="44dp"
android:onClick="back"
android:text="@string/back"
app:layout_constraintBottom_toTopOf="@+id/imageView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.049"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.196" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".CreateAccount">
<TextView
android:id="@+id/textView5"
android:layout_width="286dp"
android:layout_height="67dp"
android:layout_marginStart="62dp"
android:layout_marginTop="49dp"
android:layout_marginEnd="63dp"
android:text="@string/createButton"
android:textAlignment="center"
android:textSize="36sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button" />
<EditText
android:id="@+id/passConf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_marginTop="49dp"
android:layout_marginEnd="101dp"
android:ems="10"
android:hint="Confirm Password"
android:inputType="textPassword"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/newPass" />
<EditText
android:id="@+id/newPass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_marginTop="41dp"
android:layout_marginEnd="101dp"
android:ems="10"
android:hint="Password"
android:inputType="textPassword"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/newUser" />
<EditText
android:id="@+id/newUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_marginTop="61dp"
android:layout_marginEnd="101dp"
android:ems="10"
android:hint="Username"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView5" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="305dp"
android:text="@string/back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/createAcc"
android:layout_width="181dp"
android:layout_height="50dp"
android:layout_marginStart="115dp"
android:layout_marginTop="44dp"
android:layout_marginEnd="115dp"
android:layout_marginBottom="167dp"
android:text="@string/createButton"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passConf" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="69dp"
android:text="@string/signInButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passWord" />
<Button
android:id="@+id/create"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:text="@string/createButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/login" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/welcome"
android:textSize="36sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_marginTop="181dp"
android:layout_marginEnd="101dp"
android:ems="10"
android:hint="Username"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
<EditText
android:id="@+id/passWord"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="98dp"
android:layout_marginTop="41dp"
android:layout_marginEnd="103dp"
android:ems="10"
android:hint="Password"
android:inputType="textPassword"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/userName" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Payment">
<TextView
android:id="@+id/textView3"
android:layout_width="188dp"
android:layout_height="57dp"
android:layout_marginStart="155dp"
android:layout_marginTop="68dp"
android:layout_marginEnd="155dp"
android:layout_marginBottom="644dp"
android:text="@string/payment"
android:textAlignment="center"
android:textSize="36sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.505"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.131" />
<TextView
android:id="@+id/mDetails"
android:layout_width="380dp"
android:layout_height="42dp"
android:layout_marginStart="17dp"
android:layout_marginTop="76dp"
android:layout_marginEnd="337dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button10" />
<TextView
android:id="@+id/TimeDetails"
android:layout_width="377dp"
android:layout_height="47dp"
android:layout_marginStart="17dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="337dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mDetails" />
<TextView
android:id="@+id/cafeDetails"
android:layout_width="391dp"
android:layout_height="67dp"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="337dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/TimeDetails" />
<TextView
android:id="@+id/souvenirDetails"
android:layout_width="387dp"
android:layout_height="74dp"
android:layout_marginStart="17dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="337dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cafeDetails" />
<TextView
android:id="@+id/totalCost"
android:layout_width="115dp"
android:layout_height="53dp"
android:layout_marginStart="260dp"
android:layout_marginTop="402dp"
android:layout_marginEnd="93dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3" />
<EditText
android:id="@+id/paymentTotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="185dp"
android:layout_marginTop="23dp"
android:layout_marginEnd="16dp"
android:ems="10"
android:inputType="numberDecimal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/totalCost" />
<Button
android:id="@+id/button10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="11dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="187dp"
android:layout_marginBottom="103dp"
android:onClick="back"
android:text="@string/back"
app:layout_constraintBottom_toTopOf="@+id/mDetails"
app:layout_constraintEnd_toStartOf="@+id/button11"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="14dp"
android:layout_marginBottom="455dp"
android:onClick="menu"
android:text="@string/menu"
app:layout_constraintBottom_toTopOf="@+id/totalCost"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView3"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="289dp"
android:layout_marginTop="42dp"
android:layout_marginEnd="29dp"
android:layout_marginBottom="31dp"
android:onClick="pay"
android:text="@string/bookingButton"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/paymentTotal" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".receiptPage">
<TextView
android:id="@+id/textView4"
android:layout_width="205dp"
android:layout_height="69dp"
android:layout_marginStart="103dp"
android:layout_marginTop="42dp"
android:layout_marginEnd="103dp"
android:text="@string/receipt"
android:textAlignment="center"
android:textSize="36sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/mFinal"
android:layout_width="322dp"
android:layout_height="48dp"
android:layout_marginStart="48dp"
android:layout_marginTop="58dp"
android:layout_marginEnd="41dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
<TextView
android:id="@+id/timeFinal"
android:layout_width="318dp"
android:layout_height="42dp"
android:layout_marginStart="48dp"
android:layout_marginTop="13dp"
android:layout_marginEnd="45dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mFinal" />
<TextView
android:id="@+id/cafeFinal"
android:layout_width="318dp"
android:layout_height="32dp"
android:layout_marginStart="48dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="43dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/timeFinal" />
<TextView
android:id="@+id/souvenirFinal"
android:layout_width="318dp"
android:layout_height="32dp"
android:layout_marginStart="48dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="45dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cafeFinal" />
<TextView
android:id="@+id/payFinal"
android:layout_width="313dp"
android:layout_height="64dp"
android:layout_marginStart="48dp"
android:layout_marginTop="19dp"
android:layout_marginEnd="50dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/souvenirFinal" />
<TextView
android:id="@+id/nameBook"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginStart="139dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="139dp"
android:text="TextView"
android:textAlignment="center"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/payFinal" />
<TextView
android:id="@+id/bookingNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="132dp"
android:layout_marginTop="18dp"
android:layout_marginEnd="133dp"
android:text="TextView"
android:textSize="36sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/nameBook" />
<Button
android:id="@+id/button13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="308dp"
android:layout_marginTop="126dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="41dp"
android:onClick="menu"
android:text="@string/menu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/payFinal" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TimeAndDate">
<Button
android:id="@+id/backBut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="back"
android:text="@string/back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.05"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.023" />
<Button
android:id="@+id/dateBut"
style="@android:style/Widget.Holo.Spinner"
android:layout_width="253dp"
android:layout_height="63dp"
android:background="#00FFFFFF"
android:onClick="dateSelect"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="36sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.179"
app:strokeColor="#AF6767" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:text="@string/choosedate"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="@+id/dateBut"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.937" />
<RadioGroup
android:id="@+id/timeSelect"
android:layout_width="229dp"
android:layout_height="190dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/dateBut">
<RadioButton
android:id="@+id/time1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/date1" />
<RadioButton
android:id="@+id/time2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/date2" />
<RadioButton
android:id="@+id/time3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/date3" />
<RadioButton
android:id="@+id/time4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/date4" />
</RadioGroup>
<Button
android:id="@+id/button7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:onClick="book"
android:text="@string/bookingButton"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.792"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/timeSelect"
app:layout_constraintVertical_bias="0.576" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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>
\ No newline at end of file
<?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>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Coursework2" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="list_options">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
</string-array>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">Museum Booker</string>
<string name="signInButton">Sign In</string>
<string name="createButton">Create Account</string>
<string name="welcome">Museum Finder</string>
<string name="logout">Log Out</string>
<string name="back">Back</string>
<string name="menutop">Museum</string>
<string name="cafetop">Cafe</string>
<string name="payment">Payment</string>
<string name="receipt">Receipt</string>
<string name="bookingNumber">Booking Number</string>
<string name="soutop">Souvenir Shop</string>
<string name="fee">Fee</string>
<string name="fee10">£10</string>
<string name="fee5">£5</string>
<string name="m1">Louvre</string>
<string name="m2">National Museum of China</string>
<string name="m3">Vatican Museums</string>
<string name="m4">Metropolitan Museum of Art</string>
<string name="m5">British Museum</string>
<string name="m6">Tate Modern</string>
<string name="m7">National Gallery</string>
<string name="m8">Natural History Museum</string>
<string name="m9">American Museum of Natural History</string>
<string name="m10">Stage Hermitage Museum</string>
<string name="menu">Menu</string>
<string name="bookingButton">Book</string>
<string name="choosedate">Choose Date</string>
<string name="date1">9am-11am</string>
<string name="date2">11am-1pm</string>
<string name="date3">1pm-3pm</string>
<string name="date4">3pm-5pm</string>
<string name="fee1">£1</string>
<string name="fee2">£2</string>
<string name="item">Item</string>
<string name="tea">Tea</string>
<string name="water">Water</string>
<string name="coffee">Coffee</string>
<string name="flatbread">Flatbread</string>
<string name="sandwich">Sandwich</string>
<string name="sweetroll">Sweet Roll</string>
<string name="salad">Salad</string>
<string name="shirt">Shirt</string>
<string name="hat">Hat</string>
<string name="snowglobe">Snow Globe</string>
<string name="keychain">Key Chain</string>
<string name="bottle">Bottle</string>
<string name="mug">Mug</string>
<string name="coaster">Coaster</string>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Coursework2" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
package com.example.coursework2;
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);
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
\ No newline at end of file
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
\ No newline at end of file
#Mon Apr 26 12:15:47 BST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
include ':app'
rootProject.name = "Coursework2"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment