本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}