getEvent seems to be working...

This commit is contained in:
Graham Jones
2022-01-17 23:04:43 +00:00
parent cd5ef5192a
commit a4a1faf67c
2 changed files with 20 additions and 9 deletions

View File

@@ -52,17 +52,29 @@ public class EditEventActivity extends AppCompatActivity
Log.v(TAG, "onCreate()");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_event);
mWac = new WebApiConnection(this, this, this, this);
mLm = new LogManager(this);
Bundle extras = getIntent().getExtras();
if (extras != null) {
Long eventId = extras.getLong("eventId");
Log.v(TAG, "onCreate - eventId=" + eventId);
mEventId = eventId;
mWac.getEvent(mEventId, (JSONObject eventObj) -> {
mEventObj = eventObj;
updateUi();
// FIXME: modify updateUi to use mEventObj
}
);
Log.v(TAG, "onCreate - mEventId=" + mEventId);
try {
mWac.getEvent(mEventId, (JSONObject eventObj) -> {
Log.v(TAG,"onCreate.getEvent");
mEventObj = eventObj;
Log.v(TAG, "onCreate.getEvent: eventObj=" + eventObj.toString());
updateUi();
// FIXME: modify updateUi to use mEventObj
}
);
} catch (Exception e) {
Log.e(TAG,"ERROR:"+e.getMessage());
e.printStackTrace();
}
}
mUtil = new OsdUtil(this, serverStatusHandler);
@@ -77,8 +89,6 @@ public class EditEventActivity extends AppCompatActivity
mEventSubTypeRg = findViewById(R.id.eventSubTypeRg);
mEventSubTypeRg.setOnCheckedChangeListener(onEventSubTypeChange);
mWac = new WebApiConnection(this, this, this, this);
mLm = new LogManager(this);
// Retrieve the JSONObject containing the standard event types.
// Note this obscure syntax is to avoid having to create another interface, so it is worth it :)

View File

@@ -219,6 +219,7 @@ public class WebApiConnection {
}
public boolean getEvent(Long eventId, Consumer<JSONObject> callback) {
//Long eventId=Long.valueOf(285);
Log.v(TAG, "getEvent()");
String urlStr = mUrlBase + "/api/events/"+eventId;
Log.v(TAG, "getEvent(): urlStr=" + urlStr);