Skip to content

Commit

Permalink
Merge pull request #85 from hieupham007/timob-18244
Browse files Browse the repository at this point in the history
[TIMOB-18244]: Fixed a couple map crashes
  • Loading branch information
jonalter committed Mar 30, 2015
2 parents c7249ee + c14a968 commit 6fa1f40
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
Binary file added android/dist/ti.map-android-2.3.0.zip
Binary file not shown.
2 changes: 2 additions & 0 deletions android/documentation/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Change Log
<pre>

v2.3.0 Fixed a couple crashing issues with map, added API name. [TIMOB-18244]

v2.2.5 Fixed the example. [MOD-2073]

v2.2.4 Added support for density-specific images for leftButton and rightButton properties. [MOD-1771]
Expand Down
4 changes: 2 additions & 2 deletions android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 2.2.5
version: 2.3.0
apiversion: 2
architectures: armeabi armeabi-v7a x86
description: External version of Map module to support new Google Map v2 sdk
Expand All @@ -16,5 +16,5 @@ name: map
moduleid: ti.map
guid: f0d8fd44-86d2-4730-b67d-bd454577aeee
platform: android
minsdk: 3.3.0
minsdk: 4.1.0
respackage: com.google.android.gms
17 changes: 17 additions & 0 deletions android/src/ti/map/TiUIMapView.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class TiUIMapView extends TiUIFragment implements GoogleMap.OnMarkerClick
protected LatLngBounds preLayoutUpdateBounds;
protected ArrayList<TiMarker> timarkers;
protected AnnotationProxy selectedAnnotation;
private int retries = 0;

public TiUIMapView(final TiViewProxy proxy, Activity activity)
{
Expand Down Expand Up @@ -102,6 +103,22 @@ protected void processPreloadRoutes()
protected void onViewCreated()
{
map = acquireMap();

if (map == null && retries < 10) {
Log.w(TAG, "Cannot load map. Retrying");
sendMessage();
retries++;
return;
}

if (map == null) {
Log.e(TAG, "Unable to load map");
return;
}

//successfully loaded map
retries = 0;

//A workaround for https://code.google.com/p/android/issues/detail?id=11676 pre Jelly Bean.
//This problem doesn't exist on 4.1+ since the map base view changes to TextureView from SurfaceView.
if (Build.VERSION.SDK_INT < 16) {
Expand Down
5 changes: 5 additions & 0 deletions android/src/ti/map/ViewProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -591,4 +591,9 @@ public void handleSetLocation(HashMap<String, Object> location)
Log.e(TAG, "Unable set location since the map view has not been created yet. Use setRegion() instead.");
}
}

public String getApiName()
{
return "Ti.Map";
}
}

0 comments on commit 6fa1f40

Please sign in to comment.