Java 类com.facebook.internal.CollectionMapper 实例源码

项目:kognitivo    文件:ShareApi.java   
private <T> void stageCollectionValues(final CollectionMapper.Collection<T> collection,
                                              final CollectionMapper.OnMapperCompleteListener
                                                      onCollectionValuesStagedListener) {
    final CollectionMapper.ValueMapper valueMapper = new CollectionMapper.ValueMapper() {
        @Override
        public void mapValue(Object value,
                             CollectionMapper.OnMapValueCompleteListener
                                     onMapValueCompleteListener) {
            if (value instanceof ArrayList) {
                stageArrayList((ArrayList) value, onMapValueCompleteListener);
            } else if (value instanceof ShareOpenGraphObject) {
                stageOpenGraphObject(
                        (ShareOpenGraphObject) value,
                        onMapValueCompleteListener);
            } else if (value instanceof SharePhoto) {
                stagePhoto((SharePhoto) value, onMapValueCompleteListener);
            } else {
                onMapValueCompleteListener.onComplete(value);
            }
        }
    };
    CollectionMapper.iterate(collection, valueMapper, onCollectionValuesStagedListener);
}
项目:Move-Alarm_ORCA    文件:ShareApi.java   
private static <T> void stageCollectionValues(final CollectionMapper.Collection<T> collection,
                                              final CollectionMapper.OnMapperCompleteListener
                                                      onCollectionValuesStagedListener) {
    final CollectionMapper.ValueMapper valueMapper = new CollectionMapper.ValueMapper() {
        @Override
        public void mapValue(Object value,
                             CollectionMapper.OnMapValueCompleteListener
                                     onMapValueCompleteListener) {
            if (value instanceof ArrayList) {
                stageArrayList((ArrayList) value, onMapValueCompleteListener);
            } else if (value instanceof ShareOpenGraphObject) {
                stageOpenGraphObject(
                        (ShareOpenGraphObject) value,
                        onMapValueCompleteListener);
            } else if (value instanceof SharePhoto) {
                stagePhoto((SharePhoto) value, onMapValueCompleteListener);
            } else {
                onMapValueCompleteListener.onComplete(value);
            }
        }
    };
    CollectionMapper.iterate(collection, valueMapper, onCollectionValuesStagedListener);
}
项目:SocioBlood    文件:ShareApi.java   
private static <T> void stageCollectionValues(final CollectionMapper.Collection<T> collection,
                                              final CollectionMapper.OnMapperCompleteListener
                                                      onCollectionValuesStagedListener) {
    final CollectionMapper.ValueMapper valueMapper = new CollectionMapper.ValueMapper() {
        @Override
        public void mapValue(Object value,
                             CollectionMapper.OnMapValueCompleteListener
                                     onMapValueCompleteListener) {
            if (value instanceof ArrayList) {
                stageArrayList((ArrayList) value, onMapValueCompleteListener);
            } else if (value instanceof ShareOpenGraphObject) {
                stageOpenGraphObject(
                        (ShareOpenGraphObject) value,
                        onMapValueCompleteListener);
            } else if (value instanceof SharePhoto) {
                stagePhoto((SharePhoto) value, onMapValueCompleteListener);
            } else {
                onMapValueCompleteListener.onComplete(value);
            }
        }
    };
    CollectionMapper.iterate(collection, valueMapper, onCollectionValuesStagedListener);
}
项目:kognitivo    文件:ShareApi.java   
private void shareOpenGraphContent(final ShareOpenGraphContent openGraphContent,
                                   final FacebookCallback<Sharer.Result> callback) {
    // In order to create a new Open Graph action using a custom object that does not already
    // exist (objectID or URL), you must first send a request to post the object and then
    // another to post the action.  If a local image is supplied with the object or action, that
    // must be staged first and then referenced by the staging URL that is returned by that
    // request.
    final GraphRequest.Callback requestCallback = new GraphRequest.Callback() {
        @Override
        public void onCompleted(GraphResponse response) {
            final JSONObject data = response.getJSONObject();
            final String postId = (data == null ? null : data.optString("id"));
            ShareInternalUtility.invokeCallbackWithResults(callback, postId, response);
        }
    };
    final ShareOpenGraphAction action = openGraphContent.getAction();
    final Bundle parameters = action.getBundle();
    this.addCommonParameters(parameters, openGraphContent);
    if (!Utility.isNullOrEmpty(this.getMessage())) {
        parameters.putString("message", this.getMessage());
    }

    final CollectionMapper.OnMapperCompleteListener stageCallback = new CollectionMapper
            .OnMapperCompleteListener() {
        @Override
        public void onComplete() {
            try {
                handleImagesOnAction(parameters);

                new GraphRequest(
                        AccessToken.getCurrentAccessToken(),
                        getGraphPath(
                                URLEncoder.encode(action.getActionType(), DEFAULT_CHARSET)),
                        parameters,
                        HttpMethod.POST,
                        requestCallback).executeAsync();
            } catch (final UnsupportedEncodingException ex) {
                ShareInternalUtility.invokeCallbackWithException(callback, ex);
            }
        }

        @Override
        public void onError(FacebookException exception) {
            ShareInternalUtility.invokeCallbackWithException(callback, exception);
        }
    };
    this.stageOpenGraphAction(parameters, stageCallback);
}
项目:Move-Alarm_ORCA    文件:ShareApi.java   
private void shareOpenGraphContent(final ShareOpenGraphContent openGraphContent,
                                   final FacebookCallback<Sharer.Result> callback) {
    // In order to create a new Open Graph action using a custom object that does not already
    // exist (objectID or URL), you must first send a request to post the object and then
    // another to post the action.  If a local image is supplied with the object or action, that
    // must be staged first and then referenced by the staging URL that is returned by that
    // request.
    final GraphRequest.Callback requestCallback = new GraphRequest.Callback() {
        @Override
        public void onCompleted(GraphResponse response) {
            final JSONObject data = response.getJSONObject();
            final String postId = (data == null ? null : data.optString("id"));
            ShareInternalUtility.invokeCallbackWithResults(callback, postId, response);
        }
    };
    final ShareOpenGraphAction action = openGraphContent.getAction();
    final Bundle parameters = action.getBundle();
    final CollectionMapper.OnMapperCompleteListener stageCallback = new CollectionMapper
            .OnMapperCompleteListener() {
        @Override
        public void onComplete() {
            try {
                handleImagesOnAction(parameters);

                new GraphRequest(
                        AccessToken.getCurrentAccessToken(),
                        "/me/" + URLEncoder.encode(action.getActionType(), "UTF-8"),
                        parameters,
                        HttpMethod.POST,
                        requestCallback).executeAsync();
            } catch (final UnsupportedEncodingException ex) {
                ShareInternalUtility.invokeCallbackWithException(callback, ex);
            }
        }

        @Override
        public void onError(FacebookException exception) {
            ShareInternalUtility.invokeCallbackWithException(callback, exception);
        }
    };
    this.stageOpenGraphAction(parameters, stageCallback);
}
项目:SocioBlood    文件:ShareApi.java   
private void shareOpenGraphContent(final ShareOpenGraphContent openGraphContent,
                                   final FacebookCallback<Sharer.Result> callback) {
    // In order to create a new Open Graph action using a custom object that does not already
    // exist (objectID or URL), you must first send a request to post the object and then
    // another to post the action.  If a local image is supplied with the object or action, that
    // must be staged first and then referenced by the staging URL that is returned by that
    // request.
    final GraphRequest.Callback requestCallback = new GraphRequest.Callback() {
        @Override
        public void onCompleted(GraphResponse response) {
            final JSONObject data = response.getJSONObject();
            final String postId = (data == null ? null : data.optString("id"));
            ShareInternalUtility.invokeCallbackWithResults(callback, postId, response);
        }
    };
    final ShareOpenGraphAction action = openGraphContent.getAction();
    final Bundle parameters = action.getBundle();
    this.addCommonParameters(parameters, openGraphContent);
    if (!Utility.isNullOrEmpty(this.getMessage())) {
        parameters.putString("message", this.getMessage());
    }

    final CollectionMapper.OnMapperCompleteListener stageCallback = new CollectionMapper
            .OnMapperCompleteListener() {
        @Override
        public void onComplete() {
            try {
                handleImagesOnAction(parameters);

                new GraphRequest(
                        AccessToken.getCurrentAccessToken(),
                        "/me/" + URLEncoder.encode(action.getActionType(), "UTF-8"),
                        parameters,
                        HttpMethod.POST,
                        requestCallback).executeAsync();
            } catch (final UnsupportedEncodingException ex) {
                ShareInternalUtility.invokeCallbackWithException(callback, ex);
            }
        }

        @Override
        public void onError(FacebookException exception) {
            ShareInternalUtility.invokeCallbackWithException(callback, exception);
        }
    };
    this.stageOpenGraphAction(parameters, stageCallback);
}