LoginActivity¶
-
public class
LoginActivity
extends RedirectableAppCompatActivity¶ Login screen that lets a user either sign in with email and password or create a new account
Methods¶
isLoggedIn¶
Check whether any user is currently signed in
Parameters: - settings – The app’s shared settings, which store user preferences
Returns: true
if a user is signed in,false
otherwise
onCreate¶
-
protected void
onCreate
(Bundle savedInstanceState)¶ Create the user interface from
R.layout.activity_login
. Also setup buttons to perform the associated actions, including log-ins withAPI.Get.loginWithCred(RequestQueue,String,String,SharedPreferences,Response.Listener)
and account creation withAPI.Post.user(RequestQueue,User,String,String,Response.Listener)
. Also sets up the animations to convert between signing in and creating an account.Parameters: - savedInstanceState – {@inheritDoc}
setLoggedIn¶
Largely for testing, this public method can be used to set which user is currently logged in This is useful for PickOnboardingStatusActivity because different login states correspond to different users. No logged-in user is signalled by a missing SharedPreferences entry.
Parameters: - settings – The SharedPreferences storing user login state
- userID – ID of the user to make logged-in
setLoggedOut¶
Logout the currently logged-out user. If no user is logged in, nothing happens
Parameters: - settings – The app’s shared settings, which store user preferences