public Logger(LoggingBehavior behavior, String tag) { Validate.notNullOrEmpty(tag, "tag"); this.behavior = behavior; this.tag = LOG_TAG_BASE + tag; this.contents = new StringBuilder(); }
/** * Sets the list of friends for pre selection. These friends will be selected by default. * @param graphUsers list of friends as GraphUsers */ public void setSelection(List<JSONObject> graphUsers) { List<String> userIds = new ArrayList<String>(); for(JSONObject graphUser: graphUsers) { String id = graphUser.optString("id"); Validate.notNullOrEmpty(id, "id"); userIds.add(id); } setSelectionByIds(userIds); }
public static Uri getProfilePictureUri( String userId, int width, int height) { Validate.notNullOrEmpty(userId, "userId"); width = Math.max(width, UNSPECIFIED_DIMENSION); height = Math.max(height, UNSPECIFIED_DIMENSION); if (width == UNSPECIFIED_DIMENSION && height == UNSPECIFIED_DIMENSION) { throw new IllegalArgumentException("Either width or height must be greater than 0"); } Uri.Builder builder = Uri.parse(ServerProtocol.getGraphUrlBase()) .buildUpon() .path(String.format( Locale.US, PATH, FacebookSdk.getGraphApiVersion(), userId)); if (height != UNSPECIFIED_DIMENSION) { builder.appendQueryParameter(HEIGHT_PARAM, String.valueOf(height)); } if (width != UNSPECIFIED_DIMENSION) { builder.appendQueryParameter(WIDTH_PARAM, String.valueOf(width)); } builder.appendQueryParameter(MIGRATION_PARAM, MIGRATION_VALUE); return builder.build(); }
/** * Constructor that builds a dialog without an authenticated user. * * @param context the Context within which the dialog will be shown. * @param applicationId the application ID to be included in the dialog URL. * @param action the portion of the dialog URL following www.facebook.com/dialog/. * See https://developers.facebook.com/docs/reference/dialogs/ for details. * @param parameters a Bundle containing parameters to pass as part of the URL. */ public Builder(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); }
@Test public void testNotNullOrEmptyOnNull() { try { Validate.notNullOrEmpty(null, "name"); fail("expected exception"); } catch (Exception e) { } }
@Test public void testNotNullOrEmptyOnEmpty() { try { Validate.notNullOrEmpty("", "name"); fail("expected exception"); } catch (Exception e) { } }
@Test public void testNotNullOrEmptyOnNonEmpty() { Validate.notNullOrEmpty("hi", "name"); }
final Date dataAccessExpirationTime ) { Validate.notNullOrEmpty(accessToken, "accessToken"); Validate.notNullOrEmpty(applicationId, "applicationId"); Validate.notNullOrEmpty(userId, "userId");
@Nullable final Uri linkUri) { Validate.notNullOrEmpty(id, "id");
public Logger(LoggingBehavior behavior, String tag) { Validate.notNullOrEmpty(tag, "tag"); this.behavior = behavior; this.tag = LOG_TAG_BASE + tag; this.contents = new StringBuilder(); }
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; }
public static URI getProfilePictureUrl( String userId, int width, int height) throws URISyntaxException { Validate.notNullOrEmpty(userId, "userId"); width = Math.max(width, UNSPECIFIED_DIMENSION); height = Math.max(height, UNSPECIFIED_DIMENSION); if (width == UNSPECIFIED_DIMENSION && height == UNSPECIFIED_DIMENSION) { throw new IllegalArgumentException("Either width or height must be greater than 0"); } Uri.Builder builder = new Uri.Builder().encodedPath(String.format(PROFILEPIC_URL_FORMAT, userId)); if (height != UNSPECIFIED_DIMENSION) { builder.appendQueryParameter(HEIGHT_PARAM, String.valueOf(height)); } if (width != UNSPECIFIED_DIMENSION) { builder.appendQueryParameter(WIDTH_PARAM, String.valueOf(width)); } builder.appendQueryParameter(MIGRATION_PARAM, MIGRATION_VALUE); return new URI(builder.toString()); }
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); }
/** * 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; }
Validate.notNullOrEmpty(actionType, "actionType"); Validate.notNullOrEmpty(previewPropertyName, "previewPropertyName"); if (action.getProperty(previewPropertyName) == null) { throw new IllegalArgumentException(