use of com.abewy.android.apps.klyph.core.fql.Status in project Klyph by jonathangerbaud.
the class StreamFragment method populate.
@Override
protected void populate(List<GraphObject> data) {
if (data.size() > 0) {
if (isFirstLoad()) {
if (isStreamAvailableOnLaunch) {
GraphObject object = data.get(0);
if (object instanceof Status) {
initVariables((Status) object);
} else if (object instanceof Link) {
initVariables((Link) object);
} else if (object instanceof Photo) {
initVariables((Photo) object);
}
// Remove loading
getAdapter().removeAt(1);
likeTitle = new StreamLikeCount();
getAdapter().add(likeTitle);
refreshLikeCount();
data.remove(0);
if (stream.getComment_info().getCan_comment()) {
sendButton.setVisibility(View.VISIBLE);
sendEditText.setVisibility(View.VISIBLE);
}
if (getActivity() != null)
((FragmentActivity) getActivity()).invalidateOptionsMenu();
setRequestType(Query.COMMENTS);
setNoMoreData(false);
endLoading();
refresh();
} else {
if (data.get(0) instanceof Stream) {
Stream stream = (Stream) data.get(0);
// setIsFirstLoad(true);
setStreamAndLoad(stream);
refresh();
} else {
super.populate(new ArrayList<GraphObject>());
}
}
} else {
super.populate(data);
}
} else {
if (isFirstLoad() && isStreamAvailableOnLaunch) {
// Remove loading
getAdapter().removeAt(1);
}
super.populate(data);
}
setNoMoreData(!isFirstLoad() && (data.size() == 0 || (getRequest().getPagingNext() == null || getRequest().getPagingNext().length() == 0)));
if (getAdapter().getCount() > 2) {
setOffset(getAfterCursor());
}
}
use of com.abewy.android.apps.klyph.core.fql.Status in project Klyph by jonathangerbaud.
the class StreamStatus method mergeData.
public void mergeData(StreamHolder holder, Stream stream) {
final Status status = stream.getStatus();
new StreamHeader(specialLayout).mergeData(holder, stream, status);
new StreamButtonBar(getParentAdapter(), specialLayout).mergeData(holder, stream, status);
if (status.getMessage().length() > 0) {
holder.getMessage().setText(status.getMessage());
holder.getMessage().setVisibility(View.VISIBLE);
}
}
use of com.abewy.android.apps.klyph.core.fql.Status in project Klyph by jonathangerbaud.
the class StatusDeserializer method deserializeObject.
@Override
public GraphObject deserializeObject(JSONObject data) {
Status status = new Status();
deserializePrimitives(status, data);
status.setLike_info((LikeInfo) new LikesDeserializer().deserializeObject(getJsonObject(data, "like_info")));
status.setComment_info((CommentInfo) new StreamDeserializer.CommentsDeserializer().deserializeObject(getJsonObject(data, "comment_info")));
return status;
}
use of com.abewy.android.apps.klyph.core.fql.Status in project Klyph by jonathangerbaud.
the class StatusSerializer method serializeObject.
@Override
public JSONObject serializeObject(GraphObject object) {
JSONObject json = new JSONObject();
serializePrimitives(object, json);
Status status = (Status) object;
LikesSerializer ls = new LikesSerializer();
StreamSerializer.CommentsSerializer cs = new StreamSerializer.CommentsSerializer();
try {
json.put("like_info", ls.serializeObject(status.getLike_info()));
json.put("comment_info", cs.serializeObject(status.getComment_info()));
} catch (JSONException e) {
Log.d("StatusSerializer", "JSONException " + e.getMessage());
}
return json;
}
Aggregations