This commit is contained in:
Batuhan Berk Başoğlu 2018-11-18 15:05:52 -05:00
commit 65e1cb6200
24 changed files with 1037 additions and 67 deletions

BIN
Deliverable3.zip Normal file

Binary file not shown.

View file

@ -60,7 +60,7 @@
android:name=".EditProfile" android:name=".EditProfile"
android:label="Edit Profile" android:label="Edit Profile"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden"/> android:windowSoftInputMode="stateHidden" />
<activity <activity
android:name=".ServiceProviderServicesList" android:name=".ServiceProviderServicesList"
android:label="List of Services" android:label="List of Services"
@ -68,8 +68,12 @@
<activity <activity
android:name=".ServiceProviderAvailabilities" android:name=".ServiceProviderAvailabilities"
android:label="Availabilities" android:label="Availabilities"
android:screenOrientation="portrait"></activity> android:screenOrientation="portrait" />
<activity android:name=".SignUpPart2"></activity> <activity android:name=".SignUpPart2" />
<activity android:name=".ServiceProviderBookings" />
<activity android:name=".HomeOwnerBookings" />
<activity android:name=".FindServiceProvider" />
<activity android:name=".MakeBooking"></activity>
</application> </application>
</manifest> </manifest>

View file

@ -0,0 +1,124 @@
package com.uottawa.olympus.olympusservices;
public class Booking {
private int starth;
private int startmin;
private int endh;
private int endmin;
private int day;
private int month;
private int year;
private String serviceprovider; //username
private String homeowner; //username
public enum Status {
PENDING, CONFIRMED, CANCELLED
}
private Status status;
int rating; //out of 5
public Booking(int starth, int startmin, int endh, int endmin, int day, int month, int year,
String serviceprovider, String homeowner){
this.starth = starth;
this.startmin = startmin;
this.endh = endh;
this.endmin = endmin;
this.day = day;
this.month = month;
this.year = year;
this.serviceprovider = serviceprovider;
this.homeowner = homeowner;
this.status = Status.PENDING;
}
public int getStarth() {
return starth;
}
public void setStarth(int starth) {
this.starth = starth;
}
public int getStartmin() {
return startmin;
}
public void setStartmin(int startmin) {
this.startmin = startmin;
}
public int getEndh() {
return endh;
}
public void setEndh(int endh) {
this.endh = endh;
}
public int getEndmin() {
return endmin;
}
public void setEndmin(int endmin) {
this.endmin = endmin;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public String getServiceprovider() {
return serviceprovider;
}
public void setServiceprovider(String serviceprovider) {
this.serviceprovider = serviceprovider;
}
public String getHomeowner() {
return homeowner;
}
public void setHomeowner(String homeowner) {
this.homeowner = homeowner;
}
public void setStatus(Status status){
this.status = status;
}
public Status getStatus(){
return this.status;
}
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
}

View file

@ -353,7 +353,7 @@ public class DBHelper extends SQLiteOpenHelper {
if (phonenumber != null && !phonenumber.equals(""))values.put(COLUMN_PHONE, phonenumber); if (phonenumber != null && !phonenumber.equals(""))values.put(COLUMN_PHONE, phonenumber);
if (companyname != null && !companyname.equals(""))values.put(COLUMN_COMPANY, companyname); if (companyname != null && !companyname.equals(""))values.put(COLUMN_COMPANY, companyname);
if (licensed != null) values.put(COLUMN_LICENSED, String.valueOf(licensed)); if (licensed != null) values.put(COLUMN_LICENSED, String.valueOf(licensed));
if (description != null && !description.equals(""))values.put(COLUMN_DESCRIPTION, description); if (description != null )values.put(COLUMN_DESCRIPTION, description);
return writeDB.update(TABLE_LOGIN, values, COLUMN_USERNAME+" = ?", return writeDB.update(TABLE_LOGIN, values, COLUMN_USERNAME+" = ?",

View file

@ -12,6 +12,10 @@ public class EditProfile extends AppCompatActivity {
String username; String username;
DBHelper dbHelper; DBHelper dbHelper;
/**
* Prepoplates the fields with user information when the activity is created
* @param savedInstanceState
*/
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -56,6 +60,11 @@ public class EditProfile extends AppCompatActivity {
startActivity(intent); startActivity(intent);
finish(); finish();
} }
/**
* Saves updated user information to the database
* @param view
*/
public void Save(View view){ public void Save(View view){
TextView firstname = findViewById(R.id.FirstNameInput); TextView firstname = findViewById(R.id.FirstNameInput);
TextView lastname = findViewById(R.id.LastNameInput); TextView lastname = findViewById(R.id.LastNameInput);
@ -66,6 +75,7 @@ public class EditProfile extends AppCompatActivity {
TextView description = findViewById(R.id.DescriptionInput); TextView description = findViewById(R.id.DescriptionInput);
CheckBox licensed = findViewById(R.id.LicensedInput); CheckBox licensed = findViewById(R.id.LicensedInput);
//Checks for the fields
if(password.getText().toString().length()>=5 && firstname.getText().toString().length()>0 if(password.getText().toString().length()>=5 && firstname.getText().toString().length()>0
&& lastname.getText().toString().length()>0 && companyname.getText().toString().length()>0 && lastname.getText().toString().length()>0 && companyname.getText().toString().length()>0
&& address.getText().toString().length()>0 && phonenumber.getText().toString().length()>0 && address.getText().toString().length()>0 && phonenumber.getText().toString().length()>0

View file

@ -0,0 +1,315 @@
package com.uottawa.olympus.olympusservices;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
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.Button;
import android.widget.DatePicker;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import com.jaredrummler.materialspinner.MaterialSpinner;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
public class FindServiceProvider extends AppCompatActivity {
String username;
DBHelper dbHelper;
//field for RecyclerView
private RecyclerView mRecyclerView;
//field for adapter of Recycler view
private RecyclerView.Adapter mAdapter;
//field for layout manager of Recyler view.
private RecyclerView.LayoutManager mLayoutManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_find_service_provider);
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);
List<String[]> serviceslist = dbHelper.getAllServices();
String[] services = new String[(serviceslist.size())];
Iterator iter = serviceslist.iterator();
for (int i=0; i<serviceslist.size();i++){
String[] current = (String[])iter.next();
services[i] = current[0];
}
spinner2.setItems(services);
//iffy code
ServiceProvider provider = (ServiceProvider)dbHelper.findUserByUsername("testing");
ServiceProvider[] providerslist = {provider};
mRecyclerView = (RecyclerView) findViewById(R.id.ServiceProviders);
mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
mAdapter = new MyAdapter(providerslist, this);
mRecyclerView.setAdapter(mAdapter);
//
}
@Override
public void onBackPressed(){
Intent intent = new Intent(getApplicationContext(),Welcome.class);
intent.putExtra("username", username);
startActivity(intent);
finish();
}
public void Search(View view){
MaterialSpinner spinner = findViewById(R.id.ServicesInput);
Button button = findViewById(R.id.Start);
Button button2 = findViewById(R.id.End);
Button button3 = findViewById(R.id.Date);
MaterialSpinner spinner2 = findViewById(R.id.RatingInput);
String service = spinner.getText().toString();
int start;
int 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());
date = button3.getText().toString();
}
else{
//figure out with dbhelper
}
int rating;
if(spinner2.getText().toString()!=""){
rating = Integer.parseInt(spinner2.getText().toString());
}
else{
//figure out with dbhelper
}
//do search here
//update recylcler view
}
public void makeBooking(String serviceprovider){
MaterialSpinner spinner = findViewById(R.id.ServicesInput);
String service = spinner.getText().toString();
Intent intent = new Intent(getApplicationContext(),MakeBooking.class);
intent.putExtra("homeowner", username);
intent.putExtra("serviceprovider", serviceprovider);
intent.putExtra("service", service);
startActivity(intent);
finish();
}
public void onClickDate(View view){
final Button button = (Button)view;
final Calendar c = Calendar.getInstance();
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int day) {
Calendar newDate = Calendar.getInstance();
newDate.set(year, month, day);
String daystring;
String monthstring;
if((""+day).length()==1){
daystring = "0"+day;
}
else{
daystring = day+"";
}
if((""+month).length()==1){
monthstring = "0"+month;
}
else{
monthstring = ""+month;
}
button.setText(monthstring + " / " + daystring + " / "
+ year);
}
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
datePickerDialog.show();
}
public void onClickTime(View view){
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
final Button button = (Button)view;
// Launch Time Picker Dialog
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
String time = "";
button.setText(formatTime(hourOfDay,minute));
//set availibility for service provider and check start time is less than finish
}
}, hour, minute, false);
timePickerDialog.show();
}
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;
}
private int[] parseTime(String startTime, String endTime){
int[] times = new int[4];
if(startTime.equals("START")){
times[0]=0;
times[1]=0;
}else{
times[0] = Integer.parseInt(startTime.substring(0,2));
times[1] = Integer.parseInt(startTime.substring(3));
}
if(endTime.equals("END")){
times[2]=0;
times[3]=0;
}else{
times[2] = Integer.parseInt(endTime.substring(0,2));
times[3] = Integer.parseInt(endTime.substring(3));
}
return times;
}
private boolean validateTime(int[] time){
if(time[0]==0&&time[1]==0&&time[2]==0&&time[3]==0){
return true;
}
if(time[2]>time[0]){
return true;
}else{
if(time[2]==time[0]&&time[3]>time[1]){
return true;
}else{
return false;
}
}
}
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ProviderHolder> {
private ServiceProvider[] serviceProviders;
private Context context;
// Provide a reference to the views for each data item
// Complex data items may need more than one view per item, and
// 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) {
this.serviceProviders = serviceProviders;
}
// Create new views (invoked by the layout manager)
@NonNull
@Override
public ProviderHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.service_list_item, parent, false);
ProviderHolder vh = new ProviderHolder(v);
return vh;
}
// 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()
}
// Return the size of your dataset (invoked by the layout manager)
@Override
public int getItemCount() {
return serviceProviders.length;
}
class ProviderHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
TextView name;
TextView rate;
public ProviderHolder(View row){
super(row);
name = row.findViewById(R.id.Name);
rate = row.findViewById(R.id.Rate);
row.setOnClickListener(this);
}
@Override
public void onClick(View view) {
TextView nameview = (TextView)view.findViewById(R.id.Name);
String name = nameview.getText().toString();
makeBooking(name);
}
}
}
}

View file

@ -0,0 +1,30 @@
package com.uottawa.olympus.olympusservices;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class HomeOwnerBookings extends AppCompatActivity {
String username;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_owner_bookings);
Bundle bundle = getIntent().getExtras();
username = bundle.getString("username");
}
/**
* Override so that previous screen refreshes when pressing the
* back button on this activity of the app.
*
*/
@Override
public void onBackPressed(){
Intent intent = new Intent(getApplicationContext(),Welcome.class);
intent.putExtra("username", username);
startActivity(intent);
finish();
}
}

View file

@ -0,0 +1,166 @@
package com.uottawa.olympus.olympusservices;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
import android.widget.TimePicker;
import java.util.Calendar;
public class MakeBooking extends AppCompatActivity {
String homeowner;
String serviceprovider;
String service;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_make_booking);
Bundle bundle = getIntent().getExtras();
homeowner = bundle.getString("homeowner");
serviceprovider = bundle.getString("serviceprovider");
service = bundle.getString("service");
TextView homeo = findViewById(R.id.HomeOwner);
TextView servicep = findViewById(R.id.ServiceProvider);
TextView serv = findViewById(R.id.Service);
homeo.setText("Home Owner: \n"+homeowner);
servicep.setText("ServiceProvider: \n"+serviceprovider);
serv.setText("Service: \n"+service);
}
@Override
public void onBackPressed(){
Intent intent = new Intent(getApplicationContext(),Welcome.class);
intent.putExtra("username", homeowner);
startActivity(intent);
finish();
}
public void Cancel(View view){
onBackPressed();
}
public void Book(View view){
//
}
public void onClickDate(View view){
final Button button = (Button)view;
final Calendar c = Calendar.getInstance();
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int day) {
Calendar newDate = Calendar.getInstance();
newDate.set(year, month, day);
String daystring;
String monthstring;
if((""+day).length()==1){
daystring = "0"+day;
}
else{
daystring = day+"";
}
if((""+month).length()==1){
monthstring = "0"+month;
}
else{
monthstring = ""+month;
}
button.setText(monthstring + " / " + daystring + " / "
+ year);
}
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
datePickerDialog.show();
}
public void onClickTime(View view){
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
final Button button = (Button)view;
// Launch Time Picker Dialog
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
String time = "";
button.setText(formatTime(hourOfDay,minute));
//set availibility for service provider and check start time is less than finish
}
}, hour, minute, false);
timePickerDialog.show();
}
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;
}
private int[] parseTime(String startTime, String endTime){
int[] times = new int[4];
if(startTime.equals("START")){
times[0]=0;
times[1]=0;
}else{
times[0] = Integer.parseInt(startTime.substring(0,2));
times[1] = Integer.parseInt(startTime.substring(3));
}
if(endTime.equals("END")){
times[2]=0;
times[3]=0;
}else{
times[2] = Integer.parseInt(endTime.substring(0,2));
times[3] = Integer.parseInt(endTime.substring(3));
}
return times;
}
private boolean validateTime(int[] time){
if(time[0]==0&&time[1]==0&&time[2]==0&&time[3]==0){
return true;
}
if(time[2]>time[0]){
return true;
}else{
if(time[2]==time[0]&&time[3]>time[1]){
return true;
}else{
return false;
}
}
}
}

View file

@ -30,6 +30,7 @@ public class ServiceProvider extends UserType {
private String companyname; private String companyname;
private boolean licensed; private boolean licensed;
private String description; private String description;
private int rating;
@ -53,6 +54,7 @@ public class ServiceProvider extends UserType {
this.companyname = companyname; this.companyname = companyname;
this.licensed = licensed; this.licensed = licensed;
this.description = ""; this.description = "";
this.rating = 0;
} }
ServiceProvider(String username, String password, String firstname, String lastname, String address, ServiceProvider(String username, String password, String firstname, String lastname, String address,
@ -162,4 +164,12 @@ public class ServiceProvider extends UserType {
this.description = description; this.description = description;
} }
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
} }

View file

@ -0,0 +1,30 @@
package com.uottawa.olympus.olympusservices;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class ServiceProviderBookings extends AppCompatActivity {
String username;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_service_provider_bookings);
Bundle bundle = getIntent().getExtras();
username = bundle.getString("username");
}
/**
* Override so that previous screen refreshes when pressing the
* back button on this activity of the app.
*
*/
@Override
public void onBackPressed(){
Intent intent = new Intent(getApplicationContext(),ServiceProviderWelcome.class);
intent.putExtra("username", username);
startActivity(intent);
finish();
}
}

View file

@ -39,7 +39,7 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De
/** /**
* On creation loads up the xml, and generates the services list, * On creation loads up the xml, and generates the services list,
* and fillsout the recylerView fields. * and fills out the recylerView fields.
* *
* @param savedInstanceState Bundle to transfer information. * @param savedInstanceState Bundle to transfer information.
*/ */
@ -83,15 +83,6 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De
spinner.setItems(services); spinner.setItems(services);
spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
@Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
Snackbar.make(view, "Clicked " + item, Snackbar.LENGTH_LONG).show();
}
});
} }
@ -207,6 +198,7 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De
return services.length; return services.length;
} }
//nested class for the items in the recycler view
class ServicesHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ class ServicesHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
TextView name; TextView name;
@ -218,6 +210,11 @@ public class ServiceProviderServicesList extends AppCompatActivity implements De
rate = row.findViewById(R.id.Rate); rate = row.findViewById(R.id.Rate);
row.setOnClickListener(this); row.setOnClickListener(this);
} }
/**
* Onclick function for the items in the recycler view
* @param view
*/
@Override @Override
public void onClick(View view) { public void onClick(View view) {
TextView nameview = (TextView)view.findViewById(R.id.Name); TextView nameview = (TextView)view.findViewById(R.id.Name);

View file

@ -32,8 +32,7 @@ public class ServiceProviderWelcome extends AppCompatActivity {
UserType user; UserType user;
user = dbHelper.findUserByUsername(username); user = dbHelper.findUserByUsername(username);
TextView welcome = findViewById(R.id.Welcome); TextView welcome = findViewById(R.id.Welcome);
welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Service Provider"); welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Home Owner");
} }
@ -79,6 +78,12 @@ public class ServiceProviderWelcome extends AppCompatActivity {
startActivity(intent); startActivity(intent);
finish(); finish();
} }
public void SeeBookings(View view){
Intent intent = new Intent(getApplicationContext(),ServiceProviderBookings.class);
intent.putExtra("username", username);
startActivity(intent);
finish();
}
} }

View file

@ -37,12 +37,12 @@ public class SignUpPart2 extends AppCompatActivity {
if(companyname.length()>0 && address.length()>0 && phonenumber.length()>0 if(companyname.length()>0 && address.length()>0 && phonenumber.length()>0
&& companyname.matches("^[a-zA-Z0-9_ ]*$") && address.matches("^[a-zA-Z0-9_ ]*$") && companyname.matches("^[a-zA-Z0-9_ ]*$") && address.matches("^[a-zA-Z0-9_ ]*$")
&& phonenumber.matches("^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$") && phonenumber.matches("^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$")
&& description.matches("^[a-zA-Z0-9_ ]*$")
&& companyname.replaceAll("\\s+","").length()>0 && companyname.replaceAll("\\s+","").length()>0
&& address.replaceAll("\\s+","").length()>0) { && address.replaceAll("\\s+","").length()>0) {
ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname, ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname,
address, phonenumber, companyname, licensed); address, phonenumber, companyname, licensed, description);
serviceProvider.setDescription(description);
if(dbHelper.addUser(serviceProvider)){ if(dbHelper.addUser(serviceProvider)){
startActivity(intent); startActivity(intent);
finish(); finish();

View file

@ -13,6 +13,7 @@ import android.content.Intent;
* *
*/ */
public class Welcome extends AppCompatActivity { public class Welcome extends AppCompatActivity {
String username;
/** /**
* On creation of this object the app will display the xml file for * On creation of this object the app will display the xml file for
@ -26,14 +27,13 @@ public class Welcome extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome); setContentView(R.layout.activity_welcome);
Bundle bundle = getIntent().getExtras(); Bundle bundle = getIntent().getExtras();
String username = bundle.getString("username"); username = bundle.getString("username");
DBHelper dbHelper = new DBHelper(this); DBHelper dbHelper = new DBHelper(this);
UserType user; UserType user;
user = dbHelper.findUserByUsername(username); user = dbHelper.findUserByUsername(username);
TextView role = findViewById(R.id.Role); TextView welcome = findViewById(R.id.Welcome);
TextView name = findViewById(R.id.name); welcome.setText("Welcome "+user.getFirstname()+ " you are logged in as a Service Provider");
role.setText(user.getRole());
name.setText(user.getFirstname());
} }
@ -60,5 +60,19 @@ public class Welcome extends AppCompatActivity {
finish(); finish();
} }
public void SeeBookings(View view){
Intent intent = new Intent(getApplicationContext(),HomeOwnerBookings.class);
intent.putExtra("username", username);
startActivity(intent);
finish();
}
public void FindServiceProvider(View view){
Intent intent = new Intent(getApplicationContext(),FindServiceProvider.class);
intent.putExtra("username", username);
startActivity(intent);
finish();
}
} }

View file

@ -11,7 +11,7 @@
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/background" android:background="@drawable/background"
tools:context=".Welcome"> tools:context=".AdminWelcome">
<TextView <TextView
android:id="@+id/Welcome" android:id="@+id/Welcome"
android:layout_width="300dp" android:layout_width="300dp"

View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/background"
tools:context=".FindServiceProvider">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="5dp">
<TextView
android:id="@+id/ServicePick"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:gravity="center"
android:text="By Service:"
android:paddingRight="5dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:textSize="15sp" />
<com.jaredrummler.materialspinner.MaterialSpinner
android:id="@+id/ServicesInput"
android:layout_width="240dp"
android:layout_height="45dp"
android:layout_marginTop="5dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="@+id/DatePick"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:gravity="center"
android:text="By Time:"
android:paddingRight="20dp"
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_height="wrap_content"
android:text="Start"
android:theme="@style/AppTheme.Button"
android:onClick="onClickTime"
android:layout_marginRight="5dp"/>
<Button
android:id="@+id/End"
android:layout_width="115dp"
android:layout_height="wrap_content"
android:text="End"
android:theme="@style/AppTheme.Button"
android:onClick="onClickTime"
android:layout_marginRight="5dp"/>
</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">
<TextView
android:id="@+id/RatingPick"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:gravity="center"
android:text="By Rating:"
android:paddingRight="10dp"
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"/>
</LinearLayout>
<Button
android:id="@+id/Search"
android:layout_width="400dp"
android:layout_height="45dp"
android:text="Search"
android:theme="@style/AppTheme.Button"
android:onClick="Search"
android:layout_marginRight="10dp"
/>
<android.support.v7.widget.RecyclerView
android:id="@+id/ServiceProviders"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="250dp"/>
</LinearLayout>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeOwnerBookings">
</android.support.constraint.ConstraintLayout>

View file

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/background"
tools:context=".MakeBooking">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp">
<TextView
android:background="@color/colorWhite"
android:id="@+id/HomeOwner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Home Owner:"
android:paddingRight="5dp"
android:paddingLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/black"
android:textSize="20sp"
android:layout_gravity="start"/>
<TextView
android:background="@color/colorWhite"
android:id="@+id/ServiceProvider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Service Provider:"
android:paddingRight="5dp"
android:paddingLeft="10dp"
android:layout_marginBottom="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/black"
android:textSize="20sp"
android:layout_gravity="start"/>
<TextView
android:background="@color/colorWhite"
android:id="@+id/Service"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Service:"
android:layout_marginBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingBottom="5dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/black"
android:textSize="20sp"
android:layout_gravity="start"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp">
<Button
android:id="@+id/Start"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:text="Start"
android:theme="@style/AppTheme.Button"
android:onClick="onClickTime"
android:layout_marginRight="5dp"/>
<Button
android:id="@+id/End"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:text="End"
android:theme="@style/AppTheme.Button"
android:onClick="onClickTime"
android:layout_marginRight="5dp"/>
<Button
android:id="@+id/Date"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:text="Date"
android:theme="@style/AppTheme.Button"
android:onClick="onClickDate"
android:layout_gravity="end"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="30dp">
<Button
android:id="@+id/Book"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:text="Book"
android:theme="@style/AppTheme.Button"
android:onClick="Book"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"/>
<Button
android:id="@+id/Cancel"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:text="Cancel"
android:theme="@style/AppTheme.Button"
android:onClick="Cancel"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ServiceProviderBookings">
</android.support.constraint.ConstraintLayout>

View file

@ -57,6 +57,7 @@
android:layout_height="60dp" android:layout_height="60dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:text="Bookings" android:text="Bookings"
android:onClick="SeeBookings"
android:theme="@style/AppTheme.Button" /> android:theme="@style/AppTheme.Button" />
<Button <Button
android:id="@+id/LogOut" android:id="@+id/LogOut"

View file

@ -80,6 +80,21 @@
android:buttonTint="@color/colorWhite" android:buttonTint="@color/colorWhite"
android:layout_marginBottom="15dp"/> android:layout_marginBottom="15dp"/>
//component used from https://github.com/rengwuxian/MaterialEditText
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/DescriptionInput"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@drawable/customborder"
android:hint="General Description"
android:text=""
android:textSize="15sp"
app:met_baseColor="@android:color/white"
app:met_floatingLabel="highlight"
app:met_primaryColor="@color/colorWhite"
app:met_singleLineEllipsis="true"
android:textCursorDrawable="@color/colorWhite"/>
<Button <Button
android:id="@+id/SignUp" android:id="@+id/SignUp"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -11,7 +11,7 @@
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/background" android:background="@drawable/background"
tools:context=".Welcome"> tools:context=".UsersList">
<LinearLayout <LinearLayout

View file

@ -17,59 +17,44 @@
android:id="@+id/Welcome" android:id="@+id/Welcome"
android:layout_width="300dp" android:layout_width="300dp"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_marginBottom="20dp" android:layout_marginBottom="10dp"
android:gravity="center" android:gravity="center"
android:text="Welcome" android:text="Welcome"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="30sp"
android:layout_marginTop="50dp"
app:fontFamily="@font/julius_sans_one" />
<TextView
android:id="@+id/name"
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="FirstNameHere"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:textSize="20sp" android:textSize="20sp"
android:background="@drawable/customborder" android:layout_marginTop="10dp"
app:fontFamily="@font/julius_sans_one" /> app:fontFamily="@font/julius_sans_one" />
<TextView <Button
android:id="@+id/Roleis" android:id="@+id/Profile"
android:layout_width="300dp" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="60dp"
android:layout_marginBottom="20dp" android:layout_marginTop="10dp"
android:gravity="center" android:text="Profile"
android:text="You are logged in as a" android:theme="@style/AppTheme.Button" />
android:textAppearance="@style/TextAppearance.AppCompat.Large" <Button
android:textColor="@android:color/white" android:id="@+id/Find"
android:textSize="18sp" android:layout_width="match_parent"
app:fontFamily="@font/julius_sans_one" /> android:layout_height="60dp"
android:layout_marginTop="15dp"
<TextView android:text="Find a Service Provider"
android:id="@+id/Role" android:onClick="FindServiceProvider"
android:layout_width="300dp" android:theme="@style/AppTheme.Button" />
android:layout_height="50dp" <Button
android:layout_marginBottom="20dp" android:id="@+id/Bookings"
android:gravity="center" android:layout_width="match_parent"
android:text="Role Here" android:layout_height="60dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:layout_marginTop="20dp"
android:textColor="@android:color/white" android:text="Bookings"
android:background="@drawable/customborder" android:onClick="SeeBookings"
android:textSize="20sp" android:theme="@style/AppTheme.Button" />
app:fontFamily="@font/julius_sans_one" />
<Button <Button
android:id="@+id/LogOut" android:id="@+id/LogOut"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="60dp"
android:layout_marginTop="10dp" android:layout_marginTop="15dp"
android:onClick="LogOut" android:onClick="LogOut"
android:text="Logout" android:text="Logout"
android:theme="@style/AppTheme.Button" /> android:theme="@style/AppTheme.Button" />
</LinearLayout> </LinearLayout>

View file

@ -13,5 +13,10 @@
<item name="android:textColor">@color/colorBlack</item> <item name="android:textColor">@color/colorBlack</item>
</style> </style>
<style name="RatingBar" parent="Theme.AppCompat">
<item name="colorControlNormal">@color/colorWhite</item>
<item name="colorControlActivated">@color/colorWhite</item>
</style>
</resources> </resources>