|
@@ -1,12 +1,18 @@
|
|
|
package com.example.yiupang.freefoodfinder;
|
|
package com.example.yiupang.freefoodfinder;
|
|
|
|
|
|
|
|
|
|
+import android.content.Context;
|
|
|
|
|
+import android.content.Intent;
|
|
|
import android.util.Log;
|
|
import android.util.Log;
|
|
|
|
|
+import android.view.View;
|
|
|
|
|
+import android.widget.AdapterView;
|
|
|
|
|
+import android.widget.ListView;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fasterxml.jackson.databind.type.TypeFactory;
|
|
import com.fasterxml.jackson.databind.type.TypeFactory;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
|
+import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -14,9 +20,10 @@ import java.util.List;
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-public class Utility
|
|
|
|
|
|
|
+class Utility
|
|
|
{
|
|
{
|
|
|
- public static List<Event> parseFromJSONToEventObjs(JsonNode node)
|
|
|
|
|
|
|
+ private Utility(){}
|
|
|
|
|
+ static List<Event> parseFromJSONToEventObjs(JsonNode node)
|
|
|
{
|
|
{
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
TypeFactory typeFactory = mapper.getTypeFactory();
|
|
TypeFactory typeFactory = mapper.getTypeFactory();
|
|
@@ -30,7 +37,19 @@ public class Utility
|
|
|
{
|
|
{
|
|
|
Log.d("size: ", e + "");
|
|
Log.d("size: ", e + "");
|
|
|
}
|
|
}
|
|
|
- return null;
|
|
|
|
|
|
|
+ return new LinkedList<>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ static Intent getDetail(Event selectedEvent, Context context)
|
|
|
|
|
+ {
|
|
|
|
|
+ Intent details = new Intent(context, EventDetailsScreen.class);
|
|
|
|
|
+
|
|
|
|
|
+ details.putExtra("selectedEventName", selectedEvent.getName());
|
|
|
|
|
+ details.putExtra("selectedEventTime", selectedEvent.getTime());
|
|
|
|
|
+ details.putExtra("selectedEventPlace", selectedEvent.getPlace());
|
|
|
|
|
+ details.putExtra("selectedEventDesc", selectedEvent.getDescription());
|
|
|
|
|
+ details.putExtra("selectedEventFoodType", selectedEvent.getFoodType());
|
|
|
|
|
+
|
|
|
|
|
+ return details;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|