Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Simmitive_Chris_Crook
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
chris.crook
Simmitive_Chris_Crook
Commits
2bb09d82
Commit
2bb09d82
authored
Apr 28, 2021
by
chris.crook
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
> bigboi generations
parent
25849d59
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
37 deletions
+80
-37
BuyScreen.java
...ain/java/com/example/summative_chris_crook/BuyScreen.java
+37
-2
activity_buy_screen.xml
app/src/main/res/layout/activity_buy_screen.xml
+8
-0
activity_main_booking_page.xml
app/src/main/res/layout/activity_main_booking_page.xml
+31
-31
activity_main_shop_page.xml
app/src/main/res/layout/activity_main_shop_page.xml
+4
-4
No files found.
app/src/main/java/com/example/summative_chris_crook/BuyScreen.java
View file @
2bb09d82
...
...
@@ -5,6 +5,7 @@ import androidx.appcompat.app.AppCompatActivity;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
android.widget.Toast
;
...
...
@@ -45,6 +46,40 @@ public class BuyScreen extends AppCompatActivity {
}
public
void
YouWillPayForWhatYouHaveDone
(
View
view
){
// do they have the money?
String
tempinopit
=
((
EditText
)
findViewById
(
R
.
id
.
yeetus
)).
getText
().
toString
();
if
(
tempinopit
.
equals
(
""
)){
// no value entered
return
;
}
double
priceinput
;
priceinput
=
Double
.
parseDouble
(((
EditText
)
findViewById
(
R
.
id
.
yeetus
)).
getText
().
toString
());
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 number,full_receipt,price(£)
if
(
Double
.
parseDouble
(
passed
[
2
])
<=
priceinput
){
// enough money was given
String
ihateyou
=
(
priceinput
-
Double
.
parseDouble
(
passed
[
2
])
+
""
);
((
EditText
)
findViewById
(
R
.
id
.
yeetus
)).
setText
(
ihateyou
);
passed
[
2
]
=
"0"
;
// passed [0] = "Payment Complete";
((
TextView
)
findViewById
(
R
.
id
.
textView36
)).
setText
(
"Payment Complete"
);
((
TextView
)
findViewById
(
R
.
id
.
textView37
)).
setText
(
"Price to pay: £"
+
passed
[
2
]
+
", all transactions are made in GBP."
);
}
else
{
// u too poor
((
EditText
)
findViewById
(
R
.
id
.
yeetus
)).
setText
(
""
);
Toast
.
makeText
(
getApplicationContext
(),
"You need more money"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
// clear things and go back
String
filename6
=
"Booking"
;
File
file6
;
file6
=
new
File
(
getApplicationContext
().
getFilesDir
(),
filename6
+
".txt"
);
...
...
@@ -71,7 +106,7 @@ public class BuyScreen extends AppCompatActivity {
}
catch
(
Exception
e
){
Toast
.
makeText
(
getApplicationContext
(),
"Internal File Error"
,
Toast
.
LENGTH_LONG
).
show
();
}
Intent
intent
=
new
Intent
(
this
,
CheckoutScreen
.
class
);
startActivity
(
intent
);
//
Intent intent = new Intent(this,CheckoutScreen.class);
//
startActivity(intent);
}
}
\ No newline at end of file
app/src/main/res/layout/activity_buy_screen.xml
View file @
2bb09d82
...
...
@@ -45,5 +45,13 @@
android:text=
"Pay"
app:rippleColor=
"#0f0"
/>
<EditText
android:id=
"@+id/yeetus"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:hint=
"enter money"
android:inputType=
"textPersonName"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_main_booking_page.xml
View file @
2bb09d82
...
...
@@ -69,14 +69,14 @@
<ImageView
android:id=
"@+id/imageView12"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0px
"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
app:srcCompat=
"@android:drawable/ic_menu_gallery"
/>
<Button
android:id=
"@+id/button55"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:onClick=
"Lbook"
...
...
@@ -90,18 +90,18 @@
<ImageView
android:id=
"@+id/imageView7"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0px
"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
app:srcCompat=
"@android:drawable/ic_menu_gallery"
/>
<Button
android:id=
"@+id/button50"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:onClick=
"NMOCbook"
android:text=
"N
MOC
"
/>
android:text=
"N
ational Museum Of China
"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -111,18 +111,18 @@
<ImageView
android:id=
"@+id/imageView8"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0px
"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
app:srcCompat=
"@android:drawable/ic_menu_gallery"
/>
<Button
android:id=
"@+id/button51"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:onClick=
"VMbook"
android:text=
"V
M
"
/>
android:text=
"V
atican Museums
"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -132,18 +132,18 @@
<ImageView
android:id=
"@+id/imageView9"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0px
"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
app:srcCompat=
"@android:drawable/ic_menu_gallery"
/>
<Button
android:id=
"@+id/button52"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:onClick=
"MMOAbook"
android:text=
"M
MOA
"
/>
android:text=
"M
etropolitan Museum Of Art
"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -153,18 +153,18 @@
<ImageView
android:id=
"@+id/imageView10"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0px
"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
app:srcCompat=
"@android:drawable/ic_menu_gallery"
/>
<Button
android:id=
"@+id/button53"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:onClick=
"BMbook"
android:text=
"B
M
"
/>
android:text=
"B
ritish Museum
"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -174,18 +174,18 @@
<ImageView
android:id=
"@+id/imageView2"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0px
"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
app:srcCompat=
"@android:drawable/ic_menu_gallery"
/>
<Button
android:id=
"@+id/button44"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:onClick=
"TMbook"
android:text=
"T
M
"
/>
android:text=
"T
ate Modern
"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -195,18 +195,18 @@
<ImageView
android:id=
"@+id/imageView3"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0px
"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
app:srcCompat=
"@android:drawable/ic_menu_gallery"
/>
<Button
android:id=
"@+id/button45"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:onClick=
"NGbook"
android:text=
"N
G
"
/>
android:text=
"N
ational Gallery
"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -237,18 +237,18 @@
<ImageView
android:id=
"@+id/imageView5"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0px
"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
app:srcCompat=
"@android:drawable/ic_menu_gallery"
/>
<Button
android:id=
"@+id/button47"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:onClick=
"NHMbook"
android:text=
"N
HM
"
/>
android:text=
"N
atural History Museum
"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -258,18 +258,18 @@
<ImageView
android:id=
"@+id/imageView6"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0px
"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
app:srcCompat=
"@android:drawable/ic_menu_gallery"
/>
<Button
android:id=
"@+id/button49"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:onClick=
"AMONHbook"
android:text=
"A
MONH
"
/>
android:text=
"A
merican Museum Of Natural History
"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -279,18 +279,18 @@
<ImageView
android:id=
"@+id/miv1"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0px
"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
app:srcCompat=
"@android:drawable/ic_menu_gallery"
/>
<Button
android:id=
"@+id/mb1"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:onClick=
"SHMbook"
android:text=
"S
HM
"
/>
android:text=
"S
tate Hermatige Museum
"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -317,12 +317,12 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"
match_parent
"
android:layout_height=
"
232dp
"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/button61"
android:layout_width=
"
match_parent
"
android:layout_width=
"
210dp
"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:onClick=
"tocart"
...
...
app/src/main/res/layout/activity_main_shop_page.xml
View file @
2bb09d82
...
...
@@ -369,14 +369,14 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"
53
dp"
android:layout_height=
"
150
dp"
android:orientation=
"horizontal"
android:translationY=
"-
115
px"
>
android:translationY=
"-
350
px"
>
<Button
android:id=
"@+id/button99"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:layout_weight=
"1"
android:onClick=
"tocart"
android:text=
"Cart"
...
...
@@ -385,7 +385,7 @@
<Button
android:id=
"@+id/button100"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:layout_weight=
"1"
android:onClick=
"tobooking"
android:text=
"Booking"
...
...
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