Merge pull request #15 from ebivibe/DBBranch
Changing gridview text colour to white
This commit is contained in:
commit
674ed9352f
5 changed files with 55 additions and 2 deletions
|
@ -1,12 +1,17 @@
|
||||||
package com.uottawa.olympus.olympusservices;
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Service {
|
public class Service {
|
||||||
private String name;
|
private String name;
|
||||||
private double rate;
|
private double rate;
|
||||||
|
private List<ServiceProvider> serviceProviders;
|
||||||
|
|
||||||
Service(String name, double rate) {
|
Service(String name, double rate) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rate = rate;
|
this.rate = rate;
|
||||||
|
serviceProviders = new ArrayList<ServiceProvider>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -24,4 +29,18 @@ public class Service {
|
||||||
public void setRate(double rate) {
|
public void setRate(double rate) {
|
||||||
this.rate = 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,31 @@
|
||||||
package com.uottawa.olympus.olympusservices;
|
package com.uottawa.olympus.olympusservices;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ServiceProvider extends UserType {
|
public class ServiceProvider extends UserType {
|
||||||
|
|
||||||
|
private List<Service> services;
|
||||||
|
|
||||||
ServiceProvider(String username, String password, String firstname, String lastname){
|
ServiceProvider(String username, String password, String firstname, String lastname){
|
||||||
super(username, password, firstname, lastname);
|
super(username, password, firstname, lastname);
|
||||||
|
services = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRole(){ return "ServiceProvider"; }
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class ServicesList extends AppCompatActivity implements NewServiceDialogF
|
||||||
services[(i+1)*2] = current[0];
|
services[(i+1)*2] = current[0];
|
||||||
services[(i+1)*2+1] = current[1];
|
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 gridView = findViewById(R.id.Services);
|
||||||
gridView.setAdapter(adapter);
|
gridView.setAdapter(adapter);
|
||||||
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class UsersList extends AppCompatActivity {
|
||||||
usernames[(i+1)*2] = current[0];
|
usernames[(i+1)*2] = current[0];
|
||||||
usernames[(i+1)*2+1] = current[3];
|
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 gridView = findViewById(R.id.Users);
|
||||||
gridView.setAdapter(adapter);
|
gridView.setAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in a new issue