Commit 1d96eec0 authored by Christof Wolke's avatar Christof Wolke

event wird nun gespeichert und eine liste von appNamen wird im Response objekt geparst

parent 0f4c2c74
......@@ -4,14 +4,14 @@ import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import java.io.Serializable;
import java.util.ArrayList;
import classes.apps.AppContainer;
import co.uk.rushorm.core.RushObject;
import co.uk.rushorm.core.annotations.RushClassSerializationName;
/**
* Created by Christof on 23.08.2016.
*/
@JsonObject
public class Event extends RushObject implements Serializable {
......@@ -21,17 +21,16 @@ public class Event extends RushObject implements Serializable {
@JsonField(name = "name")
private String name;
@JsonField(name = "appContainer")
private AppContainer appContainer;
@JsonField(name = "apps")
private ArrayList<String> apps;
public Event() {
}
public Event(int eventId, String name, AppContainer appContainer) {
public Event(int eventId, String name, ArrayList<String> apps) {
this.eventId = eventId;
this.name = name;
this.appContainer = appContainer;
this.apps = apps;
}
......@@ -51,12 +50,12 @@ public class Event extends RushObject implements Serializable {
this.name = name;
}
public AppContainer getAppContainer() {
return appContainer;
public ArrayList<String> getApps() {
return apps;
}
public void setAppContainer(AppContainer appContainer) {
this.appContainer = appContainer;
public void setApps(ArrayList<String> apps) {
this.apps = apps;
}
@Override
......@@ -64,7 +63,7 @@ public class Event extends RushObject implements Serializable {
return "Event{" +
"eventId=" + eventId +
", name='" + name + '\'' +
", appContainer=" + appContainer +
", apps=" + apps +
'}';
}
}
......@@ -14,18 +14,13 @@ import com.estimote.sdk.BeaconManager;
import com.estimote.sdk.Region;
import com.estimote.sdk.SystemRequirementsChecker;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import classes.Event;
import classes.LocalStorage;
import classes.apps.AppContainer;
import classes.apps.Feedback;
import classes.apps.Forum;
import de.uni_oldenburg.bidl.R;
import de.uni_oldenburg.bidl.guest_view.LoginActivity;
import services.db.DBHelper;
import services.servercommunication.NetworkService;
......@@ -82,7 +77,6 @@ public class MainActivity extends AppCompatActivity {
if (!list.isEmpty() && !list.get(0).equals(nearestBeacon)){
nearestBeacon = list.get(0);
getEventFromServer(nearestBeacon);
setAppList(event);
} if (list.isEmpty()){
showMessage(getResources().getString(R.string.noBeaconFound));
}
......@@ -94,17 +88,6 @@ public class MainActivity extends AppCompatActivity {
}
private void setAppList(Event event) {
List<AppContainer> container = DBHelper.getAllAps();
AppContainer app = container.get(0);
Feedback feedback = app.getFeedback();
Log.d(TAG, "TEST "+feedback.getFeedbackId());
}
private void setEvent(Event event) {
this.event = this.event;
}
private void getEventFromServer(Beacon nearestBeacon) {
String uud = nearestBeacon.getProximityUUID().toString().toUpperCase();
int major = nearestBeacon.getMajor();
......@@ -114,8 +97,9 @@ public class MainActivity extends AppCompatActivity {
@Override
public void done(Event event) {
if (event != null){
event.save();
//setEvent(event);
//TODO: event.getApps und die Liste dem gridadapter übergeben und die Main View verändern.
Log.d(TAG, "TEST: "+event.getEventId()+" "+event.getName()+" "+event.getApps());
}else{
showMessage(getResources().getString(R.string.noCurrentEvent));
......
......@@ -43,10 +43,5 @@ public class DBHelper {
}
public static List<AppContainer> getAllAps(){
List<AppContainer> container = new RushSearch().find(AppContainer.class);
return container;
}
}
......@@ -162,6 +162,7 @@ public abstract class NetworkService {
if (response.isSuccessful()){
String responseString = response.body().string();
Event event = LoganSquare.parse(responseString, Event.class);
event.save();
handler.done(event);
}
}catch (IOException e){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment