Updated managers so they can load

This commit is contained in:
RemoMeijer
2020-12-17 11:16:03 +01:00
parent 9e8e9f4cdd
commit 1f835a94b0
3 changed files with 43 additions and 23 deletions

View File

@@ -1,23 +1,31 @@
package com.a1.nextlocation.recyclerview;
import android.content.Context;
import com.a1.nextlocation.data.Coupon;
import java.util.List;
public class CouponListManager {
private List<Coupon> coupon;
public CouponListManager(){
private List<Coupon> couponList;
private Context context;
public CouponListManager(Context context){
this.context = context;
}
public List<Coupon> getCoupon() {
return coupon;
public List<Coupon> getCouponList() {
return couponList;
}
public void setCoupon(List<Coupon> location) {
this.coupon = coupon;
public Coupon getCoupon(int place) {
return couponList.get(place);
}
public void load(){
CouponLoader couponLoader = new CouponLoader(this.context);
this.couponList = couponLoader.load();
}
}

View File

@@ -1,22 +1,31 @@
package com.a1.nextlocation.recyclerview;
import android.content.Context;
import com.a1.nextlocation.data.Location;
import java.util.List;
public class LocationListManager {
private List<Location> location;
private List<Location> locationList;
private Context context;
public LocationListManager(){
public LocationListManager(Context context){
this.context = context;
}
public List<Location> getLocation() {
return location;
public List<Location> getLocationList() {
return locationList;
}
public void setLocation(List<Location> location) {
this.location = location;
public Location getLocation(int place) {
return locationList.get(place);
}
public void load() {
LocationLoader locationLoader = new LocationLoader(this.context);
this.locationList = locationLoader.load();
}
}

View File

@@ -1,27 +1,30 @@
package com.a1.nextlocation.recyclerview;
import android.content.Context;
import com.a1.nextlocation.data.Route;
import java.util.List;
public class RouteListManager implements Loader{
public class RouteListManager{
List<Route> routes;
public RouteListManager(){
private List<Route> routeList;
private Context context;
public RouteListManager(Context context){
this.context = context;
}
public List<Route> getRoutes() {
return routes;
public List<Route> getRouteList() {
return routeList;
}
public void setRoutes(List<Route> routes) {
this.routes = routes;
public Route getRoute(int place) {
return routeList.get(place);
}
@Override
public void load() {
RouteLoader routeLoader = new RouteLoader(this.context);
this.routeList = routeLoader.load();
}
}