changed loader stuff
This commit is contained in:
@@ -12,7 +12,7 @@ public class Coupon {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private String reward;
|
private String reward;
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,37 @@
|
|||||||
package com.a1.nextlocation.data;
|
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;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public interface Loader {
|
public interface Loader<T> {
|
||||||
void load();
|
T load();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.a1.nextlocation.recyclerview;
|
package com.a1.nextlocation.recyclerview;
|
||||||
|
|
||||||
public class LocationLoader implements Loader{
|
import com.a1.nextlocation.data.Location;
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
|
|
||||||
|
public class LocationLoader implements Loader<Location>{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location load() {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user