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


Java Utility類代碼示例

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


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

示例1: setCurrentAccessToken

import com.facebook.internal.Utility; //導入依賴的package包/類
private void setCurrentAccessToken(AccessToken currentAccessToken, boolean saveToCache) {
    AccessToken oldAccessToken = this.currentAccessToken;
    this.currentAccessToken = currentAccessToken;
    tokenRefreshInProgress.set(false);
    this.lastAttemptedTokenExtendDate = new Date(0);

    if (saveToCache) {
        if (currentAccessToken != null) {
            accessTokenCache.save(currentAccessToken);
        } else {
            accessTokenCache.clear();
            Utility.clearFacebookCookies(FacebookSdk.getApplicationContext());
        }
    }

    if (!Utility.areObjectsEqual(oldAccessToken, currentAccessToken)) {
        sendCurrentAccessTokenChangedBroadcast(oldAccessToken, currentAccessToken);
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:20,代碼來源:AccessTokenManager.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: onSearchBoxTextChanged

import com.facebook.internal.Utility; //導入依賴的package包/類
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
開發者ID:MobileDev418,項目名稱:chat-sdk-android-push-firebase,代碼行數:32,代碼來源:PlacePickerFragment.java

示例4: processSuccess

import com.facebook.internal.Utility; //導入依賴的package包/類
@Override
protected void processSuccess(GraphResponse response) {
    JSONArray dataSet = Utility.tryGetJSONArrayFromResponse(
            response.getJSONObject(),
            "data");
    if (dataSet != null) {
        for (int i = 0; i < dataSet.length(); i++) {
            JSONObject data = dataSet.optJSONObject(i);
            if (data != null) {
                objectIsLiked = true;
                JSONObject appData = data.optJSONObject("application");
                AccessToken accessToken = AccessToken.getCurrentAccessToken();
                if (appData != null &&
                        accessToken != null &&
                        Utility.areObjectsEqual(
                                accessToken.getApplicationId(),
                                appData.optString("id"))) {
                    unlikeToken = data.optString("id");
                }
            }
        }
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:24,代碼來源:LikeActionController.java

示例5: create

import com.facebook.internal.Utility; //導入依賴的package包/類
public static Bundle create(AppGroupCreationContent appGroupCreationContent) {
    Bundle webParams = new Bundle();

    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_NAME,
            appGroupCreationContent.getName());

    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_DESCRIPTION,
            appGroupCreationContent.getDescription());

    AppGroupCreationContent.AppGroupPrivacy privacy =
            appGroupCreationContent.getAppGroupPrivacy();
    if (privacy != null) {
        Utility.putNonEmptyString(
                webParams,
                ShareConstants.WEB_DIALOG_PARAM_PRIVACY,
                privacy.toString().toLowerCase(Locale.ENGLISH));
    }

    return webParams;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:25,代碼來源:WebDialogParameters.java

示例6: createForFeed

import com.facebook.internal.Utility; //導入依賴的package包/類
public static Bundle createForFeed(ShareLinkContent shareLinkContent) {
    Bundle webParams = new Bundle();

    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_NAME,
            shareLinkContent.getContentTitle());

    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_DESCRIPTION,
            shareLinkContent.getContentDescription());

    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_LINK,
            Utility.getUriString(shareLinkContent.getContentUrl()));

    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_PICTURE,
            Utility.getUriString(shareLinkContent.getImageUrl()));

    return webParams;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:26,代碼來源:WebDialogParameters.java

示例7: create

import com.facebook.internal.Utility; //導入依賴的package包/類
private static Bundle create(
        ShareOpenGraphContent openGraphContent,
        JSONObject openGraphActionJSON,
        boolean dataErrorsFatal) {
    Bundle params = createBaseParameters(openGraphContent, dataErrorsFatal);

    // Strip namespace from preview property name
    String previewProperty = ShareInternalUtility.getFieldNameAndNamespaceFromFullName(
            openGraphContent.getPreviewPropertyName()).second;

    Utility.putNonEmptyString(
            params,
            ShareConstants.PREVIEW_PROPERTY_NAME,
            previewProperty);
    Utility.putNonEmptyString(
            params,
            ShareConstants.ACTION_TYPE,
            openGraphContent.getAction().getActionType());

    Utility.putNonEmptyString(
            params,
            ShareConstants.ACTION,
            openGraphActionJSON.toString());

    return params;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:27,代碼來源:NativeDialogParameters.java

示例8: createBaseParameters

import com.facebook.internal.Utility; //導入依賴的package包/類
private static Bundle createBaseParameters(ShareContent content, boolean dataErrorsFatal) {
    Bundle params = new Bundle();

    Utility.putUri(params, ShareConstants.CONTENT_URL, content.getContentUrl());
    Utility.putNonEmptyString(params, ShareConstants.PLACE_ID, content.getPlaceId());
    Utility.putNonEmptyString(params, ShareConstants.REF, content.getRef());

    params.putBoolean(ShareConstants.DATA_FAILURES_FATAL, dataErrorsFatal);

    List<String> peopleIds = content.getPeopleIds();
    if (!Utility.isNullOrEmpty(peopleIds)) {
        params.putStringArrayList(
                ShareConstants.PEOPLE_IDS,
                new ArrayList<String>(peopleIds));
    }

    return params;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:19,代碼來源:NativeDialogParameters.java

示例9: validatePhotoForApi

import com.facebook.internal.Utility; //導入依賴的package包/類
private static void validatePhotoForApi(SharePhoto photo, Validator validator) {
    if (photo == null) {
        throw new FacebookException("Cannot share a null SharePhoto");
    }

    Bitmap photoBitmap = photo.getBitmap();
    Uri photoUri = photo.getImageUrl();

    if (photoBitmap == null) {
        if (photoUri == null) {
            throw new FacebookException(
                    "SharePhoto does not have a Bitmap or ImageUrl specified");
        }

        if (Utility.isWebUri(photoUri) && !validator.isOpenGraphContent()) {
            throw new FacebookException(
                    "Cannot set the ImageUrl of a SharePhoto to the Uri of an image on the " +
                            "web when sharing SharePhotoContent");
        }
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:22,代碼來源:ShareContentValidation.java

示例10: 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

示例11: create

import com.facebook.internal.Utility; //導入依賴的package包/類
private static Bundle create(
        ShareOpenGraphContent openGraphContent,
        JSONObject openGraphActionJSON,
        boolean dataErrorsFatal) {
    Bundle params = createBaseParameters(openGraphContent, dataErrorsFatal);

    Utility.putNonEmptyString(
            params,
            ShareConstants.LEGACY_PREVIEW_PROPERTY_NAME,
            openGraphContent.getPreviewPropertyName());
    Utility.putNonEmptyString(
            params,
            ShareConstants.LEGACY_ACTION_TYPE,
            openGraphContent.getAction().getActionType());

    Utility.putNonEmptyString(
            params,
            ShareConstants.LEGACY_ACTION,
            openGraphActionJSON.toString());

    return params;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:23,代碼來源:LegacyNativeDialogParameters.java

示例12: createBaseParameters

import com.facebook.internal.Utility; //導入依賴的package包/類
private static Bundle createBaseParameters(ShareContent content, boolean dataErrorsFatal) {
    Bundle params = new Bundle();

    Utility.putUri(params, ShareConstants.LEGACY_LINK, content.getContentUrl());
    Utility.putNonEmptyString(params, ShareConstants.LEGACY_PLACE_TAG, content.getPlaceId());
    Utility.putNonEmptyString(params, ShareConstants.LEGACY_REF, content.getRef());

    params.putBoolean(ShareConstants.LEGACY_DATA_FAILURES_FATAL, dataErrorsFatal);

    List<String> peopleIds = content.getPeopleIds();
    if (!Utility.isNullOrEmpty(peopleIds)) {
        params.putStringArrayList(
                ShareConstants.LEGACY_FRIEND_TAGS,
                new ArrayList<>(peopleIds));
    }

    return params;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:19,代碼來源:LegacyNativeDialogParameters.java

示例13: issueResponse

import com.facebook.internal.Utility; //導入依賴的package包/類
private static void issueResponse(
        final UploadContext uploadContext,
        final FacebookException error,
        final String videoId) {
    // Remove the UploadContext synchronously
    // Once the UploadContext is removed, this is the only reference to it.
    removePendingUpload(uploadContext);

    Utility.closeQuietly(uploadContext.videoStream);

    if (uploadContext.callback != null) {
        if (error != null) {
            ShareInternalUtility.invokeOnErrorCallback(uploadContext.callback, error);
        } else if (uploadContext.isCanceled) {
            ShareInternalUtility.invokeOnCancelCallback(uploadContext.callback);
        } else {
            ShareInternalUtility.invokeOnSuccessCallback(uploadContext.callback, videoId);
        }
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:21,代碼來源:VideoUploader.java

示例14: registerAccessTokenTracker

import com.facebook.internal.Utility; //導入依賴的package包/類
private static void registerAccessTokenTracker() {
    accessTokenTracker = new AccessTokenTracker() {
        @Override
        protected void onCurrentAccessTokenChanged(
                AccessToken oldAccessToken,
                AccessToken currentAccessToken) {
            if (oldAccessToken == null) {
                // If we never had an access token, then there would be no pending uploads.
                return;
            }

            if (currentAccessToken == null ||
                    !Utility.areObjectsEqual(
                            currentAccessToken.getUserId(),
                            oldAccessToken.getUserId())) {
                // Cancel any pending uploads since the user changed.
                cancelAllRequests();
            }
        }
    };
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:22,代碼來源:VideoUploader.java

示例15: handleSuccess

import com.facebook.internal.Utility; //導入依賴的package包/類
@Override
protected void handleSuccess(JSONObject jsonObject)
        throws JSONException {
    String startOffset = jsonObject.getString(PARAM_START_OFFSET);
    String endOffset = jsonObject.getString(PARAM_END_OFFSET);

    if (Utility.areObjectsEqual(startOffset, endOffset)) {
        enqueueUploadFinish(
                uploadContext,
                0);
    } else {
        enqueueUploadChunk(
                uploadContext,
                startOffset,
                endOffset,
                0);
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:19,代碼來源:VideoUploader.java


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