Commit 9a68a5a5 authored by Sam's avatar Sam

3.0 push of World Museums

parent 4f5f7a62
...@@ -14,6 +14,7 @@ import android.widget.ImageView; ...@@ -14,6 +14,7 @@ import android.widget.ImageView;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
...@@ -21,11 +22,13 @@ import androidx.fragment.app.DialogFragment; ...@@ -21,11 +22,13 @@ import androidx.fragment.app.DialogFragment;
import com.example.museumworld.R; import com.example.museumworld.R;
import com.example.museumworld.cafe_shop.cafe_activity; import com.example.museumworld.cafe_shop.cafe_activity;
import com.example.museumworld.checkout.Receipt;
import com.example.museumworld.details.MuseumDetails; import com.example.museumworld.details.MuseumDetails;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
...@@ -88,29 +91,8 @@ public class booking extends AppCompatActivity implements View.OnClickListener, ...@@ -88,29 +91,8 @@ public class booking extends AppCompatActivity implements View.OnClickListener,
snackbarAlert("Please Select a date", true); snackbarAlert("Please Select a date", true);
Log.d("TEStB", "TEST"); Log.d("TEStB", "TEST");
} else { } else {
//select the spinner item OpenDialogBox(getString(R.string.bookingTitle));
switch (spinner.getSelectedItem().toString()) {
case "9-11am":
timeSelected = "09:00";
break;
case "11-1pm":
timeSelected = "11:00";
break;
case "1-3pm":
timeSelected = "13:00";
break;
case "3-5pm":
timeSelected = "15:00";
break;
}
//start the cafe activity
Intent cafe = new Intent(this, cafe_activity.class);
//put the URL image in the cafe activity
cafe.putExtra("topURL", topImgURL);
startActivity(cafe);
} }
break; break;
} }
...@@ -193,4 +175,39 @@ public class booking extends AppCompatActivity implements View.OnClickListener, ...@@ -193,4 +175,39 @@ public class booking extends AppCompatActivity implements View.OnClickListener,
} }
alert.show(); alert.show();
} }
public void OpenDialogBox(String title) {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AlertDialogTheme);
builder.setTitle(title)
.setMessage(getString(R.string.bookingConfirm) +" " +MuseumDetails.MuseumName +"\n"+ getString(R.string.bookingConfirm2)+" " + dateSelected + "\n" + getString(R.string.bookingConfirm3) +" "+ spinner.getSelectedItem().toString())
.setPositiveButton(getResources().getString(R.string.yes), (dialog, which) -> {
switch (spinner.getSelectedItem().toString()) {
case "9-11am":
timeSelected = "09:00";
break;
case "11-1pm":
timeSelected = "11:00";
break;
case "1-3pm":
timeSelected = "13:00";
break;
case "3-5pm":
timeSelected = "15:00";
break;
}
//start the cafe activity
Intent cafe = new Intent(this, cafe_activity.class);
//put the URL image in the cafe activity
cafe.putExtra("topURL", topImgURL);
startActivity(cafe);
}).setNegativeButton(getResources().getString(R.string.no), (dialog, which) -> {
});
builder.show();
}
} }
\ No newline at end of file
...@@ -82,4 +82,8 @@ ...@@ -82,4 +82,8 @@
<string name="select_time">Sélectionnez l\'heure</string> <string name="select_time">Sélectionnez l\'heure</string>
<string name="too_much_input">Vous êtes trop entré</string> <string name="too_much_input">Vous êtes trop entré</string>
<string name="world_museums">Musées du monde</string> <string name="world_museums">Musées du monde</string>
<string name="bookingConfirm">Êtes-vous sûr de vouloir réserver:</string>
<string name="bookingConfirm2">Daté:</string>
<string name="bookingConfirm3">Temps:</string>
<string name="bookingTitle">Confirmer la réservation</string>
</resources> </resources>
\ No newline at end of file
...@@ -73,6 +73,10 @@ ...@@ -73,6 +73,10 @@
<string name="email_invalid">Please Enter a Valid Email</string> <string name="email_invalid">Please Enter a Valid Email</string>
<string name="email_sent">The Receipt Was sent to the email</string> <string name="email_sent">The Receipt Was sent to the email</string>
<string name="email_error">Something went wrong please try again</string> <string name="email_error">Something went wrong please try again</string>
<string name="bookingConfirm">Are you sure you want to book:</string>
<string name="bookingConfirm2"> Date:</string>
<string name="bookingConfirm3"> Time:</string>
<string name="bookingTitle"> Confirm Booking</string>
<!-- LOGIN / REGISTER--> <!-- LOGIN / REGISTER-->
<string name="login_usernameError">*Name has to be 5 characters long</string> <string name="login_usernameError">*Name has to be 5 characters long</string>
......
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