Package io.anyline2.legacy.trainer
Class AssetController
- java.lang.Object
-
- io.anyline2.core.AssetDelegate
-
- io.anyline2.legacy.trainer.AssetController
-
public class AssetController extends AssetDelegate
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.Stringpath
-
Constructor Summary
Constructors Constructor Description AssetController(android.content.Context context, java.lang.String assetPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareLocalAssetsAvailable()Returns true if local assets are available.voidcancelUpdate()Cancel an ongoing updatevoidcheckForUpdates()Checks whether asset updates are availablevoidcreateBackup()Creates a backup of the current assetsbooleandeleteBackup()Deletes the backup folderbooleandeleteLocalAssets()Delete the local assetsjava.util.List<java.lang.String>getAssetFiles()Gets a list of all local assets that have been stored for this project.java.lang.StringgetAssetId()java.lang.StringgetAssetVersion()Gets the asset versionjava.lang.StringgetPath()Gets the asset pathjava.lang.StringgetReportingValues()java.lang.StringgetSchemaPath()booleanisActive()Returns true if the AssetController if 'SetupAssetUpdate' was called.booleanisUpdateLocked()voidlockUpdate()voidonAssetDownloadProgress(java.lang.String assetName, float progress)voidonAssetUpdateAvailable(boolean updateAvailable)voidonAssetUpdateError(java.lang.String error)voidonAssetUpdateFinished()voidresetAssetUpdate()Resets the asset update functionality.voidrestoreBackup()Restores assets from a backup if it existsvoidsetPath(java.lang.String path)Sets the asset pathvoidsetReportingValues(java.lang.String reportingValues)voidsetupAssetUpdate(AssetContext assetContext, IAssetDelegate callback)Sets up the AssetController with a context to the Trainer project and a delegate to handle callbacks.voidupdateAssets()Updates the assets, only aftercheckForUpdates()was successfully called-
Methods inherited from class io.anyline2.core.AssetDelegate
destroy
-
-
-
-
Method Detail
-
setupAssetUpdate
public void setupAssetUpdate(AssetContext assetContext, IAssetDelegate callback)
Sets up the AssetController with a context to the Trainer project and a delegate to handle callbacks. After this method is called, the AssetController is considered 'active'.- Parameters:
assetContext- The contextcallback- The callback
-
lockUpdate
public void lockUpdate()
-
isUpdateLocked
public boolean isUpdateLocked()
-
resetAssetUpdate
public void resetAssetUpdate()
Resets the asset update functionality. After this is called,setupAssetUpdate(AssetContext, IAssetDelegate)must be called again
-
createBackup
public void createBackup()
Creates a backup of the current assets
-
restoreBackup
public void restoreBackup()
Restores assets from a backup if it exists
-
deleteBackup
public boolean deleteBackup()
Deletes the backup folder- Returns:
- success of the function
-
getPath
public java.lang.String getPath()
Gets the asset path- Returns:
- asset path
-
setPath
public void setPath(java.lang.String path)
Sets the asset path- Parameters:
path- asset path
-
getSchemaPath
public java.lang.String getSchemaPath()
-
getAssetFiles
public java.util.List<java.lang.String> getAssetFiles()
Gets a list of all local assets that have been stored for this project.
-
getAssetVersion
public java.lang.String getAssetVersion()
Gets the asset version- Returns:
- asset version
-
areLocalAssetsAvailable
public boolean areLocalAssetsAvailable()
Returns true if local assets are available.
-
isActive
public boolean isActive()
Returns true if the AssetController if 'SetupAssetUpdate' was called. Returns false if 'ResetAssetUpdate' was called or 'SetupAssetUpdate' has not been called.
-
checkForUpdates
public void checkForUpdates()
Checks whether asset updates are available
-
updateAssets
public void updateAssets()
Updates the assets, only aftercheckForUpdates()was successfully called
-
getReportingValues
public java.lang.String getReportingValues()
-
setReportingValues
public void setReportingValues(java.lang.String reportingValues)
-
cancelUpdate
public void cancelUpdate()
Cancel an ongoing update
-
getAssetId
public java.lang.String getAssetId()
-
deleteLocalAssets
public boolean deleteLocalAssets()
Delete the local assets
-
onAssetDownloadProgress
public void onAssetDownloadProgress(java.lang.String assetName, float progress)- Specified by:
onAssetDownloadProgressin classAssetDelegate
-
onAssetUpdateAvailable
public void onAssetUpdateAvailable(boolean updateAvailable)
- Specified by:
onAssetUpdateAvailablein classAssetDelegate
-
onAssetUpdateError
public void onAssetUpdateError(java.lang.String error)
- Specified by:
onAssetUpdateErrorin classAssetDelegate
-
onAssetUpdateFinished
public void onAssetUpdateFinished()
- Specified by:
onAssetUpdateFinishedin classAssetDelegate
-
-