Search in sources :

Example 31 with AsyncRequest

use of com.abewy.android.apps.klyph.request.AsyncRequest 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();
}
Also used : Response(com.abewy.android.apps.klyph.core.request.Response) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest) TextButtonItem(com.abewy.klyph.items.TextButtonItem)

Example 32 with AsyncRequest

use of com.abewy.android.apps.klyph.request.AsyncRequest 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();
}
Also used : Response(com.abewy.android.apps.klyph.core.request.Response) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest)

Example 33 with AsyncRequest

use of com.abewy.android.apps.klyph.request.AsyncRequest 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();
}
Also used : AlertDialog(android.app.AlertDialog) Response(com.abewy.android.apps.klyph.core.request.Response) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest) IFbPermissionCallback(com.abewy.android.apps.klyph.facebook.IFbPermissionCallback)

Example 34 with AsyncRequest

use of com.abewy.android.apps.klyph.request.AsyncRequest in project Klyph by jonathangerbaud.

the class StreamFragment method deleteComment.

private void deleteComment(final Comment comment) {
    final AlertDialog dialog = AlertUtil.showAlert(getActivity(), R.string.delete, R.string.deleting);
    new AsyncRequest(Query.DELETE_POST, comment.getId(), "", new AsyncRequest.Callback() {

        @Override
        public void onComplete(Response response) {
            dialog.dismiss();
            onDeleteCommentRequestComplete(response, comment);
        }
    }).execute();
}
Also used : AlertDialog(android.app.AlertDialog) Response(com.abewy.android.apps.klyph.core.request.Response) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest) IFbPermissionCallback(com.abewy.android.apps.klyph.facebook.IFbPermissionCallback)

Example 35 with AsyncRequest

use of com.abewy.android.apps.klyph.request.AsyncRequest 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();
    }
}
Also used : Response(com.abewy.android.apps.klyph.core.request.Response) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest) IFbPermissionCallback(com.abewy.android.apps.klyph.facebook.IFbPermissionCallback)

Aggregations

AsyncRequest (com.abewy.android.apps.klyph.request.AsyncRequest)37 Response (com.abewy.android.apps.klyph.core.request.Response)34 IFbPermissionCallback (com.abewy.android.apps.klyph.facebook.IFbPermissionCallback)17 AlertDialog (android.app.AlertDialog)9 ArrayList (java.util.ArrayList)6 Bundle (android.os.Bundle)4 GraphObject (com.abewy.android.apps.klyph.core.graph.GraphObject)4 Callback (com.abewy.android.apps.klyph.core.request.BaseAsyncRequest.Callback)4 Context (android.content.Context)3 TagCallback (com.abewy.android.apps.klyph.util.TextViewUtil.TagCallback)3 Intent (android.content.Intent)2 View (android.view.View)2 ImageButton (android.widget.ImageButton)2 TextView (android.widget.TextView)2 Photo (com.abewy.android.apps.klyph.core.fql.Photo)2 TextButtonItem (com.abewy.klyph.items.TextButtonItem)2 UiLifecycleHelper (com.facebook.UiLifecycleHelper)2 Uri (android.net.Uri)1 FragmentActivity (android.support.v4.app.FragmentActivity)1 ViewGroup (android.view.ViewGroup)1