public class VTManager
extends com.lf.api.utils.EventDispatcher
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
REDIRECT_OAUTH_URL |
| Constructor and Description |
|---|
VTManager()
constructor
|
| Modifier and Type | Method and Description |
|---|---|
java.util.ArrayList<WorkoutPreset> |
combineArrayList(java.util.ArrayList<WorkoutPreset> presetListone,
java.util.ArrayList<WorkoutPreset> presetListtwo) |
AccessToken |
getAccessToken() |
java.util.List<WorkoutPreset> |
getDefaultWorkouts(Context context)
Returns the embedded workouts in the library.
|
static VTManager |
getInstance()
Returns a single instance of the workout library.
|
Progress |
getProgressSummary()
Returns the user Progress.
|
RequestToken |
getRequestToken() |
java.lang.Integer |
getUnit() |
User |
getUserProfile() |
java.util.List<WorkoutPreset> |
getUserWorkout()
Gets a JSON format of user workouts from the server and wraps them in a
class and then returns them in an ArrayList.
|
AccessToken |
login(AccessToken token) |
void |
login(Context context,
WebView webview) |
void |
logout()
Logouts the lifefitness user and clears the oauth token.
|
void |
postUserWorkout(WorkoutResult pworkoutresult)
Submits user workout result to the lifefitness server.
|
void |
setUnit(java.lang.Integer unit)
Use to set the user preferred unit from the response.
|
public AccessToken getAccessToken()
public RequestToken getRequestToken()
public static VTManager getInstance()
public void login(Context context,
WebView webview)
throws InvalidLicenseException,
java.io.IOException,
InvalidCredentialException
context - webview - InvalidLicenseExceptionjava.io.IOException - - thrown if there is no Internet connectivity or INTERNET
ACCESS & NETWORK_STATE permission is not set on the Manifest
dispatchesInvalidCredentialException
AuthorizationEvent.AUTHORIZATION_INIT
AuthorizationEvent.AUTHORIZATION_COMPLETED
AuthorizationEvent.AUTHORIZATION_NOT_ACCEPTED_BY_USER
public AccessToken login(AccessToken token) throws InvalidLicenseException, GeneralException, java.io.IOException
token - Token from the OAUTH2.0 authentication.java.io.IOException - - Thrown if there is no Internet connectivity or the INTERNET
connectivity is not in the permission manifestGeneralException - -Thrown if its a bad request.InvalidLicenseExceptionpublic java.util.List<WorkoutPreset> getUserWorkout() throws java.io.IOException, InvalidLicenseException, InvalidCredentialException, GeneralException
InvalidLicenseException - thrown if the developer didn't set the proper key.InvalidCredentialException - thrown if the token is already expired or not valid. try
calling refresh or request another token.java.io.IOExceptionGeneralExceptionWorkoutPresetpublic java.util.List<WorkoutPreset> getDefaultWorkouts(Context context) throws InvalidLicenseException
InvalidLicenseExceptionpublic void postUserWorkout(WorkoutResult pworkoutresult) throws InvalidLicenseException, InvalidCredentialException, InvalidUsageException, java.io.IOException
pworkoutresult - InvalidLicenseException - thrown if the library license is invalidInvalidCredentialException - thrown if the user is not logged in or the token is invalidInvalidUsageException - thrown if the the parameters are incorrect.java.io.IOException - thrown if there is no internet connectivity or INTERNET is
not specified in the Manifest permissions.public void logout()
public Progress getProgressSummary() throws InvalidLicenseException, InvalidCredentialException, java.io.IOException, GeneralException
InvalidCredentialExceptionInvalidLicenseExceptionGeneralExceptionjava.io.IOExceptionProgresspublic java.util.ArrayList<WorkoutPreset> combineArrayList(java.util.ArrayList<WorkoutPreset> presetListone, java.util.ArrayList<WorkoutPreset> presetListtwo)
public User getUserProfile() throws InvalidCredentialException, java.io.IOException, GeneralException
InvalidCredentialExceptionjava.io.IOExceptionGeneralExceptionUserpublic java.lang.Integer getUnit()