當前位置: 首頁>>代碼示例>>Java>>正文


Java CollectionMapper類代碼示例

本文整理匯總了Java中com.facebook.internal.CollectionMapper的典型用法代碼示例。如果您正苦於以下問題:Java CollectionMapper類的具體用法?Java CollectionMapper怎麽用?Java CollectionMapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CollectionMapper類屬於com.facebook.internal包,在下文中一共展示了CollectionMapper類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: stageCollectionValues

import com.facebook.internal.CollectionMapper; //導入依賴的package包/類
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);
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:24,代碼來源:ShareApi.java

示例2: stageCollectionValues

import com.facebook.internal.CollectionMapper; //導入依賴的package包/類
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);
}
 
開發者ID:CE-KMITL-OOAD-2015,項目名稱:Move-Alarm_ORCA,代碼行數:24,代碼來源:ShareApi.java

示例3: shareOpenGraphContent

import com.facebook.internal.CollectionMapper; //導入依賴的package包/類
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);
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:49,代碼來源:ShareApi.java

示例4: shareOpenGraphContent

import com.facebook.internal.CollectionMapper; //導入依賴的package包/類
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);
}
 
開發者ID:CE-KMITL-OOAD-2015,項目名稱:Move-Alarm_ORCA,代碼行數:43,代碼來源:ShareApi.java

示例5: shareOpenGraphContent

import com.facebook.internal.CollectionMapper; //導入依賴的package包/類
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);
}
 
開發者ID:yudiandreanp,項目名稱:SocioBlood,代碼行數:48,代碼來源:ShareApi.java


注:本文中的com.facebook.internal.CollectionMapper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。