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.String
path
-
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 boolean
areLocalAssetsAvailable()
Returns true if local assets are available.void
cancelUpdate()
Cancel an ongoing updatevoid
checkForUpdates()
Checks whether asset updates are availablevoid
createBackup()
Creates a backup of the current assetsboolean
deleteBackup()
Deletes the backup folderboolean
deleteLocalAssets()
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.String
getAssetId()
java.lang.String
getAssetVersion()
Gets the asset versionjava.lang.String
getPath()
Gets the asset pathjava.lang.String
getReportingValues()
java.lang.String
getSchemaPath()
boolean
isActive()
Returns true if the AssetController if 'SetupAssetUpdate' was called.boolean
isUpdateLocked()
void
lockUpdate()
void
onAssetDownloadProgress(java.lang.String assetName, float progress)
void
onAssetUpdateAvailable(boolean updateAvailable)
void
onAssetUpdateError(java.lang.String error)
void
onAssetUpdateFinished()
void
resetAssetUpdate()
Resets the asset update functionality.void
restoreBackup()
Restores assets from a backup if it existsvoid
setPath(java.lang.String path)
Sets the asset pathvoid
setReportingValues(java.lang.String reportingValues)
void
setupAssetUpdate(AssetContext assetContext, IAssetDelegate callback)
Sets up the AssetController with a context to the Trainer project and a delegate to handle callbacks.void
updateAssets()
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:
onAssetDownloadProgress
in classAssetDelegate
-
onAssetUpdateAvailable
public void onAssetUpdateAvailable(boolean updateAvailable)
- Specified by:
onAssetUpdateAvailable
in classAssetDelegate
-
onAssetUpdateError
public void onAssetUpdateError(java.lang.String error)
- Specified by:
onAssetUpdateError
in classAssetDelegate
-
onAssetUpdateFinished
public void onAssetUpdateFinished()
- Specified by:
onAssetUpdateFinished
in classAssetDelegate
-
-