use of com.abewy.android.apps.klyph.core.request.Response in project Klyph by jonathangerbaud.
the class PostAlbums method loadAlbums.
private void loadAlbums() {
AsyncRequest request = new AsyncRequest(Query.UPLOADABLE_ALBUM, KlyphSession.getSessionUserId(), "", new AsyncRequest.Callback() {
public void onComplete(Response response) {
if (response.getError() == null) {
onRequestSuccess(response.getGraphObjectList());
} else {
onRequestError(response.getError());
}
}
});
request.execute();
}
use of com.abewy.android.apps.klyph.core.request.Response in project Klyph by jonathangerbaud.
the class PostShare method initWithIntent.
public void initWithIntent(Intent intent) {
String photoId = intent.getStringExtra(KlyphBundleExtras.SHARE_PHOTO_ID);
String videoId = intent.getStringExtra(KlyphBundleExtras.SHARE_VIDEO_ID);
String albumId = intent.getStringExtra(KlyphBundleExtras.SHARE_ALBUM_ID);
Stream post = intent.getParcelableExtra(KlyphBundleExtras.SHARE_POST_ID);
String linkUrl = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_URL);
if (photoId != null) {
url = PHOTO + photoId;
new AsyncRequest(Query.PHOTO, photoId, "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
onPhotoRequestComplete(response);
}
}).execute();
} else if (videoId != null) {
url = VIDEO + videoId;
new AsyncRequest(Query.VIDEO, videoId, "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
onVideoRequestComplete(response);
}
}).execute();
} else if (albumId != null) {
url = ALBUM + albumId;
new AsyncRequest(Query.ALBUM, albumId, "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
onAlbumRequestComplete(response);
}
}).execute();
} else if (post != null) {
url = post.getPermalink();
if (post.isStatus()) {
fillViews(post.getActor_name(), post.getMessage(), post.getActor_pic());
getActivity().setTitle(R.string.post_share_status);
} else {
Attachment att = post.getAttachment();
if (att.isPhoto() || att.isVideo() || att.isAlbum()) {
Media media = att.getMedia().get(0);
if (att.isAlbum()) {
fillViews(post.getActor_name(), att.getName(), media.getSrc());
} else {
fillViews(post.getActor_name(), media.getAlt(), media.getSrc());
}
if (att.isPhoto())
getActivity().setTitle(R.string.post_share_photo);
else if (att.isVideo())
getActivity().setTitle(R.string.post_share_video);
else
getActivity().setTitle(R.string.post_share_album);
} else {
getActivity().setTitle(R.string.post_share_status);
fillViews(post.getActor_name(), post.getMessage(), post.getActor_pic());
}
}
} else if (linkUrl != null) {
isLink = true;
url = linkUrl;
imageUrl = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_IMAGE_URL);
String linkName = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_NAME);
String linkDesc = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_DESC);
fillViews(linkName, linkDesc, imageUrl);
getActivity().setTitle(R.string.post_share_link);
} else {
Log.d("PostShare", "All null");
}
if (isLink == false) {
((ViewGroup) spinner.getParent()).setVisibility(View.GONE);
} else {
SpinnerAdapter adapter = new SpinnerAdapter(getActivity());
spinner.setAdapter(adapter);
Friend friend = new Friend();
friend.setName(getString(R.string.post_share_on_my_wall));
adapter.add(friend);
friend = new Friend();
friend.setName(getString(R.string.post_share_on_friend_wall));
adapter.add(friend);
adapter.notifyDataSetChanged();
spinner.setSelection(0);
spinner.setOnItemSelectedListener(this);
previousPosition = 0;
}
}
use of com.abewy.android.apps.klyph.core.request.Response in project Klyph by jonathangerbaud.
the class KlyphFragment method loadNewest.
protected void loadNewest() {
newestLoading = true;
setPullToRefreshRefreshing(true);
if (getAdapter().getFirstItem() instanceof TextButtonItem) {
getAdapter().removeAt(0);
getAdapter().notifyDataSetChanged();
}
String offset = null;
AsyncRequest request = new AsyncRequest(requestNewestType, getElementId(), offset, new AsyncRequest.Callback() {
public void onComplete(Response response) {
onRequestNewestComplete(response);
}
});
request.execute();
}
use of com.abewy.android.apps.klyph.core.request.Response in project Klyph by jonathangerbaud.
the class StreamFragment method delete.
private void delete() {
final AlertDialog dialog = AlertUtil.showAlert(getActivity(), R.string.delete, R.string.deleting);
new AsyncRequest(Query.DELETE_POST, getElementId(), "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
dialog.dismiss();
onDeleteRequestComplete(response);
}
}).execute();
}
use of com.abewy.android.apps.klyph.core.request.Response in project Klyph by jonathangerbaud.
the class ImageFragment method doLikeCommentAction.
private void doLikeCommentAction(final Comment comment) {
if (comment.getUser_likes() == false) {
comment.setUser_likes(true);
comment.setLike_count(comment.getLike_count() + 1);
new AsyncRequest(Query.POST_LIKE, comment.getId(), "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
Log.d("onComplete", "" + response.getError());
onCommentLikeRequestComplete(response, comment);
}
}).execute();
} else {
comment.setUser_likes(false);
comment.setLike_count(comment.getLike_count() - 1);
getAdapter().notifyDataSetChanged();
new AsyncRequest(Query.POST_UNLIKE, comment.getId(), "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
Log.d("onComplete", "" + response.getError());
onCommentUnlikeRequestComplete(response, comment);
}
}).execute();
}
}
Aggregations