Java 类com.facebook.internal.Validate 实例源码

项目:kognitivo    文件:GameRequestValidation.java   
public static void validate(GameRequestContent content) {
    Validate.notNull(content.getMessage(), "message");
    if (content.getObjectId() != null ^
            (content.getActionType() == GameRequestContent.ActionType.ASKFOR
            || content.getActionType() == GameRequestContent.ActionType.SEND)) {
        throw new IllegalArgumentException(
                "Object id should be provided if and only if action type is send or askfor");
    }

    // parameters to, filters, suggestions are mutually exclusive
    int mutex = 0;
    if (content.getTo() != null) {
        mutex++;
    }
    if (content.getSuggestions() != null) {
        mutex++;
    }
    if (content.getFilters() != null) {
        mutex++;
    }
    if (mutex > 1) {
        throw new IllegalArgumentException(
                "Parameters to, filters and suggestions are mutually exclusive");
    }
}
项目:kognitivo    文件:AppLinkData.java   
/**
 * Asynchronously fetches app link information that might have been stored for use after
 * installation of the app
 *
 * @param context           The context
 * @param applicationId     Facebook application Id. If null, it is taken from the manifest
 * @param completionHandler CompletionHandler to be notified with the AppLinkData object or null
 *                          if none is available.  Must not be null.
 */
public static void fetchDeferredAppLinkData(
        Context context,
        String applicationId,
        final CompletionHandler completionHandler) {
    Validate.notNull(context, "context");
    Validate.notNull(completionHandler, "completionHandler");

    if (applicationId == null) {
        applicationId = Utility.getMetadataApplicationId(context);
    }

    Validate.notNull(applicationId, "applicationId");

    final Context applicationContext = context.getApplicationContext();
    final String applicationIdCopy = applicationId;
    FacebookSdk.getExecutor().execute(new Runnable() {
        @Override
        public void run() {
            fetchDeferredAppLinkFromServer(
                    applicationContext, applicationIdCopy, completionHandler);
        }
    });
}
项目:kognitivo    文件:AppLinkData.java   
/**
 * Parses out any app link data from the Intent of the Activity passed in.
 * @param activity Activity that was started because of an app link
 * @return AppLinkData if found. null if not.
 */
public static AppLinkData createFromActivity(Activity activity) {
    Validate.notNull(activity, "activity");
    Intent intent = activity.getIntent();
    if (intent == null) {
        return null;
    }

    AppLinkData appLinkData = createFromAlApplinkData(intent);
    if (appLinkData == null) {
        String appLinkArgsJsonString = intent.getStringExtra(BUNDLE_APPLINK_ARGS_KEY);
        appLinkData = createFromJson(appLinkArgsJsonString);
    }
    if (appLinkData == null) {
        // Try regular app linking
        appLinkData = createFromUri(intent.getData());
    }

    return appLinkData;
}
项目:kognitivo    文件:LegacyTokenHelper.java   
public void save(Bundle bundle) {
    Validate.notNull(bundle, "bundle");

    SharedPreferences.Editor editor = cache.edit();

    for (String key : bundle.keySet()) {
        try {
            serializeKey(key, bundle, editor);
        } catch (JSONException e) {
            // Error in the bundle. Don't store a partial cache.
            Logger.log(
                    LoggingBehavior.CACHE,
                    Log.WARN,
                    TAG,
                    "Error processing value for key: '" + key + "' -- " + e);

            // Bypass the commit and just return. This cancels the entire edit transaction
            return;
        }
    }
    editor.apply();
}
项目:chat-sdk-android-push-firebase    文件:FacebookDialog.java   
/**
 * 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;
}
项目:AndroidBackendlessChat    文件:SharedPreferencesTokenCachingStrategy.java   
/**
 * Persists all supported data types present in the passed in Bundle, to the
 * cache
 *
 * @param bundle
 *          The Bundle containing information to be cached
 */
public void save(Bundle bundle) {
    Validate.notNull(bundle, "bundle");

    SharedPreferences.Editor editor = cache.edit();

    for (String key : bundle.keySet()) {
        try {
            serializeKey(key, bundle, editor);
        } catch (JSONException e) {
            // Error in the bundle. Don't store a partial cache.
            Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e);

            // Bypass the commit and just return. This cancels the entire edit transaction
            return;
        }
    }

    boolean successfulCommit = editor.commit();
    if (!successfulCommit) {
        Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful");
    }
}
项目:AndroidBackendlessChat    文件:NativeAppCallAttachmentStore.java   
/**
 * Adds a number of bitmap attachments associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Bitmaps; the attachment names will be part of
 *                         the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentsForCall(Context context, UUID callId, Map<String, Bitmap> imageAttachments) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachments.values(), "imageAttachments");
    Validate.containsNoNullOrEmpty(imageAttachments.keySet(), "imageAttachments");

    addAttachments(context, callId, imageAttachments, new ProcessAttachment<Bitmap>() {
        @Override
        public void processAttachment(Bitmap attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            try {
                attachment.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
            } finally {
                Utility.closeQuietly(outputStream);
            }
        }
    });
}
项目:AndroidBackendlessChat    文件:FacebookDialog.java   
/**
 * 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 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
 */
public OpenGraphDialogBuilderBase(Activity activity, OpenGraphAction action, String previewPropertyName) {
    super(activity);

    Validate.notNull(action, "action");
    Validate.notNullOrEmpty(action.getType(), "action.getType()");
    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.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:chat-sdk-android-push-firebase    文件:SharedPreferencesTokenCachingStrategy.java   
/**
 * Creates a {@link SharedPreferencesTokenCachingStrategy SharedPreferencesTokenCachingStrategy} instance
 * that is distinct for the passed in cacheKey.
 *
 * @param context
 *              The Context object to use to get the SharedPreferences object.
 *
 * @param cacheKey
 *              Identifies a distinct set of token information.
 *
 * @throws NullPointerException if the passed in Context is null
 */
public SharedPreferencesTokenCachingStrategy(Context context, String cacheKey) {
    Validate.notNull(context, "context");

    this.cacheKey = Utility.isNullOrEmpty(cacheKey) ? DEFAULT_CACHE_KEY : cacheKey;

    // If the application context is available, use that. However, if it isn't
    // available (possibly because of a context that was created manually), use
    // the passed in context directly.
    Context applicationContext = context.getApplicationContext();
    context = applicationContext != null ? applicationContext : context;

    this.cache = context.getSharedPreferences(
            this.cacheKey,
            Context.MODE_PRIVATE);
}
项目:letv    文件:FacebookSdk.java   
public static String getApplicationSignature(Context context) {
    Validate.sdkInitialized();
    if (context == null) {
        return null;
    }
    PackageManager packageManager = context.getPackageManager();
    if (packageManager == null) {
        return null;
    }
    try {
        PackageInfo pInfo = packageManager.getPackageInfo(context.getPackageName(), 64);
        Signature[] signatures = pInfo.signatures;
        if (signatures == null || signatures.length == 0) {
            return null;
        }
        try {
            MessageDigest md = MessageDigest.getInstance(CommonUtils.SHA1_INSTANCE);
            md.update(pInfo.signatures[0].toByteArray());
            return Base64.encodeToString(md.digest(), 9);
        } catch (NoSuchAlgorithmException e) {
            return null;
        }
    } catch (NameNotFoundException e2) {
        return null;
    }
}
项目:kognitivo    文件:AccessTokenManager.java   
AccessTokenManager(LocalBroadcastManager localBroadcastManager,
                   AccessTokenCache accessTokenCache) {

    Validate.notNull(localBroadcastManager, "localBroadcastManager");
    Validate.notNull(accessTokenCache, "accessTokenCache");

    this.localBroadcastManager = localBroadcastManager;
    this.accessTokenCache = accessTokenCache;
}
项目:kognitivo    文件:LegacyNativeDialogParameters.java   
public static Bundle create(
        UUID callId,
        ShareContent shareContent,
        boolean shouldFailOnDataError) {
    Validate.notNull(shareContent, "shareContent");
    Validate.notNull(callId, "callId");

    Bundle nativeParams = null;
    if (shareContent instanceof ShareLinkContent) {
        final ShareLinkContent linkContent = (ShareLinkContent)shareContent;
        nativeParams = create(linkContent, shouldFailOnDataError);
    } else if (shareContent instanceof SharePhotoContent) {
        final SharePhotoContent photoContent = (SharePhotoContent)shareContent;
        List<String> photoUrls = ShareInternalUtility.getPhotoUrls(
                photoContent,
                callId);

        nativeParams = create(photoContent, photoUrls, shouldFailOnDataError);
    } else if (shareContent instanceof ShareVideoContent) {
        final ShareVideoContent videoContent = (ShareVideoContent)shareContent;
        nativeParams = create(videoContent, shouldFailOnDataError);
    } else if (shareContent instanceof ShareOpenGraphContent) {
        final ShareOpenGraphContent openGraphContent = (ShareOpenGraphContent) shareContent;
        try {
            JSONObject openGraphActionJSON = ShareInternalUtility.toJSONObjectForCall(
                    callId, openGraphContent);

            nativeParams = create(openGraphContent, openGraphActionJSON, shouldFailOnDataError);
        } catch (final JSONException e) {
            throw new FacebookException(
                    "Unable to create a JSON Object from the provided ShareOpenGraphContent: "
                            + e.getMessage());
        }
    }

    return nativeParams;
}
项目:chat-sdk-android-push-firebase    文件:NativeAppCallAttachmentStore.java   
/**
 * Adds a number of bitmap attachment files associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Files containing the bitmaps; the attachment names will be
 *                         part of the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentFilesForCall(Context context, UUID callId, Map<String, File> imageAttachmentFiles) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachmentFiles.values(), "imageAttachmentFiles");
    Validate.containsNoNullOrEmpty(imageAttachmentFiles.keySet(), "imageAttachmentFiles");

    addAttachments(context, callId, imageAttachmentFiles, new ProcessAttachment<File>() {
        @Override
        public void processAttachment(File attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            FileInputStream inputStream = null;
            try {
                inputStream = new FileInputStream(attachment);

                byte[] buffer = new byte[1024];
                int len;
                while ((len = inputStream.read(buffer)) > 0) {
                    outputStream.write(buffer, 0, len);
                }
            } finally {
                Utility.closeQuietly(outputStream);
                Utility.closeQuietly(inputStream);
            }
        }
    });
}
项目:kognitivo    文件:AccessTokenCache.java   
public void save(AccessToken accessToken) {
    Validate.notNull(accessToken, "accessToken");

    JSONObject jsonObject = null;
    try {
        jsonObject = accessToken.toJSONObject();
        sharedPreferences.edit().putString(CACHED_ACCESS_TOKEN_KEY, jsonObject.toString())
                .apply();
    } catch (JSONException e) {
        // Can't recover
    }
}
项目:kognitivo    文件:LoginClient.java   
Result(
        Request request,
        Code code,
        AccessToken token,
        String errorMessage,
        String errorCode) {
    Validate.notNull(code, "code");
    this.request = request;
    this.token = token;
    this.errorMessage = errorMessage;
    this.code = code;
    this.errorCode = errorCode;
}
项目:kognitivo    文件:FacebookSdk.java   
/**
 * Sets the Executor used by the SDK for non-AsyncTask background work.
 *
 * @param executor
 *          the Executor to use; must not be null.
 */
public static void setExecutor(Executor executor) {
    Validate.notNull(executor, "executor");
    synchronized (LOCK) {
        FacebookSdk.executor = executor;
    }
}
项目:chat-sdk-android-push-firebase    文件:WebDialog.java   
protected BuilderBase(Context context, Session session, String action, Bundle parameters) {
    Validate.notNull(session, "session");
    if (!session.isOpened()) {
        throw new FacebookException("Attempted to use a Session that was not open.");
    }
    this.session = session;

    finishInit(context, action, parameters);
}
项目:kognitivo    文件:ProfileTracker.java   
/**
 * Constructor.
 */
public ProfileTracker() {
    Validate.sdkInitialized();
    this.receiver = new ProfileBroadcastReceiver();
    this.broadcastManager = LocalBroadcastManager.getInstance(
            FacebookSdk.getApplicationContext());
    startTracking();
}
项目:kognitivo    文件:ProfileCache.java   
void save(Profile profile) {
    Validate.notNull(profile, "profile");
    JSONObject jsonObject = profile.toJSONObject();
    if (jsonObject != null) {
        sharedPreferences
                .edit()
                .putString(CACHED_PROFILE_KEY, jsonObject.toString())
                .apply();
    }
}
项目:kognitivo    文件:AppEventsLogger.java   
/**
 * Constructor is private, newLogger() methods should be used to build an instance.
 */
private AppEventsLogger(Context context, String applicationId, AccessToken accessToken) {
    Validate.notNull(context, "context");
    this.contextName = Utility.getActivityName(context);

    if (accessToken == null) {
        accessToken = AccessToken.getCurrentAccessToken();
    }

    // If we have a session and the appId passed is null or matches the session's app ID:
    if (accessToken != null &&
            (applicationId == null || applicationId.equals(accessToken.getApplicationId()))
            ) {
        accessTokenAppId = new AccessTokenAppIdPair(accessToken);
    } else {
        // If no app ID passed, get it from the manifest:
        if (applicationId == null) {
            applicationId = Utility.getMetadataApplicationId(context);
        }
        accessTokenAppId = new AccessTokenAppIdPair(null, applicationId);
    }

    synchronized (staticLock) {

        if (applicationContext == null) {
            applicationContext = context.getApplicationContext();
        }
    }

    initializeTimersIfNeeded();
}
项目:kognitivo    文件:ProfileManager.java   
ProfileManager(
        LocalBroadcastManager localBroadcastManager,
        ProfileCache profileCache) {
    Validate.notNull(localBroadcastManager, "localBroadcastManager");
    Validate.notNull(profileCache, "profileCache");
    this.localBroadcastManager = localBroadcastManager;
    this.profileCache = profileCache;
}
项目:kognitivo    文件:AccessToken.java   
/**
 * Creates a new AccessToken using the supplied information from a previously-obtained access
 * token (for instance, from an already-cached access token obtained prior to integration with
 * the Facebook SDK). Note that the caller is asserting that all parameters provided are correct
 * with respect to the access token string; no validation is done to verify they are correct.
 *
 * @param accessToken         the access token string obtained from Facebook
 * @param applicationId       the ID of the Facebook Application associated with this access
 *                            token
 * @param userId              the id of the user
 * @param permissions         the permissions that were requested when the token was obtained
 *                            (or when it was last reauthorized); may be null if permission set
 *                            is unknown
 * @param declinedPermissions the permissions that were declined when the token was obtained;
 *                            may be null if permission set is unknown
 * @param accessTokenSource   an enum indicating how the token was originally obtained (in most
 *                            cases, this will be either AccessTokenSource.FACEBOOK_APPLICATION
 *                            or AccessTokenSource.WEB_VIEW); if null, FACEBOOK_APPLICATION is
 *                            assumed.
 * @param expirationTime      the expiration date associated with the token; if null, an
 *                            infinite expiration time is assumed (but will become correct when
 *                            the token is refreshed)
 * @param lastRefreshTime     the last time the token was refreshed (or when it was first
 *                            obtained); if null, the current time is used.
 */
public AccessToken(
        final String accessToken,
        final String applicationId,
        final String userId,
        @Nullable
        final Collection<String> permissions,
        @Nullable
        final Collection<String> declinedPermissions,
        @Nullable
        final AccessTokenSource accessTokenSource,
        @Nullable
        final Date expirationTime,
        @Nullable
        final Date lastRefreshTime
) {
    Validate.notNullOrEmpty(accessToken, "accessToken");
    Validate.notNullOrEmpty(applicationId, "applicationId");
    Validate.notNullOrEmpty(userId, "userId");

    this.expires = expirationTime != null ? expirationTime : DEFAULT_EXPIRATION_TIME;
    this.permissions = Collections.unmodifiableSet(
            permissions != null ? new HashSet<String>(permissions) : new HashSet<String>());
    this.declinedPermissions = Collections.unmodifiableSet(
            declinedPermissions != null
                    ? new HashSet<String>(declinedPermissions)
                    : new HashSet<String>());
    this.token = accessToken;
    this.source = accessTokenSource != null ? accessTokenSource : DEFAULT_ACCESS_TOKEN_SOURCE;
    this.lastRefresh = lastRefreshTime != null ? lastRefreshTime : DEFAULT_LAST_REFRESH_TIME;
    this.applicationId = applicationId;
    this.userId = userId;
}
项目:kognitivo    文件:LegacyTokenHelper.java   
public static Set<String> getPermissions(Bundle bundle) {
    Validate.notNull(bundle, "bundle");
    ArrayList<String> arrayList = bundle.getStringArrayList(PERMISSIONS_KEY);
    if (arrayList == null) {
        return null;
    }
    return new HashSet<String>(arrayList);
}
项目:kognitivo    文件:AccessTokenTracker.java   
/**
 * The constructor.
 */
public AccessTokenTracker() {
    Validate.sdkInitialized();

    this.receiver = new CurrentAccessTokenBroadcastReceiver();
    this.broadcastManager = LocalBroadcastManager.getInstance(
            FacebookSdk.getApplicationContext());

    startTracking();
}
项目:chat-sdk-android-push-firebase    文件:GraphObject.java   
public GraphObjectListImpl(JSONArray state, Class<?> itemType) {
    Validate.notNull(state, "state");
    Validate.notNull(itemType, "itemType");

    this.state = state;
    this.itemType = itemType;
}
项目:chat-sdk-android-push-firebase    文件:TestSession.java   
TestSession(Activity activity, List<String> permissions, TokenCachingStrategy tokenCachingStrategy,
        String sessionUniqueUserTag, Mode mode) {
    super(activity, TestSession.testApplicationId, tokenCachingStrategy);

    Validate.notNull(permissions, "permissions");

    // Validate these as if they were arguments even though they are statics.
    Validate.notNullOrEmpty(testApplicationId, "testApplicationId");
    Validate.notNullOrEmpty(testApplicationSecret, "testApplicationSecret");

    this.sessionUniqueUserTag = sessionUniqueUserTag;
    this.mode = mode;
    this.requestedPermissions = permissions;
}
项目:AndroidBackendlessChat    文件:NativeAppCallAttachmentStore.java   
/**
 * Adds a number of bitmap attachment files associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Files containing the bitmaps; the attachment names will be
 *                         part of the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentFilesForCall(Context context, UUID callId, Map<String, File> imageAttachmentFiles) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachmentFiles.values(), "imageAttachmentFiles");
    Validate.containsNoNullOrEmpty(imageAttachmentFiles.keySet(), "imageAttachmentFiles");

    addAttachments(context, callId, imageAttachmentFiles, new ProcessAttachment<File>() {
        @Override
        public void processAttachment(File attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            FileInputStream inputStream = null;
            try {
                inputStream = new FileInputStream(attachment);

                byte[] buffer = new byte[1024];
                int len;
                while ((len = inputStream.read(buffer)) > 0) {
                    outputStream.write(buffer, 0, len);
                }
            } finally {
                Utility.closeQuietly(outputStream);
                Utility.closeQuietly(inputStream);
            }
        }
    });
}
项目:AndroidBackendlessChat    文件:GraphObject.java   
public GraphObjectListImpl(JSONArray state, Class<?> itemType) {
    Validate.notNull(state, "state");
    Validate.notNull(itemType, "itemType");

    this.state = state;
    this.itemType = itemType;
}
项目:AndroidBackendlessChat    文件:TestSession.java   
TestSession(Activity activity, List<String> permissions, TokenCachingStrategy tokenCachingStrategy,
        String sessionUniqueUserTag, Mode mode) {
    super(activity, TestSession.testApplicationId, tokenCachingStrategy);

    Validate.notNull(permissions, "permissions");

    // Validate these as if they were arguments even though they are statics.
    Validate.notNullOrEmpty(testApplicationId, "testApplicationId");
    Validate.notNullOrEmpty(testApplicationSecret, "testApplicationSecret");

    this.sessionUniqueUserTag = sessionUniqueUserTag;
    this.mode = mode;
    this.requestedPermissions = permissions;
}
项目:AndroidBackendlessChat    文件:AccessToken.java   
/**
 * Creates a new AccessToken using the information contained in an Intent populated by the Facebook
 * application in order to launch a native link. For more information on native linking, please see
 * https://developers.facebook.com/docs/mobile/android/deep_linking/.
 *
 * @param intent the Intent that was used to start an Activity; must not be null
 * @return a new AccessToken, or null if the Intent did not contain enough data to create one
 */
public static AccessToken createFromNativeLinkingIntent(Intent intent) {
    Validate.notNull(intent, "intent");

    if (intent.getExtras() == null) {
        return null;
    }

    return createFromBundle(null, intent.getExtras(), AccessTokenSource.FACEBOOK_APPLICATION_WEB, new Date());
}
项目:AndroidBackendlessChat    文件:FacebookDialog.java   
Builder(Activity activity) {
    Validate.notNull(activity, "activity");

    this.activity = activity;
    applicationId = Utility.getMetadataApplicationId(activity);
    appCall = new PendingCall(NativeProtocol.DIALOG_REQUEST_CODE);
}
项目:chat-sdk-android-push-firebase    文件:FacebookDialog.java   
Builder(Activity activity) {
    Validate.notNull(activity, "activity");

    this.activity = activity;
    applicationId = Utility.getMetadataApplicationId(activity);
    appCall = new PendingCall(NativeProtocol.DIALOG_REQUEST_CODE);
}
项目:AndroidBackendlessChat    文件:WebDialog.java   
protected BuilderBase(Context context, Session session, String action, Bundle parameters) {
    Validate.notNull(session, "session");
    if (!session.isOpened()) {
        throw new FacebookException("Attempted to use a Session that was not open.");
    }
    this.session = session;

    finishInit(context, action, parameters);
}
项目:AndroidBackendlessChat    文件:WebDialog.java   
protected BuilderBase(Context context, String applicationId, String action, Bundle parameters) {
    if (applicationId == null) {
        applicationId = Utility.getMetadataApplicationId(context);
    }
    Validate.notNullOrEmpty(applicationId, "applicationId");
    this.applicationId = applicationId;

    finishInit(context, action, parameters);
}
项目:AndroidBackendlessChat    文件:Settings.java   
/**
 * Sets the Executor used by the SDK for non-AsyncTask background work.
 *
 * @param executor
 *          the Executor to use; must not be null.
 */
public static void setExecutor(Executor executor) {
    Validate.notNull(executor, "executor");
    synchronized (LOCK) {
        Settings.executor = executor;
    }
}
项目:chat-sdk-android-push-firebase    文件:AccessToken.java   
/**
 * Creates a new AccessToken using the information contained in an Intent populated by the Facebook
 * application in order to launch a native link. For more information on native linking, please see
 * https://developers.facebook.com/docs/mobile/android/deep_linking/.
 *
 * @param intent the Intent that was used to start an Activity; must not be null
 * @return a new AccessToken, or null if the Intent did not contain enough data to create one
 */
public static AccessToken createFromNativeLinkingIntent(Intent intent) {
    Validate.notNull(intent, "intent");

    if (intent.getExtras() == null) {
        return null;
    }

    return createFromBundle(null, intent.getExtras(), AccessTokenSource.FACEBOOK_APPLICATION_WEB, new Date());
}
项目:chat-sdk-android-push-firebase    文件:Settings.java   
/**
 * Sets the Executor used by the SDK for non-AsyncTask background work.
 *
 * @param executor
 *          the Executor to use; must not be null.
 */
public static void setExecutor(Executor executor) {
    Validate.notNull(executor, "executor");
    synchronized (LOCK) {
        Settings.executor = executor;
    }
}
项目:chat-sdk-android-push-firebase    文件:WebDialog.java   
protected BuilderBase(Context context, String applicationId, String action, Bundle parameters) {
    if (applicationId == null) {
        applicationId = Utility.getMetadataApplicationId(context);
    }
    Validate.notNullOrEmpty(applicationId, "applicationId");
    this.applicationId = applicationId;

    finishInit(context, action, parameters);
}
项目:chat-sdk-android-push-firebase    文件:TokenCachingStrategy.java   
/**
 * Puts the list of permissions into a Bundle.
 * 
 * @param bundle
 *            A Bundle in which the list of permissions should be stored.
 * @param value
 *            The List&lt;String&gt; representing the list of permissions,
 *            or null.
 *
 * @throws NullPointerException if the passed in Bundle or permissions list are null
 */
public static void putPermissions(Bundle bundle, List<String> value) {
    Validate.notNull(bundle, "bundle");
    Validate.notNull(value, "value");

    ArrayList<String> arrayList;
    if (value instanceof ArrayList<?>) {
        arrayList = (ArrayList<String>) value;
    } else {
        arrayList = new ArrayList<String>(value);
    }
    bundle.putStringArrayList(PERMISSIONS_KEY, arrayList);
}
项目:letv    文件:FacebookSdk.java   
public static boolean getLimitEventAndDataUsage(Context context) {
    Validate.sdkInitialized();
    return context.getSharedPreferences("com.facebook.sdk.appEventPreferences", 0).getBoolean("limitEventUsage", false);
}