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
ab08d7f6
Commit
ab08d7f6
authored
May 29, 2023
by
a-j.towse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
semi working ticket selector
parent
713ef004
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
9 deletions
+76
-9
performanceInfoPage.java
...va/com/example/no1theatrecompany/performanceInfoPage.java
+62
-6
performance_infopage.xml
app/src/main/res/layout/performance_infopage.xml
+14
-3
No files found.
app/src/main/java/com/example/no1theatrecompany/performanceInfoPage.java
View file @
ab08d7f6
...
...
@@ -15,6 +15,7 @@ import android.widget.EditText;
import
android.widget.LinearLayout
;
import
android.widget.NumberPicker
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.appcompat.app.AppCompatActivity
;
...
...
@@ -23,6 +24,11 @@ import java.util.List;
public
class
performanceInfoPage
extends
AppCompatActivity
{
int
ticketTypeCount
=
0
;
String
selectedPerformance
;
ArrayList
currentPerformance
=
null
;
ArrayList
ticketTypeList
=
new
ArrayList
<>();
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -30,10 +36,9 @@ public class performanceInfoPage extends AppCompatActivity {
setContentView
(
R
.
layout
.
performance_infopage
);
Intent
intent
=
getIntent
();
String
selectedPerformance
=
intent
.
getStringExtra
(
"selectedPlay"
);
selectedPerformance
=
intent
.
getStringExtra
(
"selectedPlay"
);
setInfo
(
selectedPerformance
);
}
public
void
backBtn
(
View
view
)
{
...
...
@@ -51,7 +56,6 @@ public class performanceInfoPage extends AppCompatActivity {
DBConnector
connector
=
new
DBConnector
(
this
,
null
);
ArrayList
performanceInfoList
=
connector
.
getPerformanceInfo
();
ArrayList
currentPerformance
=
null
;
for
(
int
i
=
0
;
i
<
performanceInfoList
.
size
();
i
++)
{
ArrayList
tempList
=
(
ArrayList
)
performanceInfoList
.
get
(
i
);
...
...
@@ -66,14 +70,16 @@ public class performanceInfoPage extends AppCompatActivity {
venueTextView
.
setText
((
currentPerformance
.
get
(
3
).
toString
()+
": "
+
currentPerformance
.
get
(
2
).
toString
()));
int
ticketTypeCount
=
0
;
ticketTypeCount
=
0
;
//count the number of tickets types left
for
(
int
x
=
7
;
x
<
currentPerformance
.
size
();
x
++)
{
if
(
currentPerformance
.
get
(
x
)
!=
null
)
{
ticketTypeCount
+=
1
;
String
unSplitItem
=
currentPerformance
.
get
(
x
).
toString
();
System
.
out
.
println
(
currentPerformance
.
get
(
x
));
String
[]
splitItems
=
unSplitItem
.
split
(
","
,
0
);
//String num = unSplitItem.substring(0,unSplitItem.indexOf(","));
//String price = unSplitItem.substring(1,unSplitItem.indexOf(","));
//String name = unSplitItem.substring(2,unSplitItem.indexOf(","));
...
...
@@ -85,7 +91,6 @@ public class performanceInfoPage extends AppCompatActivity {
text
.
setPadding
(
0
,
0
,
0
,
15
);
linearLayout
.
addView
(
text
);
final
LinearLayout
linearLayout2
=
(
LinearLayout
)
findViewById
(
R
.
id
.
bookTicketsLayout2
);
final
TextView
text2
=
new
TextView
(
this
);
text2
.
setText
(
"Available: "
+
splitItems
[
0
]);
...
...
@@ -99,9 +104,60 @@ public class performanceInfoPage extends AppCompatActivity {
numSelect
.
setMinimumWidth
(
40
);
numSelect
.
setRawInputType
(
TYPE_CLASS_NUMBER
);
numSelect
.
setMaxLines
(
1
);
numSelect
.
setText
(
"0"
);
numSelect
.
setGravity
(
Gravity
.
CENTER
);
numSelect
.
setTag
((
"TixSelect,"
+
splitItems
[
2
]));
linearLayout3
.
addView
(
numSelect
);
}
}
}
public
ArrayList
getTicketInfo
(
ArrayList
currentPerformance
)
{
ArrayList
workingTicketInfo
=
new
ArrayList
<>();
for
(
int
x
=
7
;
x
<
currentPerformance
.
size
();
x
++)
{
if
(
currentPerformance
.
get
(
x
)
!=
null
)
{
String
unSplitItem
=
currentPerformance
.
get
(
x
).
toString
();
workingTicketInfo
.
add
(
unSplitItem
);
}
}
return
workingTicketInfo
;
}
public
void
getBookingInfo
(
View
view
)
{
ArrayList
workingTicketInfo
=
getTicketInfo
(
currentPerformance
);
LinearLayout
linearLayout3
=
(
LinearLayout
)
findViewById
(
R
.
id
.
bookTicketsLayout3
);
for
(
int
i
=
0
;
i
<
workingTicketInfo
.
size
();
i
++)
{
String
currentTicket
=
workingTicketInfo
.
get
(
i
).
toString
();
String
[]
splitItems
=
currentTicket
.
split
(
","
,
0
);
String
tickID
=
"TixSelect,"
+
splitItems
[
2
];
EditText
editText
=
(
EditText
)
linearLayout3
.
findViewWithTag
(
tickID
);
String
ticketNumSelect
=
editText
.
getText
().
toString
();
int
ticketNumInt
=
Integer
.
parseInt
(
ticketNumSelect
);
if
(
ticketNumInt
>
Integer
.
parseInt
(
splitItems
[
0
]))
{
Toast
.
makeText
(
this
,
"Number of selected tickets not available"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
splitItems
[
0
]
=
String
.
valueOf
(
Integer
.
parseInt
(
splitItems
[
0
])
-
ticketNumInt
);
String
unsplitSplit
=
splitItems
[
0
]+
","
+
splitItems
[
1
]+
","
+
splitItems
[
2
];
for
(
int
x
=
0
;
x
>
currentPerformance
.
size
();
x
++)
{
}
}
}
...
...
app/src/main/res/layout/performance_infopage.xml
View file @
ab08d7f6
...
...
@@ -30,12 +30,23 @@
android:id=
"@+id/backBtn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:onClick=
"backBtn"
android:text=
"Back"
app:layout_constraintTop_toTopOf=
"parent"
tools:layout_editor_absoluteX=
"16dp"
/>
<Button
android:id=
"@+id/bookNowBtn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"30dp"
android:onClick=
"getBookingInfo"
android:text=
"Book Now"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.498"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_to
TopOf=
"parent
"
/>
app:layout_constraintTop_to
BottomOf=
"@+id/bookTicketsLayout2
"
/>
<LinearLayout
android:id=
"@+id/linearLayout2"
...
...
@@ -95,8 +106,8 @@
android:id=
"@+id/textView6"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Book Tickets:"
android:paddingBottom=
"20dp"
android:text=
"Book Tickets:"
android:textSize=
"20sp"
/>
</LinearLayout>
...
...
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