finished loading
This commit is contained in:
@@ -6,21 +6,20 @@ import com.a1.nextlocation.data.Coupon;
|
||||
import com.a1.nextlocation.data.FileIO;
|
||||
import com.a1.nextlocation.data.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CouponLoader implements Loader<List<Coupon>> {
|
||||
private final Context context;
|
||||
|
||||
public CouponLoader(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Coupon> load() {
|
||||
FileIO<List<Coupon>> fileIO = new FileIO<>();
|
||||
try {
|
||||
return fileIO.readFileData(context,"coupons.json").newInstance();
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
FileIO<ArrayList<Coupon>> fileIO = new FileIO<>();
|
||||
ArrayList<Coupon> res = fileIO.readFileData(context, "coupons.json");
|
||||
return res == null ? new ArrayList<>() : res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@ import android.content.Context;
|
||||
import com.a1.nextlocation.data.FileIO;
|
||||
import com.a1.nextlocation.data.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LocationLoader implements Loader<List<Location>>{
|
||||
public class LocationLoader implements Loader<List<Location>> {
|
||||
private final Context context;
|
||||
|
||||
public LocationLoader(Context context) {
|
||||
@@ -16,12 +17,10 @@ public class LocationLoader implements Loader<List<Location>>{
|
||||
|
||||
@Override
|
||||
public List<Location> load() {
|
||||
FileIO<List<Location>> fileIO = new FileIO<>();
|
||||
try {
|
||||
return fileIO.readFileData(context,"locations.json").newInstance();
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
FileIO<ArrayList<Location>> fileIO = new FileIO<>();
|
||||
|
||||
ArrayList<Location> res = fileIO.readFileData(context, "locations.json");
|
||||
return res == null ? new ArrayList<>() : res;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,12 @@ import com.a1.nextlocation.data.FileIO;
|
||||
import com.a1.nextlocation.data.Location;
|
||||
import com.a1.nextlocation.data.Route;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RouteLoader implements Loader<List<Route>> {
|
||||
private final Context context;
|
||||
|
||||
public RouteLoader(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
@@ -17,12 +19,10 @@ public class RouteLoader implements Loader<List<Route>> {
|
||||
@Override
|
||||
public List<Route> load() {
|
||||
|
||||
FileIO<List<Route>> fileIO = new FileIO<>();
|
||||
try {
|
||||
return fileIO.readFileData(context,"routes.json").newInstance();
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
FileIO<ArrayList<Route>> fileIO = new FileIO<>();
|
||||
|
||||
ArrayList<Route> res = fileIO.readFileData(context, "routes.json");
|
||||
return res == null ? new ArrayList<>() : res;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user