The following functionality is to be added in the SearchUtil class.
The method in which this is implemented should receive a Service objects which has been selected using the ServiceSelectorActivity.
First, retrieve all users and loop through them (only considering users of type service provider). Next, get the service provider profile. Using the profile, loop through all the services provided by this service provider. If a service matches (using the equals method in Service; implement it to check if the name and hourly rate are equal, not the id) then break add this service provider user object to an array list of matched service providers. This signifies that this service provider provides the requested service. Now move on to the next one in the loop. The array list should be passed into the method so that it can populate it (retrieving data from firebase is asynchronous therefore making it impossible to return anything from this method).
The following functionality is to be added in the
SearchUtil
class.The method in which this is implemented should receive a
Service
objects which has been selected using theServiceSelectorActivity
.First, retrieve all users and loop through them (only considering users of type service provider). Next, get the service provider profile. Using the profile, loop through all the services provided by this service provider. If a service matches (using the equals method in
Service
; implement it to check if the name and hourly rate are equal, not the id) then break add this service provider user object to an array list of matched service providers. This signifies that this service provider provides the requested service. Now move on to the next one in the loop. The array list should be passed into the method so that it can populate it (retrieving data from firebase is asynchronous therefore making it impossible to return anything from this method).