use of com.google.gson.Gson in project glimmr by brk3.
the class GsonHelper method marshallObject.
public boolean marshallObject(Object o, Bundle bundle, String key) {
Gson gson = new Gson();
String json = gson.toJson(o);
bundle.putString(key, json);
return true;
}
use of com.google.gson.Gson in project glimmr by brk3.
the class TaskQueueDelegateFactory method get.
public FileObjectQueue<T> get(String fileName, Class<T> taskType) {
final Converter<T> converter = new GsonConverter<T>(new Gson(), taskType);
final File queueFile = new File(mContext.getFilesDir(), fileName);
FileObjectQueue<T> delegate = null;
try {
delegate = new FileObjectQueue<T>(queueFile, converter);
} catch (IOException e) {
// TODO: how should we handle this
e.printStackTrace();
}
return delegate;
}
use of com.google.gson.Gson in project glimmr by brk3.
the class PhotosetViewerActivity method onRestoreInstanceState.
@Override
protected void onRestoreInstanceState(Bundle bundle) {
super.onRestoreInstanceState(bundle);
Gson gson = new Gson();
if (mPhotoset == null) {
String json = bundle.getString(KEY_PHOTOSET);
if (json != null) {
mPhotoset = gson.fromJson(json, Photoset.class);
} else {
Log.e(TAG, "No photoset found in savedInstanceState");
}
}
if (mUser == null) {
String json = bundle.getString(KEY_USER);
if (json != null) {
mUser = new Gson().fromJson(json, User.class);
} else {
Log.e(TAG, "No user found in savedInstanceState");
}
}
mPhotoset.setOwner(mUser);
initViewPager();
updateBottomOverlay();
}
use of com.google.gson.Gson in project bigbluebutton by bigbluebutton.
the class EventListenerImp method sendShareStartedEvent.
private void sendShareStartedEvent(ScreenShareStartedEvent event) {
Map<String, Object> data = new HashMap<String, Object>();
data.put("meetingId", event.meetingId);
data.put("streamId", event.streamId);
data.put("width", event.width);
data.put("height", event.height);
data.put("url", event.url);
data.put("session", event.session);
Map<String, Object> message = new HashMap<String, Object>();
Gson gson = new Gson();
message.put("msg", gson.toJson(data));
BroadcastClientMessage msg = new BroadcastClientMessage(event.meetingId, "screenShareStartedMessage", message);
sender.sendMessage(msg);
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", event.meetingId);
logData.put("streamId", event.streamId);
logData.put("width", event.width);
logData.put("height", event.height);
logData.put("url", event.url);
logData.put("session", event.session);
gson = new Gson();
String logStr = gson.toJson(logData);
log.info("Send to client screen share started message: data={}", logStr);
}
use of com.google.gson.Gson in project bigbluebutton by bigbluebutton.
the class EventListenerImp method sendStartShareRequestResponse.
private void sendStartShareRequestResponse(ScreenShareRequestTokenSuccessResponse event) {
Map<String, Object> data = new HashMap<String, Object>();
data.put("authToken", event.token);
data.put("jnlp", event.jnlp);
data.put("streamId", event.streamId);
data.put("session", event.session);
Map<String, Object> message = new HashMap<String, Object>();
Gson gson = new Gson();
message.put("msg", gson.toJson(data));
DirectClientMessage msg = new DirectClientMessage(event.meetingId, event.userId, "startShareRequestResponse", message);
sender.sendMessage(msg);
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", event.meetingId);
logData.put("userId", event.userId);
logData.put("session", event.session);
logData.put("authToken", event.token);
logData.put("jnlp", event.jnlp);
Gson gson2 = new Gson();
String logStr = gson2.toJson(logData);
log.info("Send to client start screen share request response: data={}", logStr);
}
Aggregations