Commit df0d01ea authored by chris.crook's avatar chris.crook

> bigboi III

parent 16f8e758
......@@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Summative_Chris_Crook">
<activity android:name=".CheckoutScreen"></activity>
<activity android:name=".ShopDetails"></activity>
<activity android:name=".CheckoutScreen" />
<activity android:name=".BookingDetails" />
<activity android:name=".PasswordSettings" />
<activity android:name=".CurrencySelect" />
......
......@@ -36,13 +36,13 @@ public class AdminMenu extends AppCompatActivity {
String [] temploadarray = temp.split("&");
//bugfixing stuff
Toast.makeText(getApplicationContext(), temp, Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temp, Toast.LENGTH_LONG).show();
for (int i = 0; i < temploadarray.length; i++){
Toast.makeText(getApplicationContext(), temploadarray [i], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [i], Toast.LENGTH_LONG).show();
}
if (temploadarray [4].equals("ENG")){ //load english button names
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((TextView)findViewById(R.id.textView4)).setText("Main Menu");
((Button)findViewById(R.id.button5)).setText("Log Out");
((Button)findViewById(R.id.button15)).setText("Bookings");
......@@ -57,7 +57,7 @@ public class AdminMenu extends AppCompatActivity {
((Button)findViewById(R.id.button43)).setText("Clear all bookings");
}
else if (temploadarray [4].equals("FRA")){ //load french button names
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((TextView)findViewById(R.id.textView4)).setText("Menu principal");
((Button)findViewById(R.id.button5)).setText("se déconnecter");
((Button)findViewById(R.id.button15)).setText("réservation");
......@@ -72,7 +72,7 @@ public class AdminMenu extends AppCompatActivity {
((Button)findViewById(R.id.button43)).setText("Clear all bookings (FR)");
}
else if (temploadarray [4].equals("ESP")){ //load spanish button names
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((TextView)findViewById(R.id.textView4)).setText("Menú principal");
((Button)findViewById(R.id.button5)).setText("espalda");
((Button)findViewById(R.id.button15)).setText("Bookings (ESP)");
......@@ -87,7 +87,7 @@ public class AdminMenu extends AppCompatActivity {
((Button)findViewById(R.id.button43)).setText("Clear all bookings (ESP)");
}
else if (temploadarray [4].equals("DEU")){ //load german button names
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((TextView)findViewById(R.id.textView4)).setText("Hauptmenü");
((Button)findViewById(R.id.button5)).setText("rückseite");
((Button)findViewById(R.id.button15)).setText("Bookings (DE)");
......@@ -102,7 +102,7 @@ public class AdminMenu extends AppCompatActivity {
((Button)findViewById(R.id.button43)).setText("Clear all bookings (DE)");
}
else{ //load a default set of button names
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((Button)findViewById(R.id.button4)).setText("Back (something broke)");
((Button)findViewById(R.id.button15)).setText("Bookings (something broke)");
((Button)findViewById(R.id.button16)).setText("Shop (something broke)");
......
......@@ -155,6 +155,7 @@ public class CheckoutScreen extends AppCompatActivity {
bookingoutput += "\n\nTotal: ";
if (temploadarray[3].equals("£")){
bookingoutput += "£";
bookingoutput += totalprice;
}
if (temploadarray[3].equals("€")){
bookingoutput += "€";
......
......@@ -226,7 +226,7 @@ public class MainActivity extends AppCompatActivity {
// user is an admin
Toast.makeText(getApplicationContext(), "Signed in as " + magicwords [i] [1] + " (admin)", Toast.LENGTH_SHORT).show();
String writetotemp = magicwords [i] [1] + "&" + magicwords [i] [3] + "&" + magicwords [i] [4] + "&" + magicwords [i] [5] + "&" + magicwords [i] [6] + "&" + i;
Toast.makeText(getApplicationContext(), "Admin preferences loaded: " + writetotemp, Toast.LENGTH_SHORT).show();
//Toast.makeText(getApplicationContext(), "Admin preferences loaded: " + writetotemp, Toast.LENGTH_SHORT).show();
try{ //writetotemp format: name,password,adminflag,currency,language,id
FileWriter stream = new FileWriter(file2, false);
stream.append(writetotemp);
......@@ -242,7 +242,7 @@ public class MainActivity extends AppCompatActivity {
// user is an admin
Toast.makeText(getApplicationContext(), "Signed in as " + magicwords [i] [1] + " (super admin)", Toast.LENGTH_SHORT).show();
String writetotemp = magicwords [i] [1] + "&" + magicwords [i] [3] + "&" + magicwords [i] [4] + "&" + magicwords [i] [5] + "&" + magicwords [i] [6] + "&" + i;
Toast.makeText(getApplicationContext(), "Admin preferences loaded: " + writetotemp, Toast.LENGTH_SHORT).show();
//Toast.makeText(getApplicationContext(), "Admin preferences loaded: " + writetotemp, Toast.LENGTH_SHORT).show();
try{
FileWriter stream = new FileWriter(file2, false);
stream.append(writetotemp);
......@@ -257,7 +257,7 @@ public class MainActivity extends AppCompatActivity {
else{
Toast.makeText(getApplicationContext(), "Signed in as " + magicwords [i] [1], Toast.LENGTH_SHORT).show();
String writetotemp = magicwords [i] [1] + "&" + magicwords [i] [3] + "&" + magicwords [i] [4] + "&" + magicwords [i] [5] + "&" + magicwords [i] [6] + "&" + i;// name,flag,currency,language,internalID
Toast.makeText(getApplicationContext(), "User preferences loaded: " + writetotemp, Toast.LENGTH_SHORT).show();
//Toast.makeText(getApplicationContext(), "User preferences loaded: " + writetotemp, Toast.LENGTH_SHORT).show();
try{
FileWriter stream = new FileWriter(file2, false);
stream.append(writetotemp);
......
......@@ -48,7 +48,7 @@ public class MainBookingPage extends AppCompatActivity {
String [] temploadarray = temp.split("&");
if (temploadarray [4].equals("ENG")){
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((TextView)findViewById(R.id.textView14)).setText("Bookings");
((Button)findViewById(R.id.button14)).setText("Back");
((TextView)findViewById(R.id.textView21)).setText("Search for museums");
......@@ -56,7 +56,7 @@ public class MainBookingPage extends AppCompatActivity {
((Button)findViewById(R.id.button56)).setText("Shop");
}
else if (temploadarray [4].equals("FRA")){
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((TextView)findViewById(R.id.textView14)).setText("Menu de réservation");
((Button)findViewById(R.id.button14)).setText("de retour");
((TextView)findViewById(R.id.textView21)).setText("Search for museums");
......@@ -64,7 +64,7 @@ public class MainBookingPage extends AppCompatActivity {
((Button)findViewById(R.id.button56)).setText("Shop");
}
else if (temploadarray [4].equals("ESP")){
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((TextView)findViewById(R.id.textView14)).setText("Menú de reserva");
((Button)findViewById(R.id.button14)).setText("espalda");
((TextView)findViewById(R.id.textView21)).setText("Search for museums");
......@@ -72,7 +72,7 @@ public class MainBookingPage extends AppCompatActivity {
((Button)findViewById(R.id.button56)).setText("Shop");
}
else if (temploadarray [4].equals("DEU")){
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((TextView)findViewById(R.id.textView14)).setText("Buchungsmenü");
((Button)findViewById(R.id.button14)).setText("rückseite");
((TextView)findViewById(R.id.textView21)).setText("Suche nach Museum");
......@@ -80,7 +80,7 @@ public class MainBookingPage extends AppCompatActivity {
((Button)findViewById(R.id.button56)).setText("kaufhaus");
}
else{
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((TextView)findViewById(R.id.textView14)).setText("Back");
((Button)findViewById(R.id.button14)).setText("Back (something broke)");
((TextView)findViewById(R.id.textView21)).setText("Search for museums");
......
......@@ -9,10 +9,16 @@ import android.widget.Button;
import android.widget.Toast;
import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;
public class MainShopPage extends AppCompatActivity {
String filename1 = "magicwords";
String filename2 = "appdatatxt";
File file1;
File file2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -90,4 +96,37 @@ public class MainShopPage extends AppCompatActivity {
Toast.makeText(getApplicationContext(), "read error", Toast.LENGTH_SHORT).show();
}
}
public String openandload(){
try{
Scanner reader = new Scanner(file1);
String temp = "";
while (reader.hasNextLine()){
temp = temp + reader.nextLine();
}
//Toast.makeText(getApplicationContext(), temp + " ", Toast.LENGTH_LONG).show();
return temp;
} catch(Exception e){
Toast.makeText(getApplicationContext(), "read error", Toast.LENGTH_LONG).show();
return "&&&";
}
}
public void item1 (View view){
String filename5 = "pass";
File file5;
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
try {
FileWriter stream = new FileWriter(file5, false);
stream.append("02&T-shirts&_&_&10");
stream.close();
} catch(Exception f){
Toast.makeText(getApplicationContext(), "Internal File Error", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this,ShopDetails.class);
startActivity(intent);
}
}
\ No newline at end of file
package com.example.summative_chris_crook;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
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 java.io.File;
import java.util.Scanner;
public class ShopDetails extends AppCompatActivity {
String filename5 = "pass";
File file5;
Double Euro = 1.16;
Double USD = 1.40;
Double HKD = 10.85;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shop_details);
String filename2 = "appdatatxt";
File file2;
file2 = new File(getApplicationContext().getFilesDir(), filename2 + ".txt");
file5 = new File(getApplicationContext().getFilesDir(), filename5 + ".txt");
String temp = "";
try{
Scanner reader = new Scanner(file5);
while (reader.hasNextLine()){
temp = temp + reader.nextLine();
}
} catch(Exception e){ }
String [] passed = temp.split("&"); // id,name,city,country,price
temp += "&";
try{
Scanner reader = new Scanner(file2);
while (reader.hasNextLine()){
temp = temp + reader.nextLine();
}
} catch(Exception e){ }
String [] temploadarray = temp.split("&"); // name,password,adminflag,currency,language,id
String title;
for (int i = 0; i < temploadarray.length; i++){
Toast.makeText(getApplicationContext(), temploadarray [i] , Toast.LENGTH_LONG).show();
}
String passedtitle = passed [1];
if (temploadarray [9].equals("ENG")){
title = "Booking for: " + passedtitle;
((TextView)findViewById(R.id.textView29)).setText(title);
((Button)findViewById(R.id.button83)).setText("Back");
}
else if (temploadarray [9].equals("FRA")){
title = "Réservation pour: " + passedtitle;
((TextView)findViewById(R.id.textView29)).setText(title);
((Button)findViewById(R.id.button83)).setText("de retour");
}
else if (temploadarray [9].equals("ESP")){
title = "Reserva para: " + passedtitle;
((TextView)findViewById(R.id.textView29)).setText(title);
((Button)findViewById(R.id.button83)).setText("espalda");
}
else if (temploadarray [9].equals("DEU")){
title = "Buchung für: " + passedtitle;
((TextView)findViewById(R.id.textView29)).setText(title);
((Button)findViewById(R.id.button83)).setText("rückseite");
}
else{
title = "Booking for: (not ENG) " + passedtitle;
((TextView)findViewById(R.id.textView29)).setText(title);
((Button)findViewById(R.id.button83)).setText("Back");
}
((EditText)findViewById(R.id.YEET3)).setText(temp);
}
public void goback (View view){
Intent intent = new Intent(this,MainShopPage.class);
startActivity(intent);
}
}
\ No newline at end of file
......@@ -34,9 +34,9 @@ public class UserMenu extends AppCompatActivity {
String [] temploadarray = temp.split("&");
//bugfixing stuff
Toast.makeText(getApplicationContext(), temp, Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temp, Toast.LENGTH_LONG).show();
for (int i = 0; i < temploadarray.length; i++){
Toast.makeText(getApplicationContext(), temploadarray [i], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [i], Toast.LENGTH_LONG).show();
}
if (temploadarray [4].equals("ENG")){ //load english button names
......@@ -80,7 +80,7 @@ public class UserMenu extends AppCompatActivity {
((Button)findViewById(R.id.button21)).setText("Delete Account");
}
else{ //load a default set of button names
Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), temploadarray [4], Toast.LENGTH_LONG).show();
((Button)findViewById(R.id.button4)).setText("Back (something broke)");
((Button)findViewById(R.id.button18)).setText("Bookings (something broke)");
((Button)findViewById(R.id.button19)).setText("Shop (something broke)");
......
......@@ -30,20 +30,20 @@
<TextView
android:id="@+id/textView21"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0px"
android:text="TextView" />
<EditText
android:id="@+id/editTextTextPersonName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0px"
android:ems="10"
android:inputType="textPersonName" />
<Button
android:id="@+id/button42"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0px"
android:text="Button" />
<TextView
......
......@@ -23,6 +23,139 @@
android:layout_height="wrap_content"
android:onClick="goback"
android:text="Back" />
<TextView
android:id="@+id/textView30"
android:layout_width="match_parent"
android:layout_height="0px"
android:text="TextView" />
<EditText
android:id="@+id/editTextTextPersonName2"
android:layout_width="match_parent"
android:layout_height="0px"
android:ems="10"
android:inputType="textPersonName" />
<Button
android:id="@+id/button84"
android:layout_width="match_parent"
android:layout_height="0px"
android:text="Button" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button85"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="item1"
android:text="T-shirt" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button86"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button87"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button88"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<Button
android:id="@+id/button89"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</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=".ShopDetails">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView29"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
<Button
android:id="@+id/button83"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="goback"
android:text="Button" />
<EditText
android:id="@+id/YEET3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:text="Name" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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