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