public class LoginButton extends Button
SessionState.CREATED_TOKEN_LOADED
state.
Developers can override the use of the active session by calling
the setSession(com.facebook.Session)
method.Modifier and Type | Class and Description |
---|---|
static interface |
LoginButton.OnErrorListener
Callback interface that will be called when a network or other error is encountered
while logging in.
|
static interface |
LoginButton.UserInfoChangedCallback
Specifies a callback interface that will be called when the button's notion of the current
user changes (if the fetch_user_info attribute is true for this control).
|
TextView.BufferType, TextView.OnEditorActionListener, TextView.SavedState
View.AccessibilityDelegate, View.BaseSavedState, View.DragShadowBuilder, View.MeasureSpec, View.OnAttachStateChangeListener, View.OnClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnSystemUiVisibilityChangeListener, View.OnTouchListener
ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_RESOLVED_DEFAULT, TRANSLATION_X, TRANSLATION_Y, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y
Constructor and Description |
---|
LoginButton(Context context)
Create the LoginButton.
|
LoginButton(Context context,
AttributeSet attrs)
Create the LoginButton by inflating from XML
|
LoginButton(Context context,
AttributeSet attrs,
int defStyle)
Create the LoginButton by inflating from XML and applying a style.
|
Modifier and Type | Method and Description |
---|---|
void |
clearPermissions()
Clears the permissions currently associated with this LoginButton.
|
SessionDefaultAudience |
getDefaultAudience()
Gets the default audience to use when the session is opened.
|
SessionLoginBehavior |
getLoginBehavior()
Gets the login behavior for the session that will be opened.
|
LoginButton.OnErrorListener |
getOnErrorListener()
Returns the current OnErrorListener for this instance of LoginButton.
|
Session.StatusCallback |
getSessionStatusCallback()
Sets the callback interface that will be called whenever the status of the Session
associated with this LoginButton changes.
|
LoginButton.UserInfoChangedCallback |
getUserInfoChangedCallback()
Gets the callback interface that will be called when the current user changes.
|
boolean |
onActivityResult(int requestCode,
int resultCode,
Intent data)
Provides an implementation for
onActivityResult that updates the Session based on information returned
during the authorization flow. |
protected void |
onAttachedToWindow() |
protected void |
onDetachedFromWindow() |
void |
onFinishInflate() |
void |
setApplicationId(String applicationId)
Set the application ID to be used to open the session.
|
void |
setDefaultAudience(SessionDefaultAudience defaultAudience)
Sets the default audience to use when the session is opened.
|
void |
setFragment(Fragment fragment)
Sets the fragment that contains this control.
|
void |
setLoginBehavior(SessionLoginBehavior loginBehavior)
Sets the login behavior for the session that will be opened.
|
void |
setOnErrorListener(LoginButton.OnErrorListener onErrorListener)
Sets an OnErrorListener for this instance of LoginButton to call into when
certain exceptions occur.
|
void |
setPublishPermissions(List<String> permissions)
Set the permissions to use when the session is opened.
|
void |
setPublishPermissions(String... permissions)
Set the permissions to use when the session is opened.
|
void |
setReadPermissions(List<String> permissions)
Set the permissions to use when the session is opened.
|
void |
setReadPermissions(String... permissions)
Set the permissions to use when the session is opened.
|
void |
setSession(Session newSession)
Set the Session object to use instead of the active Session.
|
void |
setSessionStatusCallback(Session.StatusCallback callback)
Sets the callback interface that will be called whenever the status of the Session
associated with this LoginButton changes.
|
void |
setUserInfoChangedCallback(LoginButton.UserInfoChangedCallback userInfoChangedCallback)
Sets the callback interface that will be called when the current user changes.
|
onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo
addTextChangedListener, append, append, beginBatchEdit, bringPointIntoView, cancelLongPress, clearComposingText, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollRange, debug, didTouchFocusSelect, drawableStateChanged, endBatchEdit, extractText, findViewsWithText, getAutoLinkMask, getBaseline, getBottomPaddingOffset, getCompoundDrawablePadding, getCompoundDrawables, getCompoundPaddingBottom, getCompoundPaddingLeft, getCompoundPaddingRight, getCompoundPaddingTop, getCurrentHintTextColor, getCurrentTextColor, getCustomSelectionActionModeCallback, getDefaultEditable, getDefaultMovementMethod, getEditableText, getEllipsize, getError, getExtendedPaddingBottom, getExtendedPaddingTop, getFilters, getFocusedRect, getFreezesText, getGravity, getHighlightColor, getHint, getHintTextColors, getImeActionId, getImeActionLabel, getImeOptions, getIncludeFontPadding, getInputExtras, getInputType, getKeyListener, getLayout, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLineBounds, getLineCount, getLineHeight, getLineSpacingExtra, getLineSpacingMultiplier, getLinksClickable, getLinkTextColors, getMarqueeRepeatLimit, getMaxEms, getMaxHeight, getMaxLines, getMaxWidth, getMinEms, getMinHeight, getMinLines, getMinWidth, getMovementMethod, getOffsetForPosition, getPaint, getPaintFlags, getPrivateImeOptions, getRightFadingEdgeStrength, getRightPaddingOffset, getSelectionEnd, getSelectionStart, getShadowColor, getShadowDx, getShadowDy, getShadowRadius, getText, getTextColor, getTextColors, getTextColors, getTextScaleX, getTextSize, getTopPaddingOffset, getTotalPaddingBottom, getTotalPaddingLeft, getTotalPaddingRight, getTotalPaddingTop, getTransformationMethod, getTypeface, getUrls, hasOverlappingRendering, hasSelection, invalidateDrawable, isCursorVisible, isInputMethodTarget, isPaddingOffsetRequired, isSuggestionsEnabled, isTextSelectable, jumpDrawablesToCurrentState, length, moveCursorToVisibleOffset, onBeginBatchEdit, onCheckIsTextEditor, onCommitCompletion, onCommitCorrection, onCreateDrawableState, onCreateInputConnection, onDragEvent, onDraw, onEditorAction, onEndBatchEdit, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onKeyDown, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onMeasure, onPopulateAccessibilityEvent, onPreDraw, onPrivateIMECommand, onRestoreInstanceState, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSelectionChanged, onStartTemporaryDetach, onTextChanged, onTextContextMenuItem, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, performLongClick, removeTextChangedListener, resetResolvedDrawables, resolveDrawables, sendAccessibilityEvent, setAllCaps, setAutoLinkMask, setCompoundDrawablePadding, setCompoundDrawables, setCompoundDrawablesWithIntrinsicBounds, setCompoundDrawablesWithIntrinsicBounds, setCursorVisible, setCustomSelectionActionModeCallback, setEditableFactory, setEllipsize, setEms, setEnabled, setError, setError, setExtractedText, setFilters, setFrame, setFreezesText, setGravity, setHeight, setHighlightColor, setHint, setHint, setHintTextColor, setHintTextColor, setHorizontallyScrolling, setImeActionLabel, setImeOptions, setIncludeFontPadding, setInputExtras, setInputType, setKeyListener, setLines, setLineSpacing, setLinksClickable, setLinkTextColor, setLinkTextColor, setMarqueeRepeatLimit, setMaxEms, setMaxHeight, setMaxLines, setMaxWidth, setMinEms, setMinHeight, setMinLines, setMinWidth, setMovementMethod, setOnEditorActionListener, setPadding, setPaddingRelative, setPaintFlags, setPrivateImeOptions, setRawInputType, setScroller, setSelectAllOnFocus, setSelected, setShadowLayer, setSingleLine, setSingleLine, setSpannableFactory, setText, setText, setText, setText, setText, setTextAppearance, setTextColor, setTextColor, setTextIsSelectable, setTextKeepState, setTextKeepState, setTextScaleX, setTextSize, setTextSize, setTransformationMethod, setTypeface, setTypeface, setWidth, verifyDrawable
addChildrenForAccessibility, addFocusables, addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addTouchables, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearFocus, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeVerticalScrollOffset, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchGenericFocusedEvent, dispatchGenericMotionEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, draw, findFocus, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, getAccessibilityNodeProvider, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBottom, getBottomFadingEdgeStrength, getCameraDistance, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLayerType, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOverScrollMode, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTop, getTopFadingEdgeStrength, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, hasFocus, hasFocusable, hasOnClickListeners, hasTransientState, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, isActivated, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onConfigurationChanged, onCreateContextMenu, onDisplayHint, onDrawScrollBars, onFilterTouchEventForSecurity, onHoverChanged, onHoverEvent, onKeyLongPress, onOverScrolled, onSetAlpha, onSizeChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performHapticFeedback, performHapticFeedback, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLayerType, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOverScrollMode, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSoundEffectsEnabled, setSystemUiVisibility, setTag, setTag, setTop, setTouchDelegate, setTranslationX, setTranslationY, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, showContextMenu, startActionMode, startAnimation, startDrag, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
public LoginButton(Context context)
View.View(Context)
public LoginButton(Context context, AttributeSet attrs)
View.View(Context, AttributeSet)
public LoginButton(Context context, AttributeSet attrs, int defStyle)
public void setOnErrorListener(LoginButton.OnErrorListener onErrorListener)
onErrorListener
- The listener object to setpublic LoginButton.OnErrorListener getOnErrorListener()
public void setDefaultAudience(SessionDefaultAudience defaultAudience)
defaultAudience
- the default audience value to usepublic SessionDefaultAudience getDefaultAudience()
public void setReadPermissions(List<String> permissions)
permissions
- the read permissions to useUnsupportedOperationException
- if setPublishPermissions has been calledpublic void setReadPermissions(String... permissions)
permissions
- the read permissions to useUnsupportedOperationException
- if setPublishPermissions has been calledpublic void setPublishPermissions(List<String> permissions)
permissions
- the read permissions to useUnsupportedOperationException
- if setReadPermissions has been calledIllegalArgumentException
- if permissions is null or emptypublic void setPublishPermissions(String... permissions)
permissions
- the read permissions to useUnsupportedOperationException
- if setReadPermissions has been calledIllegalArgumentException
- if permissions is null or emptypublic void clearPermissions()
public void setLoginBehavior(SessionLoginBehavior loginBehavior)
SessionLoginBehavior.SSO_WITH_FALLBACK
will be used.loginBehavior
- The SessionLoginBehavior
that
specifies what behaviors should be attempted during
authorization.public SessionLoginBehavior getLoginBehavior()
SessionLoginBehavior.SSO_WITH_FALLBACK
will be used.SessionLoginBehavior
that
specifies what behaviors should be attempted during
authorization.public void setApplicationId(String applicationId)
applicationId
- the application ID to usepublic LoginButton.UserInfoChangedCallback getUserInfoChangedCallback()
public void setUserInfoChangedCallback(LoginButton.UserInfoChangedCallback userInfoChangedCallback)
userInfoChangedCallback
- the callback interfacepublic void setSessionStatusCallback(Session.StatusCallback callback)
callback
- the callback interfacepublic Session.StatusCallback getSessionStatusCallback()
public boolean onActivityResult(int requestCode, int resultCode, Intent data)
onActivityResult
that updates the Session based on information returned
during the authorization flow. The Activity containing this view
should forward the resulting onActivityResult call here to
update the Session state based on the contents of the resultCode and
data.requestCode
- The requestCode parameter from the forwarded call. When this
onActivityResult occurs as part of Facebook authorization
flow, this value is the activityCode passed to open or
authorize.resultCode
- An int containing the resultCode parameter from the forwarded
call.data
- The Intent passed as the data parameter from the forwarded
call.Session.onActivityResult(Activity, int, int, Intent)
public void setSession(Session newSession)
newSession
- the Session object to useFacebookException
- if errors occur during the loading of user informationpublic void onFinishInflate()
onFinishInflate
in class View
public void setFragment(Fragment fragment)
onActivityResult
call rather than the Activity.fragment
- the fragment that contains this controlprotected void onAttachedToWindow()
onAttachedToWindow
in class TextView
protected void onDetachedFromWindow()
onDetachedFromWindow
in class TextView