Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Summative_Lucy_Hemingway
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
lucy.hemingway
Summative_Lucy_Hemingway
Commits
185a6c3b
Commit
185a6c3b
authored
May 12, 2021
by
lucy.hemingway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
starting to pick time
parent
eda29815
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
151 additions
and
18 deletions
+151
-18
Booking.java
app/src/main/java/com/example/appppppp/Booking.java
+39
-4
activity_booking.xml
app/src/main/res/layout/activity_booking.xml
+112
-14
No files found.
app/src/main/java/com/example/appppppp/Booking.java
View file @
185a6c3b
...
...
@@ -10,7 +10,10 @@ import android.nfc.Tag;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.DatePicker
;
import
android.widget.RadioButton
;
import
android.widget.RadioGroup
;
import
android.widget.TextView
;
import
org.w3c.dom.Text
;
...
...
@@ -26,6 +29,11 @@ public class Booking extends AppCompatActivity {
public
static
String
price
;
public
static
String
selectedMuseum
;
RadioGroup
choosetime
;
RadioButton
booknow
;
TextView
text
;
private
static
final
String
TAG
=
"Booking"
;
TextView
Date
;
...
...
@@ -49,8 +57,8 @@ public class Booking extends AppCompatActivity {
selectedMuseum
=
intent
.
getStringExtra
(
"selectedMuseum"
);
price
=
intent
.
getStringExtra
(
"price"
);
museumname
.
setText
(
selectedMuseum
);
priceofmuseum
.
setText
(
price
);
museumname
.
setText
(
"Selected Museum: "
+
selectedMuseum
);
priceofmuseum
.
setText
(
"Price: £"
+
price
);
Date
=
(
TextView
)
findViewById
(
R
.
id
.
selectdate
);
...
...
@@ -65,7 +73,7 @@ public class Booking extends AppCompatActivity {
int
day
=
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
);
DatePickerDialog
picker
=
new
DatePickerDialog
(
Booking
.
this
,
android
.
R
.
style
.
Theme_
Holo_Light_Dialog_MinWidth
,
SetDate
,
android
.
R
.
style
.
Theme_
DeviceDefault_Dialog_Alert
,
SetDate
,
year
,
month
,
day
);
picker
.
getWindow
().
setBackgroundDrawable
(
new
ColorDrawable
(
Color
.
TRANSPARENT
));
...
...
@@ -76,9 +84,36 @@ public class Booking extends AppCompatActivity {
SetDate
=
new
DatePickerDialog
.
OnDateSetListener
()
{
@Override
public
void
onDateSet
(
DatePicker
view
,
int
year
,
int
month
,
int
dayOfMonth
)
{
Log
.
d
(
TAG
,
"OnDateSet: Date: "
+
year
+
"/"
+
month
+
"/"
+
dayOfMonth
);
month
=
month
+
1
;
Log
.
d
(
TAG
,
"OnDateSet: dd/mm/yyyy Date: "
+
year
+
"/"
+
month
+
"/"
+
dayOfMonth
);
String
datechosen
=
dayOfMonth
+
"/"
+
month
+
"/"
+
year
;
Date
.
setText
(
datechosen
);
}
};
text
=
findViewById
(
R
.
id
.
selected
);
choosetime
=
findViewById
(
R
.
id
.
allbuttons
);
Button
booknow
=
findViewById
(
R
.
id
.
booknow
);
booknow
.
setOnClickListener
(
new
View
.
OnClickListener
(){
@Override
public
void
onClick
(
View
v
)
{
int
selectedradio
=
choosetime
.
getCheckedRadioButtonId
();
choosetime
=
findViewById
(
selectedradio
);
text
.
setText
(
"you selected: "
+
choosetime
.
toString
());
}
});
}
}
\ No newline at end of file
app/src/main/res/layout/activity_booking.xml
View file @
185a6c3b
...
...
@@ -6,37 +6,135 @@
android:layout_height=
"match_parent"
tools:context=
".Booking"
>
<TextView
android:id=
"@+id/Museumname"
android:layout_width=
"
230
dp"
android:layout_height=
"
116
dp"
android:layout_width=
"
316
dp"
android:layout_height=
"
58
dp"
android:text=
"Museum"
android:textSize=
"18sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.
497
"
app:layout_constraintHorizontal_bias=
"0.
568
"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0
77
"
/>
app:layout_constraintVertical_bias=
"0.0
53
"
/>
<TextView
android:id=
"@+id/selectdate"
android:layout_width=
"
170
dp"
android:layout_height=
"
44
dp"
android:text=
"
Select a Dat
e"
android:layout_width=
"
253
dp"
android:layout_height=
"
68
dp"
android:text=
"
Click Her
e"
android:textSize=
"24sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.
543
"
app:layout_constraintHorizontal_bias=
"0.
341
"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/Museumname"
app:layout_constraintVertical_bias=
"0.
356
"
/>
app:layout_constraintVertical_bias=
"0.
21
"
/>
<TextView
android:id=
"@+id/pricehere"
android:layout_width=
"227dp"
android:layout_height=
"52dp"
android:text=
"price"
tools:layout_editor_absoluteX=
"82dp"
tools:layout_editor_absoluteY=
"203dp"
/>
android:layout_width=
"209dp"
android:layout_height=
"29dp"
android:layout_marginTop=
"12dp"
android:text=
"price : £"
android:textStyle=
"bold"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.267"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/Museumname"
/>
<Button
android:id=
"@+id/booknow"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Book Time and Date"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.842"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/times"
app:layout_constraintVertical_bias=
"0.657"
/>
<TextView
android:id=
"@+id/times"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:text=
"Select a Time for Your Visit:"
android:textSize=
"24sp"
android:textStyle=
"bold"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/selectdate"
/>
<TextView
android:id=
"@+id/textView5"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"28dp"
android:text=
"Select a Date to Visit:"
android:textSize=
"24sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toTopOf=
"@+id/selectdate"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.301"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/pricehere"
/>
<RadioGroup
android:id=
"@+id/allbuttons"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"20dp"
app:layout_constraintBottom_toTopOf=
"@+id/booknow"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.163"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/times"
app:layout_constraintVertical_bias=
"1.0"
>
<RadioButton
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"9-11am"
/>
<RadioButton
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"11-1pm"
/>
<RadioButton
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"1-3pm"
/>
<RadioButton
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"3-5pm"
/>
</RadioGroup>
<TextView
android:id=
"@+id/selected"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"117dp"
android:text=
"TextView"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.47"
app:layout_constraintStart_toEndOf=
"@+id/allbuttons"
app:layout_constraintTop_toBottomOf=
"@+id/times"
app:layout_constraintVertical_bias=
"0.0"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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