changed loader stuff
This commit is contained in:
@@ -12,7 +12,7 @@ public class Coupon {
|
||||
*/
|
||||
@NonNull
|
||||
private String code;
|
||||
|
||||
|
||||
@NonNull
|
||||
private String reward;
|
||||
|
||||
|
||||
@@ -1,12 +1,37 @@
|
||||
package com.a1.nextlocation.data;
|
||||
|
||||
public class FileIO {
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
|
||||
public static void readFileData() {
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class FileIO<T> {
|
||||
|
||||
private Class<T> tClass;
|
||||
|
||||
|
||||
public Class<T> readFileData(Context context, String fileName) {
|
||||
Gson gson = new Gson();
|
||||
AssetManager am = context.getAssets();
|
||||
try {
|
||||
InputStream is = am.open(fileName);
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(is);
|
||||
T res = gson.fromJson(inputStreamReader,);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//TODO make
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void writeFileData() {
|
||||
|
||||
public void writeFileData(T objectToWrite) {
|
||||
//TODO make
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
public interface Loader {
|
||||
void load();
|
||||
public interface Loader<T> {
|
||||
T load();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.a1.nextlocation.recyclerview;
|
||||
|
||||
public class LocationLoader implements Loader{
|
||||
@Override
|
||||
public void load() {
|
||||
import com.a1.nextlocation.data.Location;
|
||||
|
||||
public class LocationLoader implements Loader<Location>{
|
||||
|
||||
@Override
|
||||
public Location load() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user