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()"); Log.v(TAG, "onCreate()");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_event); setContentView(R.layout.activity_edit_event);
mWac = new WebApiConnection(this, this, this, this);
mLm = new LogManager(this);
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
if (extras != null) { if (extras != null) {
Long eventId = extras.getLong("eventId"); Long eventId = extras.getLong("eventId");
Log.v(TAG, "onCreate - eventId=" + eventId);
mEventId = eventId; mEventId = eventId;
mWac.getEvent(mEventId, (JSONObject eventObj) -> { Log.v(TAG, "onCreate - mEventId=" + mEventId);
mEventObj = eventObj; try {
updateUi(); mWac.getEvent(mEventId, (JSONObject eventObj) -> {
// FIXME: modify updateUi to use mEventObj 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); mUtil = new OsdUtil(this, serverStatusHandler);
@@ -77,8 +89,6 @@ public class EditEventActivity extends AppCompatActivity
mEventSubTypeRg = findViewById(R.id.eventSubTypeRg); mEventSubTypeRg = findViewById(R.id.eventSubTypeRg);
mEventSubTypeRg.setOnCheckedChangeListener(onEventSubTypeChange); mEventSubTypeRg.setOnCheckedChangeListener(onEventSubTypeChange);
mWac = new WebApiConnection(this, this, this, this);
mLm = new LogManager(this);
// Retrieve the JSONObject containing the standard event types. // 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 :) // 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) { public boolean getEvent(Long eventId, Consumer<JSONObject> callback) {
//Long eventId=Long.valueOf(285);
Log.v(TAG, "getEvent()"); Log.v(TAG, "getEvent()");
String urlStr = mUrlBase + "/api/events/"+eventId; String urlStr = mUrlBase + "/api/events/"+eventId;
Log.v(TAG, "getEvent(): urlStr=" + urlStr); Log.v(TAG, "getEvent(): urlStr=" + urlStr);