Search in sources :

Example 31 with Response

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

the class ImageFragment method handleSendReplyAction.

private void handleSendReplyAction(final Comment comment, String reply) {
    if (reply.length() > 0) {
        Bundle params = new Bundle();
        params.putString("message", reply);
        final AlertDialog publishing = new AlertDialog.Builder(getActivity()).setTitle(R.string.publish_comment_dialog_title).setMessage(R.string.publish_comment_dialog_message).setCancelable(false).create();
        publishing.show();
        new AsyncRequest(Query.POST_COMMENT, comment.getId(), params, new AsyncRequest.Callback() {

            @Override
            public void onComplete(Response response) {
                publishing.hide();
                onReplyCommentRequestComplete(response, comment);
            }
        }).execute();
    } else {
        new AlertDialog.Builder(getActivity()).setTitle(R.string.error).setMessage(R.string.define_comment_before_publish).setPositiveButton(R.string.ok, null).create().show();
    }
}
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) Bundle(android.os.Bundle)

Example 32 with Response

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

the class ImageFragment 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 33 with Response

use of com.abewy.android.apps.klyph.core.request.Response 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 34 with Response

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

the class ImageActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(savedInstanceState);
    // Let the Application class know that the first launch is complete
    // If we come from a notification, then do not show the ads
    // When going back to main activity
    KlyphApplication.getInstance().launchComplete();
    isDestroyed = false;
    getWindow().setBackgroundDrawableResource(R.drawable.image_background);
    getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_background_transparent_gradient));
    setTitle("");
    final ImageFragment image = (ImageFragment) getFragmentManager().findFragmentById(R.id.image_fragment);
    String photoId = getIntent().getStringExtra(KlyphBundleExtras.PHOTO_ID);
    Log.d("ImageActivity", "photo id " + photoId);
    String userId = getIntent().getStringExtra(KlyphBundleExtras.USER_ID);
    if (photoId != null) {
        image.setElementId(photoId);
    // image.load();
    } else if (userId != null) {
        AsyncRequest loadRequest = new AsyncRequest(Query.USER_PROFILE_PHOTO, userId, "", new AsyncRequest.Callback() {

            @Override
            public void onComplete(Response response) {
                if (response.getError() == null) {
                    if (response.getGraphObjectList().size() > 0 && isDestroyed == false) {
                        Photo photo = (Photo) response.getGraphObjectList().get(0);
                        image.setElementId(photo.getObject_id());
                        image.load();
                    }
                }
            }
        });
        loadRequest.execute();
    }
}
Also used : Response(com.abewy.android.apps.klyph.core.request.Response) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest) ImageFragment(com.abewy.android.apps.klyph.fragment.ImageFragment) Photo(com.abewy.android.apps.klyph.core.fql.Photo)

Aggregations

Response (com.abewy.android.apps.klyph.core.request.Response)34 AsyncRequest (com.abewy.android.apps.klyph.request.AsyncRequest)34 IFbPermissionCallback (com.abewy.android.apps.klyph.facebook.IFbPermissionCallback)17 AlertDialog (android.app.AlertDialog)9 ArrayList (java.util.ArrayList)5 Bundle (android.os.Bundle)4 Callback (com.abewy.android.apps.klyph.core.request.BaseAsyncRequest.Callback)4 Context (android.content.Context)3 GraphObject (com.abewy.android.apps.klyph.core.graph.GraphObject)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 Uri (android.net.Uri)1 FragmentActivity (android.support.v4.app.FragmentActivity)1 ViewGroup (android.view.ViewGroup)1 InputMethodManager (android.view.inputmethod.InputMethodManager)1