@@ -613,9 +613,6 @@ public synchronized void loadPlugin(final JSONArray args, final CallbackContext
613613 plugins .put (pluginName , pluginEntry );
614614 mapCtrl .pluginManager .addService (pluginEntry );
615615
616- plugin .privateInitialize (pluginName , cordova , webView , null );
617-
618- plugin .initialize (cordova , webView );
619616 ((MyPluginInterface )plugin ).setPluginMap (PluginMap .this );
620617 MyPlugin myPlugin = (MyPlugin ) plugin ;
621618 myPlugin .self = (MyPlugin )plugin ;
@@ -666,8 +663,6 @@ public void create(final JSONArray args, final CallbackContext callbackContext)
666663 pluginMap = PluginMap .this ;
667664 pluginMap .mapCtrl .pluginManager .addService (pluginEntry );
668665
669- plugin .privateInitialize (className , cordova , webView , null );
670- plugin .initialize (cordova , webView );
671666 ((MyPluginInterface )plugin ).setPluginMap (PluginMap .this );
672667 pluginEntry .plugin .execute ("create" , args , callbackContext );
673668
@@ -724,28 +719,32 @@ public void run() {
724719 activity .runOnUiThread (new Runnable () {
725720 @ Override
726721 public void run () {
727- if (mapDivId != null ) {
728- RectF drawRect = mapCtrl .mPluginLayout .HTMLNodeRectFs .get (mapDivId );
729-
730- //Log.d(TAG, "--->mapDivId = " + mapDivId + ", drawRect = " + drawRect);
731- if (drawRect != null ) {
732- final int scrollY = webView .getView ().getScrollY ();
733-
734- int width = (int ) drawRect .width ();
735- int height = (int ) drawRect .height ();
736- int x = (int ) drawRect .left ;
737- int y = (int ) drawRect .top + scrollY ;
738- ViewGroup .LayoutParams lParams = mapView .getLayoutParams ();
739- FrameLayout .LayoutParams params = (FrameLayout .LayoutParams ) lParams ;
740-
741- params .width = width ;
742- params .height = height ;
743- params .leftMargin = x ;
744- params .topMargin = y ;
745- mapView .setLayoutParams (params );
746722
723+ if (mapCtrl .mPluginLayout == null || mapDivId == null ) {
747724 callbackContext .success ();
748- }
725+ return ;
726+ }
727+
728+ RectF drawRect = mapCtrl .mPluginLayout .HTMLNodeRectFs .get (mapDivId );
729+
730+ //Log.d(TAG, "--->mapDivId = " + mapDivId + ", drawRect = " + drawRect);
731+ if (drawRect != null ) {
732+ final int scrollY = webView .getView ().getScrollY ();
733+
734+ int width = (int ) drawRect .width ();
735+ int height = (int ) drawRect .height ();
736+ int x = (int ) drawRect .left ;
737+ int y = (int ) drawRect .top + scrollY ;
738+ ViewGroup .LayoutParams lParams = mapView .getLayoutParams ();
739+ FrameLayout .LayoutParams params = (FrameLayout .LayoutParams ) lParams ;
740+
741+ params .width = width ;
742+ params .height = height ;
743+ params .leftMargin = x ;
744+ params .topMargin = y ;
745+ mapView .setLayoutParams (params );
746+
747+ callbackContext .success ();
749748 }
750749 }
751750 });
@@ -1748,6 +1747,26 @@ public void run() {
17481747 });
17491748 }
17501749
1750+
1751+ /**
1752+ * Stop camera animation
1753+ * @param args
1754+ * @param callbackContext
1755+ * @throws JSONException
1756+ */
1757+ public void stopAnimation (JSONArray args , final CallbackContext callbackContext ) throws JSONException {
1758+
1759+ this .activity .runOnUiThread (new Runnable () {
1760+ @ Override
1761+ public void run () {
1762+ if (map != null ) {
1763+ map .stopAnimation ();
1764+ }
1765+ callbackContext .success ();
1766+ }
1767+ });
1768+ }
1769+
17511770 /**
17521771 * Pan by the specified pixel
17531772 * @param args
0 commit comments