Merge branch 'master' of https://github.com/ebivibe/SEG2105-Olympus into DBBranch

This commit is contained in:
Mary Tran 2018-11-24 14:57:22 -05:00
commit 874df37f72
20 changed files with 454 additions and 87 deletions

Binary file not shown.

View file

@ -25,7 +25,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View file

@ -70,8 +70,7 @@
android:label="Availabilities" android:label="Availabilities"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity android:name=".SignUpPart2" /> <activity android:name=".SignUpPart2" />
<activity android:name=".ServiceProviderBookings" /> <activity android:name=".Bookings" />
<activity android:name=".HomeOwnerBookings" />
<activity android:name=".FindServiceProvider" /> <activity android:name=".FindServiceProvider" />
<activity android:name=".MakeBooking" /> <activity android:name=".MakeBooking" />
<activity android:name=".HomeOwnerEditProfile"></activity> <activity android:name=".HomeOwnerEditProfile"></activity>

View file

@ -0,0 +1,184 @@
package com.uottawa.olympus.olympusservices;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
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.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
public class Bookings extends AppCompatActivity {
//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;
String username;
DBHelper dbhelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bookings);
Bundle bundle = getIntent().getExtras();
username = bundle.getString("username");
dbhelper = new DBHelper(this);
/*
Booking[] bookings;
//get bookings here
mRecyclerView = (RecyclerView) findViewById(R.id.Bookings);
mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
mAdapter = new AdminServicesList.MyAdapter(booking, this);
mRecyclerView.setAdapter(mAdapter);
*/
}
/**
* 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();
}
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.BookingHolder> {
private Booking[] bookings;
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(Booking[] bookings, Context context) {
this.bookings = bookings;
}
// Create new views (invoked by the layout manager)
@NonNull
@Override
public BookingHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.booking_list_item, parent, false);
BookingHolder vh = new BookingHolder(v);
return vh;
}
// Replace the contents of a view (invoked by the layout manager)
@Override
public void onBindViewHolder(BookingHolder holder, int position) {
Booking booking = bookings[position];
//holder.name.setText(booking.getServiceprovider().getFirstname()+" "+booking.getServiceprovider().getLastname());
}
// Return the size of your dataset (invoked by the layout manager)
@Override
public int getItemCount() {
return bookings.length;
}
class BookingHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
TextView homeowner;
TextView serviceprovider;
TextView date;
TextView start;
TextView end;
TextView status;
public BookingHolder(View row){
super(row);
homeowner = row.findViewById(R.id.HomeOwnerName);
serviceprovider = row.findViewById(R.id.ServiceProviderName);
date = row.findViewById(R.id.DateName);
start = row.findViewById(R.id.StartTime);
end = row.findViewById(R.id.EndTime);
status = row.findViewById(R.id.StatusName);
row.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if(dbhelper.findUserByUsername(username).getRole()=="ServiceProvider"){
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(Bookings.this);
alertDialogBuilder.setMessage("Cancel or Confirm your booking");
alertDialogBuilder.setPositiveButton("Confirm",
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();
}
});
alertDialogBuilder.setNegativeButton("No",
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();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
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",
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();
}
});
alertDialogBuilder.setNegativeButton("Nevermind",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}
}
}
}

View file

@ -60,9 +60,10 @@ public class FindServiceProvider extends AppCompatActivity {
spinner2.setItems(services); spinner2.setItems(services);
//iffy code //iffy code, update once we can pull the actual service providers
ServiceProvider provider = (ServiceProvider)dbHelper.findUserByUsername("testing"); ServiceProvider provider = (ServiceProvider)dbHelper.findUserByUsername("testing");
ServiceProvider[] providerslist = {provider}; ServiceProvider[] providerslist = {provider};
//iffy code ends here
mRecyclerView = (RecyclerView) findViewById(R.id.ServiceProviders); mRecyclerView = (RecyclerView) findViewById(R.id.ServiceProviders);
@ -147,6 +148,7 @@ public class FindServiceProvider extends AppCompatActivity {
public void onDateSet(DatePicker view, int year, int month, int day) { public void onDateSet(DatePicker view, int year, int month, int day) {
Calendar newDate = Calendar.getInstance(); Calendar newDate = Calendar.getInstance();
newDate.set(year, month, day); newDate.set(year, month, day);
month++;
String daystring; String daystring;
String monthstring; String monthstring;
if((""+day).length()==1){ if((""+day).length()==1){

View file

@ -1,30 +0,0 @@
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

@ -64,6 +64,7 @@ public class MakeBooking extends AppCompatActivity {
public void onDateSet(DatePicker view, int year, int month, int day) { public void onDateSet(DatePicker view, int year, int month, int day) {
Calendar newDate = Calendar.getInstance(); Calendar newDate = Calendar.getInstance();
newDate.set(year, month, day); newDate.set(year, month, day);
month++;
String daystring; String daystring;
String monthstring; String monthstring;
if((""+day).length()==1){ if((""+day).length()==1){

View file

@ -1,30 +0,0 @@
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

@ -79,7 +79,7 @@ public class ServiceProviderWelcome extends AppCompatActivity {
finish(); finish();
} }
public void SeeBookings(View view){ public void SeeBookings(View view){
Intent intent = new Intent(getApplicationContext(),ServiceProviderBookings.class); Intent intent = new Intent(getApplicationContext(),Bookings.class);
intent.putExtra("username", username); intent.putExtra("username", username);
startActivity(intent); startActivity(intent);
finish(); finish();

View file

@ -61,7 +61,7 @@ public class Welcome extends AppCompatActivity {
} }
public void SeeBookings(View view){ public void SeeBookings(View view){
Intent intent = new Intent(getApplicationContext(),HomeOwnerBookings.class); Intent intent = new Intent(getApplicationContext(),Bookings.class);
intent.putExtra("username", username); intent.putExtra("username", username);
startActivity(intent); startActivity(intent);
finish(); finish();

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!--Border width and color-->
<stroke android:width="5px" android:color="#000000" />
</shape>

View file

@ -0,0 +1,22 @@
<?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=".Bookings">
<android.support.v7.widget.RecyclerView
android:id="@+id/Bookings"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="500dp"/>
</LinearLayout>

View file

@ -1,9 +0,0 @@
<?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

@ -1,9 +0,0 @@
<?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

@ -0,0 +1,198 @@
<?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="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:orientation="horizontal"
android:layout_weight="1"
android:background="@drawable/customborder2">
<TextView
android:id="@+id/ServiceProvider"
android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="130dp"
android:layout_height="45dp"
android:text="Service Provider:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
/>
<TextView
android:id="@+id/ServiceProviderName"
android:paddingLeft="10dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_weight="1"
android:text="Service Provider"
android:textColor="@color/colorBlack"
android:textSize="15sp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="horizontal"
android:layout_weight="1"
android:background="@drawable/customborder2">
<TextView
android:id="@+id/HomeOwner"
android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="130dp"
android:layout_height="45dp"
android:text="Home Owner:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
/>
<TextView
android:id="@+id/HomeOwnerName"
android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_weight="1"
android:text="Home Owner"
android:textColor="@color/colorBlack"
android:textSize="15sp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="horizontal"
android:layout_weight="1"
android:background="@drawable/customborder2">
<TextView
android:id="@+id/Service"
android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="130dp"
android:layout_height="45dp"
android:text="Service:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
/>
<TextView
android:id="@+id/ServiceName"
android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_weight="1"
android:text="Service"
android:textColor="@color/colorBlack"
android:textSize="15sp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="horizontal"
android:layout_weight="1"
android:background="@drawable/customborder2">
<TextView
android:id="@+id/Date"
android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="130dp"
android:layout_height="45dp"
android:text="Date and Time:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
/>
<TextView
android:id="@+id/DateName"
android:paddingLeft="10dp"
android:paddingTop="6dp"
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"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="horizontal"
android:layout_weight="1"
android:background="@drawable/customborder2">
<TextView
android:id="@+id/Status"
android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="130dp"
android:layout_height="45dp"
android:text="Status:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
/>
<TextView
android:id="@+id/StatusName"
android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_weight="1"
android:text="Status"
android:textColor="@color/colorBlack"
android:textSize="15sp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -25,6 +25,7 @@ isA UserType;
class Admin class Admin
{ {
isA UserType; isA UserType;
1 -- * Service creates;
} }
class Service class Service
@ -36,6 +37,22 @@ double rate;
class Booking
{
int starth;
int startmin;
int endh;
int endmin;
int day;
int month;
int year;
status;
int rating;
* -- 1 HomeOwner;
* -- 1 ServiceProvider;
* -- 1 Service;
}
class UserType class UserType
{ {
position 475 69 141 109; position 475 69 141 109;
@ -54,10 +71,20 @@ class ServiceProvider
class Admin class Admin
{ {
position 490 236 109 41; position 490 236 109 41;
position.association Admin__Service 66,41 0,52;
position.association Admin__Service:create 109,28 0,60;
} }
class Service class Service
{ {
position 854 455 112 75; position 849 474 112 75;
position.association Service__ServiceProvider 65,0 65,143; position.association Service__ServiceProvider 65,0 65,143;
}//$?[End_of_model]$? }
class Booking
{
position 99 433 178 211;
position.association Booking__HomeOwner 62,0 54,41;
position.association Booking__ServiceProvider 178,50 0,94;
position.association Booking__Service 178,120 0,68;
}

View file

@ -11,3 +11,9 @@ password = admin
ServiceProvider account is precreated with ServiceProvider account is precreated with
username = testing, username = testing,
password = testing password = testing
APK tested on a Sony Xperia XA2, model H3123
Build Status
[![CircleCI](https://circleci.com/gh/ebivibe/SEG2105-Olympus/tree/master.svg?style=svg&circle-token=01dbbc3800d7ee80871796675582a67ba7c83604)](https://circleci.com/gh/ebivibe/SEG2105-Olympus/tree/master)

Binary file not shown.

BIN
~$L Class Diagram.docx Normal file

Binary file not shown.