platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java in rhodes-3.0.2 vs platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java in rhodes-3.1.0.beta.1
- old
+ new
@@ -1,5 +1,31 @@
+/*------------------------------------------------------------------------
+* (The MIT License)
+*
+* Copyright (c) 2008-2011 Rhomobile, Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*
+* http://rhomobile.com
+*------------------------------------------------------------------------*/
+
package com.rhomobile.rhodes.mapview;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -45,10 +71,13 @@
private String apiKey;
private Vector<Annotation> annotations;
+
+ static private ExtrasHolder mHolder = null;
+
private static class Coordinates {
public double latitude;
public double longitude;
public Coordinates() {
@@ -68,10 +97,11 @@
if (mServiceConnection != null) {
unbindService(mServiceConnection);
mServiceConnection = null;
}
super.onDestroy();
+ mc = null;
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -91,11 +121,14 @@
RelativeLayout layout = new RelativeLayout(this);
setContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
// Extrace parameters
- Bundle extras = getIntent().getExtras();
+ //Bundle extras = getIntent().getExtras();
+
+ ExtrasHolder extras = mHolder;
+
apiKey = extras.getString(SETTINGS_PREFIX + "api_key");
// Extract settings
String map_type = extras.getString(SETTINGS_PREFIX + "map_type");
if (map_type == null)
@@ -204,10 +237,12 @@
Logger.E(TAG, "Wrong region radius: " + e.getMessage());
}
}
}
+ mHolder.clear();
+
view.preLoad();
Thread geocoding = new Thread(new Runnable() {
public void run() {
doGeocoding();
@@ -281,12 +316,15 @@
return false;
}
@SuppressWarnings("unchecked")
public static void create(String gapiKey, Map<String, Object> params) {
+ mHolder = new ExtrasHolder();
try {
- Intent intent = new Intent(RhodesActivity.getContext(), GoogleMapView.class);
+ Intent intent_obj = new Intent(RhodesActivity.getContext(), GoogleMapView.class);
+ mHolder.clear();
+ ExtrasHolder intent = mHolder;
intent.putExtra(SETTINGS_PREFIX + "api_key", gapiKey);
Object settings = params.get("settings");
if (settings != null && (settings instanceof Map<?,?>)) {
Map<Object, Object> hash = (Map<Object, Object>)settings;
@@ -379,10 +417,10 @@
if (url != null && (url instanceof String))
intent.putExtra(prefix + "url", (String)url);
}
}
- RhodesService.getInstance().startActivity(intent);
+ RhodesService.getInstance().startActivity(intent_obj);
}
catch (Exception e) {
reportFail("create", e);
}
}