當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。