static AuxiliaryViewPosition fromInt(int enumValue) { for (AuxiliaryViewPosition auxViewPosition : values()) { if (auxViewPosition.getValue() == enumValue) { return auxViewPosition; } } return null; }
private Bundle getAnalyticsParameters() { Bundle params = new Bundle(); params.putString(AnalyticsEvents.PARAMETER_LIKE_VIEW_STYLE, likeViewStyle.toString()); params.putString( AnalyticsEvents.PARAMETER_LIKE_VIEW_AUXILIARY_POSITION, auxiliaryViewPosition.toString()); params.putString( AnalyticsEvents.PARAMETER_LIKE_VIEW_HORIZONTAL_ALIGNMENT, horizontalAlignment.toString()); params.putString( AnalyticsEvents.PARAMETER_LIKE_VIEW_OBJECT_ID, Utility.coerceValueIfNullOrEmpty(objectId, "")); return params; }
private void parseAttributes(AttributeSet attrs) { if (attrs == null || getContext() == null) { return; } TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.com_facebook_like_view); if (a == null) { return; } objectId = Utility.coerceValueIfNullOrEmpty( a.getString(R.styleable.com_facebook_like_view_object_id), null); objectType = ObjectType.fromInt( a.getInt( R.styleable.com_facebook_like_view_object_type, ObjectType.DEFAULT.getValue())); likeViewStyle = Style.fromInt(a.getInt(R.styleable.com_facebook_like_view_style, Style.DEFAULT.getValue())); if (likeViewStyle == null) { throw new IllegalArgumentException("Unsupported value for LikeView 'style'"); } auxiliaryViewPosition = AuxiliaryViewPosition.fromInt( a.getInt( R.styleable.com_facebook_like_view_auxiliary_view_position, AuxiliaryViewPosition.DEFAULT.getValue())); if (auxiliaryViewPosition == null) { throw new IllegalArgumentException( "Unsupported value for LikeView 'auxiliary_view_position'"); } horizontalAlignment = HorizontalAlignment.fromInt( a.getInt( R.styleable.com_facebook_like_view_horizontal_alignment, HorizontalAlignment.DEFAULT.getValue())); if (horizontalAlignment == null) { throw new IllegalArgumentException("Unsupported value for LikeView 'horizontal_alignment'"); } foregroundColor = a.getColor(R.styleable.com_facebook_like_view_foreground_color, NO_FOREGROUND_COLOR); a.recycle(); }