Search in sources :

Example 1 with Response

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

the class ImageFragment method postComment.

private void postComment() {
    if (sendTextEdit.getText().toString().length() > 0) {
        Bundle params = new Bundle();
        params.putString("message", sendTextEdit.getText().toString());
        InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(sendTextEdit.getWindowToken(), 0);
        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, getElementId(), params, new AsyncRequest.Callback() {

            @Override
            public void onComplete(Response response) {
                publishing.hide();
                onCommentRequestComplete(response);
            }
        }).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) InputMethodManager(android.view.inputmethod.InputMethodManager)

Example 2 with Response

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

the class KlyphDialogFragment method refresh.

protected void refresh() {
    startLoading();
    Log.d(TAG, "request = " + requestType + ", id = " + elementId + ", offset = " + offset);
    request = new AsyncRequest(requestType, elementId, offset, new AsyncRequest.Callback() {

        @Override
        public void onComplete(Response response) {
            Log.i(TAG, "onCompleted");
            onRequestComplete(response);
        }
    });
    request.execute();
}
Also used : Response(com.abewy.android.apps.klyph.core.request.Response) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest)

Example 3 with Response

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

the class ProfileActivity method loadData.

private void loadData() {
    isLoading = true;
    invalidateOptionsMenu();
    new AsyncRequest(getQuery(), id, getQueryParam(), new BaseAsyncRequest.Callback() {

        @Override
        public void onComplete(final Response response) {
            isLoading = false;
            if (isDestroyed)
                return;
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    if (response.getError() == null) {
                        onRequestSuccess(response.getGraphObjectList());
                    } else {
                        onRequestError(response.getError());
                    }
                    invalidateOptionsMenu();
                }
            });
        }
    }).execute();
}
Also used : Response(com.abewy.android.apps.klyph.core.request.Response) BaseAsyncRequest(com.abewy.android.apps.klyph.core.request.BaseAsyncRequest) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest)

Example 4 with Response

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

the class AlbumSpinner method loadAlbums.

private void loadAlbums() {
    AsyncRequest request = new AsyncRequest(Query.UPLOADABLE_ALBUM, KlyphSession.getSessionUserId(), "", new AsyncRequest.Callback() {

        public void onComplete(Response response) {
            onRequestComplete(response);
        }
    });
    request.execute();
}
Also used : Response(com.abewy.android.apps.klyph.core.request.Response) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest)

Example 5 with Response

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

the class AlbumSpinner method createAlbum.

@Override
public void createAlbum(final Album album, String privacy) {
    Bundle bundle = new Bundle();
    bundle.putString("name", album.getName());
    bundle.putString("location", album.getLocation());
    bundle.putString("message", album.getDescription());
    bundle.putString("privacy", privacy);
    final AlertDialog dialog = AlertUtil.showAlert(getActivity(), R.string.new_album, R.string.creating_album);
    new AsyncRequest(Query.NEW_ALBUM, "", bundle, new AsyncRequest.Callback() {

        @Override
        public void onComplete(Response response) {
            dialog.dismiss();
            if (response.getError() == null) {
                Log.d("AlbumSpinner", "createAlbum id = " + response.getReturnedId());
                album.setObject_id(response.getReturnedId());
                ((SpinnerAdapter) spinner.getAdapter()).add(album);
                ((SpinnerAdapter) spinner.getAdapter()).notifyDataSetChanged();
                spinner.setSelection(spinner.getCount() - 1);
            } else {
                Toast.makeText(getActivity(), R.string.request_error, Toast.LENGTH_SHORT).show();
            }
        }
    }).execute();
}
Also used : AlertDialog(android.app.AlertDialog) Response(com.abewy.android.apps.klyph.core.request.Response) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest) Bundle(android.os.Bundle)

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