Commit b8223813 authored by jordan.dalby's avatar jordan.dalby

Added login database

parent 56d5642a
......@@ -9,14 +9,14 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MuseumApp">
<activity android:name=".BookPayment"></activity>
<activity android:name=".BookConfirmation"></activity>
<activity android:name=".BookPayment" />
<activity android:name=".BookSouvenir" />
<activity android:name=".BookCafe" />
<activity android:name=".BookMuseum" />
<activity android:name=".MuseumPage" />
<activity android:name=".MuseumList" />
<activity android:name=".LoginPage" />
<activity android:name=".MainActivity">
<activity android:name=".LoginPage">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
package com.yorksj.museumapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.MenuItem;
import android.widget.TextView;
import android.widget.Toast;
import com.yorksj.museumapp.book.BookPacket;
import com.yorksj.museumapp.book.CafeItem;
import com.yorksj.museumapp.book.SouvenirItem;
import com.yorksj.museumapp.home.HomeButton;
import com.yorksj.museumapp.login.LoginManager;
import com.yorksj.museumapp.login.database.LoginDatabase;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.NumberFormat;
import java.util.Locale;
import java.util.Random;
public class BookConfirmation extends AppCompatActivity
{
private HomeButton homeButton;
private BookPacket bookPacket;
private LoginDatabase database;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_book_confirmation);
initialiseHomeButton();
getBookPacket();
generateReceipt();
}
private void initialiseHomeButton()
{
homeButton = new HomeButton(this, BookConfirmation.this, MuseumList.class);
}
private void getBookPacket()
{
Intent intent = getIntent();
Bundle extras = intent.getExtras();
bookPacket = (BookPacket) extras.get("packet");
}
public void generateReceipt()
{
String customerName = LoginManager.getInstance().getActiveUser().getFullName();
String museumName = bookPacket.museumPacket.name;
String date = bookPacket.getDateFormatted();
String time = bookPacket.time.name;
String totalCost = NumberFormat.getCurrencyInstance(Locale.UK).format(bookPacket.getTotalCost());
String paid = NumberFormat.getCurrencyInstance(Locale.UK).format(bookPacket.amountPaid);
String change = bookPacket.getChangeString();
String bookingCodeVal = String.format("%06d", new Random().nextInt(999999));
TextView title = findViewById(R.id.orderTitle);
title.setText("Thank you for your order " + customerName + "!");
TextView bookingCode = findViewById(R.id.bookingCode);
bookingCode.setText(bookingCodeVal);
TextView museumNameText = findViewById(R.id.bookedMuseumName);
museumNameText.setText(museumName);
TextView museumDate = findViewById(R.id.bookedMuseumDate);
museumDate.setText(date);
TextView museumTime = findViewById(R.id.bookedMuseumTime);
museumTime.setText(time);
TextView cost = findViewById(R.id.bookedCost);
cost.setText(totalCost);
TextView paidText = findViewById(R.id.bookedPaidText);
paidText.setText(paid);
TextView changeText = findViewById(R.id.bookedChangeText);
changeText.setText(change);
saveToFile(bookingCodeVal);
}
public void saveToFile(String bookingCode)
{
TextView path = findViewById(R.id.saveLocation);
try
{
File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
File file = new File(dir, bookingCode + ".txt");
file.createNewFile();
path.setText(file.getAbsolutePath());
FileWriter writer = new FileWriter(file);
writer.write("Booking Code: " + bookingCode + "\n");
writer.write("Customer Name: " + LoginManager.getInstance().getActiveUser().getFullName() + "\n");
writer.write("Museum: " + bookPacket.museumPacket.name + "\n");
writer.write("Date and time: " + bookPacket.getDateFormatted() + " " + bookPacket.time.name + "\n\n");
writer.write("Cafe items purchased:\n");
for (CafeItem item : bookPacket.cafe.quantities.keySet())
{
int amt = bookPacket.cafe.getAmount(item);
if (amt == 0)
continue;
writer.write(item.displayName + " x" + bookPacket.cafe.quantities.get(item) + " " + NumberFormat.getCurrencyInstance(Locale.UK).format((item.cost * amt)) + "\n");
}
writer.write("\nSouvenirs purchased:\n");
for (SouvenirItem item : bookPacket.souvenir.quantities.keySet())
{
int amt = bookPacket.souvenir.getAmount(item);
if (amt == 0)
continue;
writer.write(item.displayName + " x" + bookPacket.souvenir.quantities.get(item) + " " + NumberFormat.getCurrencyInstance(Locale.UK).format((item.cost * amt)) + "\n");
}
writer.write("\n\nTotal cost: " + NumberFormat.getCurrencyInstance(Locale.UK).format(bookPacket.getTotalCost()) + "\n");
writer.write("Payment received: " + NumberFormat.getCurrencyInstance(Locale.UK).format(bookPacket.amountPaid) + "\n");
writer.write("Change due: " + bookPacket.getChangeString() + "\n");
writer.close();
}
catch (IOException exception)
{
exception.printStackTrace();
Toast.makeText(BookConfirmation.this, "Failed to save receipt to file", Toast.LENGTH_LONG);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
if (!homeButton.onClick(item))
{
super.onOptionsItemSelected(item);
return false;
}
return true;
}
}
\ No newline at end of file
package com.yorksj.museumapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
......@@ -63,10 +64,21 @@ public class BookMuseum extends AppCompatActivity
LocalDate date = LocalDateTime.now().toLocalDate();
Calendar calendar = Calendar.getInstance();
calendar.set(date.getYear(), date.getMonth().getValue(), date.getDayOfMonth());
calendar.set(date.getYear(), date.getMonth().getValue() - 1, date.getDayOfMonth());
calendarView.setMinDate(calendar.getTimeInMillis());
calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener()
{
@Override
public void onSelectedDayChange(@NonNull CalendarView view, int year, int month, int dayOfMonth)
{
calendar.set(year, month, dayOfMonth);
view.setDate(calendar.getTimeInMillis(), true, true);
}
});
// uncomment to allow booking only 3 weeks in advance
//calendar.add(Calendar.DAY_OF_MONTH, 21);
//calendarView.setMaxDate(calendar.getTimeInMillis());
......@@ -97,6 +109,7 @@ public class BookMuseum extends AppCompatActivity
public void onClick(View v)
{
long date = calendarView.getDate();
System.out.println(date);
Time time = Time.NINE_TO_ELEVEN.getTimeFromString(spinnerTime.getSelectedItem().toString());
BookPacket packet = new BookPacket(activeMuseum, date, time);
......
......@@ -4,24 +4,36 @@ import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.yorksj.museumapp.book.BookPacket;
import com.yorksj.museumapp.book.CafeItem;
import com.yorksj.museumapp.book.SouvenirItem;
import com.yorksj.museumapp.home.HomeButton;
import java.util.ArrayList;
import java.util.List;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.time.LocalDate;
import java.util.Locale;
public class BookPayment extends AppCompatActivity
public class BookPayment extends AppCompatActivity implements TextWatcher
{
private BookPacket bookPacket;
private HomeButton homeButton;
private EditText enterAmount;
private String current = "";
@Override
protected void onCreate(Bundle savedInstanceState)
{
......@@ -33,6 +45,10 @@ public class BookPayment extends AppCompatActivity
setMuseumName();
getEnterAmountEditText();
setPaymentButton();
updateOverview();
}
......@@ -57,27 +73,87 @@ public class BookPayment extends AppCompatActivity
name.setText(bookPacket.museumPacket.name);
}
private void updateOverview()
private void getEnterAmountEditText()
{
enterAmount = findViewById(R.id.paymentEnterAmount);
enterAmount.addTextChangedListener(this);
}
private void setPaymentButton()
{
Button payment = findViewById(R.id.paymentConfirm);
payment.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
String s = enterAmount.getText().toString();
if (s.length() == 0)
{
Toast.makeText(BookPayment.this, "Please enter an amount to pay", Toast.LENGTH_LONG).show();
return;
}
String clean = s.toString().replaceAll("[£,.]", "");
double parsed = Double.parseDouble(clean) / 100;
int requiredAmount = bookPacket.getTotalCost();
if (parsed < requiredAmount)
{
TextView overview = findViewById(R.id.paymentOverview);
Toast.makeText(BookPayment.this, "The amount must be greater than or equal to £" + requiredAmount + ".00", Toast.LENGTH_LONG).show();
}
else
{
bookPacket.amountPaid = parsed;
Toast.makeText(BookPayment.this, "Thank you for your purchase", Toast.LENGTH_LONG).show();
Intent intent = new Intent(BookPayment.this, BookConfirmation.class);
intent.putExtra("packet", bookPacket);
startActivity(intent);
}
return;
}
});
}
String format = "%32s%10s%16s\n";
private void updateOverview()
{
TextView nameOverview = findViewById(R.id.paymentOverviewItem);
TextView quantityOverview = findViewById(R.id.paymentOverviewQuantity);
TextView costOverview = findViewById(R.id.paymentOverviewCost);
int pad = 17;
StringBuilder nameBuilder = new StringBuilder();
StringBuilder quantityBuilder = new StringBuilder();
StringBuilder costBuilder = new StringBuilder();
StringBuilder stringList = new StringBuilder();
stringList.append(pad("Item", pad) + pad("Amount", pad) + pad("Total Cost", pad) + "\n");
nameBuilder.append("Item Name\n");
quantityBuilder.append("Quantity\n");
costBuilder.append("Cost\n");
boolean b = false;
for (CafeItem item : bookPacket.cafe.quantities.keySet())
{
int amt = bookPacket.cafe.getAmount(item);
if (amt == 0)
continue;
stringList.append(pad(item.displayName, pad) + pad(String.valueOf(amt), pad) + pad("£" + (item.cost * amt) + ".00", pad) + "\n");
nameBuilder.append(item.displayName + "\n");
quantityBuilder.append(String.valueOf(amt) + "\n");
costBuilder.append("£" + (item.cost * amt) + ".00\n");
b = true;
}
stringList.append("\n");
if (b)
{
nameBuilder.append("\n");
quantityBuilder.append("\n");
costBuilder.append("\n");
}
b = false;
for (SouvenirItem item : bookPacket.souvenir.quantities.keySet())
{
......@@ -85,28 +161,32 @@ public class BookPayment extends AppCompatActivity
if (amt == 0)
continue;
stringList.append(pad(item.displayName, pad) + pad(String.valueOf(amt), pad) + pad("£" + (item.cost * amt) + ".00", pad) + "\n");
b = true;
nameBuilder.append(item.displayName + "\n");
quantityBuilder.append(String.valueOf(amt) + "\n");
costBuilder.append("£" + (item.cost * amt) + ".00\n");
}
stringList.append("\n\n");
stringList.append(pad("", pad) + "Entrance fee " + pad("£" + bookPacket.museumPacket.entranceFee + ".00\n", pad));
stringList.append(pad("", pad) + "Total " + pad("£" + bookPacket.getTotalCost() + ".00", pad));
overview.setText(stringList.toString());
if (b)
{
nameBuilder.append("\n\n");
quantityBuilder.append("\n\n");
costBuilder.append("\n\n");
}
private String pad(String s, int padAmount)
{
int amtToPad = padAmount - s.length();
quantityBuilder.append("\n");
costBuilder.append("\n");
StringBuilder builder = new StringBuilder();
builder.append(s);
for (int i = 0; i < amtToPad; i++)
{
builder.append("\t");
}
nameBuilder.append("Entrance fee\n" + bookPacket.getDateFormatted() + "\n" + bookPacket.time.name + "\n\n");
quantityBuilder.append("1");
costBuilder.append("£" + bookPacket.museumPacket.entranceFee + ".00");
nameBuilder.append("Total");
costBuilder.append("\n\n\n£" + bookPacket.getTotalCost() + ".00");
return builder.toString();
nameOverview.setText(nameBuilder.toString());
quantityOverview.setText(quantityBuilder.toString());
costOverview.setText(costBuilder.toString());
}
@Override
......@@ -119,4 +199,34 @@ public class BookPayment extends AppCompatActivity
}
return true;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
if (s.length() == 0)
return;
if (!s.toString().equals(current))
{
enterAmount.removeTextChangedListener(this);
String clean = s.toString().replaceAll("[£,.]", "");
double parsed = Double.parseDouble(clean);
String formatted = NumberFormat.getCurrencyInstance(Locale.UK).format((parsed / 100));
current = formatted;
enterAmount.setText(formatted);
enterAmount.setSelection(formatted.length());
enterAmount.addTextChangedListener(this);
}
}
@Override
public void afterTextChanged(Editable s) { }
}
\ No newline at end of file
......@@ -7,22 +7,23 @@ import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.yorksj.museumapp.login.LoginManager;
import com.yorksj.museumapp.login.LoginUser;
import com.yorksj.museumapp.login.database.LoginDatabase;
import org.w3c.dom.Text;
public class LoginPage extends AppCompatActivity {
public LoginManager loginManager = new LoginManager();
public class LoginPage extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_page);
LoginDatabase loginDatabase = new LoginDatabase(this, null, null, 1);
Button loginButton = findViewById(R.id.login);
Button registerButton = findViewById(R.id.register);
......@@ -38,11 +39,15 @@ public class LoginPage extends AppCompatActivity {
String usernameString = username.getText().toString();
String passwordString = password.getText().toString();
boolean result = loginManager.login(usernameString, passwordString);
LoginUser user = loginDatabase.findUser(usernameString, passwordString, true);
boolean result = user != null;
System.out.println("Login result: " + result);
if (result)
{
Toast.makeText(LoginPage.this, "Login successful.", Toast.LENGTH_SHORT).show();
LoginManager.getInstance().setActiveUser(user);
startActivity(new Intent(LoginPage.this, MuseumList.class));
}
else
......@@ -79,7 +84,12 @@ public class LoginPage extends AppCompatActivity {
return;
}
boolean result = loginManager.register(LoginPage.this, fullNameString, usernameString, passwordString);
boolean result = false;
if (loginDatabase.findUser(usernameString, passwordString, false) == null)
{
loginDatabase.addNewUser(usernameString, passwordString, fullNameString);
result = true;
}
System.out.println("Register result: " + result);
if (result)
......
package com.yorksj.museumapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
startActivity(new Intent(MainActivity.this, LoginPage.class));
}
});
}
}
\ No newline at end of file
......@@ -3,7 +3,9 @@ package com.yorksj.museumapp.book;
import com.yorksj.museumapp.museums.MuseumPacket;
import java.io.Serializable;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
public class BookPacket implements Serializable
{
......@@ -15,6 +17,8 @@ public class BookPacket implements Serializable
public CafePacket cafe;
public SouvenirPacket souvenir;
public double amountPaid;
public BookPacket(MuseumPacket _museumPacket, long _date, Time _time)
{
museumPacket = _museumPacket;
......@@ -32,7 +36,7 @@ public class BookPacket implements Serializable
public String getDateFormatted()
{
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yy");
SimpleDateFormat format = new SimpleDateFormat("dd MMMM yyyy");
return format.format(date);
}
......@@ -41,4 +45,17 @@ public class BookPacket implements Serializable
return museumPacket.entranceFee + cafe.getTotal() + souvenir.getTotal();
}
public String getChangeString()
{
double parsed = new Double(amountPaid);
int requiredAmount = getTotalCost();
double change = parsed - requiredAmount;
String formatted = NumberFormat.getCurrencyInstance(Locale.UK).format(change);
return formatted;
}
}
......@@ -2,45 +2,29 @@ package com.yorksj.museumapp.login;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
public class LoginManager
import com.yorksj.museumapp.LoginPage;
import com.yorksj.museumapp.login.database.LoginDatabase;
public final class LoginManager
{
public LoginDataContainer container;
private static LoginManager instance;
private LoginUser activeUser;
public LoginManager()
{
container = new LoginDataContainer();
}
public boolean login(String username, String password)
{
LoginUser result = container.login(username, password);
if (result != null)
public static LoginManager getInstance()
{
activeUser = result;
return true;
}
return false;
}
public void logout()
{
activeUser = null;
}
public boolean register(Activity activeActivity, String fullName, String username, String password)
{
boolean result = container.register(fullName, username, password);
if (result)
if (instance == null)
{
return true;
instance = new LoginManager();
}
return false;
return instance;
}
public LoginUser getActiveUser()
......@@ -48,9 +32,9 @@ public class LoginManager
return activeUser;
}
public LoginDataContainer getLoginDataContainer()
public void setActiveUser(LoginUser user)
{
return container;
activeUser = user;
}
}
\ No newline at end of file
package com.yorksj.museumapp.login.database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
import com.yorksj.museumapp.login.LoginDataContainer;
import com.yorksj.museumapp.login.LoginUser;
public final class LoginDatabase extends SQLiteOpenHelper
{
private static final int DB_VERSION = 1;
private static final String DB_NAME = "Logins.db";
private static final String TABLE_USERS = "Users";
private static final String COLUMN_NAME = "Username";
private static final String COLUMN_PASSWORD = "Password";
private static final String COLUMN_FULL_NAME = "FullName";
public LoginDatabase(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version)
{
super(context, DB_NAME, factory, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db)
{
String create = "CREATE TABLE " +
TABLE_USERS + "(" +
COLUMN_NAME + " TEXT," +
COLUMN_PASSWORD + " TEXT," +
COLUMN_FULL_NAME + " TEXT)";
db.execSQL(create);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
}
public void addNewUser(String name, String password, String fullName)
{
ContentValues values = new ContentValues();
values.put(COLUMN_NAME, name);
values.put(COLUMN_PASSWORD, password);
values.put(COLUMN_FULL_NAME, fullName);
SQLiteDatabase db = this.getWritableDatabase();
db.insert(TABLE_USERS, null, values);
db.close();
}
public LoginUser findUser(String name, String password, boolean check)
{
LoginUser user = null;
String query = "SELECT * FROM " + TABLE_USERS + " WHERE " + COLUMN_NAME + " = \"" + name + "\"";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst())
{
if (cursor.getString(1).equals(password) || !check)
{
user = new LoginUser(cursor.getString(2), name, password);
}
}
cursor.close();
db.close();
return user;
}
}
......@@ -513,19 +513,19 @@
android:id="@+id/subtotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="62dp"
android:layout_marginTop="12dp"
android:layout_marginStart="32dp"
android:layout_marginTop="20dp"
android:text="Subtotal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/saladMinus" />
app:layout_constraintStart_toEndOf="@+id/saladName"
app:layout_constraintTop_toBottomOf="@+id/sandwichMinus" />
<TextView
android:id="@+id/subtotalAmountCafe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="62dp"
android:layout_marginStart="32dp"
android:text="££££"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toEndOf="@+id/saladName"
app:layout_constraintTop_toBottomOf="@+id/subtotal" />
<Button
......
<?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=".BookConfirmation">
<TextView
android:id="@+id/orderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="Thank you for your order FullName!"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Your booking code is"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/orderTitle" />
<TextView
android:id="@+id/bookingCode"
android:layout_width="166dp"
android:layout_height="26dp"
android:layout_marginTop="4dp"
android:text="123456"
android:textAlignment="center"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView10" />
<TextView
android:id="@+id/text10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="424dp"
android:text="Your receipt has been saved to"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bookingCode" />
<TextView
android:id="@+id/text5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="(View > Tool Windows > Device File Explorer)"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/saveLocation" />
<TextView
android:id="@+id/saveLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="C:/TEST/TEST"
android:textAlignment="center"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text10" />
<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:text="You are going to"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bookingCode" />
<TextView
android:id="@+id/bookedMuseumName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="MuseumName"
android:textAlignment="center"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView12" />
<TextView
android:id="@+id/bookedMuseumDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Date"
android:textAlignment="center"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text11" />
<TextView
android:id="@+id/bookedMuseumTime"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:text="Time"
android:textAlignment="center"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bookedMuseumDate" />
<TextView
android:id="@+id/text11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="on"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bookedMuseumName" />
<TextView
android:id="@+id/bookedCostText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Total Cost"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bookedMuseumTime" />
<TextView
android:id="@+id/bookedCost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Total Cost"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bookedCostText" />
<TextView
android:id="@+id/paidText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Amount Paid"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bookedCost" />
<TextView
android:id="@+id/bookedPaidText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Amount Paid"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/paidText" />
<TextView
android:id="@+id/changeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Change"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bookedPaidText" />
<TextView
android:id="@+id/bookedChangeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Change"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/changeText" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -7,7 +7,7 @@
tools:context=".BookPayment">
<Button
android:id="@+id/button2"
android:id="@+id/paymentConfirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
......@@ -18,27 +18,43 @@
<ScrollView
android:id="@+id/paymentScrollView"
android:layout_width="414dp"
android:layout_height="573dp"
android:layout_marginTop="80dp"
android:layout_width="320dp"
android:layout_height="513dp"
app:layout_constraintBottom_toTopOf="@+id/paymentConfirm"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.494"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toBottomOf="@+id/paymentMuseumName2"
app:layout_constraintVertical_bias="0.0">
<LinearLayout
android:id="@+id/paymentLinearLayout"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="horizontal">
<TextView
android:id="@+id/paymentOverview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/paymentOverviewItem"
android:layout_width="130dp"
android:layout_height="match_parent"
android:fontFamily="sans-serif"
android:text="Sandwich\nShirt"
android:textAlignment="center" />
<TextView
android:id="@+id/paymentOverviewQuantity"
android:layout_width="77dp"
android:layout_height="match_parent"
android:fontFamily="sans-serif"
android:text="test\ntest\ngood"
android:textAlignment="textStart" />
android:text="1\n2"
android:textAlignment="center" />
<TextView
android:id="@+id/paymentOverviewCost"
android:layout_width="113dp"
android:layout_height="match_parent"
android:fontFamily="sans-serif"
android:text="£2.00\n£10.00"
android:textAlignment="center" />
</LinearLayout>
</ScrollView>
......@@ -60,26 +76,30 @@
android:text="Please review your purchase overview"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/paymentMuseumName" />
<TextView
android:id="@+id/totalText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginBottom="32dp"
android:text="Total"
<EditText
android:id="@+id/paymentEnterAmount"
android:layout_width="131dp"
android:layout_height="39dp"
android:layout_marginStart="24dp"
android:layout_marginBottom="24dp"
android:ems="10"
android:hint="£"
android:inputType="numberDecimal"
android:singleLine="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/totalPaymentAmount"
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="68dp"
android:layout_marginBottom="32dp"
android:text="££££££"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="24dp"
android:text="Enter amount to pay"
app:layout_constraintBottom_toTopOf="@+id/paymentEnterAmount"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -170,8 +170,8 @@
android:layout_height="71dp"
android:layout_marginTop="168dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.19"
app:layout_constraintStart_toEndOf="@+id/hatImage"
app:layout_constraintHorizontal_bias="0.227"
app:layout_constraintStart_toEndOf="@+id/bottleImage"
app:layout_constraintTop_toBottomOf="@+id/shirtName"
app:srcCompat="@drawable/mug" />
......@@ -283,7 +283,7 @@
android:layout_width="73dp"
android:layout_height="71dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.212"
app:layout_constraintHorizontal_bias="0.27"
app:layout_constraintStart_toEndOf="@+id/hatImage"
app:layout_constraintTop_toBottomOf="@+id/shirtName"
app:srcCompat="@drawable/snowglobe" />
......@@ -520,22 +520,22 @@
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/subtotal"
android:id="@+id/subtotalAmountSouvenir"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="62dp"
android:layout_marginTop="12dp"
android:text="Subtotal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/coasterMinus" />
android:layout_marginStart="32dp"
android:text="££££"
app:layout_constraintStart_toEndOf="@+id/coasterName"
app:layout_constraintTop_toBottomOf="@+id/subtotal" />
<TextView
android:id="@+id/subtotalAmountSouvenir"
android:id="@+id/subtotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="62dp"
android:text="££££"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/subtotal" />
android:layout_marginStart="32dp"
android:layout_marginTop="20dp"
android:text="Subtotal"
app:layout_constraintStart_toEndOf="@+id/coasterName"
app:layout_constraintTop_toBottomOf="@+id/bottleMinus" />
</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/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
tools:layout_editor_absoluteX="143dp"
tools:layout_editor_absoluteY="220dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -8,8 +8,30 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/museumRecyclerList"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="58dp"
tools:layout_editor_absoluteY="76dp" />
android:layout_width="412dp"
android:layout_height="640dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView6" />
<TextView
android:id="@+id/textView"
android:layout_width="fill_parent"
android:layout_height="24dp"
android:text="Museum List"
android:textAlignment="center"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/textView6"
android:layout_width="fill_parent"
android:layout_height="24dp"
android:text="Please select the museum you wish to visit"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -8,34 +8,36 @@
<TextView
android:id="@+id/museumName"
android:layout_width="262dp"
android:layout_height="25dp"
android:layout_marginStart="12dp"
android:layout_width="390dp"
android:layout_height="24dp"
android:layout_marginTop="16dp"
android:text="TextView"
android:textAlignment="center"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/museumDescription"
android:layout_width="393dp"
android:layout_height="111dp"
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:layout_width="344dp"
android:layout_height="294dp"
android:layout_marginTop="16dp"
android:text="TextView"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/museumName" />
app:layout_constraintTop_toBottomOf="@+id/museumImage" />
<ImageView
android:id="@+id/museumImage"
android:layout_width="392dp"
android:layout_height="254dp"
android:layout_width="396dp"
android:layout_height="173dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.491"
app:layout_constraintHorizontal_bias="0.473"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/museumDescription"
app:layout_constraintTop_toBottomOf="@+id/museumName"
app:srcCompat="@drawable/ic_launcher_background" />
<Button
......
<resources>
<string name="app_name">MuseumApp</string>
<string name="louvre_description">Located in Paris, France. \n£10 entry fee.</string>
<string name="louvre_enhanced_description">Louvre is located in Paris, France and is the worlds largest art museum. It is a historic monument in Paris and is home to the Mona Lisa.</string>
<string name="louvre_enhanced_description">Louvre is located in Paris, France and is the worlds largest art museum. It is a historic monument in Paris and is home to the Mona Lisa. This museum is featured in the movie "The Da Vinci Code" and "Wonder Woman".</string>
<string name="china_description">Located in Beijing, China.\n£10 entry fee.</string>
<string name="china_enhanced_description">The National Museum of China is located in Beijing, China. Its mission is to educate people about the arts and history of China. It is the second most visited museum in the world.</string>
<string name="china_enhanced_description">The National Museum of China is located in Beijing, China. Its mission is to educate people about the arts and history of China. It is the second most visited museum in the world. This museum is home to the remains of the Yuanmou Man, the first evidence of human life found in China, 1.7 million years ago.</string>
<string name="vatican_description">Located in Vatican City, Vatican. \n£10 entrance fee.</string>
<string name="vatican_enhanced_description">The Vatican Museums are located in Vatican City, Vatican and are home to over 70,000 works of art. Almost 7,000,000 people visited this museum in 2019.</string>
<string name="vatican_enhanced_description">The Vatican Museums are located in Vatican City, Vatican and are home to over 70,000 works of art. Almost 7,000,000 people visited this museum in 2019. This museum is the main plot of the movie "The Da Vinci Code" starring Tom Hanks.</string>
<string name="museum_oa_description">Located in US, New York. \n£10 entrance fee. </string> <!--museum of art-->
<string name="museum_oa_enhanced_description">The Metropolitan Museum of Art is located in US, New York. It is home to over 2,000,000 works of art and is the fourth most visited museum in the world.</string>
<string name="museum_oa_enhanced_description">The Metropolitan Museum of Art is located in US, New York. It is home to over 2,000,000 works of art and is the fourth most visited museum in the world. This museum is home to the Great Hall and pieces of art from many places all around the world.</string>
<string name="british_museum_description">Located in London, UK. \n£10 entrance fee.</string>
<string name="british_museum_enhanced_description">The British Museum is located in London, UK. This museum is home to over 8,000,000 works of art and is one of the most comprehensive museums in the world.</string>
<string name="british_museum_enhanced_description">The British Museum is located in London, UK. This museum is home to over 8,000,000 works of art and is one of the most comprehensive museums in the world. The British Museum was established in 1753, largely based on the collections of the Irish physician and scientist Sir Hans Sloane. It first opened to the public in 1559.</string>
<string name="tate_description">Located in London, UK. \n£5 entrance fee.</string>
<string name="tate_enhanced_description">The Tate Modern Museum is located in London, UK. This museum had 5,900,000 visitors in 2018.</string>
<string name="tate_enhanced_description">The Tate Modern Museum is located in London, UK. This museum had 5,900,000 visitors in 2018. The Tate Modern Museum was opened by the Queen in 2000 and received 5.25 million visitors in its first year. This museum used to be a power station.</string>
<string name="gallery_description">Located in London, UK. \n£5 entrance fee.</string>
<string name="gallery_enhanced_description">The National Gallery Museum is located in London, UK. This museum houses 2,300 paintings from the mid-13th century to 1900.</string>
<string name="gallery_enhanced_description">The National Gallery Museum is located in London, UK. This museum houses 2,300 paintings from the mid-13th century to 1900. This museum can be found in Trafalgar Square in the City of Westminster. Famously one of the pink properties in the original Monopoly game.</string>
<string name="natural_history_description">Located in London, UK. \n£5 entrance fee.</string>
<string name="natural_history_enhanced_description">The Natural History Museum is located in London, UK. It is home to over 80,000,000 items within five main collections.</string>
<string name="natural_history_enhanced_description">The Natural History Museum is located in London, UK. It is home to over 80,000,000 items within five main collections. This museum contains specimens collected by Charles Darwin himself, including a large Diplodocus in the central hall of the museum, now replaced with a blue whale skeleton as of 2017.</string>
<string name="american_natural_history_description">Located in US, New York. \n£5 entrance fee.</string>
<string name="american_natural_history_enhanced_description">The American Museum of Natural History is located in US, New York. The museum contains over 34,000,000 specimens including human remains.</string>
<string name="american_natural_history_enhanced_description">The American Museum of Natural History is located in US, New York. The museum contains over 34,000,000 specimens including human remains. This museum was founded by Theodore Roosevelt\'s father and some others in 1869. This museum was the home of the Night at the Museum film starring Ben Stiller as Larry Daley.</string>
<string name="hermitage_description">Located in Saint Petersburg, Russia. \n£5 entrance fee.</string>
<string name="hermitage_enhanced_description">The State Hermitage Museum is located in Saint Petersburg, Russia. It has the largest collections of paintings in the world. </string>
<string name="hermitage_enhanced_description">The State Hermitage Museum is located in Saint Petersburg, Russia. It has the largest collections of paintings in the world. The Hermitage is considered a world wonder in the games Civilization IV, V, and VI.</string>
<string-array name="book_times">
<item>9am-11am</item>
......
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