Commit Graph

78 Commits

Author SHA1 Message Date
Antonio Zugaldia
7d1a4c5ec1 [android] Create a new local reference frame to avoid a local reference table overflow
Fixes #4706
2016-05-03 13:10:37 -04:00
John Firebaugh
b4b693e09f [android] Add completedTile{Count,Size} bindings 2016-04-27 13:41:29 -07:00
Thiago Marcos P. Santos
7d80690f91 [android] Restore prior GLContext if exists
Apparently some versions of Android, notable 4.4.4 running
on my Nexus 5, creates a GLContext on the Android UIThread
which is the one we are now using for rendering after #2909.

If the context is not restored, nothing gets rendered (or
sometimes partially, or artifacts) because Android will try
to do GL stuff on the context used by Mapbox GL and mess things up.
2016-04-18 18:57:20 +03:00
John Firebaugh
6e78eabfff [core] Clean up ThreadContext vestiges 2016-04-15 09:56:18 -07:00
John Firebaugh
3af3e72bb3 [all] Replace HTTPContextBase/HTTPRequestBase with FileSource 2016-04-14 14:18:19 -07:00
Thiago Marcos P. Santos
ba3125142e [android] Make the correct GL context current 2016-04-14 13:51:27 -07:00
Thiago Marcos P. Santos
7b3c61f619 [android] Do not attach/detach to threads
Not needed as everything is now running on the same thread.
2016-04-14 13:51:27 -07:00
Thiago Marcos P. Santos
02db7fa852 [android] Create a RunLoop for the main thread 2016-04-14 13:51:27 -07:00
Thiago Marcos P. Santos
40e590b681 [android] Use ALooper_addFd() and callbacks to wake up
This is needed for plugging into an existing Looper because
we won't call ::run() on the main thread (this is called
on the Java side of the application automatically by Android).

But we still need to wake up and process the events. For that
we create a pipe and write to the pipe to wake up the main
loop and we process events on the callback of the fd handler.

Fixes #4682
2016-04-14 13:44:08 -07:00
John Firebaugh
204c7fee03 [core] Render from the main thread
Do not create a thread for the MapContext anymore.
2016-04-14 13:44:08 -07:00
Brad Leege
9a3e8ae571 [android] #4619 - Creating standalone CustomLayerActivity example 2016-04-06 14:44:52 -05:00
Thiago Marcos P. Santos
10b503eabf [android] Attach thread on the RunLoop
Needed because Looper could be used by Java and it would crash
complaining that we didn't detach otherwise.
2016-04-06 04:52:51 -03:00
Thiago Marcos P. Santos
74a1d3c164 [android] Introduce RunLoop based on Looper
Also implement a Timer and AsyncTask based on Android's Looper.
2016-04-06 04:52:51 -03:00
John Firebaugh
5eda74a514 Merge branch 'release-ios-3.2.0-android-4.0.0' 2016-03-30 17:43:37 -07:00
Brad Leege
335e346ed1 [android] #4475 - Introducing LatLng.wrap() and removing usage of wrap() in JNI's nativeLatLngForPixel() 2016-03-25 16:55:07 -05:00
Brad Leege
6a29e7e624 [android] #4444 - Wrapping all LatLng from nativeLatLngForPixel() to solve problem and mirror Android Google Maps API 2016-03-24 16:59:47 -05:00
John Firebaugh
169755e89a [core] Unify FileRequest and WorkRequest 2016-03-24 10:54:32 -07:00
Antonio Zugaldia
682b404bf6 [android] Unify cache and offline databases
See #4362
2016-03-21 10:55:54 -07:00
John Firebaugh
1593b962ed [android] Throw C++ exceptions by value, not by pointer
Refs #4385
2016-03-18 16:29:22 -07:00
Bruno de Oliveira Abinader
15621b066c [android] Remove default transition duration 2016-03-18 01:26:22 +02:00
Tobrun
20c3706536 [android] #4240 - add flag to resize only when needed. 2016-03-08 08:06:55 -05:00
Tobrun
e9b7cd724f [android] #3631 - resize fix issue 2016-03-07 21:47:40 -05:00
Tobrun
46986c665e [android] #2996 - test workaround for device not sharing context 2016-03-07 21:46:11 -05:00
Thiago Marcos P. Santos
fe811bd38e [android] Do not reach native if the HTTPContext was invalidated
Native will get destroyed before the Java HTTPRequest and asynchronous
requests might still get answered.

If the request gets canceled, we now clear the reference to the native
code and it will never reach it.

Lock is needed because OkHTTP replies on its own thread, so we need to
guard the access to the variable we use for checking if the Request was
canceled. In the future we could remove the lock and use Runnable when
we move Android main loop to Looper instead of libuv.

Like the other implementations of HTTPRequest on Mapbox GL Native, the
request is destroyed synchronously on ::cancel().
2016-03-07 19:13:56 -03:00
John Firebaugh
b318903ab9 [android] Don't crash if someone tries to use OfflineRegion after delete 2016-03-07 09:31:16 -08:00
John Firebaugh
c8b100ffe4 [android] Remove redundant arguments from offline native methods
`this` is automatically provided as the first argument to a native method.
2016-03-07 09:31:16 -08:00
John Firebaugh
6aa8be56f6 [android] destroyOfflineRegion must not delete an already-deleted peer 2016-03-07 09:31:16 -08:00
John Firebaugh
0386aeea22 [android] Don't call util::toString() on a null exception_ptr 2016-03-07 09:31:16 -08:00
John Firebaugh
cce49c147d [android] Don't leak global references to OfflineRegionObservers 2016-03-04 18:45:38 -08:00
John Firebaugh
dbffe1dfab [android] Use jni.hpp low-level wrappers 2016-03-04 15:33:32 -08:00
John Firebaugh
068998cf8a [android] Remove JNI_OnUnload; it is in practice never called
http://bleaklow.com/2006/02/18/jni_onunload_mostly_useless.html
2016-03-04 15:33:32 -08:00
John Firebaugh
edbd4284f2 [android] Remove JNICALL; it's a no-op macro 2016-03-04 15:33:32 -08:00
John Firebaugh
f321bf2514 [android] Remove unnecessary declarations from jni.hpp 2016-03-04 15:33:32 -08:00
John Firebaugh
235f4ee6f6 [android] Use jni.hpp in http_request_android.cpp 2016-03-04 15:33:32 -08:00
Antonio Zugaldia
ee12824c83 [android] Make listOfflineRegions include definitions
Fixes #4165
2016-03-03 13:14:56 -05:00
Tobrun
bc63d75227 [android] #3867 - performance improvement for invalidating the camera 2016-03-03 13:28:01 +01:00
Bruno de Oliveira Abinader
c17e954983 [android|ios|osx] Fix return type for pixelForLatLng 2016-03-01 20:58:54 +00:00
Bruno de Oliveira Abinader
4994b3dc57 [core] PrecisionPoint is now ScreenCoordinate 2016-03-01 20:58:54 +00:00
Antonio Zugaldia
55cacfafd4 [android] Simplify offline metadata API on Android
Fixes #4139
2016-02-29 13:45:08 -05:00
Antonio Zugaldia
11d3eff173 [android] Remove invoke to DeleteGlobalRef to avoid client crash
See #4121
2016-02-26 10:05:47 -05:00
Antonio Zugaldia
01e55f183e # This is a combination of 8 commits.
# The first commit's message is:
# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 3 commits.
# The first commit's message is:
# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 21 commits.
# The first commit's message is:
[android] - Implements Android bindings for offline API
Fixes #3891

# The 2nd commit message will be skipped:

#	[android] #3891 - rename OFFLINE_MAX_CACHE_SIZE to DEFAULT_MAX_CACHE_SIZE and adjust value

# The 3rd commit message will be skipped:

#	[android] #3891 - makes de documentation more relevant to the current android implementation

# The 4th commit message will be skipped:

#	[android] #3891 - rename isRequiredResourceCountIsIndeterminate() to isRequiredResourceCountPrecise()

# The 5th commit message will be skipped:

#	[android] #3891 - rename complete() to isComplete()

# The 6th commit message will be skipped:

#	[android] #3891 - rename OfflineRegionDefinition to OfflineTilePyramidRegionDefinition and make OfflineRegionDefinition an interface. Docs for corresponding classes updated.

# The 7th commit message will be skipped:

#	[android] #3891 - make reason a more idiomatic ErrorReason Android IntDef and remove unnecessary constructor

# The 8th commit message will be skipped:

#	[android] #3891 - reuse the calling object instead of creating a new manager

# The 9th commit message will be skipped:

#	[android] #3891 - location, location, location

# The 10th commit message will be skipped:

#	[android] #3891 - simpler list regions iteration

# The 11th commit message will be skipped:

#	[android] #3891 - proper indeterminate -> precise transition

# The 12th commit message will be skipped:

#	[android] #3891 - improve description for DEFAULT_MAX_CACHE_SIZE

# The 13th commit message will be skipped:

#	[android] #3891 - delete global refs for obj and listCallback

# The 14th commit message will be skipped:

#	[android] #3891 - simplify metadata conversion and fix metadata object

# The 15th commit message will be skipped:

#	[android] - Implements Android bindings for offline API
#	Fixes #3891

# The 16th commit message will be skipped:

#	[android] #3891 - avoid exposing the int reason value in the public API

# The 17th commit message will be skipped:

#	[android] #3891 - delete global refs for remaining callbacks and observer

# The 18th commit message will be skipped:

#	[android] #3891 - remove unused offlineManagerClassConstructorId together with unnecessary private java constructor

# The 19th commit message will be skipped:

#	[android] #3891 - remove non-relevant line

# The 20th commit message will be skipped:

#	[android] #3891 - handle requiredResourceCountIsIndeterminate -> requiredResourceCountIsPrecise rename

# The 21st commit message will be skipped:

#	[android] #3891 - revert map changes to allow rebase

# The 2nd commit message will be skipped:

#	[android] #3891 - avoid exposing the int reason value in the public API

# The 2nd commit message will be skipped:

#	[android] #3891 - rename complete() to isComplete()

# The 3rd commit message will be skipped:

#	[android] #3891 - rename OfflineRegionDefinition to OfflineTilePyramidRegionDefinition and make OfflineRegionDefinition an interface. Docs for corresponding classes updated.

# The 2nd commit message will be skipped:

#	[android] #3891 - location, location, location

# The 2nd commit message will be skipped:

#	[android] #3891 - improve description for DEFAULT_MAX_CACHE_SIZE

# The 3rd commit message will be skipped:

#	[android] #3891 - delete global refs for obj and listCallback

# The 4th commit message will be skipped:

#	[android] #3891 - simplify metadata conversion and fix metadata object

# The 5th commit message will be skipped:

#	[android] #3891 - delete global refs for remaining callbacks and observer

# The 6th commit message will be skipped:

#	[android] #3891 - remove unused offlineManagerClassConstructorId together with unnecessary private java constructor

# The 7th commit message will be skipped:

#	[android] #3891 - remove non-relevant line

# The 8th commit message will be skipped:

#	[android] #3891 - handle requiredResourceCountIsIndeterminate -> requiredResourceCountIsPrecise rename
2016-02-26 09:13:17 -05:00
Thiago Marcos P. Santos
18380708cd [android] Fix crash on HTTP 200 with no data 2016-02-23 00:21:57 +02:00
Gabriel Miklós
b395302990 [android] Update marker position and icon #3885 2016-02-15 11:05:29 +01:00
John Firebaugh
ff15bd51b9 [core] Throttle the number of concurrent requests to 20 2016-02-10 15:40:20 -08:00
John Firebaugh
e9302c797f [all] Don't interpret 404s on non-tile resources as "no content" 2016-02-10 15:40:20 -08:00
John Firebaugh
7eb1a91c4e [all] Do not set Response data for 404s
For AssetFileSource and the node FileSource this was already the case; this makes the other implementations consistent.
2016-02-10 15:40:20 -08:00
Jonas Bergvall
040fc09ea7 [android] Fixed error with asset URLs with URL encoded spaces. 2016-02-08 10:05:57 -08:00
Konstantin Käfer
2f06ca74e2 [core] move platform/gl.hpp to gl/gl.hpp 2016-02-08 12:50:00 +01:00
John Firebaugh
4d29c7d5ce [core] Remove Response::Error::Reason::Canceled
There is no such thing as a cancelled response, only cancelled requests. A request that is cancelled does not have its callback called with a Response.
2016-02-04 13:18:14 -08:00
Tobrun
aa05cba0df [android] #3758 - Projection / Visible Region implementation.
[android] #3758 - add VisibleRegion + unit tests, removed boundingbox, cleanup jni, cleanup test app, renamed CoordinateSpan to LatLng.
2016-02-04 12:08:39 +01:00