Merge pull request #15 from ebivibe/DBBranch

Changing gridview text colour to white
This commit is contained in:
FunwithaPorpoise 2018-10-31 12:58:05 -04:00 committed by GitHub
commit df6d80f729
5 changed files with 55 additions and 2 deletions

View file

@ -1,12 +1,17 @@
package com.uottawa.olympus.olympusservices;
import java.util.ArrayList;
import java.util.List;
public class Service {
private String name;
private double rate;
private List<ServiceProvider> serviceProviders;
Service(String name, double rate) {
this.name = name;
this.rate = rate;
serviceProviders = new ArrayList<ServiceProvider>();
}
public String getName() {
@ -24,4 +29,18 @@ public class Service {
public void setRate(double rate) {
this.rate = rate;
}
public boolean addServiceProvider(ServiceProvider user){
for (ServiceProvider listUser : serviceProviders){
if (user.getUsername().equals(listUser.getUsername())){
return false;
}
}
serviceProviders.add(user);
return true;
}
public List<ServiceProvider> getServiceProviders(){
return serviceProviders;
}
}

View file

@ -1,12 +1,31 @@
package com.uottawa.olympus.olympusservices;
import java.util.ArrayList;
import java.util.List;
public class ServiceProvider extends UserType {
private List<Service> services;
ServiceProvider(String username, String password, String firstname, String lastname){
super(username, password, firstname, lastname);
services = new ArrayList<>();
}
public String getRole(){ return "ServiceProvider"; }
public boolean addService(Service service){
for (Service listService : services){
if (service.getName().equals(listService.getName())){
return false;
}
}
services.add(service);
return true;
}
public List<Service> getServices(){
return services;
}
}

View file

@ -29,7 +29,7 @@ public class ServicesList extends AppCompatActivity implements NewServiceDialogF
services[(i+1)*2] = current[0];
services[(i+1)*2+1] = current[1];
}
ArrayAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, services);
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.simple_list_item_1_customized, services);
GridView gridView = findViewById(R.id.Services);
gridView.setAdapter(adapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

View file

@ -26,7 +26,7 @@ public class UsersList extends AppCompatActivity {
usernames[(i+1)*2] = current[0];
usernames[(i+1)*2+1] = current[3];
}
ArrayAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, usernames);
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.simple_list_item_1_customized, usernames);
GridView gridView = findViewById(R.id.Users);
gridView.setAdapter(adapter);
}

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="@android:color/white">
</TextView>