new ui for del 4
This commit is contained in:
parent
9fabb41d83
commit
5faed3fd4a
11 changed files with 502 additions and 158 deletions
Binary file not shown.
|
@ -7,10 +7,13 @@ import android.support.annotation.NonNull;
|
|||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -34,15 +37,16 @@ public class Bookings extends AppCompatActivity {
|
|||
username = bundle.getString("username");
|
||||
dbhelper = new DBHelper(this);
|
||||
|
||||
/*
|
||||
Booking[] bookings;
|
||||
//get bookings here
|
||||
//Booking[] bookings = (Booking[])dbhelper.findBookings(username).toArray();
|
||||
|
||||
Booking[] testbooking = {new Booking(5, 5, 6, 6, 2, 3, 2019, (ServiceProvider)dbhelper.findUserByUsername("testing"),
|
||||
(HomeOwner)dbhelper.findUserByUsername("tester"), dbhelper.findService("service1"))};
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.Bookings);
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mAdapter = new AdminServicesList.MyAdapter(booking, this);
|
||||
mAdapter = new MyAdapter(testbooking, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,7 +56,14 @@ public class Bookings extends AppCompatActivity {
|
|||
*/
|
||||
@Override
|
||||
public void onBackPressed(){
|
||||
Intent intent = new Intent(getApplicationContext(),Welcome.class);
|
||||
Intent intent;
|
||||
if(dbhelper.findUserByUsername(username).getRole().equals("ServiceProvider")){
|
||||
intent = new Intent(getApplicationContext(),ServiceProviderWelcome.class);
|
||||
}
|
||||
else{
|
||||
intent = new Intent(getApplicationContext(),Welcome.class);
|
||||
}
|
||||
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
@ -87,8 +98,29 @@ public class Bookings extends AppCompatActivity {
|
|||
@Override
|
||||
public void onBindViewHolder(BookingHolder holder, int position) {
|
||||
Booking booking = bookings[position];
|
||||
//holder.name.setText(booking.getServiceprovider().getFirstname()+" "+booking.getServiceprovider().getLastname());
|
||||
holder.serviceprovider.setText(booking.getServiceprovider().getFirstname()+" "+booking.getServiceprovider().getLastname());
|
||||
holder.homeowner.setText(booking.getHomeowner().getFirstname()+" "+booking.getHomeowner().getLastname());
|
||||
holder.service.setText(booking.getService().getName());
|
||||
String day;
|
||||
String month;
|
||||
String year = booking.getYear()+"";
|
||||
if(booking.getDay()<10){
|
||||
day = "0"+booking.getDay();
|
||||
}
|
||||
else{
|
||||
day = booking.getDay()+"";
|
||||
}
|
||||
if(booking.getMonth()<10){
|
||||
month = "0"+booking.getMonth();
|
||||
}
|
||||
else{
|
||||
month = booking.getMonth()+"";
|
||||
}
|
||||
|
||||
holder.date.setText(month+"/"+day+"/"+year);
|
||||
holder.start.setText(formatTime(booking.getStarth(), booking.getStartmin()));
|
||||
holder.end.setText(formatTime(booking.getEndh(), booking.getEndmin()));
|
||||
holder.status.setText(booking.getStatus().toString());
|
||||
|
||||
|
||||
}
|
||||
|
@ -103,15 +135,24 @@ public class Bookings extends AppCompatActivity {
|
|||
|
||||
TextView homeowner;
|
||||
TextView serviceprovider;
|
||||
TextView service;
|
||||
TextView date;
|
||||
TextView start;
|
||||
TextView end;
|
||||
TextView status;
|
||||
int starth;
|
||||
int startmin;
|
||||
int endh;
|
||||
int endmin;
|
||||
int month;
|
||||
int day;
|
||||
int year;
|
||||
|
||||
public BookingHolder(View row){
|
||||
super(row);
|
||||
homeowner = row.findViewById(R.id.HomeOwnerName);
|
||||
serviceprovider = row.findViewById(R.id.ServiceProviderName);
|
||||
service = row.findViewById(R.id.ServiceName);
|
||||
date = row.findViewById(R.id.DateName);
|
||||
start = row.findViewById(R.id.StartTime);
|
||||
end = row.findViewById(R.id.EndTime);
|
||||
|
@ -124,23 +165,38 @@ public class Bookings extends AppCompatActivity {
|
|||
if(dbhelper.findUserByUsername(username).getRole()=="ServiceProvider"){
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(Bookings.this);
|
||||
alertDialogBuilder.setMessage("Cancel or Confirm your booking");
|
||||
alertDialogBuilder.setPositiveButton("Confirm",
|
||||
alertDialogBuilder.setPositiveButton("Confirm Booking",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
//confirm booking
|
||||
Toast.makeText(Bookings.this,"Booking is confirmed",Toast.LENGTH_LONG).show();
|
||||
Bookings.this.recreate();
|
||||
if(dbhelper.confirmBooking(new Booking(starth, startmin, endh, endmin, day, month,
|
||||
year, (ServiceProvider)dbhelper.findUserByUsername(serviceprovider.getText().toString()),
|
||||
(HomeOwner)dbhelper.findUserByUsername(homeowner.getText().toString()),
|
||||
dbhelper.findService(service.getText().toString())))){
|
||||
Toast.makeText(Bookings.this,"Booking is confirmed",Toast.LENGTH_LONG).show();
|
||||
Bookings.this.recreate();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(Bookings.this,"Booking could not be confirmed",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
alertDialogBuilder.setNegativeButton("No",
|
||||
alertDialogBuilder.setNegativeButton("Cancel Booking",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//delete booking
|
||||
Toast.makeText(Bookings.this,"Booking is deleted",Toast.LENGTH_LONG).show();
|
||||
Bookings.this.recreate();
|
||||
if(dbhelper.cancelBooking(new Booking(starth, startmin, endh, endmin, day, month,
|
||||
year, (ServiceProvider)dbhelper.findUserByUsername(serviceprovider.getText().toString()),
|
||||
(HomeOwner)dbhelper.findUserByUsername(homeowner.getText().toString()),
|
||||
dbhelper.findService(service.getText().toString())))){
|
||||
Toast.makeText(Bookings.this,"Booking is cancelled",Toast.LENGTH_LONG).show();
|
||||
Bookings.this.recreate();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(Bookings.this,"Booking could not be cancelled",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -148,23 +204,48 @@ public class Bookings extends AppCompatActivity {
|
|||
alertDialog.show();
|
||||
}
|
||||
else{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(Bookings.this);
|
||||
alertDialogBuilder.setMessage("Are you sure you want to cancel your booking");
|
||||
alertDialogBuilder.setPositiveButton("Cancel",
|
||||
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(Bookings.this);
|
||||
alertDialogBuilder.setView(R.layout.rating_item);
|
||||
alertDialogBuilder.setPositiveButton("Rate Booking",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
//cancel booking
|
||||
Toast.makeText(Bookings.this,"Booking is cancelled",Toast.LENGTH_LONG).show();
|
||||
Bookings.this.recreate();
|
||||
RadioGroup ratingselect = ((AlertDialog) arg0).findViewById(R.id.RatingSelect);
|
||||
int selectedId = ratingselect.getCheckedRadioButtonId();
|
||||
RadioButton ratingpicked;
|
||||
if(selectedId!=-1){
|
||||
ratingpicked = (RadioButton)((AlertDialog) arg0).findViewById(selectedId);
|
||||
double rating = Double.parseDouble(ratingpicked.getText().toString());
|
||||
Booking booking = new Booking(starth, startmin, endh, endmin, day, month,
|
||||
year, (ServiceProvider)dbhelper.findUserByUsername(serviceprovider.getText().toString()),
|
||||
(HomeOwner)dbhelper.findUserByUsername(homeowner.getText().toString()),
|
||||
dbhelper.findService(service.getText().toString()));;
|
||||
if(!dbhelper.addRating(booking, rating)){
|
||||
Toast.makeText(context, "Rating could not be added", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else{
|
||||
Bookings.this.recreate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
alertDialogBuilder.setNegativeButton("Nevermind",
|
||||
alertDialogBuilder.setNegativeButton("Cancel Booking",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
if(dbhelper.cancelBooking(new Booking(starth, startmin, endh, endmin, day, month,
|
||||
year, (ServiceProvider)dbhelper.findUserByUsername(serviceprovider.getText().toString()),
|
||||
(HomeOwner)dbhelper.findUserByUsername(homeowner.getText().toString()),
|
||||
dbhelper.findService(service.getText().toString())))){
|
||||
Toast.makeText(Bookings.this,"Booking is cancelled",Toast.LENGTH_LONG).show();
|
||||
Bookings.this.recreate();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(Bookings.this,"Booking could not be cancelled",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -181,4 +262,19 @@ public class Bookings extends AppCompatActivity {
|
|||
|
||||
|
||||
}
|
||||
private String formatTime(int hours, int minutes){
|
||||
String time = "";
|
||||
if(hours<10){
|
||||
time = time+"0"+hours+":";
|
||||
}else{
|
||||
time = time+hours+":";
|
||||
}
|
||||
if (minutes<10){
|
||||
time = time+"0"+minutes;
|
||||
}
|
||||
else {
|
||||
time = time+minutes;
|
||||
}
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1308,7 +1308,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
List<String[]> providers = getAll("SELECT " + TABLE_SERVICEPROVIDERS + "." + COLUMN_SERVICEPROVIDERNAME + ", "
|
||||
+ TABLE_LOGIN + "." + COLUMN_FIRSTNAME + ", "
|
||||
+ TABLE_LOGIN + "." + COLUMN_LASTNAME + ", "
|
||||
+ TABLE_SERVICEPROVIDERS + "." + COLUMN_AVERAGERATING + ", "
|
||||
+ TABLE_SERVICEPROVIDERS + "." + COLUMN_AVERAGERATING + " "
|
||||
+ " FROM " + TABLE_SERVICEPROVIDERS + " JOIN " + TABLE_LOGIN
|
||||
+ " ON " + TABLE_SERVICEPROVIDERS + "." + COLUMN_SERVICEPROVIDERNAME + " = "
|
||||
+ TABLE_LOGIN + "." + COLUMN_USERNAME
|
||||
|
|
|
@ -15,6 +15,8 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.RatingBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
|
@ -44,8 +46,6 @@ public class FindServiceProvider extends AppCompatActivity {
|
|||
Bundle bundle = getIntent().getExtras();
|
||||
username = bundle.getString("username");
|
||||
|
||||
MaterialSpinner spinner = findViewById(R.id.RatingInput);
|
||||
spinner.setItems("",1, 2, 3, 4, 5);
|
||||
|
||||
dbHelper = new DBHelper(this);
|
||||
MaterialSpinner spinner2 = findViewById(R.id.ServicesInput);
|
||||
|
@ -60,19 +60,13 @@ public class FindServiceProvider extends AppCompatActivity {
|
|||
spinner2.setItems(services);
|
||||
|
||||
|
||||
//iffy code, update once we can pull the actual service providers
|
||||
ServiceProvider provider = (ServiceProvider)dbHelper.findUserByUsername("testing");
|
||||
ServiceProvider[] providerslist = {provider};
|
||||
//iffy code ends here
|
||||
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.ServiceProviders);
|
||||
|
||||
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
|
||||
mAdapter = new MyAdapter(providerslist, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
|
@ -89,31 +83,81 @@ public class FindServiceProvider extends AppCompatActivity {
|
|||
Button button = findViewById(R.id.Start);
|
||||
Button button2 = findViewById(R.id.End);
|
||||
Button button3 = findViewById(R.id.Date);
|
||||
MaterialSpinner spinner2 = findViewById(R.id.RatingInput);
|
||||
RadioGroup ratingselect = findViewById(R.id.RatingSelect);
|
||||
int selectedId = ratingselect.getCheckedRadioButtonId();
|
||||
RadioButton ratingpicked;
|
||||
|
||||
String service = spinner.getText().toString();
|
||||
int start;
|
||||
int end;
|
||||
String start;
|
||||
String end;
|
||||
String date;
|
||||
if(button.getText().toString()!="Start" && button.getText().toString()!="End"
|
||||
&& button3.getText().toString()!="Date"){
|
||||
start = Integer.parseInt(button.getText().toString());
|
||||
end = Integer.parseInt(button2.getText().toString());
|
||||
double rating;
|
||||
List<String[]> providers;
|
||||
if(!button.getText().toString().equals("Start") && !button2.getText().toString().equals("End")
|
||||
&& !button3.getText().toString().equals("Date")){
|
||||
System.out.println(button.getText().toString()+":"+button2.getText().toString()+":"+button3.getText().toString());
|
||||
start = button.getText().toString();
|
||||
end = button2.getText().toString();
|
||||
date = button3.getText().toString();
|
||||
|
||||
String[] dates = date.split("/");
|
||||
int month = Integer.parseInt(dates[0].replaceAll("\\s+",""));
|
||||
int day = Integer.parseInt(dates[1].replaceAll("\\s+",""));
|
||||
int year = Integer.parseInt(dates[2].replaceAll("\\s+",""));
|
||||
|
||||
String[] starttimes = start.split(":");
|
||||
int starth = Integer.parseInt(starttimes[0].replaceAll("\\s+",""));
|
||||
int startmin = Integer.parseInt(starttimes[1].replaceAll("\\s+",""));
|
||||
|
||||
String[] endtimes = end.split(":");
|
||||
int endh = Integer.parseInt(endtimes[0].replaceAll("\\s+",""));
|
||||
int endmin = Integer.parseInt(endtimes[1].replaceAll("\\s+",""));
|
||||
|
||||
int[] times = {starth, startmin, endh, endmin};
|
||||
if(selectedId!=-1 && validateTime(times)){
|
||||
ratingpicked = (RadioButton) findViewById(selectedId);
|
||||
rating = Double.parseDouble(ratingpicked.getText().toString());
|
||||
providers = dbHelper.getProvidersByTimeAndRating(service, rating, year, month, day,
|
||||
starth, startmin, endh, endmin);
|
||||
}
|
||||
else if(validateTime(times)){
|
||||
providers = dbHelper.getProvidersByTime(service, year, month, day,
|
||||
starth, startmin, endh, endmin);
|
||||
}
|
||||
else if(selectedId!=-1){
|
||||
Toast.makeText(this, "Times are invalid, only searching by service and rating"+starth+";"+startmin+","+endh+";"+endmin, Toast.LENGTH_SHORT).show();
|
||||
ratingpicked = (RadioButton) findViewById(selectedId);
|
||||
rating = Double.parseDouble(ratingpicked.getText().toString());
|
||||
providers = dbHelper.getProvidersAboveRating(service, rating);
|
||||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Times are invalid, only searching by service", Toast.LENGTH_SHORT).show();
|
||||
providers = dbHelper.getAllProvidersByService(service);
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
//figure out with dbhelper
|
||||
if(selectedId!=-1){
|
||||
ratingpicked = (RadioButton) findViewById(selectedId);
|
||||
rating = Double.parseDouble(ratingpicked.getText().toString());
|
||||
providers = dbHelper.getProvidersAboveRating(service, rating);
|
||||
}
|
||||
else{
|
||||
providers = dbHelper.getAllProvidersByService(service);
|
||||
}
|
||||
}
|
||||
|
||||
int rating;
|
||||
if(spinner2.getText().toString()!=""){
|
||||
rating = Integer.parseInt(spinner2.getText().toString());
|
||||
//update recycler view
|
||||
String[][] providerslist = new String[providers.size()][];
|
||||
for(int i=0; i<providers.size(); i++){
|
||||
providerslist[i] = providers.get(i);
|
||||
}
|
||||
else{
|
||||
//figure out with dbhelper
|
||||
}
|
||||
//do search here
|
||||
//update recylcler view
|
||||
|
||||
mAdapter = new MyAdapter(providerslist, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -129,11 +173,6 @@ public class FindServiceProvider extends AppCompatActivity {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onClickDate(View view){
|
||||
|
@ -165,6 +204,8 @@ public class FindServiceProvider extends AppCompatActivity {
|
|||
}
|
||||
button.setText(monthstring + " / " + daystring + " / "
|
||||
+ year);
|
||||
|
||||
button.setTextSize(9);
|
||||
}
|
||||
|
||||
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
|
||||
|
@ -189,6 +230,7 @@ public class FindServiceProvider extends AppCompatActivity {
|
|||
String time = "";
|
||||
|
||||
button.setText(formatTime(hourOfDay,minute));
|
||||
|
||||
//set availibility for service provider and check start time is less than finish
|
||||
}
|
||||
|
||||
|
@ -250,7 +292,7 @@ public class FindServiceProvider extends AppCompatActivity {
|
|||
|
||||
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ProviderHolder> {
|
||||
|
||||
private ServiceProvider[] serviceProviders;
|
||||
private String[][] serviceProviders;
|
||||
private Context context;
|
||||
|
||||
// Provide a reference to the views for each data item
|
||||
|
@ -258,7 +300,7 @@ public class FindServiceProvider extends AppCompatActivity {
|
|||
// you provide access to all the views for a data item in a view holder
|
||||
|
||||
// Provide a suitable constructor (depends on the kind of dataset)
|
||||
public MyAdapter(ServiceProvider[] serviceProviders, Context context) {
|
||||
public MyAdapter(String[][] serviceProviders, Context context) {
|
||||
this.serviceProviders = serviceProviders;
|
||||
}
|
||||
|
||||
|
@ -275,10 +317,10 @@ public class FindServiceProvider extends AppCompatActivity {
|
|||
// Replace the contents of a view (invoked by the layout manager)
|
||||
@Override
|
||||
public void onBindViewHolder(ProviderHolder holder, int position) {
|
||||
ServiceProvider serviceprovider = serviceProviders[position];
|
||||
holder.name.setText(serviceprovider.getFirstname()+" "+serviceprovider.getLastname());
|
||||
holder.rate.setText("5");
|
||||
//serviceprovider.getRating()
|
||||
String[] serviceprovider = serviceProviders[position];
|
||||
holder.name.setText(serviceprovider[1]+" "+serviceprovider[2]);
|
||||
holder.rate.setText(""+serviceprovider[3]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class HomeOwnerEditProfile extends AppCompatActivity {
|
|||
*/
|
||||
@Override
|
||||
public void onBackPressed(){
|
||||
Intent intent = new Intent(getApplicationContext(),ServiceProviderWelcome.class);
|
||||
Intent intent = new Intent(getApplicationContext(),Welcome.class);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
|
|
@ -10,8 +10,11 @@ import android.widget.Button;
|
|||
import android.widget.DatePicker;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class MakeBooking extends AppCompatActivity {
|
||||
String homeowner;
|
||||
|
@ -49,7 +52,63 @@ public class MakeBooking extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public void Book(View view){
|
||||
//
|
||||
Button button = findViewById(R.id.Start);
|
||||
Button button2 = findViewById(R.id.End);
|
||||
Button button3 = findViewById(R.id.Date);
|
||||
|
||||
if(!button.getText().toString().equals("Start") && !button2.getText().toString().equals("End")
|
||||
&& !button3.getText().toString().equals("Date")){
|
||||
String[] dates = button3.getText().toString().split("/");
|
||||
int month = Integer.parseInt(dates[0].replaceAll("\\s+",""));
|
||||
int day = Integer.parseInt(dates[1].replaceAll("\\s+",""));
|
||||
int year = Integer.parseInt(dates[2].replaceAll("\\s+",""));
|
||||
|
||||
String[] starttimes = button.getText().toString().split(":");
|
||||
int starth = Integer.parseInt(starttimes[0].replaceAll("\\s+",""));
|
||||
int startmin = Integer.parseInt(starttimes[1].replaceAll("\\s+",""));
|
||||
|
||||
String[] endtimes = button2.getText().toString().split(":");
|
||||
int endh = Integer.parseInt(endtimes[0].replaceAll("\\s+",""));
|
||||
int endmin = Integer.parseInt(endtimes[1].replaceAll("\\s+",""));
|
||||
|
||||
Date date = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
Date selecteddate = sdf.parse(dates[2].replaceAll("\\s+","") + "-" + dates[0].replaceAll("\\s+","") + "-" + dates[1].replaceAll("\\s+",""));
|
||||
if(selecteddate.compareTo(date)<0){
|
||||
Toast.makeText(this, "Date must be a future date", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else{
|
||||
if (starth<endh || (starth==endh && startmin<endmin)){
|
||||
DBHelper dbHelper = new DBHelper(this);
|
||||
if(dbHelper.addBooking(serviceprovider, homeowner, service, year, month, day,
|
||||
starth, startmin, endh, endmin)){
|
||||
Toast.makeText(this, "Booking Made", Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(getApplicationContext(),Welcome.class);
|
||||
intent.putExtra("username", homeowner);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Booking could not be made", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Time is invalid", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
Toast.makeText(this, "Date is invalid", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, "Date and times must be selected", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickDate(View view){
|
||||
|
|
|
@ -32,7 +32,7 @@ public class ServiceProviderWelcome extends AppCompatActivity {
|
|||
UserType user;
|
||||
user = dbHelper.findUserByUsername(username);
|
||||
TextView welcome = findViewById(R.id.Welcome);
|
||||
welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Home Owner");
|
||||
welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Service Provider");
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<!--Border width and color-->
|
||||
<stroke android:width="5px" android:color="#000000" />
|
||||
<stroke android:width="2px" android:color="#000000" />
|
||||
</shape>
|
|
@ -38,67 +38,123 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="start"
|
||||
android:layout_gravity="start"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/DatePick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:gravity="start"
|
||||
android:layout_gravity="start"
|
||||
android:text="By Time:"
|
||||
android:paddingRight="20dp"
|
||||
android:textAlignment="textStart"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp"/>
|
||||
<Button
|
||||
android:id="@+id/Start"
|
||||
android:layout_width="115dp"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start"
|
||||
android:textSize="11sp"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickTime"
|
||||
android:layout_marginRight="5dp"/>
|
||||
android:onClick="onClickTime"/>
|
||||
<Button
|
||||
android:id="@+id/End"
|
||||
android:layout_width="115dp"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="End"
|
||||
android:textSize="11sp"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickTime"
|
||||
android:layout_marginRight="5dp"/>
|
||||
android:onClick="onClickTime"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/Date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Date"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickDate"
|
||||
android:layout_gravity="end"
|
||||
android:textSize="11sp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/Date"
|
||||
android:layout_width="235dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Date"
|
||||
android:theme="@style/AppTheme.Button"
|
||||
android:onClick="onClickDate"
|
||||
android:layout_gravity="end"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="5dp">
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="start"
|
||||
android:layout_gravity="start">
|
||||
<TextView
|
||||
android:id="@+id/RatingPick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:gravity="start"
|
||||
android:layout_gravity="start"
|
||||
android:text="By Rating:"
|
||||
android:textAlignment="textStart"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<com.jaredrummler.materialspinner.MaterialSpinner
|
||||
android:id="@+id/RatingInput"
|
||||
android:layout_width="235dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="5dp"/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/RatingSelect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:buttonTint="@color/colorWhite"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="2"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:buttonTint="@color/colorWhite"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:buttonTint="@color/colorWhite"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:buttonTint="@color/colorWhite"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:buttonTint="@color/colorWhite"/>
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/Search"
|
||||
android:layout_width="400dp"
|
||||
|
|
|
@ -1,27 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorWhite"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/customborder2">
|
||||
android:background="@drawable/customborder2"
|
||||
android:paddingBottom="10dp">
|
||||
<TextView
|
||||
android:id="@+id/ServiceProvider"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Service Provider:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
|
@ -32,7 +29,7 @@
|
|||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Service Provider"
|
||||
android:textColor="@color/colorBlack"
|
||||
|
@ -42,17 +39,18 @@
|
|||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/customborder2">
|
||||
android:background="@drawable/customborder2"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/HomeOwner"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Home Owner:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
|
@ -62,7 +60,7 @@
|
|||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Home Owner"
|
||||
android:textColor="@color/colorBlack"
|
||||
|
@ -71,17 +69,18 @@
|
|||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/customborder2">
|
||||
android:background="@drawable/customborder2"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Service"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Service:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
|
@ -91,7 +90,7 @@
|
|||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Service"
|
||||
android:textColor="@color/colorBlack"
|
||||
|
@ -100,79 +99,96 @@
|
|||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/customborder2">
|
||||
android:background="@drawable/customborder2"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Date"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Date and Time:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/DateName"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:layout_weight="1"
|
||||
android:text="Date"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/StartTime"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:layout_weight="1"
|
||||
android:text="Start"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/Textfield"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_weight="1"
|
||||
android:text="-"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/EndTime"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:layout_weight="1"
|
||||
android:text="End"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/DateName"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Date"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/StartTime"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Start"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/Timespace"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="to"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/EndTime"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="End"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/customborder2">
|
||||
android:background="@drawable/customborder2"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Status"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Status:"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="15sp"
|
||||
|
@ -182,7 +198,7 @@
|
|||
android:paddingLeft="10dp"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Status"
|
||||
android:textColor="@color/colorBlack"
|
||||
|
@ -192,7 +208,5 @@
|
|||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
|
77
OlympusServices/app/src/main/res/layout/rating_item.xml
Normal file
77
OlympusServices/app/src/main/res/layout/rating_item.xml
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="10dp">
|
||||
<TextView
|
||||
android:id="@+id/RatingPick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="start"
|
||||
android:layout_gravity="start"
|
||||
android:text="Rating:"
|
||||
android:textAlignment="textStart"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/RatingSelect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:buttonTint="@color/colorBlack"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="2"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:buttonTint="@color/colorBlack"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:buttonTint="@color/colorBlack"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:buttonTint="@color/colorBlack"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radio5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:buttonTint="@color/colorBlack"/>
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in a new issue