Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Summative_Sam_Markey
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sam.markey
Summative_Sam_Markey
Commits
96c2a5fe
Commit
96c2a5fe
authored
May 04, 2021
by
Sam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FINAL VERSION
parent
f80338d9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
11 deletions
+14
-11
booking.java
...rc/main/java/com/example/museumworld/booking/booking.java
+10
-7
Receipt.java
...c/main/java/com/example/museumworld/checkout/Receipt.java
+2
-2
checkout.java
.../main/java/com/example/museumworld/checkout/checkout.java
+1
-1
strings.xml
app/src/main/res/values/strings.xml
+1
-1
No files found.
app/src/main/java/com/example/museumworld/booking/booking.java
View file @
96c2a5fe
...
...
@@ -22,18 +22,16 @@ import androidx.fragment.app.DialogFragment;
import
com.example.museumworld.R
;
import
com.example.museumworld.cafe_shop.cafe_activity
;
import
com.example.museumworld.checkout.Receipt
;
import
com.example.museumworld.details.MuseumDetails
;
import
com.google.android.material.snackbar.Snackbar
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
public
class
booking
extends
AppCompatActivity
implements
View
.
OnClickListener
,
AdapterView
.
OnItemSelectedListener
,
DatePickerDialog
.
OnDateSetListener
{
public
static
String
dateSelected
,
timeSelected
;
public
static
String
dateSelected
Database
,
timeSelected
,
dateSelectedReceipt
;
private
ImageView
top_img
;
private
Spinner
spinner
;
private
TextView
date_Text
,
next_btn
;
...
...
@@ -58,6 +56,7 @@ public class booking extends AppCompatActivity implements View.OnClickListener,
calendar_icon
=
findViewById
(
R
.
id
.
calendar_icon
);
calendar_icon
.
setOnClickListener
(
this
);
date_Text
=
findViewById
(
R
.
id
.
date_Text
);
date_Text
.
setOnClickListener
(
this
);
//SPINNER
String
[]
times
=
{
"9-11am"
,
"11-1pm"
,
"1-3pm"
,
"3-5pm"
};
...
...
@@ -75,13 +74,16 @@ public class booking extends AppCompatActivity implements View.OnClickListener,
@Override
public
void
onClick
(
View
v
)
{
DialogFragment
datePick
=
new
DaterPicker
();
switch
(
v
.
getId
())
{
case
R
.
id
.
back_arrow_icon
:
finish
();
break
;
case
R
.
id
.
calendar_icon
:
DialogFragment
datePick
=
new
DaterPicker
();
case
R
.
id
.
date_Text
:
datePick
.
show
(
getSupportFragmentManager
(),
"Select Date"
);
break
;
...
...
@@ -131,9 +133,10 @@ public class booking extends AppCompatActivity implements View.OnClickListener,
date_Text
.
setHint
(
dateSelected
);
this
.
dateSelected
=
year
+
"-"
+
(
month
+
1
)
+
"-"
+
dayOfMonth
;
this
.
dateSelectedDatabase
=
year
+
"-"
+
(
month
+
1
)
+
"-"
+
dayOfMonth
;
this
.
dateSelectedReceipt
=
dayOfMonth
+
"/"
+
(
month
+
1
)
+
"/"
+
year
;
Log
.
d
(
"dateselect"
,
this
.
dateSelected
);
}
else
{
snackbarAlert
(
"Select a date that is present or in the future"
,
true
);
}
...
...
@@ -178,7 +181,7 @@ public class booking extends AppCompatActivity implements View.OnClickListener,
public
void
OpenDialogBox
(
String
title
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
,
R
.
style
.
AlertDialogTheme
);
builder
.
setTitle
(
title
)
.
setMessage
(
getString
(
R
.
string
.
bookingConfirm
)
+
" "
+
MuseumDetails
.
MuseumName
+
"\n"
+
getString
(
R
.
string
.
bookingConfirm2
)+
" "
+
dateSelected
+
"\n"
+
getString
(
R
.
string
.
bookingConfirm3
)
+
" "
+
spinner
.
getSelectedItem
().
toString
())
.
setMessage
(
getString
(
R
.
string
.
bookingConfirm
)
+
" "
+
MuseumDetails
.
MuseumName
+
"\n"
+
getString
(
R
.
string
.
bookingConfirm2
)+
" "
+
dateSelected
Receipt
+
"\n"
+
getString
(
R
.
string
.
bookingConfirm3
)
+
" "
+
spinner
.
getSelectedItem
().
toString
())
.
setPositiveButton
(
getResources
().
getString
(
R
.
string
.
yes
),
(
dialog
,
which
)
->
{
switch
(
spinner
.
getSelectedItem
().
toString
())
{
...
...
app/src/main/java/com/example/museumworld/checkout/Receipt.java
View file @
96c2a5fe
...
...
@@ -155,7 +155,7 @@ public class Receipt extends AppCompatActivity implements View.OnClickListener {
ArrayList
<
String
>
detailInfo
=
getIntent
().
getStringArrayListExtra
(
"detailVariables"
);
customerName_text
.
setText
(
MainActivity
.
FirstnameG
+
" "
+
MainActivity
.
LastnameG
);
Museum_text
.
setText
(
MuseumDetails
.
MuseumName
);
Date_text
.
setText
(
booking
.
dateSelected
);
Date_text
.
setText
(
booking
.
dateSelected
Receipt
);
Time_text
.
setText
(
booking
.
timeSelected
);
totalCost_text
.
setText
(
"£"
+
detailInfo
.
get
(
0
)
+
".00"
);
amountEntered_text
.
setText
(
"£"
+
detailInfo
.
get
(
1
)
+
"0"
);
...
...
@@ -212,7 +212,7 @@ public class Receipt extends AppCompatActivity implements View.OnClickListener {
jsonAllDetails
=
new
JSONObject
();
jsonAllDetails
.
putOpt
(
"museumName"
,
MuseumDetails
.
MuseumName
);
jsonAllDetails
.
put
(
"dateSelected"
,
booking
.
dateSelected
);
jsonAllDetails
.
put
(
"dateSelected"
,
booking
.
dateSelected
Receipt
);
jsonAllDetails
.
put
(
"timeSelected"
,
booking
.
timeSelected
);
jsonAllDetails
.
put
(
"totalCost"
,
totalCost_text
.
getText
().
toString
().
replaceAll
(
"£"
,
"&pound;"
));
jsonAllDetails
.
put
(
"amountEntered"
,
amountEntered_text
.
getText
().
toString
().
replaceAll
(
"£"
,
"&pound;"
));
...
...
app/src/main/java/com/example/museumworld/checkout/checkout.java
View file @
96c2a5fe
...
...
@@ -216,7 +216,7 @@ public class checkout extends AppCompatActivity implements View.OnClickListener
data
.
put
(
"bookingID"
,
String
.
valueOf
(
bookingID
));
data
.
put
(
"museumID"
,
String
.
valueOf
(
MuseumDetails
.
MuseumID
));
data
.
put
(
"numberOfItems"
,
String
.
valueOf
(
TotalnumberOfItems
));
data
.
put
(
"bookedDate"
,
booking
.
dateSelected
);
data
.
put
(
"bookedDate"
,
booking
.
dateSelected
Database
);
data
.
put
(
"bookedTime"
,
booking
.
timeSelected
);
data
.
put
(
"totalCost"
,
String
.
valueOf
(
totalOfCheckout
));
data
.
put
(
"userEntered"
,
String
.
valueOf
(
money_EditText
.
getText
()));
...
...
app/src/main/res/values/strings.xml
View file @
96c2a5fe
...
...
@@ -89,7 +89,7 @@
<string
name=
"register_username_contain"
>
*Username cannot contain your first or last name
</string>
<string
name=
"reister_password"
>
*Password has to be at least 7 characters long
</string>
<string
name=
"reister_password2"
>
*Passwords do not match
</string>
<string
name=
"date_goes_here"
>
Date
goes h
ere
</string>
<string
name=
"date_goes_here"
>
Date
Displays H
ere
</string>
<string
name=
"world_museums"
>
World Museums
</string>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment