Commit 185a6c3b authored by lucy.hemingway's avatar lucy.hemingway

starting to pick time

parent eda29815
...@@ -10,7 +10,10 @@ import android.nfc.Tag; ...@@ -10,7 +10,10 @@ import android.nfc.Tag;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.DatePicker; import android.widget.DatePicker;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView; import android.widget.TextView;
import org.w3c.dom.Text; import org.w3c.dom.Text;
...@@ -26,6 +29,11 @@ public class Booking extends AppCompatActivity { ...@@ -26,6 +29,11 @@ public class Booking extends AppCompatActivity {
public static String price; public static String price;
public static String selectedMuseum; public static String selectedMuseum;
RadioGroup choosetime;
RadioButton booknow;
TextView text;
private static final String TAG = "Booking"; private static final String TAG = "Booking";
TextView Date; TextView Date;
...@@ -49,8 +57,8 @@ public class Booking extends AppCompatActivity { ...@@ -49,8 +57,8 @@ public class Booking extends AppCompatActivity {
selectedMuseum = intent.getStringExtra("selectedMuseum"); selectedMuseum = intent.getStringExtra("selectedMuseum");
price = intent.getStringExtra("price"); price = intent.getStringExtra("price");
museumname.setText(selectedMuseum); museumname.setText("Selected Museum: " + selectedMuseum);
priceofmuseum.setText(price); priceofmuseum.setText("Price: £" + price);
Date = (TextView) findViewById(R.id.selectdate); Date = (TextView) findViewById(R.id.selectdate);
...@@ -65,7 +73,7 @@ public class Booking extends AppCompatActivity { ...@@ -65,7 +73,7 @@ public class Booking extends AppCompatActivity {
int day = calendar.get(Calendar.DAY_OF_MONTH); int day = calendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog picker = new DatePickerDialog(Booking.this, 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); year,month,day);
picker.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); picker.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
...@@ -76,9 +84,36 @@ public class Booking extends AppCompatActivity { ...@@ -76,9 +84,36 @@ public class Booking extends AppCompatActivity {
SetDate = new DatePickerDialog.OnDateSetListener() { SetDate = new DatePickerDialog.OnDateSetListener() {
@Override @Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { 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
...@@ -6,37 +6,135 @@ ...@@ -6,37 +6,135 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".Booking"> tools:context=".Booking">
<TextView <TextView
android:id="@+id/Museumname" android:id="@+id/Museumname"
android:layout_width="230dp" android:layout_width="316dp"
android:layout_height="116dp" android:layout_height="58dp"
android:text="Museum" android:text="Museum"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="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_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.077" /> app:layout_constraintVertical_bias="0.053" />
<TextView <TextView
android:id="@+id/selectdate" android:id="@+id/selectdate"
android:layout_width="170dp" android:layout_width="253dp"
android:layout_height="44dp" android:layout_height="68dp"
android:text="Select a Date" android:text="Click Here"
android:textSize="24sp" android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="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_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/Museumname" app:layout_constraintTop_toBottomOf="@+id/Museumname"
app:layout_constraintVertical_bias="0.356" /> app:layout_constraintVertical_bias="0.21" />
<TextView <TextView
android:id="@+id/pricehere" android:id="@+id/pricehere"
android:layout_width="227dp" android:layout_width="209dp"
android:layout_height="52dp" android:layout_height="29dp"
android:text="price" android:layout_marginTop="12dp"
tools:layout_editor_absoluteX="82dp" android:text="price : £"
tools:layout_editor_absoluteY="203dp" /> 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> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment