blob: 02e3ed0908b955bfab6ca28f5a7f14eea55d1802 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
package com.mapbox.mapboxsdk.storage;
import android.support.annotation.UiThread;
import android.support.annotation.NonNull;
@UiThread
public class DefaultFileSource {
//
// Native peer management
//
static {
System.loadLibrary("mapbox-gl");
}
// Pointer to the native peer
private long peer;
// Initializes the native peer object
private native void initialize(String cachePath, String assetRoot, long maximumCacheSize);
@Override
protected native void finalize() throws Throwable;
//
// Constants
//
/*
* The maximumCacheSize parameter is a limit applied to non-offline resources only,
* i.e. resources added to the database for the "ambient use" caching functionality.
* There is no size limit for offline resources.
*/
private static final long DEFAULT_MAX_CACHE_SIZE = 50 * 1024 * 1024;
//
// Constructors
//
/**
* Creates a new DefaultFileSource object.
*
* @param cachePath Path to the cache database file
* @param assetRoot Path to the APK that contains the assets
* @param maximumCacheSize Maximum size of the database file, in bytes
*/
public DefaultFileSource(@NonNull String cachePath, @NonNull String assetRoot, long maximumCacheSize) {
initialize(cachePath, assetRoot, maximumCacheSize);
}
/**
* Creates a new DefaultFileSource object.
*
* @param cachePath Path to the cache database file
* @param assetRoot Path to the APK that contains the assets
*/
public DefaultFileSource(@NonNull String cachePath, @NonNull String assetRoot) {
initialize(cachePath, assetRoot, DEFAULT_MAX_CACHE_SIZE);
}
//
// Methods
//
/**
* Sets the API base URL when connecting to Mapbox servers. Defaults to <code>https://api.mapbox.com</code>.
*
* @param apiBaseURL New path prefix of Mapbox-hosted assets
*/
public native void setAPIBaseURL(@NonNull String apiBaseURL);
/**
* Returns the currently set API base URL for Mapbox-hosted assets.
*
* @return The path prefix for Mapbox-hosted assets
*/
public native String getAPIBaseURL();
/**
* Sets the access token for Mapbox resources.
*
* @param accessToken New access token for Mapbox-hosted assets
*/
public native void setAccessToken(@NonNull String accessToken);
/**
* Returns the current Mapbox access token.
*
* @return The access token currently used for requesting Mapbox-hosted assets
*/
public native String getAccessToken();
}
|