
moved from assistant to one single activity model with dialogs and navigation drawer as main content holder completed separate threaded queue based service to communicate with daemon(s) added first few elements to the nav drawer
36 lines
887 B
Java
36 lines
887 B
Java
package com.idlegandalf.ledd.components;
|
|
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
import java.util.UUID;
|
|
|
|
import lombok.Getter;
|
|
|
|
@Getter
|
|
public class Sendable {
|
|
private Host recipient;
|
|
private JSONObject message;
|
|
private String ref;
|
|
private AnswerTask onAnswer;
|
|
|
|
public Sendable(JSONObject msg, AnswerTask task, Host host) throws JSONException {
|
|
this(msg, UUID.randomUUID().toString(), task, host);
|
|
}
|
|
|
|
public Sendable(JSONObject msg, String ref, AnswerTask task, Host recipient) throws JSONException {
|
|
this.message = msg;
|
|
this.ref = ref;
|
|
this.message.put("ref", ref);
|
|
this.onAnswer = task;
|
|
this.recipient = recipient;
|
|
}
|
|
|
|
public void onResponse(JSONObject object) {
|
|
if (onAnswer != null) {
|
|
onAnswer.response = object;
|
|
onAnswer.run();
|
|
}
|
|
}
|
|
}
|