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

This commit is contained in:
Mary Tran 2018-11-28 22:28:05 -05:00
commit 7f169fe0e6
16 changed files with 509 additions and 153 deletions

View file

@ -1,22 +0,0 @@
package com.uottawa.olympus.olympusservices;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class LogInTest {
@Rule
public ActivityTestRule<LogIn> mActivityTestRule = new ActivityTestRule<LogIn>(LogIn.class);
@Test
public void checkSignIn() throws Exception{
}
}

View file

@ -1,90 +0,0 @@
package com.uottawa.olympus.olympusservices;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.widget.TextView;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withSpinnerText;
import static java.util.regex.Pattern.matches;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.AllOf.allOf;
import static org.junit.Assert.*;
@RunWith(AndroidJUnit4.class)
public class SignUpTest {
@Rule
public ActivityTestRule<SignUp> mActivityTestRule = new ActivityTestRule<SignUp>(SignUp.class);
private SignUp mActivity=null;
private TextView text;
@Before
public void setUp() throws Exception {
mActivity = mActivityTestRule.getActivity();
}
@Test
public void checkSignUp1() throws Exception{
onView(withId(R.id.UsernameInput)).perform(typeText("John123"), closeSoftKeyboard());
onView(withId(R.id.PasswordInput)).perform(typeText("1234567890"), closeSoftKeyboard());
onView(withId(R.id.FirstNameInput)).perform(typeText("John"), closeSoftKeyboard());
onView(withId(R.id.LastNameInput)).perform(typeText("Doe"), closeSoftKeyboard());
onView(withId(R.id.SignUp)).perform(click());
}
@Test
public void checkSignUp2() throws Exception{
onView(withId(R.id.RoleInput)).perform(click());
onData(allOf(is(instanceOf(String.class)), is("Service Provider"))).perform(click());
onView(withId(R.id.UsernameInput)).perform(typeText("Service123"), closeSoftKeyboard());
onView(withId(R.id.PasswordInput)).perform(typeText("1234567890"), closeSoftKeyboard());
onView(withId(R.id.FirstNameInput)).perform(typeText("Jane"), closeSoftKeyboard());
onView(withId(R.id.LastNameInput)).perform(typeText("Doe"), closeSoftKeyboard());
onView(withId(R.id.SignUp)).perform(click());
}
@Test
public void checkSignUp3() throws Exception{
onView(withId(R.id.UsernameInput)).perform(typeText(""), closeSoftKeyboard());
onView(withId(R.id.PasswordInput)).perform(typeText(""), closeSoftKeyboard());
onView(withId(R.id.FirstNameInput)).perform(typeText(""), closeSoftKeyboard());
onView(withId(R.id.LastNameInput)).perform(typeText(""), closeSoftKeyboard());
onView(withId(R.id.SignUp)).perform(click());
}
@Test
public void checkSignUp4() throws Exception{
onView(withId(R.id.UsernameInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
onView(withId(R.id.PasswordInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
onView(withId(R.id.FirstNameInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
onView(withId(R.id.LastNameInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
onView(withId(R.id.SignUp)).perform(click());
}
public void checkSignUp5() throws Exception{
onView(withId(R.id.UsernameInput)).perform(typeText("user"), closeSoftKeyboard());
onView(withId(R.id.PasswordInput)).perform(typeText("pass"), closeSoftKeyboard());
onView(withId(R.id.FirstNameInput)).perform(typeText("Honda"), closeSoftKeyboard());
onView(withId(R.id.LastNameInput)).perform(typeText("Gokuchi"), closeSoftKeyboard());
onView(withId(R.id.SignUp)).perform(click());
}
@After
public void tearDown() throws Exception {
mActivity=null;
}
}

View file

@ -12,11 +12,14 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import java.util.List;
public class Bookings extends AppCompatActivity { public class Bookings extends AppCompatActivity {
//field for RecyclerView //field for RecyclerView
@ -37,14 +40,18 @@ public class Bookings extends AppCompatActivity {
username = bundle.getString("username"); username = bundle.getString("username");
dbhelper = new DBHelper(this); dbhelper = new DBHelper(this);
//Booking[] bookings = (Booking[])dbhelper.findBookings(username).toArray(); List<Booking> booking = (List<Booking>)dbhelper.findBookings(username);
Booking[] bookings = new Booking[booking.size()];
bookings = booking.toArray(bookings);
Booking[] testbooking = {new Booking(5, 5, 6, 6, 2, 3, 2019, (ServiceProvider)dbhelper.findUserByUsername("testing"), /* mock data
Booking[] bookings = {new Booking(5, 5, 6, 6, 2, 3, 2019, (ServiceProvider)dbhelper.findUserByUsername("testing"),
(HomeOwner)dbhelper.findUserByUsername("tester"), dbhelper.findService("service1"))}; (HomeOwner)dbhelper.findUserByUsername("tester"), dbhelper.findService("service1"))};
*/
mRecyclerView = (RecyclerView) findViewById(R.id.Bookings); mRecyclerView = (RecyclerView) findViewById(R.id.Bookings);
mLayoutManager = new LinearLayoutManager(this); mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager); mRecyclerView.setLayoutManager(mLayoutManager);
mAdapter = new MyAdapter(testbooking, this); mAdapter = new MyAdapter(bookings, this);
mRecyclerView.setAdapter(mAdapter); mRecyclerView.setAdapter(mAdapter);
} }
@ -98,7 +105,7 @@ public class Bookings extends AppCompatActivity {
@Override @Override
public void onBindViewHolder(BookingHolder holder, int position) { public void onBindViewHolder(BookingHolder holder, int position) {
Booking booking = bookings[position]; Booking booking = bookings[position];
holder.serviceprovider.setText(booking.getServiceprovider().getFirstname()+" "+booking.getServiceprovider().getLastname()); holder.serviceprovider.setText(booking.getServiceprovider().getFirstname()+" "+booking.getServiceprovider().getLastname()+", "+booking.getServiceprovider().getCompanyname());
holder.homeowner.setText(booking.getHomeowner().getFirstname()+" "+booking.getHomeowner().getLastname()); holder.homeowner.setText(booking.getHomeowner().getFirstname()+" "+booking.getHomeowner().getLastname());
holder.service.setText(booking.getService().getName()); holder.service.setText(booking.getService().getName());
String day; String day;
@ -173,6 +180,7 @@ public class Bookings extends AppCompatActivity {
year, (ServiceProvider)dbhelper.findUserByUsername(serviceprovider.getText().toString()), year, (ServiceProvider)dbhelper.findUserByUsername(serviceprovider.getText().toString()),
(HomeOwner)dbhelper.findUserByUsername(homeowner.getText().toString()), (HomeOwner)dbhelper.findUserByUsername(homeowner.getText().toString()),
dbhelper.findService(service.getText().toString())))){ dbhelper.findService(service.getText().toString())))){
Toast.makeText(Bookings.this,"Booking is confirmed",Toast.LENGTH_LONG).show(); Toast.makeText(Bookings.this,"Booking is confirmed",Toast.LENGTH_LONG).show();
Bookings.this.recreate(); Bookings.this.recreate();
} }
@ -213,21 +221,30 @@ public class Bookings extends AppCompatActivity {
RadioGroup ratingselect = ((AlertDialog) arg0).findViewById(R.id.RatingSelect); RadioGroup ratingselect = ((AlertDialog) arg0).findViewById(R.id.RatingSelect);
int selectedId = ratingselect.getCheckedRadioButtonId(); int selectedId = ratingselect.getCheckedRadioButtonId();
RadioButton ratingpicked; RadioButton ratingpicked;
if(selectedId!=-1){ EditText comment = ((AlertDialog) arg0).findViewById(R.id.Comment);
if(selectedId!=-1 && !comment.getText().toString().equals("")){
ratingpicked = (RadioButton)((AlertDialog) arg0).findViewById(selectedId); ratingpicked = (RadioButton)((AlertDialog) arg0).findViewById(selectedId);
double rating = Double.parseDouble(ratingpicked.getText().toString()); double rating = Double.parseDouble(ratingpicked.getText().toString());
Booking booking = new Booking(starth, startmin, endh, endmin, day, month, /*Booking booking = new Booking(starth, startmin, endh, endmin, day, month,
year, (ServiceProvider)dbhelper.findUserByUsername(serviceprovider.getText().toString()), year, (ServiceProvider)dbhelper.findUserByUsername(serviceprovider.getText().toString()),
(HomeOwner)dbhelper.findUserByUsername(homeowner.getText().toString()), (HomeOwner)dbhelper.findUserByUsername(homeowner.getText().toString()),
dbhelper.findService(service.getText().toString()));; dbhelper.findService(service.getText().toString()));
if(!dbhelper.addRating(booking, rating)){ */
Toast.makeText(context, "Rating could not be added", Toast.LENGTH_SHORT).show(); Booking booking = new Booking(starth, startmin, endh, endmin, day, month, year, new ServiceProvider(serviceprovider.getText().toString(),
"", "", "", "", "", "", true),
new HomeOwner(homeowner.getText().toString(), "", "", ""),
new Service(service.getText().toString(), 5));
if(!dbhelper.addRating(booking, rating, comment.getText().toString())){
Toast.makeText(Bookings.this, "Rating could not be added", Toast.LENGTH_SHORT).show();
} }
else{ else{
Bookings.this.recreate(); Bookings.this.recreate();
} }
} }
else{
Toast.makeText(Bookings.this, "Rating and comment must be filled in", Toast.LENGTH_SHORT).show();
}
} }
}); });

View file

@ -1787,7 +1787,7 @@ public class DBHelper extends SQLiteOpenHelper {
(ServiceProvider) findUserByUsername(cursor.getString(0)) : serviceProvider); (ServiceProvider) findUserByUsername(cursor.getString(0)) : serviceProvider);
HomeOwner homeowner = (homeOwner == null ? HomeOwner homeowner = (homeOwner == null ?
(HomeOwner) findUserByUsername(cursor.getString(1)) : homeOwner); (HomeOwner) findUserByUsername(cursor.getString(1)) : homeOwner);
Service service = findService(cursor.getString(3)); Service service = (Service)findService(cursor.getString(2));
Booking booking = new Booking(starth, startmin, endh, endmin, day, month, year, Booking booking = new Booking(starth, startmin, endh, endmin, day, month, year,
serviceprovider, homeowner, service); serviceprovider, homeowner, service);
booking.setStatus(status); booking.setStatus(status);

View file

@ -3,9 +3,11 @@ package com.uottawa.olympus.olympusservices;
import android.app.DatePickerDialog; import android.app.DatePickerDialog;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
@ -13,8 +15,10 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.DatePicker; import android.widget.DatePicker;
import android.widget.ListView;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import android.widget.RatingBar; import android.widget.RatingBar;
@ -78,6 +82,18 @@ public class FindServiceProvider extends AppCompatActivity {
startActivity(intent); startActivity(intent);
finish(); finish();
} }
public void Reset(View view){
//clears recycler view
String[][] empty = {};
mAdapter = new MyAdapter(empty, this);
mRecyclerView.setAdapter(mAdapter);
mAdapter.notifyDataSetChanged();
}
public void Search(View view){ public void Search(View view){
MaterialSpinner spinner = findViewById(R.id.ServicesInput); MaterialSpinner spinner = findViewById(R.id.ServicesInput);
Button button = findViewById(R.id.Start); Button button = findViewById(R.id.Start);
@ -320,6 +336,7 @@ public class FindServiceProvider extends AppCompatActivity {
String[] serviceprovider = serviceProviders[position]; String[] serviceprovider = serviceProviders[position];
holder.name.setText(serviceprovider[1]+" "+serviceprovider[2]); holder.name.setText(serviceprovider[1]+" "+serviceprovider[2]);
holder.rate.setText(""+serviceprovider[3]); holder.rate.setText(""+serviceprovider[3]);
holder.username.setText(serviceprovider[0]);
@ -336,18 +353,93 @@ public class FindServiceProvider extends AppCompatActivity {
TextView name; TextView name;
TextView rate; TextView rate;
TextView username;
public ProviderHolder(View row){ public ProviderHolder(View row){
super(row); super(row);
name = row.findViewById(R.id.Name); name = row.findViewById(R.id.Name);
rate = row.findViewById(R.id.Rate); rate = row.findViewById(R.id.Rate);
username = row.findViewById(R.id.Username);
row.setOnClickListener(this); row.setOnClickListener(this);
} }
@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.Username);
String name = nameview.getText().toString(); final String name = nameview.getText().toString();
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(FindServiceProvider.this);
alertDialogBuilder.setView(R.layout.sp_info_item);
alertDialogBuilder.setPositiveButton("Make Booking",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
makeBooking(name); makeBooking(name);
}
});
alertDialogBuilder.setNegativeButton("Nevermind",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
ServiceProvider sp = (ServiceProvider)dbHelper.findUserByUsername(name);
TextView spname = alertDialog.findViewById(R.id.NameName);
spname.setText(sp.getFirstname()+" "+sp.getLastname());
TextView company = alertDialog.findViewById(R.id.CompanyName);
company.setText(sp.getCompanyname());
TextView address = alertDialog.findViewById(R.id.AddressName);
address.setText(sp.getAddress());
TextView phone = alertDialog.findViewById(R.id.PhoneNumberName);
phone.setText(sp.getPhonenumber());
TextView licensed = alertDialog.findViewById(R.id.LicensedName);
if(sp.isLicensed()){
licensed.setText("Yes");
}
else{
licensed.setText("No");
}
TextView description = alertDialog.findViewById(R.id.DescriptionName);
description.setText(sp.getDescription());
TextView rating = alertDialog.findViewById(R.id.AverageRatingName);
MaterialSpinner spinner = findViewById(R.id.ServicesInput);
rating.setText(""+dbHelper.getAverageRating(name, spinner.getText().toString()));
TextView ratingtext = alertDialog.findViewById(R.id.AverageRating);
ratingtext.setText("Rating for " +spinner.getText().toString());
//actual data
List<String[]> randc = dbHelper.getAllRatingsAndComments(name,spinner.getText().toString());
String[] ratings = new String[randc.size()];
for(int i=0; i<randc.size(); i++){
ratings[i] = "Rating: "+randc.get(i)[1]+"\nComment: "+randc.get(i)[3];
}
/*mock data
String[] ratings ={"Rating: 5\nComment: Did great","Rating: 1\nComment: Worst plumber ever",
"Rating: 1\nComment: Couldn't find my house", "Rating: 2\nComment: Too expensive, ok plumber"};
*/
ArrayAdapter adapter = new ArrayAdapter<String>(FindServiceProvider.this, R.layout.simple_list_item_1_customized, ratings);
ListView listView = (ListView) alertDialog.findViewById(R.id.RatingList);
listView.setAdapter(adapter);
} }

View file

@ -81,6 +81,10 @@ public class MakeBooking extends AppCompatActivity {
else{ else{
if (starth<endh || (starth==endh && startmin<endmin)){ if (starth<endh || (starth==endh && startmin<endmin)){
DBHelper dbHelper = new DBHelper(this); DBHelper dbHelper = new DBHelper(this);
//check if sp is availible not just true
if(true) {
if (dbHelper.addBooking(serviceprovider, homeowner, service, year, month, day, if (dbHelper.addBooking(serviceprovider, homeowner, service, year, month, day,
starth, startmin, endh, endmin)) { starth, startmin, endh, endmin)) {
Toast.makeText(this, "Booking Made", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Booking Made", Toast.LENGTH_SHORT).show();
@ -89,10 +93,10 @@ public class MakeBooking extends AppCompatActivity {
startActivity(intent); startActivity(intent);
finish(); finish();
} } else {
else{
Toast.makeText(this, "Booking could not be made", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Booking could not be made", Toast.LENGTH_SHORT).show();
} }
}
} }

View file

@ -154,10 +154,25 @@
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/Reset"
android:layout_width="150dp"
android:layout_height="45dp"
android:text="Reset"
android:theme="@style/AppTheme.Button"
android:onClick="Reset"
android:layout_marginRight="10dp"
/>
<Button <Button
android:id="@+id/Search" android:id="@+id/Search"
android:layout_width="400dp" android:layout_width="150dp"
android:layout_height="45dp" android:layout_height="45dp"
android:text="Search" android:text="Search"
android:theme="@style/AppTheme.Button" android:theme="@style/AppTheme.Button"
@ -165,6 +180,11 @@
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
/> />
</LinearLayout>
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/ServiceProviders" android:id="@+id/ServiceProviders"
android:scrollbars="vertical" android:scrollbars="vertical"

View file

@ -4,6 +4,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorWhite" android:background="@color/colorWhite"
android:orientation="vertical" android:orientation="vertical"
android:layout_marginBottom="10dp"
> >
<LinearLayout <LinearLayout
@ -138,7 +139,6 @@
<TextView <TextView
android:id="@+id/StartTime" android:id="@+id/StartTime"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@ -149,7 +149,6 @@
<TextView <TextView
android:id="@+id/Timespace" android:id="@+id/Timespace"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@ -161,7 +160,6 @@
<TextView <TextView
android:id="@+id/EndTime" android:id="@+id/EndTime"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingTop="6dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"

View file

@ -0,0 +1,61 @@
<?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="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp"
android:layout_marginBottom="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/Rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rating:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
android:paddingRight="10dp"/>
<TextView
android:id="@+id/RatingName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/colorBlack"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/Comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Comment: "
android:textColor="@color/colorBlack"
android:textSize="15sp"
android:paddingRight="10dp"/>
<TextView
android:id="@+id/CommentName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/colorBlack"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -68,10 +69,23 @@
android:buttonTint="@color/colorBlack"/> android:buttonTint="@color/colorBlack"/>
</RadioGroup> </RadioGroup>
</LinearLayout>
//component used from https://github.com/rengwuxian/MaterialEditText
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/Comment"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@color/colorWhite"
android:textSize="15sp"
android:hint="Comment"
android:text=""
android:layout_marginLeft="10dp"
android:textCursorDrawable="@color/colorWhite"/>
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -33,4 +33,16 @@
android:textColor="@color/colorBlack" android:textColor="@color/colorBlack"
android:textSize="15sp" android:textSize="15sp"
android:gravity="end"/> android:gravity="end"/>
<TextView
android:id="@+id/Username"
android:text=""
android:layout_height="0dp"
android:layout_width="0dp"
android:textColor="@color/colorWhite"
android:textSize="0sp"
android:gravity="end"
/>
</LinearLayout> </LinearLayout>

View file

@ -8,11 +8,13 @@
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
android:paddingRight="?android:attr/listPreferredItemPaddingRight" android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:paddingStart="30dp"
android:textAppearance="?android:attr/textAppearanceListItemSmall" android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:paddingBottom="5dp"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:background="@color/colorWhite" android:background="@color/colorWhite"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:textSize="15sp"
> >

View file

@ -0,0 +1,212 @@
<?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:orientation="vertical"
android:layout_marginBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="400dp"
android:layout_height="400dp"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Service Provider:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
android:paddingRight="10dp"/>
<TextView
android:id="@+id/NameName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FirstName"
android:textColor="@color/colorBlack"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/Company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Company:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
android:paddingRight="10dp"/>
<TextView
android:id="@+id/CompanyName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Company"
android:textColor="@color/colorBlack"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/Address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
android:paddingRight="10dp"/>
<TextView
android:id="@+id/AddressName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address"
android:textColor="@color/colorBlack"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/PhoneNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Phone Number:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
android:paddingRight="10dp"/>
<TextView
android:id="@+id/PhoneNumberName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PhoneNumber"
android:textColor="@color/colorBlack"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/Licensed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Licensed:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
android:paddingRight="10dp"/>
<TextView
android:id="@+id/LicensedName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Licensed"
android:textColor="@color/colorBlack"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
android:paddingRight="10dp"/>
<TextView
android:id="@+id/DescriptionName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description"
android:textColor="@color/colorBlack"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/AverageRating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Average Rating:"
android:textColor="@color/colorBlack"
android:textSize="15sp"
android:paddingRight="10dp"/>
<TextView
android:id="@+id/AverageRatingName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rating"
android:textColor="@color/colorBlack"
android:textSize="15sp" />
</LinearLayout>
<ListView
android:id="@+id/RatingList"
android:paddingTop="5dp"
android:layout_width="350dp"
android:layout_height="200dp"
android:background="@drawable/customborder2"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -11,6 +11,9 @@ public class BookingTest {
Booking book = new Booking(13, 30, 16, 0, 0, 0, 2019, Booking book = new Booking(13, 30, 16, 0, 0, 0, 2019,
serviceprovider, user, service); serviceprovider, user, service);
/**
* tests starth input and its functions.
*/
@Test @Test
public void testStarth() { public void testStarth() {
assertEquals(13, book.getStarth()); assertEquals(13, book.getStarth());
@ -18,6 +21,9 @@ public class BookingTest {
assertNotEquals(13, book.getStarth()); assertNotEquals(13, book.getStarth());
} }
/**
* tests startmin input and its functions.
*/
@Test @Test
public void testStartmin() { public void testStartmin() {
assertEquals(30, book.getStartmin()); assertEquals(30, book.getStartmin());
@ -25,6 +31,9 @@ public class BookingTest {
assertNotEquals(30, book.getStartmin()); assertNotEquals(30, book.getStartmin());
} }
/**
* tests Endh input and its functions.
*/
@Test @Test
public void testEndh() { public void testEndh() {
assertEquals(16, book.getEndh()); assertEquals(16, book.getEndh());
@ -32,6 +41,9 @@ public class BookingTest {
assertNotEquals(16, book.getEndh()); assertNotEquals(16, book.getEndh());
} }
/**
* tests Endmin input and its functions.
*/
@Test @Test
public void testEndmin() { public void testEndmin() {
assertEquals(0, book.getEndmin()); assertEquals(0, book.getEndmin());
@ -39,6 +51,9 @@ public class BookingTest {
assertNotEquals(0, book.getEndmin()); assertNotEquals(0, book.getEndmin());
} }
/**
* tests Day input and its functions.
*/
@Test @Test
public void testDay() { public void testDay() {
assertEquals(0, book.getDay()); assertEquals(0, book.getDay());
@ -46,6 +61,9 @@ public class BookingTest {
assertNotEquals(0, book.getDay()); assertNotEquals(0, book.getDay());
} }
/**
* tests Month input and its functions.
*/
@Test @Test
public void testMonth() { public void testMonth() {
assertEquals(0, book.getMonth()); assertEquals(0, book.getMonth());
@ -53,6 +71,9 @@ public class BookingTest {
assertNotEquals(0, book.getMonth()); assertNotEquals(0, book.getMonth());
} }
/**
* tests Year input and its functions.
*/
@Test @Test
public void testYear() { public void testYear() {
assertEquals(2019, book.getYear()); assertEquals(2019, book.getYear());
@ -60,6 +81,9 @@ public class BookingTest {
assertNotEquals(2019, book.getYear()); assertNotEquals(2019, book.getYear());
} }
/**
* tests ServiceProvider in booking class and its functions.
*/
@Test @Test
public void testServiceprovider() { public void testServiceprovider() {
assertEquals(serviceprovider, book.getServiceprovider() ); assertEquals(serviceprovider, book.getServiceprovider() );
@ -68,6 +92,9 @@ public class BookingTest {
assertNotEquals(serviceprovider, book.getServiceprovider()); assertNotEquals(serviceprovider, book.getServiceprovider());
} }
/**
* tests HomeOwner in booking class and its functions.
*/
@Test @Test
public void testHomeowner() { public void testHomeowner() {
assertEquals(user, book.getHomeowner() ); assertEquals(user, book.getHomeowner() );
@ -76,6 +103,9 @@ public class BookingTest {
assertNotEquals(user, book.getHomeowner()); assertNotEquals(user, book.getHomeowner());
} }
/**
* tests Service in booking class and its functions.
*/
@Test @Test
public void testService() { public void testService() {
assertEquals(service, book.getService() ); assertEquals(service, book.getService() );
@ -84,12 +114,18 @@ public class BookingTest {
assertNotEquals(service, book.getService()); assertNotEquals(service, book.getService());
} }
/**
* tests Status and its functions by setting it up.
*/
@Test @Test
public void testStatus() { public void testStatus() {
book.setStatus(Booking.Status.CONFIRMED); book.setStatus(Booking.Status.CONFIRMED);
assertEquals(Booking.Status.CONFIRMED, book.getStatus()); assertEquals(Booking.Status.CONFIRMED, book.getStatus());
} }
/**
* tests Rating and its functions by setting it up.
*/
@Test @Test
public void testRating() { public void testRating() {
book.setRating(5); book.setRating(5);

View file

@ -15,5 +15,5 @@ password = testing
APK tested on a Sony Xperia XA2, model H3123 APK tested on a Sony Xperia XA2, model H3123
Build Status 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) [![CircleCI](https://circleci.com/gh/ebivibe/SEG2105-Olympus/tree/deliverable3.svg?style=svg&circle-token=01dbbc3800d7ee80871796675582a67ba7c83604)](https://circleci.com/gh/ebivibe/SEG2105-Olympus/tree/deliverable3)