|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.support.v4.app.Fragment
com.facebook.widget.UserSettingsFragment
public class UserSettingsFragment
A Fragment that displays a Login/Logout button as well as the user's profile picture and name when logged in.
This Fragment will create and use the active session upon construction if it has the available data (if the app ID is specified in the manifest). It will also open the active session if it does not require user interaction (i.e. if the session is in theSessionState.CREATED_TOKEN_LOADED
state.
Developers can override the use of the active session by calling
the setSession(com.facebook.Session)
method.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class android.support.v4.app.Fragment |
---|
Fragment.InstantiationException, Fragment.SavedState |
Constructor Summary | |
---|---|
UserSettingsFragment()
|
Method Summary | |
---|---|
void |
clearPermissions()
Clears the permissions currently associated with this LoginButton. |
protected void |
closeSession()
Closes the current session. |
protected void |
closeSessionAndClearTokenInformation()
Closes the current session as well as clearing the token cache. |
protected String |
getAccessToken()
Gets the access token associated with the current session or null if no session has been created. |
SessionDefaultAudience |
getDefaultAudience()
Gets the default audience to use when the session is opened. |
protected Date |
getExpirationDate()
Gets the date at which the current session will expire or null if no session has been created. |
SessionLoginBehavior |
getLoginBehavior()
Gets the login behavior for the session that will be opened. |
LoginButton.OnErrorListener |
getOnErrorListener()
Returns the current OnErrorListener for this instance of UserSettingsFragment. |
protected Session |
getSession()
Gets the current Session. |
protected List<String> |
getSessionPermissions()
Gets the permissions associated with the current session or null if no session has been created. |
protected SessionState |
getSessionState()
Gets the current state of the session or null if no session has been created. |
Session.StatusCallback |
getSessionStatusCallback()
Sets the callback interface that will be called whenever the status of the Session associated with this LoginButton changes. |
protected boolean |
isSessionOpen()
Determines whether the current session is open. |
void |
onActivityCreated(Bundle savedInstanceState)
|
void |
onActivityResult(int requestCode,
int resultCode,
Intent data)
Called when the activity that was launched exits. |
void |
onCreate(Bundle savedInstanceState)
|
View |
onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
|
void |
onDestroy()
|
void |
onResume()
|
protected void |
onSessionStateChange(SessionState state,
Exception exception)
Called when the session state changes. |
protected void |
openSession()
Opens a new session. |
protected void |
openSessionForPublish(String applicationId,
List<String> permissions)
Opens a new session with publish permissions. |
protected void |
openSessionForPublish(String applicationId,
List<String> permissions,
SessionLoginBehavior behavior,
int activityCode)
Opens a new session with publish permissions. |
protected void |
openSessionForRead(String applicationId,
List<String> permissions)
Opens a new session with read permissions. |
protected void |
openSessionForRead(String applicationId,
List<String> permissions,
SessionLoginBehavior behavior,
int activityCode)
Opens a new session with read permissions. |
void |
setDefaultAudience(SessionDefaultAudience defaultAudience)
Sets the default audience to use when the session is opened. |
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 UserSettingsFragment to call into when certain exceptions occur. |
void |
setPublishPermissions(List<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 |
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UserSettingsFragment()
Method Detail |
---|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
onCreateView
in class Fragment
public void onCreate(Bundle savedInstanceState)
onCreate
in class Fragment
public void onResume()
onResume
in class Fragment
FacebookException
- if errors occur during the loading of user informationpublic void setSession(Session newSession)
newSession
- the Session object to use
FacebookException
- if errors occur during the loading of user informationpublic void setDefaultAudience(SessionDefaultAudience defaultAudience)
defaultAudience
- the default audience value to usepublic SessionDefaultAudience getDefaultAudience()
public void setReadPermissions(List<String> permissions)
permissions
- the read permissions to use
UnsupportedOperationException
- if setPublishPermissions has been calledpublic void setPublishPermissions(List<String> permissions)
permissions
- the read permissions to use
UnsupportedOperationException
- if setReadPermissions has been called
IllegalArgumentException
- 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 setOnErrorListener(LoginButton.OnErrorListener onErrorListener)
onErrorListener
- The listener object to setpublic LoginButton.OnErrorListener getOnErrorListener()
public void setSessionStatusCallback(Session.StatusCallback callback)
callback
- the callback interfacepublic Session.StatusCallback getSessionStatusCallback()
protected void onSessionStateChange(SessionState state, Exception exception)
state
- the new stateexception
- any exceptions that occurred during the state changepublic void onActivityCreated(Bundle savedInstanceState)
onActivityCreated
in class Fragment
public void onActivityResult(int requestCode, int resultCode, Intent data)
super.onActivityResult(...)
first.
onActivityResult
in class Fragment
public void onDestroy()
onDestroy
in class Fragment
protected final Session getSession()
protected final boolean isSessionOpen()
protected final SessionState getSessionState()
protected final String getAccessToken()
protected final Date getExpirationDate()
protected final void closeSession()
protected final void closeSessionAndClearTokenInformation()
protected final List<String> getSessionPermissions()
protected final void openSession()
protected final void openSessionForRead(String applicationId, List<String> permissions)
applicationId
- the applicationID, can be nullpermissions
- the permissions list, can be nullprotected final void openSessionForRead(String applicationId, List<String> permissions, SessionLoginBehavior behavior, int activityCode)
applicationId
- the applicationID, can be nullpermissions
- the permissions list, can be nullbehavior
- the login behavior to use with the sessionactivityCode
- the activity code to use for the SSO activityprotected final void openSessionForPublish(String applicationId, List<String> permissions)
applicationId
- the applicationID, can be nullpermissions
- the permissions list, cannot be nullprotected final void openSessionForPublish(String applicationId, List<String> permissions, SessionLoginBehavior behavior, int activityCode)
applicationId
- the applicationID, can be nullpermissions
- the permissions list, cannot be nullbehavior
- the login behavior to use with the sessionactivityCode
- the activity code to use for the SSO activity
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |