public static ToolTipMode fromInt(int enumValue) { for (ToolTipMode mode : values()) { if (mode.getValue() == enumValue) { return mode; } } return null; }
private void parseLoginButtonAttributes( final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) { this.toolTipMode = ToolTipMode.DEFAULT; final TypedArray a = context .getTheme() .obtainStyledAttributes( attrs, R.styleable.com_facebook_login_view, defStyleAttr, defStyleRes); try { confirmLogout = a.getBoolean(R.styleable.com_facebook_login_view_com_facebook_confirm_logout, true); loginText = a.getString(R.styleable.com_facebook_login_view_com_facebook_login_text); logoutText = a.getString(R.styleable.com_facebook_login_view_com_facebook_logout_text); toolTipMode = ToolTipMode.fromInt( a.getInt( R.styleable.com_facebook_login_view_com_facebook_tooltip_mode, ToolTipMode.DEFAULT.getValue())); } finally { a.recycle(); } }