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


Java Utility.isNullOrEmpty方法代碼示例

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


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

示例1: OpenGraphDialogBuilderBase

import com.facebook.internal.Utility; //導入方法依賴的package包/類
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published, which must contain a reference to at least one
 *                            Open Graph object with the property name specified by setPreviewPropertyName; the action
 *                            must have had its type specified via the {@link OpenGraphAction#setType(String)} method
 * @param actionType          the type of the Open Graph action to be published, which should be the namespace-qualified
 *                            name of the action type (e.g., "myappnamespace:myactiontype"); this will override the type
 *                            of the action passed in.
 * @param previewPropertyName the name of a property on the Open Graph action that contains the
 *                            Open Graph object which will be displayed as a preview to the user
 */
@Deprecated
public OpenGraphDialogBuilderBase(Activity activity, OpenGraphAction action, String actionType,
        String previewPropertyName) {
    super(activity);

    Validate.notNull(action, "action");
    Validate.notNullOrEmpty(actionType, "actionType");
    Validate.notNullOrEmpty(previewPropertyName, "previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }
    String typeOnAction = action.getType();
    if (!Utility.isNullOrEmpty(typeOnAction) && !typeOnAction.equals(actionType)) {
        throw new IllegalArgumentException("'actionType' must match the type of 'action' if it is specified. " +
                "Consider using OpenGraphDialogBuilderBase(Activity activity, OpenGraphAction action, " +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:38,代碼來源:FacebookDialog.java

示例2: setBundleExtras

import com.facebook.internal.Utility; //導入方法依賴的package包/類
@Override
Bundle setBundleExtras(Bundle extras) {
    putExtra(extras, NativeProtocol.EXTRA_APPLICATION_ID, applicationId);
    putExtra(extras, NativeProtocol.EXTRA_APPLICATION_NAME, applicationName);
    putExtra(extras, NativeProtocol.EXTRA_TITLE, name);
    putExtra(extras, NativeProtocol.EXTRA_SUBTITLE, caption);
    putExtra(extras, NativeProtocol.EXTRA_DESCRIPTION, description);
    putExtra(extras, NativeProtocol.EXTRA_LINK, link);
    putExtra(extras, NativeProtocol.EXTRA_IMAGE, picture);
    putExtra(extras, NativeProtocol.EXTRA_PLACE_TAG, place);
    putExtra(extras, NativeProtocol.EXTRA_TITLE, name);
    putExtra(extras, NativeProtocol.EXTRA_REF, ref);

    extras.putBoolean(NativeProtocol.EXTRA_DATA_FAILURES_FATAL, dataErrorsFatal);
    if (!Utility.isNullOrEmpty(friends)) {
        extras.putStringArrayList(NativeProtocol.EXTRA_FRIEND_TAGS, friends);
    }
    return extras;
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:20,代碼來源:FacebookDialog.java

示例3: validateOpenGraphContent

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private static void validateOpenGraphContent(
        ShareOpenGraphContent openGraphContent, Validator validator) {
    validator.validate(openGraphContent.getAction());

    String previewPropertyName = openGraphContent.getPreviewPropertyName();
    if (Utility.isNullOrEmpty(previewPropertyName)) {
        throw new FacebookException("Must specify a previewPropertyName.");
    }

    if (openGraphContent.getAction().get(previewPropertyName) == null) {
        throw new FacebookException(
                "Property \"" + previewPropertyName + "\" was not found on the action. " +
                        "The name of the preview property must match the name of an " +
                        "action property.");
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:17,代碼來源:ShareContentValidation.java

示例4: createFromBundle

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private static AccessToken createFromBundle(
        List<String> requestedPermissions,
        Bundle bundle,
        AccessTokenSource source,
        Date expirationBase,
        String applicationId) {
    String token = bundle.getString(ACCESS_TOKEN_KEY);
    Date expires = Utility.getBundleLongAsDate(bundle, EXPIRES_IN_KEY, expirationBase);
    String userId = bundle.getString(USER_ID_KEY);

    if (Utility.isNullOrEmpty(token) || (expires == null)) {
        return null;
    }

    return new AccessToken(
            token,
            applicationId,
            userId,
            requestedPermissions,
            null,
            source,
            expires,
            new Date());
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:25,代碼來源:AccessToken.java

示例5: setPublishPermissions

import com.facebook.internal.Utility; //導入方法依賴的package包/類
public void setPublishPermissions(List<String> permissions) {

            if (LoginAuthorizationType.READ.equals(authorizationType)) {
                throw new UnsupportedOperationException("Cannot call setPublishPermissions after " +
                        "setReadPermissions has been called.");
            }
            if (Utility.isNullOrEmpty(permissions)) {
                throw new IllegalArgumentException(
                        "Permissions for publish actions cannot be null or empty.");
            }
            this.permissions = permissions;
            authorizationType = LoginAuthorizationType.PUBLISH;
        }
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:14,代碼來源:LoginButton.java

示例6: createNew

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private static AccessToken createNew(
        List<String> requestedPermissions, String accessToken, Date expires, AccessTokenSource source) {
    if (Utility.isNullOrEmpty(accessToken) || (expires == null)) {
        return createEmptyToken(requestedPermissions);
    } else {
        return new AccessToken(accessToken, expires, requestedPermissions, source, new Date());
    }
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:9,代碼來源:AccessToken.java

示例7: validatePermissions

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private boolean validatePermissions(List<String> permissions,
        SessionAuthorizationType authType, Session currentSession) {
    if (SessionAuthorizationType.PUBLISH.equals(authType)) {
        if (Utility.isNullOrEmpty(permissions)) {
            throw new IllegalArgumentException("Permissions for publish actions cannot be null or empty.");
        }
    }
    if (currentSession != null && currentSession.isOpened()) {
        if (!Utility.isSubset(permissions, currentSession.getPermissions())) {
            Log.e(TAG, "Cannot set additional permissions when session is already open.");
            return false;
        }
    }
    return true;
}
 
開發者ID:MobileDev418,項目名稱:chat-sdk-android-push-firebase,代碼行數:16,代碼來源:LoginButton.java

示例8: createFromLegacyCache

import com.facebook.internal.Utility; //導入方法依賴的package包/類
static AccessToken createFromLegacyCache(Bundle bundle) {
    List<String> permissions = getPermissionsFromBundle(
            bundle,
            LegacyTokenHelper.PERMISSIONS_KEY);
    List<String> declinedPermissions = getPermissionsFromBundle(
            bundle,
            LegacyTokenHelper.DECLINED_PERMISSIONS_KEY);

    String applicationId = LegacyTokenHelper.getApplicationId(bundle);
    if (Utility.isNullOrEmpty(applicationId)) {
        applicationId = FacebookSdk.getApplicationId();
    }

    String tokenString = LegacyTokenHelper.getToken(bundle);
    String userId;
    JSONObject userInfo = Utility.awaitGetGraphMeRequestWithCache(tokenString);
    try {
        userId = userInfo.getString("id");
    } catch (JSONException ex) {
        // This code is only used by AccessTokenCache. If we for any reason fail to get the
        // user id just return null.
        return null;
    }

    return new AccessToken(
            tokenString,
            applicationId,
            userId,
            permissions,
            declinedPermissions,
            LegacyTokenHelper.getSource(bundle),
            LegacyTokenHelper.getDate(
                    bundle,
                    LegacyTokenHelper.EXPIRATION_DATE_KEY),
            LegacyTokenHelper.getDate(
                    bundle,
                    LegacyTokenHelper.LAST_REFRESH_DATE_KEY)
    );
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:40,代碼來源:AccessToken.java

示例9: validateOpenGraphAction

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private static void validateOpenGraphAction(
        ShareOpenGraphAction openGraphAction,
        Validator validator) {
    if (openGraphAction == null) {
        throw new FacebookException("Must specify a non-null ShareOpenGraphAction");
    }

    if (Utility.isNullOrEmpty(openGraphAction.getActionType())) {
        throw new FacebookException("ShareOpenGraphAction must have a non-empty actionType");
    }

    validator.validate((ShareOpenGraphValueContainer) openGraphAction, false);
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:14,代碼來源:ShareContentValidation.java

示例10: invokeCallbackWithResults

import com.facebook.internal.Utility; //導入方法依賴的package包/類
public static void invokeCallbackWithResults(
        FacebookCallback<Sharer.Result> callback,
        final String postId,
        final GraphResponse graphResponse) {
    FacebookRequestError requestError = graphResponse.getError();
    if (requestError != null) {
        String errorMessage = requestError.getErrorMessage();
        if (Utility.isNullOrEmpty(errorMessage)) {
            errorMessage = "Unexpected error sharing.";
        }
        invokeOnErrorCallback(callback, graphResponse, errorMessage);
    } else {
        invokeOnSuccessCallback(callback, postId);
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:16,代碼來源:ShareInternalUtility.java

示例11: setBundleExtras

import com.facebook.internal.Utility; //導入方法依賴的package包/類
@Override
Bundle setBundleExtras(Bundle extras) {
    putExtra(extras, NativeProtocol.EXTRA_APPLICATION_ID, applicationId);
    putExtra(extras, NativeProtocol.EXTRA_APPLICATION_NAME, applicationName);
    putExtra(extras, NativeProtocol.EXTRA_PLACE_TAG, place);
    extras.putStringArrayList(NativeProtocol.EXTRA_PHOTOS, imageAttachmentUrls);

    if (!Utility.isNullOrEmpty(friends)) {
        extras.putStringArrayList(NativeProtocol.EXTRA_FRIEND_TAGS, friends);
    }
    return extras;
}
 
開發者ID:MobileDev418,項目名稱:chat-sdk-android-push-firebase,代碼行數:13,代碼來源:FacebookDialog.java

示例12: createFromWebBundle

import com.facebook.internal.Utility; //導入方法依賴的package包/類
static AccessToken createFromWebBundle(List<String> requestedPermissions, Bundle bundle, AccessTokenSource source) {
    Date expires = getBundleLongAsDate(bundle, EXPIRES_IN_KEY, new Date());
    String token = bundle.getString(ACCESS_TOKEN_KEY);

    // With Login v4, we now get back the actual permissions granted, so update the permissions to be the real thing
    String grantedPermissions = bundle.getString("granted_scopes");
    if (!Utility.isNullOrEmpty(grantedPermissions)) {
        requestedPermissions =  new ArrayList<String>(Arrays.asList(grantedPermissions.split(",")));
    }

    return createNew(requestedPermissions, token, expires, source);
}
 
開發者ID:MobileDev418,項目名稱:chat-sdk-android-push-firebase,代碼行數:13,代碼來源:AccessToken.java

示例13: addCommonParameters

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private void addCommonParameters(final Bundle bundle, ShareContent shareContent) {
    final List<String> peopleIds = shareContent.getPeopleIds();
    if (!Utility.isNullOrEmpty(peopleIds)) {
        bundle.putString("tags", TextUtils.join(", ", peopleIds));
    }

    if (!Utility.isNullOrEmpty(shareContent.getPlaceId())) {
        bundle.putString("place", shareContent.getPlaceId());
    }

    if (!Utility.isNullOrEmpty(shareContent.getRef())) {
        bundle.putString("ref", shareContent.getRef());
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:15,代碼來源:ShareApi.java

示例14: getRequestForPagedResults

import com.facebook.internal.Utility; //導入方法依賴的package包/類
/**
 * If a Response contains results that contain paging information, returns a new
 * Request that will retrieve the next page of results, in whichever direction
 * is desired. If no paging information is available, returns null.
 *
 * @param direction enum indicating whether to page forward or backward
 * @return a Request that will retrieve the next page of results in the desired
 *         direction, or null if no paging information is available
 */
public GraphRequest getRequestForPagedResults(PagingDirection direction) {
    String link = null;
    if (graphObject != null) {
        JSONObject pagingInfo = graphObject.optJSONObject("paging");
        if (pagingInfo != null) {
            if (direction == PagingDirection.NEXT) {
                link = pagingInfo.optString("next");
            } else {
                link = pagingInfo.optString("previous");
            }
        }
    }
    if (Utility.isNullOrEmpty(link)) {
        return null;
    }

    if (link != null && link.equals(request.getUrlForSingleRequest())) {
        // We got the same "next" link as we just tried to retrieve. This could happen if cached
        // data is invalid. All we can do in this case is pretend we have finished.
        return null;
    }

    GraphRequest pagingRequest;
    try {
        pagingRequest = new GraphRequest(request.getAccessToken(), new URL(link));
    } catch (MalformedURLException e) {
        return null;
    }

    return pagingRequest;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:41,代碼來源:GraphResponse.java

示例15: fetchVerifiedObjectId

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private void fetchVerifiedObjectId(final RequestCompletionCallback completionHandler) {
    if (!Utility.isNullOrEmpty(verifiedObjectId)) {
        if (completionHandler != null) {
            completionHandler.onComplete();
        }

        return;
    }

    final GetOGObjectIdRequestWrapper objectIdRequest =
            new GetOGObjectIdRequestWrapper(objectId, objectType);
    final GetPageIdRequestWrapper pageIdRequest =
            new GetPageIdRequestWrapper(objectId, objectType);

    GraphRequestBatch requestBatch = new GraphRequestBatch();
    objectIdRequest.addToBatch(requestBatch);
    pageIdRequest.addToBatch(requestBatch);

    requestBatch.addCallback(new GraphRequestBatch.Callback() {
        @Override
        public void onBatchCompleted(GraphRequestBatch batch) {
            verifiedObjectId = objectIdRequest.verifiedObjectId;
            if (Utility.isNullOrEmpty(verifiedObjectId)) {
                verifiedObjectId = pageIdRequest.verifiedObjectId;
                objectIsPage = pageIdRequest.objectIsPage;
            }

            if (Utility.isNullOrEmpty(verifiedObjectId)) {
                Logger.log(LoggingBehavior.DEVELOPER_ERRORS,
                        TAG,
                        "Unable to verify the FB id for '%s'. Verify that it is a valid FB" +
                                " object or page",
                        objectId);
                logAppEventForError("get_verified_id",
                        pageIdRequest.getError() != null
                                ? pageIdRequest.getError()
                                : objectIdRequest.getError());
            }

            if (completionHandler != null) {
                completionHandler.onComplete();
            }
        }
    });

    requestBatch.executeAsync();
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:48,代碼來源:LikeActionController.java


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