From ff0418d4cd8755233950d3ee744eafc1669d7661 Mon Sep 17 00:00:00 2001 From: IvanaE <33612255+ebivibe@users.noreply.github.com> Date: Mon, 26 Nov 2018 21:19:00 -0500 Subject: [PATCH 1/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e78c1f..03d54a1 100644 --- a/README.md +++ b/README.md @@ -15,5 +15,5 @@ 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) +[![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) From 611cf2934cb4358c4480880570534a1e090c02be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Berk=20Ba=C5=9Fo=C4=9Flu?= Date: Tue, 27 Nov 2018 17:30:53 -0500 Subject: [PATCH 2/4] Added comments --- .../.idea/caches/build_file_checksums.ser | Bin 537 -> 537 bytes .../olympus/olympusservices/LogInTest.java | 22 ----- .../olympus/olympusservices/SignUpTest.java | 90 ------------------ .../olympus/olympusservices/BookingTest.java | 36 +++++++ 4 files changed, 36 insertions(+), 112 deletions(-) delete mode 100644 OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/LogInTest.java delete mode 100644 OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java diff --git a/OlympusServices/.idea/caches/build_file_checksums.ser b/OlympusServices/.idea/caches/build_file_checksums.ser index 66d481e50942458fe6b32ac43428c079c4495dce..a72ac4f80232789a26d38690c2e779bbdd3d1f86 100644 GIT binary patch delta 66 zcmV-I0KNa21epYom;_flQAm-Ti4Q14I$TwAWpZ;|VqtW3Xp^=9Hj^a*a1*WPSOtKy Y?=A2okcKFiw>@+K5tF|G8 Sb6iPwVQyiQGyyh~>;Wye0~S;O diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/LogInTest.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/LogInTest.java deleted file mode 100644 index 0487845..0000000 --- a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/LogInTest.java +++ /dev/null @@ -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 mActivityTestRule = new ActivityTestRule(LogIn.class); - - @Test - public void checkSignIn() throws Exception{ - - } -} \ No newline at end of file diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java deleted file mode 100644 index b299158..0000000 --- a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java +++ /dev/null @@ -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 mActivityTestRule = new ActivityTestRule(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; - } -} \ No newline at end of file diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/BookingTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/BookingTest.java index 0faeded..5e20336 100644 --- a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/BookingTest.java +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/BookingTest.java @@ -11,6 +11,9 @@ public class BookingTest { Booking book = new Booking(13, 30, 16, 0, 0, 0, 2019, serviceprovider, user, service); + /** + * tests starth input and its functions. + */ @Test public void testStarth() { assertEquals(13, book.getStarth()); @@ -18,6 +21,9 @@ public class BookingTest { assertNotEquals(13, book.getStarth()); } + /** + * tests startmin input and its functions. + */ @Test public void testStartmin() { assertEquals(30, book.getStartmin()); @@ -25,6 +31,9 @@ public class BookingTest { assertNotEquals(30, book.getStartmin()); } + /** + * tests Endh input and its functions. + */ @Test public void testEndh() { assertEquals(16, book.getEndh()); @@ -32,6 +41,9 @@ public class BookingTest { assertNotEquals(16, book.getEndh()); } + /** + * tests Endmin input and its functions. + */ @Test public void testEndmin() { assertEquals(0, book.getEndmin()); @@ -39,6 +51,9 @@ public class BookingTest { assertNotEquals(0, book.getEndmin()); } + /** + * tests Day input and its functions. + */ @Test public void testDay() { assertEquals(0, book.getDay()); @@ -46,6 +61,9 @@ public class BookingTest { assertNotEquals(0, book.getDay()); } + /** + * tests Month input and its functions. + */ @Test public void testMonth() { assertEquals(0, book.getMonth()); @@ -53,6 +71,9 @@ public class BookingTest { assertNotEquals(0, book.getMonth()); } + /** + * tests Year input and its functions. + */ @Test public void testYear() { assertEquals(2019, book.getYear()); @@ -60,6 +81,9 @@ public class BookingTest { assertNotEquals(2019, book.getYear()); } + /** + * tests ServiceProvider in booking class and its functions. + */ @Test public void testServiceprovider() { assertEquals(serviceprovider, book.getServiceprovider() ); @@ -68,6 +92,9 @@ public class BookingTest { assertNotEquals(serviceprovider, book.getServiceprovider()); } + /** + * tests HomeOwner in booking class and its functions. + */ @Test public void testHomeowner() { assertEquals(user, book.getHomeowner() ); @@ -76,6 +103,9 @@ public class BookingTest { assertNotEquals(user, book.getHomeowner()); } + /** + * tests Service in booking class and its functions. + */ @Test public void testService() { assertEquals(service, book.getService() ); @@ -84,12 +114,18 @@ public class BookingTest { assertNotEquals(service, book.getService()); } + /** + * tests Status and its functions by setting it up. + */ @Test public void testStatus() { book.setStatus(Booking.Status.CONFIRMED); assertEquals(Booking.Status.CONFIRMED, book.getStatus()); } + /** + * tests Rating and its functions by setting it up. + */ @Test public void testRating() { book.setRating(5); From a5a25902d190e953d42b903de2506893358af42a Mon Sep 17 00:00:00 2001 From: IvanaE Date: Wed, 28 Nov 2018 13:11:37 -0500 Subject: [PATCH 3/4] added comment to ui --- OlympusServices/.idea/misc.xml | 2 +- .../app/src/main/res/layout/rating_item.xml | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/OlympusServices/.idea/misc.xml b/OlympusServices/.idea/misc.xml index dc34569..cc51e58 100644 --- a/OlympusServices/.idea/misc.xml +++ b/OlympusServices/.idea/misc.xml @@ -25,7 +25,7 @@ - + diff --git a/OlympusServices/app/src/main/res/layout/rating_item.xml b/OlympusServices/app/src/main/res/layout/rating_item.xml index a04f15e..5a5f2c8 100644 --- a/OlympusServices/app/src/main/res/layout/rating_item.xml +++ b/OlympusServices/app/src/main/res/layout/rating_item.xml @@ -1,7 +1,8 @@ + android:layout_height="match_parent" + android:orientation="vertical"> - - - + //component used from https://github.com/rengwuxian/MaterialEditText + + + + + + From ec9fabdef26fea3714c8b7dde2075840ceb7e18d Mon Sep 17 00:00:00 2001 From: IvanaE Date: Wed, 28 Nov 2018 22:12:08 -0500 Subject: [PATCH 4/4] latest code --- .../.idea/caches/build_file_checksums.ser | Bin 537 -> 537 bytes OlympusServices/.idea/misc.xml | 2 +- .../olympus/olympusservices/Bookings.java | 35 ++- .../olympus/olympusservices/DBHelper.java | 10 +- .../olympusservices/FindServiceProvider.java | 98 +++++++- .../olympus/olympusservices/MakeBooking.java | 24 +- .../layout/activity_find_service_provider.xml | 38 +++- .../src/main/res/layout/booking_list_item.xml | 4 +- .../main/res/layout/rating_comment_item.xml | 61 +++++ .../app/src/main/res/layout/rating_item.xml | 2 + .../src/main/res/layout/service_list_item.xml | 12 + .../layout/simple_list_item_1_customized.xml | 4 +- .../app/src/main/res/layout/sp_info_item.xml | 212 ++++++++++++++++++ 13 files changed, 461 insertions(+), 41 deletions(-) create mode 100644 OlympusServices/app/src/main/res/layout/rating_comment_item.xml create mode 100644 OlympusServices/app/src/main/res/layout/sp_info_item.xml diff --git a/OlympusServices/.idea/caches/build_file_checksums.ser b/OlympusServices/.idea/caches/build_file_checksums.ser index a72ac4f80232789a26d38690c2e779bbdd3d1f86..03c8afea49b0bcc4c038eb4a4f251a3197c55a0d 100644 GIT binary patch delta 60 zcmV-C0K@;81epYom;_wl Sb6iPwVQyiQGyyh~>;WzIo)?k; delta 66 zcmV-I0KNa21epYom;_flQAm-Ti4Q14I$TwAWpZ;|VqtW3Xp^=9Hj^a*a1*WPSOtKy Y?=A2okcKFiw>@+K5tF|G8 - + diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Bookings.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Bookings.java index 5577ecc..c7b38ca 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Bookings.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/Bookings.java @@ -12,11 +12,14 @@ import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; +import java.util.List; + public class Bookings extends AppCompatActivity { //field for RecyclerView @@ -37,14 +40,18 @@ public class Bookings extends AppCompatActivity { username = bundle.getString("username"); dbhelper = new DBHelper(this); - //Booking[] bookings = (Booking[])dbhelper.findBookings(username).toArray(); + List booking = (List)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"))}; + */ mRecyclerView = (RecyclerView) findViewById(R.id.Bookings); mLayoutManager = new LinearLayoutManager(this); mRecyclerView.setLayoutManager(mLayoutManager); - mAdapter = new MyAdapter(testbooking, this); + mAdapter = new MyAdapter(bookings, this); mRecyclerView.setAdapter(mAdapter); } @@ -98,7 +105,7 @@ public class Bookings extends AppCompatActivity { @Override public void onBindViewHolder(BookingHolder holder, int 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.service.setText(booking.getService().getName()); String day; @@ -173,6 +180,7 @@ public class Bookings extends AppCompatActivity { year, (ServiceProvider)dbhelper.findUserByUsername(serviceprovider.getText().toString()), (HomeOwner)dbhelper.findUserByUsername(homeowner.getText().toString()), dbhelper.findService(service.getText().toString())))){ + Toast.makeText(Bookings.this,"Booking is confirmed",Toast.LENGTH_LONG).show(); Bookings.this.recreate(); } @@ -213,21 +221,30 @@ public class Bookings extends AppCompatActivity { RadioGroup ratingselect = ((AlertDialog) arg0).findViewById(R.id.RatingSelect); int selectedId = ratingselect.getCheckedRadioButtonId(); 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); 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()), (HomeOwner)dbhelper.findUserByUsername(homeowner.getText().toString()), - dbhelper.findService(service.getText().toString()));; - if(!dbhelper.addRating(booking, rating)){ - Toast.makeText(context, "Rating could not be added", Toast.LENGTH_SHORT).show(); + dbhelper.findService(service.getText().toString())); + */ + 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{ Bookings.this.recreate(); } } + else{ + Toast.makeText(Bookings.this, "Rating and comment must be filled in", Toast.LENGTH_SHORT).show(); + } } }); diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java index 3934647..a585ceb 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java @@ -1185,7 +1185,7 @@ public class DBHelper extends SQLiteOpenHelper { + COLUMN_BOOKINGYEAR + " = ? AND " + COLUMN_BOOKINGMONTH + " = ? AND " + COLUMN_BOOKINGDATE + " = ? AND " - + COLUMN_BOOKINGSTART + " = ?)", + + COLUMN_BOOKINGSTART + " = ?", new String[] {booking.getServiceprovider().getUsername(), booking.getHomeowner().getUsername(), String.valueOf(booking.getYear()), @@ -1274,9 +1274,9 @@ public class DBHelper extends SQLiteOpenHelper { public List getAllRatingsAndComments(String serviceProviderName, String serviceName){ return getAll("SELECT " + COLUMN_BOOKINGHOMEOWNER +", " + COLUMN_RATING + ", " + COLUMN_COMMENT + " FROM " + TABLE_BOOKINGS - + " WHERE " + COLUMN_BOOKINGSERVICEPROVIDER + " = " + serviceProviderName - + " AND " + COLUMN_BOOKINGSERVICE + " = " + serviceName - + " AND " + COLUMN_RATING + " > 0"); + + " WHERE " + COLUMN_BOOKINGSERVICEPROVIDER + " = '" + serviceProviderName + + "' AND " + COLUMN_BOOKINGSERVICE + " = '" + serviceName + + "' AND " + COLUMN_RATING + " > 0"); } public String[] getSpecificRatingAndComment(String serviceProviderName, String serviceName, @@ -1739,7 +1739,7 @@ public class DBHelper extends SQLiteOpenHelper { (ServiceProvider) findUserByUsername(cursor.getString(0)) : serviceProvider); HomeOwner homeowner = (homeOwner == null ? (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, serviceprovider, homeowner, service); booking.setStatus(status); diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/FindServiceProvider.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/FindServiceProvider.java index 1f526c7..717d6f7 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/FindServiceProvider.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/FindServiceProvider.java @@ -3,9 +3,11 @@ package com.uottawa.olympus.olympusservices; import android.app.DatePickerDialog; import android.app.TimePickerDialog; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.support.annotation.NonNull; import android.support.design.widget.Snackbar; +import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; @@ -13,8 +15,10 @@ import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.DatePicker; +import android.widget.ListView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.RatingBar; @@ -78,6 +82,18 @@ public class FindServiceProvider extends AppCompatActivity { startActivity(intent); 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){ MaterialSpinner spinner = findViewById(R.id.ServicesInput); Button button = findViewById(R.id.Start); @@ -320,6 +336,7 @@ public class FindServiceProvider extends AppCompatActivity { String[] serviceprovider = serviceProviders[position]; holder.name.setText(serviceprovider[1]+" "+serviceprovider[2]); holder.rate.setText(""+serviceprovider[3]); + holder.username.setText(serviceprovider[0]); @@ -336,18 +353,93 @@ public class FindServiceProvider extends AppCompatActivity { TextView name; TextView rate; + TextView username; public ProviderHolder(View row){ super(row); name = row.findViewById(R.id.Name); rate = row.findViewById(R.id.Rate); + username = row.findViewById(R.id.Username); row.setOnClickListener(this); } @Override public void onClick(View view) { - TextView nameview = (TextView)view.findViewById(R.id.Name); - String name = nameview.getText().toString(); - makeBooking(name); + TextView nameview = (TextView)view.findViewById(R.id.Username); + 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); + } + }); + + 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 randc = dbHelper.getAllRatingsAndComments(name,spinner.getText().toString()); + String[] ratings = new String[randc.size()]; + for(int i=0; i(FindServiceProvider.this, R.layout.simple_list_item_1_customized, ratings); + + ListView listView = (ListView) alertDialog.findViewById(R.id.RatingList); + listView.setAdapter(adapter); + + + } diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/MakeBooking.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/MakeBooking.java index b75780f..5c51195 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/MakeBooking.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/MakeBooking.java @@ -81,17 +81,21 @@ public class MakeBooking extends AppCompatActivity { else{ if (starth + +