diff --git a/GoogleMaps/lib/CLDC11.jar b/GoogleMaps/lib/CLDC11.jar deleted file mode 100644 index 73ca016..0000000 Binary files a/GoogleMaps/lib/CLDC11.jar and /dev/null differ diff --git a/GoogleMaps/native/android/com/codename1/googlemaps/InternalNativeMapsImpl.java b/GoogleMaps/native/android/com/codename1/googlemaps/InternalNativeMapsImpl.java index 89269c2..41fb7bf 100644 --- a/GoogleMaps/native/android/com/codename1/googlemaps/InternalNativeMapsImpl.java +++ b/GoogleMaps/native/android/com/codename1/googlemaps/InternalNativeMapsImpl.java @@ -32,23 +32,29 @@ import com.google.android.gms.maps.model.LatLng; import android.graphics.BitmapFactory; import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.view.ViewGroup; +import android.graphics.BitmapFactory; +import android.graphics.Point; import android.os.Bundle; +import android.os.Looper; +import android.view.View; +import android.view.ViewGroup; import com.codename1.impl.android.AndroidImplementation; +import com.codename1.impl.android.AndroidNativeUtil; import com.codename1.impl.android.LifecycleListener; -import com.google.android.gms.maps.model.BitmapDescriptorFactory; +import com.codename1.io.Log; import com.google.android.gms.maps.CameraUpdateFactory; +import com.google.android.gms.maps.GoogleMap; +import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.MapsInitializer; -import android.os.Looper; -import android.view.View; -import com.google.android.gms.maps.model.PolylineOptions; -import com.google.android.gms.maps.model.Polyline; -import android.graphics.Point; -//import com.codename1.impl.android.AndroidImplementation.PeerDraw; -import com.codename1.io.Log; -import com.codename1.ui.Display; +import com.google.android.gms.maps.OnMapReadyCallback; +import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.CameraPosition; +import com.google.android.gms.maps.model.LatLng; +import com.google.android.gms.maps.model.Marker; +import com.google.android.gms.maps.model.MarkerOptions; +import com.google.android.gms.maps.model.Polyline; +import com.google.android.gms.maps.model.PolylineOptions; +import java.util.HashMap; public class InternalNativeMapsImpl implements LifecycleListener { private int mapId; @@ -64,21 +70,25 @@ public class InternalNativeMapsImpl implements LifecycleListener { private Point lastPoint; private boolean showMyLocation; private boolean rotateGestureEnabled; + private static boolean initialized = false; static { + if(AndroidNativeUtil.getActivity() != null) { - android.util.Log.d("CN1 Maps", "Initializing maps"); + android.util.Log.i("CN1 Maps", "Initializing maps"); if (Looper.getMainLooper().getThread() == Thread.currentThread()) { + android.util.Log.i("CN1 Mapss", "static()->getMainLooper:ok"); initMaps(); } else { AndroidNativeUtil.getActivity().runOnUiThread(new Runnable() { public void run() { + android.util.Log.d("CN1 Mapss", "static()->runOnUiThread:ok"); initMaps(); } }); } } else { - android.util.Log.d("CN1 Mapss", "Did not initialize maps because activity was null"); + android.util.Log.i("CN1 Mapss", "static()->Did not initialize maps because activity was null"); } AndroidNativeUtil.registerViewRenderer(MapView.class, new AndroidNativeUtil.BitmapViewRenderer() { @@ -98,6 +108,7 @@ public Bitmap renderViewOnBitmap(View v, final int w, final int h) { } }); + } private static class PeerImage { @@ -236,6 +247,7 @@ public void run() { private static boolean initialized = false; private static void initMaps() { + if (!initialized) { initialized = true; try { @@ -246,12 +258,15 @@ private static void initMaps() { v.onCreate(AndroidNativeUtil.getActivationBundle()); v.onResume(); v.getMap(); + android.util.Log.i("CN1 Mapss", "initMaps()->initialized:"+initialized); } catch (Exception e) { supported = false; System.out.println("Failed to initialize, google play services not installed: " + e); e.printStackTrace(); } - } + } else + android.util.Log.i("CN1 Mapss", "initMaps()->initialized:"+initialized); + } public long addMarker(final byte[] icon, final double lat, final double lon, final String text, final String snippet, final boolean callback) { @@ -261,7 +276,7 @@ public long addMarker(final byte[] icon, final double lat, final double lon, fin public void run() { MarkerOptions mo = new MarkerOptions(); if(text != null) { - mo.title(text); + mo.title(text); } if(icon != null) { Bitmap bmp = BitmapFactory.decodeByteArray(icon, 0, icon.length); @@ -271,8 +286,12 @@ public void run() { mo.snippet(snippet); } mo.position(new LatLng(lat, lon)); - + Marker m = mapInstance.addMarker(mo); + + if (text!=null) + m.showInfoWindow(); + if(callback) { listeners.put(m, key); } @@ -470,6 +489,7 @@ public void onMapLongClick(LatLng point) { }); mapInstance.setMyLocationEnabled(showMyLocation); mapInstance.getUiSettings().setRotateGesturesEnabled(rotateGestureEnabled); + android.util.Log.i("CN1 Mapss", "installListeners()->loaded:ok"); } }); @@ -501,6 +521,8 @@ public void run() { //PeerImage.submitUpdate(view, view.getWidth(), view.getHeight()); } }); + android.util.Log.i("CN1 Mapss", "createNativeMap()->mapInstance:"+(mapInstance!=null?"ok":"null")); + android.util.Log.i("CN1 Mapss", "createNativeMap()->view :"+(view!=null?"ok":"null")); return view; } @@ -588,13 +610,12 @@ public boolean isSupported() { } public void onCreate(Bundle savedInstanceState) { + android.util.Log.d("CN1 Mapss", "onCreate()"); try { if (view != null) { view.onCreate(savedInstanceState); initMaps(); mapInstance = view.getMap(); - - } } catch (Exception e) { e.printStackTrace(); @@ -602,19 +623,25 @@ public void onCreate(Bundle savedInstanceState) { } public void onResume() { + android.util.Log.i("CN1 Mapss", "onResume()"); try { if(view != null) { - mapInstance = view.getMap(); + view.onResume(); + mapInstance = view.getMap(); installListeners(); - } + android.util.Log.i("CN1 Mapss", "onResume()->ok"); + }else + android.util.Log.i("CN1 Mapss", "onResume()->view:null"); } catch (Exception e) { e.printStackTrace(); + android.util.Log.e("CN1 Mapss", "onResume()->err:"+e.toString()); } } public void onPause() { + android.util.Log.i("CN1 Mapss", "onPause()"); try { if(view != null) { view.onPause(); @@ -622,10 +649,12 @@ public void onPause() { } } catch (Exception ex) { ex.printStackTrace(); + android.util.Log.e("CN1 Mapss", "onPause()->err:"+ex.toString()); } } public void onDestroy() { + android.util.Log.i("CN1 Mapss", "onDestroy()"); try { if(view != null) { if (view.getParent() != null) { @@ -636,6 +665,7 @@ public void onDestroy() { } } catch (Exception e) { e.printStackTrace(); + android.util.Log.e("CN1 Mapss", "onPause()->err:"+e.toString()); } } @@ -650,6 +680,7 @@ public void onSaveInstanceState(Bundle b) { } public void onLowMemory() { + android.util.Log.i("CN1 Mapss", "onLowMemory()"); try { if(view != null) { view.onLowMemory(); diff --git a/GoogleMaps/native/ios/com_codename1_googlemaps_InternalNativeMapsImpl.m b/GoogleMaps/native/ios/com_codename1_googlemaps_InternalNativeMapsImpl.m index b99aab2..0237e51 100644 --- a/GoogleMaps/native/ios/com_codename1_googlemaps_InternalNativeMapsImpl.m +++ b/GoogleMaps/native/ios/com_codename1_googlemaps_InternalNativeMapsImpl.m @@ -50,7 +50,8 @@ -(long long)addMarker:(NSData*)param param1:(double)param1 param2:(double)param2 } else { marker.userData = nil; } - + //mapView.appearAnimation = kGMSMarkerAnimationPop + mapView.selectedMarker = marker; [marker retain]; [pool release]; }); diff --git a/GoogleMaps/nbproject/project.properties b/GoogleMaps/nbproject/project.properties index d29f9de..99989f3 100644 --- a/GoogleMaps/nbproject/project.properties +++ b/GoogleMaps/nbproject/project.properties @@ -1,79 +1,79 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=GoogleMaps -application.vendor=Codename One -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/GoogleMaps.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.CLDC11.jar=lib/CLDC11.jar -file.reference.CodenameOne.jar=lib/CodenameOne.jar -file.reference.CodenameOne_SRC.zip=lib/CodenameOne_SRC.zip -file.reference.GoogleMaps-override=override -includes=** -jar.compress=false -javac.classpath=\ - ${file.reference.CLDC11.jar}:\ - ${file.reference.CodenameOne.jar}:\ - ${file.reference.CodenameOne_SRC.zip}:\ - ${file.reference.GoogleMaps-override} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.5 -javac.target=1.5 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value -# or test-sys-prop.name=value to set system properties for unit tests): -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=windows-1252 -src.dir=src -test.src.dir=test +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=GoogleMaps +application.vendor=Codename One +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/GoogleMaps.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.CLDC11.jar=lib/CLDC11.jar +file.reference.CodenameOne.jar=lib/CodenameOne.jar +file.reference.CodenameOne_SRC.zip=lib/CodenameOne_SRC.zip +includes=** +jar.compress=true +javac.classpath=\ + ${file.reference.CLDC11.jar}:\ + ${file.reference.CodenameOne.jar}:\ + ${file.reference.CodenameOne_SRC.zip} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=windows-1252 +src.dir=src +test.src.dir=test diff --git a/GoogleMaps/src/com/codename1/googlemaps/MapContainer.java b/GoogleMaps/src/com/codename1/googlemaps/MapContainer.java index 2bf7d2a..329f69e 100644 --- a/GoogleMaps/src/com/codename1/googlemaps/MapContainer.java +++ b/GoogleMaps/src/com/codename1/googlemaps/MapContainer.java @@ -18,7 +18,6 @@ package com.codename1.googlemaps; import com.codename1.components.WebBrowser; -import com.codename1.io.Log; import com.codename1.io.Util; import com.codename1.javascript.JSFunction; import com.codename1.javascript.JSObject; @@ -32,11 +31,11 @@ import com.codename1.maps.layers.LinesLayer; import com.codename1.maps.layers.PointLayer; import com.codename1.maps.layers.PointsLayer; -import com.codename1.ui.Container; import com.codename1.maps.providers.MapProvider; import com.codename1.maps.providers.OpenStreetMapProvider; import com.codename1.system.NativeLookup; import com.codename1.ui.BrowserComponent; +import com.codename1.ui.Container; import com.codename1.ui.Display; import com.codename1.ui.EncodedImage; import com.codename1.ui.PeerComponent; @@ -206,8 +205,8 @@ public void longPointerPress(int x, int y) { addComponent(BorderLayout.CENTER, internalLightweightCmp); } else { internalBrowser = new BrowserComponent(); - internalBrowser.getAllStyles().setPadding(0,0,0,0); - internalBrowser.getAllStyles().setMargin(0,0,0,0); + //internalBrowser.getAllStyles().setPadding(0,0,0,0); + //internalBrowser.getAllStyles().setMargin(0,0,0,0); initBrowserComponent(htmlApiKey); @@ -426,7 +425,6 @@ public MapObject addMarker(EncodedImage icon, Coord location, String text, Strin if(points == null) { points = new PointsLayer(); internalLightweightCmp.addLayer(points); - } points.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { PointLayer point = (PointLayer)evt.getSource(); @@ -439,15 +437,43 @@ public void actionPerformed(ActionEvent evt) { return; } } - } - }); - points.addPoint(pl); - MapObject o = new MapObject(); - o.point = pl; - o.callback = onClick; - markers.add(o); - internalLightweightCmp.revalidate(); - return o; + } + }); + if (text!=null) + pl.setDisplayName(true); + points.addPoint(pl); + MapObject o = new MapObject(); + o.point = pl; + o.callback = onClick; + markers.add(o); + return o; + } else{ + + internalLightweightCmp.addLayer(points); + points.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + PointLayer point = (PointLayer) evt.getSource(); + for (MapObject o : markers) { + if (o.point == point) { + if (o.callback != null) { + o.callback.actionPerformed(new ActionEvent(o)); + } + return; + } + } + } + }); + if (text!=null) + pl.setDisplayName(true); + points.addPoint(pl); + MapObject o = new MapObject(); + o.point = pl; + o.callback = onClick; + markers.add(o); + return o; + + } + } else { diff --git a/GoogleMapsTest/codenameone_settings.properties b/GoogleMapsTest/codenameone_settings.properties index 8dda7b2..c0d3a75 100644 --- a/GoogleMapsTest/codenameone_settings.properties +++ b/GoogleMapsTest/codenameone_settings.properties @@ -1,61 +1,61 @@ -# -#Thu Feb 09 10:52:02 IST 2017 -codename1.ios.appid=Q5GHSKAL2F.com.codename1.test.googlemaps -codename1.ios.release.provision= -codename1.arg.rim.obfuscation=false -codename1.arg.ios.objC=true -codename1.j2me.nativeTheme=nbproject/nativej2me.res -codename1.arg.ios.project_type=ios -codename1.arg.ios.debug_local_disabled=GoogleMapsTest -codename1.arg.ios.interface_orientation=UIInterfaceOrientationPortrait\:UIInterfaceOrientationPortraitUpsideDown\:UIInterfaceOrientationLandscapeLeft\:UIInterfaceOrientationLandscapeRight -codename1.displayName=GoogleMapsTest -codename1.arg.ios.pods.platform=7.0 -codename1.android.keystoreAlias= -codename1.arg.android.xapplication= -codename1.ios.release.certificate= -codename1.android.keystorePassword= -codename1.ios.provision= -codename1.arg.ios.dsym=false -codename1.arg.android.release=true -codename1.arg.ios.glAppDelegateHeader=\n\#import "GoogleMaps/GoogleMaps.h" -codename1.arg.ios.statusbar_hidden=false -codename1.arg.android.includeGPlayServices=true -codename1.arg.ios.afterFinishLaunching=[GMSServices provideAPIKey\:@"AIzaSyD8dOfPwyS1Bqt3jQy82JuMTqyFwKGVOxE"]; -codename1.languageLevel=5 -codename1.android.keystore= -codename1.arg.ios.pods=,GoogleMaps -codename1.vendor=CodenameOne -codename1.arg.javascript.googlemaps.key=AIzaSyCDlCEMoAyZfD5kTtvtI9FxsglGktdKSLU -codename1.arg.win.ver=8 -codename1.arg.ios.locationUsageDescription=Some functionality of the application depends on your location -codename1.arg.android.playService.maps=true -codename1.ios.certificatePassword= -codename1.arg.zooz.sandbox=false -codename1.ios.debug.certificatePassword= -codename1.arg.ios.fastbuild=true -codename1.mainName=GoogleMapsTestApp -codename1.ios.release.certificatePassword= -codename1.arg.ios.pods.sources=,https\://github.com/CocoaPods/Specs.git -codename1.arg.ios.prerendered_icon=false -codename1.arg.vserv.scaleMode=false -codename1.ios.debug.certificate= -libVersion=149 -codename1.arg.android.xpermissions= -codename1.arg.ios.application_exits=false -codename1.secondaryTitle=CodenameOne_Template -codename1.description= -codename1.ios.debug.provision= -codename1.arg.javascript.minifying=false -codename1.arg.build.incSources=1 -codename1.arg.j2me.nativeThemeConst=0 -codename1.rim.certificatePassword= -codename1.version=1.0 -codename1.ios.certificate= -codename1.icon=icon.png -codename1.rim.signtoolCsk= -codename1.arg.android.debug=false -codename1.rim.signtoolDb= -codename1.arg.vserv.transition=300000 -codename1.packageName=com.codename1.test.googlemaps -codename1.arg.ios.testFlight=false -codename1.arg.ios.includePush=false +# +#Fri Mar 17 19:28:50 BOT 2017 +codename1.ios.appid=Q5GHSKAL2F.com.codename1.test.googlemaps +codename1.ios.release.provision= +codename1.arg.rim.obfuscation=false +codename1.arg.ios.objC=true +codename1.j2me.nativeTheme=nbproject/nativej2me.res +codename1.arg.ios.project_type=ios +codename1.arg.ios.debug_local_disabled=GoogleMapsTest +codename1.arg.ios.interface_orientation=UIInterfaceOrientationPortrait\:UIInterfaceOrientationPortraitUpsideDown\:UIInterfaceOrientationLandscapeLeft\:UIInterfaceOrientationLandscapeRight +codename1.displayName=GoogleMapsTest +codename1.arg.ios.pods.platform=7.0 +codename1.android.keystoreAlias= +codename1.arg.android.xapplication= +codename1.ios.release.certificate= +codename1.android.keystorePassword= +codename1.ios.provision= +codename1.arg.ios.dsym=false +codename1.arg.android.release=true +codename1.arg.ios.glAppDelegateHeader=\n\#import "GoogleMaps/GoogleMaps.h" +codename1.arg.ios.statusbar_hidden=false +codename1.arg.android.includeGPlayServices=true +codename1.arg.ios.afterFinishLaunching=[GMSServices provideAPIKey\:@"AIzaSyD8dOfPwyS1Bqt3jQy82JuMTqyFwKGVOxE"]; +codename1.languageLevel=5 +codename1.android.keystore= +codename1.arg.ios.pods=,GoogleMaps +codename1.vendor=CodenameOne +codename1.arg.javascript.googlemaps.key=AIzaSyCDlCEMoAyZfD5kTtvtI9FxsglGktdKSLU +codename1.arg.win.ver=8 +codename1.arg.ios.locationUsageDescription=Some functionality of the application depends on your location +codename1.arg.android.playService.maps=true +codename1.ios.certificatePassword= +codename1.arg.zooz.sandbox=false +codename1.ios.debug.certificatePassword= +codename1.arg.ios.fastbuild=true +codename1.mainName=GoogleMapsTestApp +codename1.arg.ios.pods.sources=,https\://github.com/CocoaPods/Specs.git +codename1.ios.release.certificatePassword= +codename1.arg.ios.prerendered_icon=false +codename1.arg.vserv.scaleMode=false +codename1.ios.debug.certificate= +libVersion=149 +codename1.arg.android.xpermissions= +codename1.arg.ios.application_exits=false +codename1.secondaryTitle=CodenameOne_Template +codename1.description= +codename1.ios.debug.provision= +codename1.arg.javascript.minifying=false +codename1.arg.build.incSources=1 +codename1.arg.j2me.nativeThemeConst=0 +codename1.rim.certificatePassword= +codename1.version=1.0 +codename1.ios.certificate= +codename1.icon=icon.png +codename1.rim.signtoolCsk= +codename1.arg.android.debug=false +codename1.arg.vserv.transition=300000 +codename1.rim.signtoolDb= +codename1.arg.ios.testFlight=false +codename1.arg.ios.includePush=false +codename1.packageName=com.codename1.test.googlemaps diff --git a/GoogleMapsTest/lib/GoogleMaps.cn1lib b/GoogleMapsTest/lib/GoogleMaps.cn1lib index d2e37cd..129d784 100644 Binary files a/GoogleMapsTest/lib/GoogleMaps.cn1lib and b/GoogleMapsTest/lib/GoogleMaps.cn1lib differ diff --git a/GoogleMapsTest/nbproject/build-impl.xml b/GoogleMapsTest/nbproject/build-impl.xml index 36a8836..07c7fa6 100644 --- a/GoogleMapsTest/nbproject/build-impl.xml +++ b/GoogleMapsTest/nbproject/build-impl.xml @@ -1,1407 +1,1420 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GoogleMapsTest/nbproject/genfiles.properties b/GoogleMapsTest/nbproject/genfiles.properties index b7b0196..79476b1 100644 --- a/GoogleMapsTest/nbproject/genfiles.properties +++ b/GoogleMapsTest/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=65812561 -build.xml.script.CRC32=c17a4175 -build.xml.stylesheet.CRC32=28e38971@1.44.1.45 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=65812561 -nbproject/build-impl.xml.script.CRC32=06c05590 -nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46 +build.xml.data.CRC32=65812561 +build.xml.script.CRC32=c17a4175 +build.xml.stylesheet.CRC32=28e38971@1.44.1.45 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=a6dffc51 +nbproject/build-impl.xml.script.CRC32=06005022 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/GoogleMapsTest/nbproject/project.properties b/GoogleMapsTest/nbproject/project.properties index 91a040f..6e3fd4b 100644 --- a/GoogleMapsTest/nbproject/project.properties +++ b/GoogleMapsTest/nbproject/project.properties @@ -1,90 +1,110 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=GoogleMapsTest -application.vendor=Codename One -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/GoogleMapsTest.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.native-internal_tmp=native/internal_tmp -file.reference.CLDC11.jar=lib/CLDC11.jar -file.reference.CodenameOne.jar=lib/CodenameOne.jar -file.reference.CodenameOne_SRC.zip=lib/CodenameOne_SRC.zip -file.reference.GoogleMapsTest-override=override -file.reference.impl-cls=lib/impl/cls -file.reference.impl-stubs=lib/impl/stubs -file.reference.JavaSE.jar=JavaSE.jar -includes=** -jar.compress=true -javac.classpath=\ - ${file.reference.CLDC11.jar}:\ - ${file.reference.CodenameOne.jar}:\ - ${file.reference.CodenameOne_SRC.zip}:\ - ${file.reference.GoogleMapsTest-override}:\ - ${file.reference.impl-cls}:\ - ${file.reference.impl-stubs} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.5 -javac.target=1.5 -javac.test.classpath=\ - ${file.reference.JavaSE.jar}:\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=com.codename1.impl.javase.Simulator -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${file.reference.JavaSE.jar}:\ - ${javac.classpath}:\ - ${build.classes.dir}:\ - ${file.reference.native-internal_tmp} -# Space-separated list of JVM arguments used when running the project -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value -# or test-sys-prop.name=value to set system properties for unit tests): -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=windows-1252 -src.dir=src -test.src.dir=test +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=GoogleMapsTest +application.vendor=Codename One +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/GoogleMapsTest.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.codenameone-google-maps-GoogleMaps=../GoogleMaps +file.reference.native-internal_tmp=native/internal_tmp +file.reference.CLDC11.jar=lib/CLDC11.jar +file.reference.CodenameOne.jar=lib/CodenameOne.jar +file.reference.CodenameOne_SRC.zip=lib/CodenameOne_SRC.zip +file.reference.impl-cls=lib/impl/cls +file.reference.impl-stubs=lib/impl/stubs +file.reference.JavaSE.jar=JavaSE.jar +includes=** +jar.archive.disabled=${jnlp.enabled} +jar.compress=true +jar.index=${jnlp.enabled} +javac.classpath=\ + ${file.reference.CLDC11.jar}:\ + ${file.reference.CodenameOne.jar}:\ + ${file.reference.CodenameOne_SRC.zip}:\ + ${file.reference.impl-cls}:\ + ${file.reference.impl-stubs}:\ + ${file.reference.codenameone-google-maps-GoogleMaps} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${file.reference.JavaSE.jar}:\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=default +jnlp.offline-allowed=false +jnlp.signed=false +jnlp.signing= +jnlp.signing.alias= +jnlp.signing.keystore= +main.class=com.codename1.impl.javase.Simulator +# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found. +manifest.custom.application.library.allowable.codebase= +# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts. +manifest.custom.caller.allowable.codebase= +# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed +manifest.custom.codebase= +# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) +manifest.custom.permissions= +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${file.reference.JavaSE.jar}:\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${file.reference.native-internal_tmp} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=windows-1252 +src.dir=src +test.src.dir=test diff --git a/GoogleMapsTest/nbproject/project.xml b/GoogleMapsTest/nbproject/project.xml index d9e7484..1a22588 100644 --- a/GoogleMapsTest/nbproject/project.xml +++ b/GoogleMapsTest/nbproject/project.xml @@ -1,15 +1,16 @@ - - - org.netbeans.modules.java.j2seproject - - - GoogleMapsTest - - - - - - - - - + + + org.netbeans.modules.java.j2seproject + + + GoogleMapsTest + + + + + + + + + + diff --git a/GoogleMapsTest/src/com/codename1/test/googlemaps/GoogleMapsTestApp.java b/GoogleMapsTest/src/com/codename1/test/googlemaps/GoogleMapsTestApp.java index 05b79e6..06dd9a3 100644 --- a/GoogleMapsTest/src/com/codename1/test/googlemaps/GoogleMapsTestApp.java +++ b/GoogleMapsTest/src/com/codename1/test/googlemaps/GoogleMapsTestApp.java @@ -52,7 +52,10 @@ public class GoogleMapsTestApp { private static final String HTML_API_KEY = "AIzaSyBWeRU02YUYPdwRuMFyTKIXUbHjq6e35Gw"; private Form current; - + MapObject me; + MapObject markerAdded; + boolean tapDisabled = false; + //----------------------------------------------------------------------------------------- public void init(Object context) { try { Resources theme = Resources.openLayered("/theme"); @@ -63,12 +66,14 @@ public void init(Object context) { e.printStackTrace(); } } - MapObject sydney; + //----------------------------------------------------------------------------------------- public void start() { + if (current != null) { current.show(); return; } + Form hi = new Form("Native Maps Test"); hi.setLayout(new BorderLayout()); final MapContainer cnt = new MapContainer(HTML_API_KEY); @@ -102,6 +107,8 @@ public void mapPositionUpdated(Component source, int zoom, Coord center) { s.setBgTransparency(0); FontImage markerImg = FontImage.createMaterial(FontImage.MATERIAL_PLACE, s, 3); + + Button btnMoveCamera = new Button("Move Camera"); Button btnAddMarker = new Button("Add Marker"); btnAddMarker.addActionListener(e->{ @@ -286,39 +293,42 @@ public void mapPositionUpdated(Component source, int zm, Coord center) { Button btnClearAll = new Button("Clear All"); - btnClearAll.addActionListener(e->{ - cnt.clearMapLayers(); + btnMoveCamera.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + //cnt.setCameraPosition(new Coord(-33.867, 151.206)); + } }); - - MapObject mo = cnt.addMarker(EncodedImage.createFromImage(markerImg, false), new Coord(-33.866, 151.195), "test", "test",e->{ - System.out.println("Marker clicked"); - cnt.removeMapObject(sydney); + btnAddMarker.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + //cnt.setCameraPosition(new Coord(41.889, -87.622)); + markerAdded = cnt.addMarker(EncodedImage.createFromImage(markerImg, false), cnt.getCameraPosition(), "Hi marker", "Optional long description", new ActionListener() { + + public void actionPerformed(ActionEvent evt) { + ToastBar.showMessage("You clicked the marker", FontImage.MATERIAL_PLACE); + } + }); + } }); - sydney = mo; - System.out.println("MO is "+mo); - mo = cnt.addMarker(EncodedImage.createFromImage(markerImg, false), new Coord(-18.142, 178.431), "test", "test",e->{ - System.out.println("Marker clicked"); + btnAddPath.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cnt.addPath( + cnt.getCameraPosition(), + new Coord(-33.866, 151.195), // Sydney + new Coord(-18.142, 178.431), // Fiji + new Coord(21.291, -157.821), // Hawaii + new Coord(37.423, -122.091) // Mountain View + ); + } }); - System.out.println("MO is "+mo); - cnt.addTapListener(e->{ - if (tapDisabled) { - return; + btnClearAll.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cnt.clearMapLayers(); } - tapDisabled = true; - TextField enterName = new TextField(); - Container wrapper = BoxLayout.encloseY(new Label("Name:"), enterName); - InteractionDialog dlg = new InteractionDialog("Add Marker"); - dlg.getContentPane().add(wrapper); - enterName.setDoneListener(e2->{ - String txt = enterName.getText(); - cnt.addMarker(EncodedImage.createFromImage(markerImg, false), cnt.getCoordAtPosition(e.getX(), e.getY()), enterName.getText(), "", e3->{ - ToastBar.showMessage("You clicked "+txt, FontImage.MATERIAL_PLACE); - }); - dlg.dispose(); - tapDisabled = false; - }); - dlg.showPopupDialog(new Rectangle(e.getX(), e.getY(), 10, 10)); - enterName.startEditingAsync(); }); Button showNextForm = $(new Button("Next Form")) @@ -370,15 +380,14 @@ public void mapPositionUpdated(Component source, int zm, Coord center) { hi.show(); } - boolean tapDisabled = false; - + //----------------------------------------------------------------------------------------- public void stop() { current = Display.getInstance().getCurrent(); } - + //----------------------------------------------------------------------------------------- public void destroy() { } - + //----------------------------------------------------------------------------------------- }