Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Theatre Booking App
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
a-j.towse
Theatre Booking App
Commits
6e4c4bf0
Commit
6e4c4bf0
authored
May 30, 2023
by
a-j.towse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
final push, all items working
parent
5681a163
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
25 deletions
+26
-25
BookingsPageAdapter.java
...va/com/example/no1theatrecompany/BookingsPageAdapter.java
+3
-4
DBConnector.java
.../main/java/com/example/no1theatrecompany/DBConnector.java
+2
-8
myBookingsActivity.java
...ava/com/example/no1theatrecompany/myBookingsActivity.java
+2
-1
performanceInfoPage.java
...va/com/example/no1theatrecompany/performanceInfoPage.java
+18
-12
mybookings_page.xml
app/src/main/res/layout/mybookings_page.xml
+1
-0
No files found.
app/src/main/java/com/example/no1theatrecompany/BookingsPageAdapter.java
View file @
6e4c4bf0
package
com
.
example
.
no1theatrecompany
;
import
static
androidx
.
core
.
content
.
ContextCompat
.
startActivity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.telecom.Call
;
...
...
@@ -40,10 +42,7 @@ public class BookingsPageAdapter extends RecyclerView.Adapter<IdleViewHolder2> {
holder
.
cancelBookingBtnButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
DBConnector
connector
=
new
DBConnector
(
context
,
null
);
System
.
out
.
println
(
mData
.
get
(
position
).
name
);
connector
.
cancelBooking
(
mData
.
get
(
position
).
name
);
context
.
startActivity
(
new
Intent
(
view
.
getContext
(),
MainActivity
.
class
));
}
});
...
...
app/src/main/java/com/example/no1theatrecompany/DBConnector.java
View file @
6e4c4bf0
...
...
@@ -313,6 +313,8 @@ public class DBConnector extends SQLiteOpenHelper {
db
.
close
();
}
public
ArrayList
getBookingInfo
()
{
ArrayList
<
ArrayList
<
String
>>
bookingInfoList
=
new
ArrayList
<>();
...
...
@@ -368,14 +370,6 @@ public class DBConnector extends SQLiteOpenHelper {
}
public
void
cancelBooking
(
String
playName
)
{
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
db
.
delete
(
TABLE_BOOKINGS
,
COLUMN_PERFORMANCENAME
+
"="
+
playName
,
null
);
db
.
close
();
}
//Upgrade DB (to satisfy extends f SQLiteOpenHelper)
@Override
public
void
onUpgrade
(
SQLiteDatabase
db
,
int
oldVersion
,
int
newVersion
)
{
...
...
app/src/main/java/com/example/no1theatrecompany/myBookingsActivity.java
View file @
6e4c4bf0
...
...
@@ -43,7 +43,8 @@ public class myBookingsActivity extends AppCompatActivity {
tempList
.
get
(
2
).
toString
(),
tempList
.
get
(
0
).
toString
()));
}
}
public
void
cancelBooking
(
View
view
)
{
public
void
backBtn
(
View
view
)
{
onBackPressed
();
}
}
app/src/main/java/com/example/no1theatrecompany/performanceInfoPage.java
View file @
6e4c4bf0
...
...
@@ -149,15 +149,20 @@ public class performanceInfoPage extends AppCompatActivity {
if
(
ticketNumInt
>
Integer
.
parseInt
(
splitItems
[
0
]))
{
Toast
.
makeText
(
this
,
"Number of selected tickets not available"
,
Toast
.
LENGTH_SHORT
).
show
();
break
;
}
else
if
(
ticketNumInt
==
0
){
Toast
.
makeText
(
this
,
"No Tickets Selected"
,
Toast
.
LENGTH_SHORT
).
show
();
break
;
}
else
else
{
splitItems
[
0
]
=
String
.
valueOf
(
Integer
.
parseInt
(
splitItems
[
0
])
-
ticketNumInt
);
String
unsplitSplit
=
splitItems
[
0
]
+
","
+
splitItems
[
1
]+
","
+
splitItems
[
2
];
String
unsplitSplit
=
splitItems
[
0
]
+
","
+
splitItems
[
1
]
+
","
+
splitItems
[
2
];
for
(
int
x
=
0
;
x
<
currentPerformance
.
size
();
x
++)
{
for
(
int
x
=
0
;
x
<
currentPerformance
.
size
();
x
++)
{
if
(
currentPerformance
.
get
(
x
)
==
(
currentTicket
))
{
currentPerformance
.
set
(
x
,
unsplitSplit
);
currentPerformance
.
set
(
x
,
unsplitSplit
);
//Connect to DB
DBConnector
connector
=
new
DBConnector
(
this
,
null
);
...
...
@@ -166,8 +171,6 @@ public class performanceInfoPage extends AppCompatActivity {
break
;
}
}
}
DBConnector
connector
=
new
DBConnector
(
this
,
null
);
String
bookingID
=
createBookingID
();
System
.
out
.
println
(
bookingID
);
...
...
@@ -175,6 +178,9 @@ public class performanceInfoPage extends AppCompatActivity {
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
startActivity
(
intent
);
}
}
}
public
String
createBookingID
()
{
int
upper
=
10000
;
...
...
app/src/main/res/layout/mybookings_page.xml
View file @
6e4c4bf0
...
...
@@ -13,6 +13,7 @@
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:onClick=
"backBtn"
android:text=
"Back"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
...
...
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