当前位置: 首页>>代码示例>>Java>>正文


Java GraphObject类代码示例

本文整理汇总了Java中com.facebook.model.GraphObject的典型用法代码示例。如果您正苦于以下问题:Java GraphObject类的具体用法?Java GraphObject怎么用?Java GraphObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GraphObject类属于com.facebook.model包,在下文中一共展示了GraphObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryAppSettings

import com.facebook.model.GraphObject; //导入依赖的package包/类
public static FetchedAppSettings queryAppSettings(final String applicationId, final boolean forceRequery) {

        // Cache the last app checked results.
        if (!forceRequery && fetchedAppSettings.containsKey(applicationId)) {
            return fetchedAppSettings.get(applicationId);
        }

        Bundle appSettingsParams = new Bundle();
        appSettingsParams.putString(APPLICATION_FIELDS, TextUtils.join(",", APP_SETTING_FIELDS));

        Request request = Request.newGraphPathRequest(null, applicationId, null);
        request.setParameters(appSettingsParams);

        GraphObject supportResponse = request.executeAndWait().getGraphObject();
        FetchedAppSettings result = new FetchedAppSettings(
                safeGetBooleanFromResponse(supportResponse, SUPPORTS_ATTRIBUTION),
                safeGetBooleanFromResponse(supportResponse, SUPPORTS_IMPLICIT_SDK_LOGGING),
                safeGetStringFromResponse(supportResponse, NUX_CONTENT),
                safeGetBooleanFromResponse(supportResponse, NUX_ENABLED)
                );

        fetchedAppSettings.put(applicationId, result);

        return result;
    }
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:26,代码来源:Utility.java

示例2: setAppEventAttributionParameters

import com.facebook.model.GraphObject; //导入依赖的package包/类
public static void setAppEventAttributionParameters(GraphObject params,
        AttributionIdentifiers attributionIdentifiers, String hashedDeviceAndAppId, boolean limitEventUsage) {
    // Send attributionID if it exists, otherwise send a hashed device+appid specific value as the advertiser_id.
    if (attributionIdentifiers != null && attributionIdentifiers.getAttributionId() != null) {
        params.setProperty("attribution", attributionIdentifiers.getAttributionId());
    }

    if (attributionIdentifiers != null && attributionIdentifiers.getAndroidAdvertiserId() != null) {
        params.setProperty("advertiser_id", attributionIdentifiers.getAndroidAdvertiserId());
        params.setProperty("advertiser_tracking_enabled", !attributionIdentifiers.isTrackingLimited());
    } else if (hashedDeviceAndAppId != null) {
        params.setProperty("advertiser_id", hashedDeviceAndAppId);
    }

    params.setProperty("application_tracking_enabled", !limitEventUsage);
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:17,代码来源:Utility.java

示例3: getPictureUriOfGraphObject

import com.facebook.model.GraphObject; //导入依赖的package包/类
protected URI getPictureUriOfGraphObject(T graphObject) {
    String uri = null;
    Object o = graphObject.getProperty(PICTURE);
    if (o instanceof String) {
        uri = (String) o;
    } else if (o instanceof JSONObject) {
        ItemPicture itemPicture = GraphObject.Factory.create((JSONObject) o).cast(ItemPicture.class);
        ItemPictureData data = itemPicture.getData();
        if (data != null) {
            uri = data.getUrl();
        }
    }

    if (uri != null) {
        try {
            return new URI(uri);
        } catch (URISyntaxException e) {
        }
    }
    return null;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:22,代码来源:GraphObjectAdapter.java

示例4: compareGraphObjects

import com.facebook.model.GraphObject; //导入依赖的package包/类
private static int compareGraphObjects(GraphObject a, GraphObject b, Collection<String> sortFields,
        Collator collator) {
    for (String sortField : sortFields) {
        String sa = (String) a.getProperty(sortField);
        String sb = (String) b.getProperty(sortField);

        if (sa != null && sb != null) {
            int result = collator.compare(sa, sb);
            if (result != 0) {
                return result;
            }
        } else if (!(sa == null && sb == null)) {
            return (sa == null) ? -1 : 1;
        }
    }
    return 0;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:18,代码来源:GraphObjectAdapter.java

示例5: queryAppSettings

import com.facebook.model.GraphObject; //导入依赖的package包/类
public static FetchedAppSettings queryAppSettings(final String applicationId, final boolean forceRequery) {

        // Cache the last app checked results.
        if (!forceRequery && fetchedAppSettings.containsKey(applicationId)) {
            return fetchedAppSettings.get(applicationId);
        }

        Bundle appSettingsParams = new Bundle();
        appSettingsParams.putString(APPLICATION_FIELDS, TextUtils.join(",", APP_SETTING_FIELDS));

        Request request = Request.newGraphPathRequest(null, applicationId, null);
        request.setParameters(appSettingsParams);

        GraphObject supportResponse = request.executeAndWait().getGraphObject();
        FetchedAppSettings result = new FetchedAppSettings(
                safeGetBooleanFromResponse(supportResponse, SUPPORTS_ATTRIBUTION),
                safeGetBooleanFromResponse(supportResponse, SUPPORTS_IMPLICIT_SDK_LOGGING));

        fetchedAppSettings.put(applicationId, result);

        return result;
    }
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:23,代码来源:Utility.java

示例6: deleteTestAccount

import com.facebook.model.GraphObject; //导入依赖的package包/类
private void deleteTestAccount(String testAccountId, String appAccessToken) {
    Bundle parameters = new Bundle();
    parameters.putString("access_token", appAccessToken);

    Request request = new Request(null, testAccountId, parameters, HttpMethod.DELETE);
    Response response = request.executeAndWait();

    FacebookRequestError error = response.getError();
    GraphObject graphObject = response.getGraphObject();
    if (error != null) {
        Log.w(LOG_TAG, String.format("Could not delete test account %s: %s", testAccountId, error.getException().toString()));
    } else if (graphObject.getProperty(Response.NON_JSON_RESPONSE_PROPERTY) == (Boolean) false
               || graphObject.getProperty(Response.SUCCESS_KEY) == (Boolean) false) {
        Log.w(LOG_TAG, String.format("Could not delete test account %s: unknown reason", testAccountId));
    }
}
 
开发者ID:maxml,项目名称:AutoTimeHelper,代码行数:17,代码来源:TestSession.java

示例7: setAppEventAttributionParameters

import com.facebook.model.GraphObject; //导入依赖的package包/类
public static void setAppEventAttributionParameters(GraphObject params,
                                                    AttributionIdentifiers attributionIdentifiers, String hashedDeviceAndAppId, boolean limitEventUsage) {
    // Send attributionID if it exists, otherwise send a hashed device+appid specific value as the advertiser_id.
    if (attributionIdentifiers != null && attributionIdentifiers.getAttributionId() != null) {
        params.setProperty("attribution", attributionIdentifiers.getAttributionId());
    }

    if (attributionIdentifiers != null && attributionIdentifiers.getAndroidAdvertiserId() != null) {
        params.setProperty("advertiser_id", attributionIdentifiers.getAndroidAdvertiserId());
        params.setProperty("advertiser_tracking_enabled", !attributionIdentifiers.isTrackingLimited());
    } else if (hashedDeviceAndAppId != null) {
        params.setProperty("advertiser_id", hashedDeviceAndAppId);
    }

    params.setProperty("application_tracking_enabled", !limitEventUsage);
}
 
开发者ID:maxml,项目名称:AutoTimeHelper,代码行数:17,代码来源:Utility.java

示例8: setAppEventAttributionParameters

import com.facebook.model.GraphObject; //导入依赖的package包/类
public static void setAppEventAttributionParameters(
        GraphObject params,
        AttributionIdentifiers attributionIdentifiers,
        String anonymousAppDeviceGUID,
        boolean limitEventUsage) {
    if (attributionIdentifiers != null && attributionIdentifiers.getAttributionId() != null) {
        params.setProperty("attribution", attributionIdentifiers.getAttributionId());
    }

    if (attributionIdentifiers != null && attributionIdentifiers.getAndroidAdvertiserId() != null) {
        params.setProperty("advertiser_id", attributionIdentifiers.getAndroidAdvertiserId());
        params.setProperty("advertiser_tracking_enabled", !attributionIdentifiers.isTrackingLimited());
    }

    params.setProperty("anon_id", anonymousAppDeviceGUID);
    params.setProperty("application_tracking_enabled", !limitEventUsage);
}
 
开发者ID:dannegm,项目名称:BrillaMXAndroid,代码行数:18,代码来源:Utility.java

示例9: setAppEventExtendedDeviceInfoParameters

import com.facebook.model.GraphObject; //导入依赖的package包/类
public static void setAppEventExtendedDeviceInfoParameters(GraphObject params, Context appContext) {
    JSONArray extraInfoArray = new JSONArray();
    extraInfoArray.put(EXTRA_APP_EVENTS_INFO_FORMAT_VERSION);

    // Application Manifest info:
    String pkgName = appContext.getPackageName();
    int versionCode = -1;
    String versionName = "";

    try {
        PackageInfo pi = appContext.getPackageManager().getPackageInfo(pkgName, 0);
        versionCode = pi.versionCode;
        versionName = pi.versionName;
    } catch (PackageManager.NameNotFoundException e) {
        // Swallow
    }

    // Application Manifest info:
    extraInfoArray.put(pkgName);
    extraInfoArray.put(versionCode);
    extraInfoArray.put(versionName);

    params.setProperty("extinfo", extraInfoArray.toString());
}
 
开发者ID:dannegm,项目名称:BrillaMXAndroid,代码行数:25,代码来源:Utility.java

示例10: showPublishResult

import com.facebook.model.GraphObject; //导入依赖的package包/类
private void showPublishResult(String message, GraphObject result, FacebookRequestError error) {
    String title = null;
    String alertMessage = null;
    if (error == null) {
        title = getString(R.string.success);
        alertMessage = getString(R.string.successfully_posted_post, message);
    } else {
        title = getString(R.string.error);
        alertMessage = error.getErrorMessage();
    }

    new AlertDialog.Builder(this)
            .setTitle(title)
            .setMessage(alertMessage)
            .setPositiveButton(R.string.ok, null)
            .show();
}
 
开发者ID:jacquesgiraudel,项目名称:TP-Formation-Android,代码行数:18,代码来源:TestFacebookActivity.java

示例11: deleteTestAccount

import com.facebook.model.GraphObject; //导入依赖的package包/类
private void deleteTestAccount(String testAccountId, String appAccessToken) {
    Bundle parameters = new Bundle();
    parameters.putString("access_token", appAccessToken);

    Request request = new Request(null, testAccountId, parameters, HttpMethod.DELETE);
    Response response = request.executeAndWait();

    FacebookRequestError error = response.getError();
    GraphObject graphObject = response.getGraphObject();
    if (error != null) {
        Log.w(LOG_TAG, String.format("Could not delete test account %s: %s", testAccountId, error.getException().toString()));
    } else if (graphObject.getProperty(Response.NON_JSON_RESPONSE_PROPERTY) == (Boolean) false) {
        Log.w(LOG_TAG, String.format("Could not delete test account %s: unknown reason", testAccountId));
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:16,代码来源:TestSession.java

示例12: Response

import com.facebook.model.GraphObject; //导入依赖的package包/类
Response(Request request, HttpURLConnection connection, String rawResponse, GraphObject graphObject, GraphObjectList<GraphObject> graphObjects, boolean isFromCache, FacebookRequestError error) {
    this.request = request;
    this.connection = connection;
    this.rawResponse = rawResponse;
    this.graphObject = graphObject;
    this.graphObjectList = graphObjects;
    this.isFromCache = isFromCache;
    this.error = error;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:10,代码来源:Response.java

示例13: getGraphObjectAs

import com.facebook.model.GraphObject; //导入依赖的package包/类
/**
 * The single graph object returned for this request, if any, cast into a particular type of GraphObject.
 *
 * @param graphObjectClass the GraphObject-derived interface to cast the graph object into
 * @return the graph object returned, or null if none was returned (or if the result was a list)
 * @throws FacebookException If the passed in Class is not a valid GraphObject interface
 */
public final <T extends GraphObject> T getGraphObjectAs(Class<T> graphObjectClass) {
    if (graphObject == null) {
        return null;
    }
    if (graphObjectClass == null) {
        throw new NullPointerException("Must pass in a valid interface that extends GraphObject");
    }
    return graphObject.cast(graphObjectClass);
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:17,代码来源:Response.java

示例14: createResponseFromObject

import com.facebook.model.GraphObject; //导入依赖的package包/类
private static Response createResponseFromObject(Request request, HttpURLConnection connection, Object object,
        boolean isFromCache, Object originalResult) throws JSONException {
    if (object instanceof JSONObject) {
        JSONObject jsonObject = (JSONObject) object;

        FacebookRequestError error =
                FacebookRequestError.checkResponseAndCreateError(jsonObject, originalResult, connection);
        if (error != null) {
            if (error.getErrorCode() == INVALID_SESSION_FACEBOOK_ERROR_CODE) {
                Session session = request.getSession();
                if (session != null) {
                    session.closeAndClearTokenInformation();
                }
            }
            return new Response(request, connection, error);
        }

        Object body = Utility.getStringPropertyAsJSON(jsonObject, BODY_KEY, NON_JSON_RESPONSE_PROPERTY);

        if (body instanceof JSONObject) {
            GraphObject graphObject = GraphObject.Factory.create((JSONObject) body);
            return new Response(request, connection, body.toString(), graphObject, isFromCache);
        } else if (body instanceof JSONArray) {
            GraphObjectList<GraphObject> graphObjectList = GraphObject.Factory.createList(
                    (JSONArray) body, GraphObject.class);
            return new Response(request, connection, body.toString(), graphObjectList, isFromCache);
        }
        // We didn't get a body we understand how to handle, so pretend we got nothing.
        object = JSONObject.NULL;
    }

    if (object == JSONObject.NULL) {
        return new Response(request, connection, object.toString(), (GraphObject)null, isFromCache);
    } else {
        throw new FacebookException("Got unexpected object type in response, class: "
                + object.getClass().getSimpleName());
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:39,代码来源:Response.java

示例15: safeGetBooleanFromResponse

import com.facebook.model.GraphObject; //导入依赖的package包/类
private static boolean safeGetBooleanFromResponse(GraphObject response, String propertyName) {
    Object result = false;
    if (response != null) {
        result = response.getProperty(propertyName);
    }
    if (!(result instanceof Boolean)) {
        result = false;
    }
    return (Boolean) result;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:11,代码来源:Utility.java


注:本文中的com.facebook.model.GraphObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。