protected FacebookDialogBase(final Activity activity, int requestCode) { Validate.notNull(activity, "activity"); this.activity = activity; this.fragmentWrapper = null; this.requestCode = requestCode; }
public Builder(Context context, Uri imageUri) { Validate.notNull(imageUri, "imageUri"); this.context = context; this.imageUrl = imageUri; }
/** * 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; } }
AccessTokenManager(LocalBroadcastManager localBroadcastManager, AccessTokenCache accessTokenCache) { Validate.notNull(localBroadcastManager, "localBroadcastManager"); Validate.notNull(accessTokenCache, "accessTokenCache"); this.localBroadcastManager = localBroadcastManager; this.accessTokenCache = accessTokenCache; }
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; }
public static long getLastRefreshMilliseconds(Bundle bundle) { Validate.notNull(bundle, "bundle"); return bundle.getLong(LAST_REFRESH_DATE_KEY); }
public static AccessTokenSource getSource(Bundle bundle) { Validate.notNull(bundle, "bundle"); if (bundle.containsKey(TOKEN_SOURCE_KEY)) { return (AccessTokenSource) bundle.getSerializable(TOKEN_SOURCE_KEY); } else { boolean isSSO = bundle.getBoolean(IS_SSO_KEY); return isSSO ? AccessTokenSource.FACEBOOK_APPLICATION_WEB : AccessTokenSource.WEB_VIEW; } }
public LegacyTokenHelper(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); }
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); }
public static void hasInternetPermissions(Context context, boolean shouldThrow) { Validate.notNull(context, "context"); if (context.checkCallingOrSelfPermission(Manifest.permission.INTERNET) == PackageManager.PERMISSION_DENIED) { if (shouldThrow) { throw new IllegalStateException(NO_INTERNET_PERMISSION_REASON); } else { Log.w(TAG, NO_INTERNET_PERMISSION_REASON); } } }
void save(Profile profile) { Validate.notNull(profile, "profile"); JSONObject jsonObject = profile.toJSONObject(); if (jsonObject != null) { sharedPreferences .edit() .putString(CACHED_PROFILE_KEY, jsonObject.toString()) .apply(); } }
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 } }