public class FileSource extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
FileSource.ResourceTransformCallback
This callback allows implementors to transform URLs before they are requested
from the internet.
|
Modifier and Type | Method and Description |
---|---|
void |
activate() |
void |
deactivate() |
protected void |
finalize() |
String |
getAccessToken() |
static FileSource |
getInstance(Context context)
Get the single instance of FileSource.
|
static String |
getInternalCachePath(Context context)
Get internal cache path for a context.
|
static String |
getResourcesCachePath(Context context)
Get files directory path for a context.
|
static void |
initializeFileDirsPaths(Context context)
Initializes file directories paths.
|
boolean |
isActivated() |
static boolean |
isExternalStorageReadable()
Checks if external storage is available to at least read.
|
void |
setAccessToken(String accessToken) |
void |
setApiBaseUrl(String baseUrl) |
void |
setResourceTransform(FileSource.ResourceTransformCallback callback)
Sets a callback for transforming URLs requested from the internet
|
public static FileSource getInstance(Context context)
context
- the context to derive the cache path frompublic static boolean isExternalStorageReadable()
Code from https://developer.android.com/guide/topics/data/data-storage.html#filesExternal
public static void initializeFileDirsPaths(Context context)
context
- the context to derive paths frompublic static String getResourcesCachePath(Context context)
context
- the context to derive the files directory path frompublic static String getInternalCachePath(Context context)
context
- the context to derive the internal cache path frompublic boolean isActivated()
public void activate()
public void deactivate()
public void setAccessToken(String accessToken)
public String getAccessToken()
public void setApiBaseUrl(String baseUrl)
public void setResourceTransform(FileSource.ResourceTransformCallback callback)
The callback will be executed on the main thread once for every requested URL.
callback
- the callback to be invoked or null to reset© 2015–2018 Mapbox. All rights reserved.