├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ └── Android_Map3D_SDK_V4.1.3_20161208.jar ├── proguard-rules.pro ├── src │ ├── androidTest │ │ └── java │ │ │ └── dev │ │ │ └── xesam │ │ │ └── android │ │ │ └── map │ │ │ └── move │ │ │ └── ExampleInstrumentedTest.java │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── dev │ │ │ │ └── xesam │ │ │ │ └── android │ │ │ │ └── map │ │ │ │ └── movedemo │ │ │ │ ├── BaseMapActivity.java │ │ │ │ ├── Bus.java │ │ │ │ ├── BusMoveMgr.java │ │ │ │ ├── BusSource.java │ │ │ │ ├── MainDemo2Activity.java │ │ │ │ └── MapCtrl.java │ │ ├── jniLibs │ │ │ └── armeabi │ │ │ │ ├── libgdinamapv4sdk752.so │ │ │ │ └── libgdinamapv4sdk752ex.so │ │ └── res │ │ │ ├── drawable │ │ │ ├── car.png │ │ │ └── icon_car.png │ │ │ ├── layout │ │ │ ├── a_infowindow.xml │ │ │ └── activity_main.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── id.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── test │ │ └── java │ │ └── dev │ │ └── xesam │ │ └── android │ │ └── map │ │ └── move │ │ └── ExampleUnitTest.java └── xesam-android-debug.jks ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib-move-marker ├── .gitignore ├── build.gradle ├── proguard-rules.pro ├── provided │ └── Android_Map3D_SDK_V4.1.3_20161208.jar └── src │ ├── androidTest │ └── java │ │ └── dev │ │ └── xesam │ │ └── android │ │ └── map │ │ └── move │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── dev │ │ └── xesam │ │ └── android │ │ └── map │ │ └── move │ │ ├── AbsMoveMgr.java │ │ ├── AndroidSdkAnim.java │ │ ├── MapSdkAnim.java │ │ ├── MoveAnim.java │ │ ├── MoveEvaluator.java │ │ ├── MoveMarker.java │ │ ├── MovePath.java │ │ └── MoveSpan.java │ └── test │ └── java │ └── dev │ └── xesam │ └── android │ └── map │ └── move │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea 3 | .gradle 4 | /local.properties 5 | /.idea/workspace.xml 6 | /.idea/libraries 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MoveMarker 2 | 3 | 高德地图 Marker 按照轨迹移动 4 | 5 | sdk 5.0.0 版本参见 branch map-5.0.0 6 | 7 | ## todo 8 | 9 | - [ ] Android 动画轨迹平滑处理 10 | - [ ] SDk 视图外动画 11 | 12 | ## 使用 13 | 14 | 第一步,添加依赖 15 | 16 | ```gradle 17 | allprojects { 18 | repositories { 19 | ... 20 | maven { url 'https://jitpack.io' } 21 | } 22 | } 23 | ``` 24 | 25 | ```gradle 26 | dependencies { 27 | compile 'com.github.xesam:MoveMarker:0.1' 28 | } 29 | ``` 30 | 31 | 第二步,添加相应的高德 SDk .jar 以及 .so 。 32 | 33 | 第三步,代码调用 34 | 35 | 在具体的工程中可以使用单个 marker 或者管理单个 marker。具体参见 [demo https://github.com/xesam/MoveMarker](https://github.com/xesam/MoveMarker) 36 | 37 | ```java 38 | 39 | MarkerOptions options = new MarkerOptions() 40 | .title("移动1") 41 | .icon(BitmapDescriptorFactory.fromResource(R.drawable.car)) 42 | .snippet("详细信息") 43 | .anchor(0.5f, 0.5f) 44 | .position(latLng); 45 | MoveMarker moveMarker = new MoveMarker<>(mAMap, mAMap.addMarker(options)); 46 | moveMarker.setData(data); 47 | moveMarker.setTotalDuration(5_000); 48 | moveMarker.setMovePoints(points); 49 | moveMarker.startMove(); 50 | 51 | ``` 52 | 53 | 或者 54 | 55 | ```java 56 | 57 | public class BusMoveMgr extends AbsMoveMgr { 58 | public BusMoveMgr(AMap map) { 59 | super(map); 60 | } 61 | 62 | @Override 63 | protected String getKey(Bus item) { 64 | return item.id; 65 | } 66 | 67 | @Override 68 | protected MoveMarker onMarkerAdded(Bus bus) { 69 | //根据 bus 创建marker 70 | return new MoveMarker<>(mAMap, mAMap.addMarker(options)); 71 | } 72 | 73 | @Override 74 | protected void onMarkerUpdated(MoveMarker moveMarker, Bus updated) { 75 | //marker 有更新 76 | } 77 | 78 | @Override 79 | protected void onMarkerLost(final MoveMarker moveMarker) { 80 | //对应的 marker 丢失 81 | moveMarker.getMarker().remove(); 82 | } 83 | 84 | } 85 | 86 | ``` 87 | 88 | ## 补充 89 | 90 | 高德 SDk 提供了基于 glAnimation 的 4 种动画: TranslateAnimation, AlphaAnimation, ScaleAnimation, RotateAnimation, 91 | 不过这 4 种动画都有以下问题(当前是 4.1.3 版本): 92 | 93 | 1. Marker Animation 如果带有 InfoWindow,InfoWindow 的移动会有延迟。 94 | 2. Marker Animation 的缺陷,不在视界内,并且没有设置 showInfoWindow() 的时候(此时 Marker 已经被移除了),Animation 就不会执行。 95 | 3. 无法停止 Marker 的 Animation。 96 | 97 | 不过高德方面回复会在新版本解决这些问题,暂用解决办法(在 Marker 不可见的时候,已然有bug): 98 | 99 | 1. (sdk 4.1.3 已修正)。 100 | 2. 不要相信 AnimationListener#onAnimationEnd 回调,使用一个与动画时长相等的 delay message 来修正最终的位置。(sdk 5.0.0 已修正) 101 | 3. 想停止动画的时候,发起一个时间非常短(比如 10 ms)的动画来冲掉正在执行的动画。 102 | 103 | 或者完全不要使用 SDK 提供的各种 Animation, 使用 Android 自身的动画机制,不过需要对轨迹作平滑处理。 104 | 105 | ## 再次补充 106 | 高德地图的论坛太不给力了,有问题还是 Github 去提 issues 吧。 107 | 108 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "dev.xesam.android.mapkit.demo" 8 | minSdkVersion 14 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | signingConfigs { 15 | debug { 16 | storeFile file("xesam-android-debug.jks") 17 | storePassword "123456" 18 | keyAlias "xesam" 19 | keyPassword "123456" 20 | } 21 | } 22 | buildTypes { 23 | 24 | debug { 25 | minifyEnabled false 26 | signingConfig signingConfigs.debug 27 | } 28 | 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | } 35 | 36 | dependencies { 37 | compile fileTree(include: ['*.jar'], dir: 'libs') 38 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 39 | exclude group: 'com.android.support', module: 'support-annotations' 40 | }) 41 | compile 'com.android.support:appcompat-v7:25.3.0' 42 | testCompile 'junit:junit:4.12' 43 | compile project(':lib-move-marker') 44 | } 45 | -------------------------------------------------------------------------------- /app/libs/Android_Map3D_SDK_V4.1.3_20161208.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xesam/MoveMarker/a947295d4e690f50dbfebfa5ab2568e82144c241/app/libs/Android_Map3D_SDK_V4.1.3_20161208.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /apps/android-sdk-linux/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/dev/xesam/android/map/move/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package dev.xesam.android.map.move; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("dev.xesam.android.map.move", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/java/dev/xesam/android/map/movedemo/BaseMapActivity.java: -------------------------------------------------------------------------------- 1 | package dev.xesam.android.map.movedemo; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | import com.amap.api.maps.AMap; 7 | import com.amap.api.maps.MapView; 8 | 9 | /** 10 | * Created by xe on 16-11-18. 11 | */ 12 | 13 | public abstract class BaseMapActivity extends AppCompatActivity { 14 | protected MapView vMapView; 15 | protected AMap mAMap; 16 | protected MapCtrl mMapCtrl; 17 | 18 | protected int getLayoutId() { 19 | return -1; 20 | } 21 | 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(getLayoutId()); 26 | vMapView = (MapView) findViewById(R.id.map); 27 | vMapView.onCreate(savedInstanceState);// 必须要写 28 | mAMap = vMapView.getMap(); 29 | mMapCtrl = new MapCtrl(mAMap); 30 | } 31 | 32 | protected void onResume() { 33 | super.onResume(); 34 | vMapView.onResume(); 35 | } 36 | 37 | @Override 38 | protected void onPause() { 39 | super.onPause(); 40 | vMapView.onPause(); 41 | } 42 | 43 | @Override 44 | protected void onSaveInstanceState(Bundle outState) { 45 | super.onSaveInstanceState(outState); 46 | vMapView.onSaveInstanceState(outState); 47 | } 48 | 49 | @Override 50 | protected void onDestroy() { 51 | super.onDestroy(); 52 | vMapView.onDestroy(); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/dev/xesam/android/map/movedemo/Bus.java: -------------------------------------------------------------------------------- 1 | package dev.xesam.android.map.movedemo; 2 | 3 | /** 4 | * Created by xe on 16-12-13. 5 | */ 6 | 7 | public class Bus { 8 | public String id; 9 | public double lat; 10 | public double lng; 11 | 12 | public Bus(String id, double lat, double lng) { 13 | this.id = id; 14 | this.lat = lat; 15 | this.lng = lng; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return "Bus{" + 21 | "id='" + id + '\'' + 22 | ", lat=" + lat + 23 | ", lng=" + lng + 24 | '}'; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/dev/xesam/android/map/movedemo/BusMoveMgr.java: -------------------------------------------------------------------------------- 1 | package dev.xesam.android.map.movedemo; 2 | 3 | import com.amap.api.maps.AMap; 4 | import com.amap.api.maps.model.BitmapDescriptorFactory; 5 | import com.amap.api.maps.model.LatLng; 6 | import com.amap.api.maps.model.MarkerOptions; 7 | import com.amap.api.maps.model.animation.AlphaAnimation; 8 | import com.amap.api.maps.model.animation.Animation; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | import dev.xesam.android.map.move.AbsMoveMgr; 15 | import dev.xesam.android.map.move.MoveMarker; 16 | 17 | /** 18 | * Created by xe on 16-12-13. 19 | */ 20 | 21 | public class BusMoveMgr extends AbsMoveMgr { 22 | public BusMoveMgr(AMap map) { 23 | super(map); 24 | } 25 | 26 | @Override 27 | protected String getKey(Bus item) { 28 | return item.id; 29 | } 30 | 31 | @Override 32 | protected MoveMarker onMarkerAdded(Bus bus, boolean performAnimation) { 33 | LatLng latLng = new LatLng(bus.lat, bus.lng); 34 | MarkerOptions options = new MarkerOptions() 35 | .title("移动1") 36 | .icon(BitmapDescriptorFactory.fromResource(R.drawable.car)) 37 | .snippet("详细信息") 38 | .anchor(0.5f, 0.5f) 39 | .position(latLng); 40 | return new MoveMarker<>(mAMap, mAMap.addMarker(options)); 41 | } 42 | 43 | @Override 44 | protected void onMarkerUpdated(MoveMarker moveMarker, Bus old, Bus updated, boolean performAnimation) { 45 | LatLng endLatLng = new LatLng(updated.lat, updated.lng); 46 | if (performAnimation) { 47 | List points = new ArrayList<>(); 48 | LatLng c = moveMarker.getMarker().getPosition(); 49 | points.add(new LatLng((c.latitude + updated.lat) / 2, (c.longitude + updated.lng) / 2)); 50 | points.add(endLatLng); 51 | moveMarker.setTotalDuration(5_000); 52 | moveMarker.setMovePoints(points); 53 | moveMarker.startMove(); 54 | } else { 55 | moveMarker.directTo(endLatLng); 56 | } 57 | } 58 | 59 | @Override 60 | protected void onMarkerLost(final MoveMarker moveMarker, boolean performAnimation) { 61 | AlphaAnimation dismiss = new AlphaAnimation(1.0f, 0f); 62 | dismiss.setDuration(500); 63 | dismiss.setAnimationListener(new Animation.AnimationListener() { 64 | @Override 65 | public void onAnimationStart() { 66 | 67 | } 68 | 69 | @Override 70 | public void onAnimationEnd() { 71 | moveMarker.getMarker().remove(); 72 | } 73 | }); 74 | moveMarker.getMarker().setAnimation(dismiss); 75 | moveMarker.getMarker().startAnimation(); 76 | } 77 | 78 | public void stop() { 79 | for (Map.Entry> entry : mMoveMarkers.entrySet()) { 80 | entry.getValue().stopMove(); 81 | } 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/dev/xesam/android/map/movedemo/BusSource.java: -------------------------------------------------------------------------------- 1 | package dev.xesam.android.map.movedemo; 2 | 3 | import android.os.Handler; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * Created by xe on 16-12-16. 10 | */ 11 | 12 | public abstract class BusSource { 13 | 14 | 15 | private int count = 0; 16 | private Handler mHandler; 17 | 18 | public BusSource() { 19 | mHandler = new Handler(); 20 | } 21 | 22 | private List getBuses1() { 23 | final List buses = new ArrayList<>(); 24 | buses.add(new Bus("1", 39.912013, 116.401131)); 25 | buses.add(new Bus("2", 39.911613, 116.401689)); 26 | buses.add(new Bus("3", 39.91126, 116.401518)); 27 | return buses; 28 | } 29 | 30 | private List getBuses2() { 31 | final List buses = new ArrayList<>(); 32 | buses.add(new Bus("1", 39.911613, 116.401689)); 33 | buses.add(new Bus("2", 39.91126, 116.401518)); 34 | buses.add(new Bus("3", 39.910803, 116.401185)); 35 | buses.add(new Bus("4", 39.910803, 116.401185)); 36 | return buses; 37 | } 38 | 39 | private void load() { 40 | switch (count % 2) { 41 | case 0: 42 | onBusesLoaded(getBuses1()); 43 | break; 44 | case 1: 45 | onBusesLoaded(getBuses2()); 46 | break; 47 | } 48 | count++; 49 | } 50 | 51 | private void start0() { 52 | mHandler.postDelayed(new Runnable() { 53 | @Override 54 | public void run() { 55 | load(); 56 | start0(); 57 | } 58 | }, 5_000); 59 | } 60 | 61 | public void start() { 62 | load(); 63 | start0(); 64 | } 65 | 66 | public void stop() { 67 | if (mHandler != null) { 68 | mHandler.removeCallbacksAndMessages(null); 69 | } 70 | } 71 | 72 | abstract void onBusesLoaded(List buses); 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/dev/xesam/android/map/movedemo/MainDemo2Activity.java: -------------------------------------------------------------------------------- 1 | package dev.xesam.android.map.movedemo; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.TextView; 7 | 8 | import com.amap.api.maps.AMap; 9 | import com.amap.api.maps.model.LatLng; 10 | import com.amap.api.maps.model.Marker; 11 | import com.amap.api.maps.model.PolylineOptions; 12 | 13 | import java.util.List; 14 | 15 | public class MainDemo2Activity extends BaseMapActivity { 16 | 17 | private BusSource mBusSource = new BusSource() { 18 | 19 | @Override 20 | void onBusesLoaded(List buses) { 21 | mMarkerMgr.update(buses, true); 22 | } 23 | }; 24 | 25 | private BusMoveMgr mMarkerMgr; 26 | 27 | @Override 28 | protected int getLayoutId() { 29 | return R.layout.activity_main; 30 | } 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | mMarkerMgr = new BusMoveMgr(mAMap); 36 | 37 | mAMap.setInfoWindowAdapter(new AMap.InfoWindowAdapter() { 38 | @Override 39 | public View getInfoWindow(Marker marker) { 40 | View view = getLayoutInflater().inflate(R.layout.a_infowindow, null, false); 41 | TextView tv = (TextView) view.findViewById(R.id.tv); 42 | tv.setText(marker.getPosition().toString()); 43 | return view; 44 | } 45 | 46 | @Override 47 | public View getInfoContents(Marker marker) { 48 | return null; 49 | } 50 | }); 51 | 52 | PolylineOptions polylineOptions = new PolylineOptions() 53 | .add(new LatLng(39.912013, 116.401131)) 54 | .add(new LatLng(39.911613, 116.401689)) 55 | .add(new LatLng(39.91126, 116.401518)) 56 | .add(new LatLng(39.910803, 116.401185)) 57 | .add(new LatLng(39.912013, 116.401131)) 58 | .width(5) 59 | .color(Color.RED); 60 | mAMap.addPolyline(polylineOptions); 61 | 62 | mAMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() { 63 | @Override 64 | public void onMapLoaded() { 65 | mMapCtrl.centerZoom(new LatLng(39.911613, 116.401689), 18f, false); 66 | mBusSource.start(); 67 | } 68 | }); 69 | 70 | findViewById(R.id.action_stop).setOnClickListener(new View.OnClickListener() { 71 | @Override 72 | public void onClick(View v) { 73 | mMarkerMgr.stop(); 74 | } 75 | }); 76 | } 77 | 78 | @Override 79 | protected void onResume() { 80 | super.onResume(); 81 | } 82 | 83 | @Override 84 | protected void onPause() { 85 | super.onPause(); 86 | } 87 | 88 | @Override 89 | protected void onDestroy() { 90 | super.onDestroy(); 91 | if (mBusSource != null) { 92 | mBusSource.stop(); 93 | } 94 | if (mMarkerMgr != null) { 95 | mMarkerMgr.stop(); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/java/dev/xesam/android/map/movedemo/MapCtrl.java: -------------------------------------------------------------------------------- 1 | package dev.xesam.android.map.movedemo; 2 | 3 | import android.support.annotation.DrawableRes; 4 | 5 | import com.amap.api.maps.AMap; 6 | import com.amap.api.maps.CameraUpdate; 7 | import com.amap.api.maps.CameraUpdateFactory; 8 | import com.amap.api.maps.MapView; 9 | import com.amap.api.maps.model.BitmapDescriptorFactory; 10 | import com.amap.api.maps.model.LatLng; 11 | import com.amap.api.maps.model.MyLocationStyle; 12 | 13 | /** 14 | * Created by xe on 16-11-15. 15 | */ 16 | 17 | public class MapCtrl { 18 | 19 | private AMap mAMap; 20 | 21 | public MapCtrl(AMap aMap) { 22 | mAMap = aMap; 23 | } 24 | 25 | public MapCtrl(MapView mapView) { 26 | this(mapView.getMap()); 27 | } 28 | 29 | public MapCtrl uiMyLocation(boolean enable) { 30 | mAMap.getUiSettings().setMyLocationButtonEnabled(enable); 31 | return this; 32 | } 33 | 34 | public MapCtrl uiZoom(boolean enable) { 35 | mAMap.getUiSettings().setZoomControlsEnabled(enable); 36 | return this; 37 | } 38 | 39 | public MapCtrl uIRotate(boolean enable) { 40 | mAMap.getUiSettings().setRotateGesturesEnabled(enable); 41 | return this; 42 | } 43 | 44 | public MapCtrl uIScale(boolean enable) { 45 | mAMap.getUiSettings().setScaleControlsEnabled(enable); 46 | return this; 47 | } 48 | 49 | public MapCtrl uiLocationIcon(@DrawableRes int icon) { 50 | mAMap.setMyLocationStyle(new MyLocationStyle().myLocationIcon(BitmapDescriptorFactory.fromResource(icon))); 51 | return this; 52 | } 53 | 54 | public MapCtrl gestureScroll(boolean enable) { 55 | mAMap.getUiSettings().setScrollGesturesEnabled(enable); 56 | return this; 57 | } 58 | 59 | public MapCtrl gestureZoom(boolean enable) { 60 | mAMap.getUiSettings().setZoomGesturesEnabled(enable); 61 | return this; 62 | } 63 | 64 | public MapCtrl gestureTilt(boolean enable) { 65 | mAMap.getUiSettings().setTiltGesturesEnabled(enable); 66 | return this; 67 | } 68 | 69 | public MapCtrl gestureRotate(boolean enable) { 70 | mAMap.getUiSettings().setRotateGesturesEnabled(enable); 71 | return this; 72 | } 73 | 74 | public MapCtrl center(LatLng latLng, boolean animate) { 75 | CameraUpdate cameraUpdate = CameraUpdateFactory.changeLatLng(latLng); 76 | if (animate) { 77 | mAMap.animateCamera(cameraUpdate); 78 | } else { 79 | mAMap.moveCamera(cameraUpdate); 80 | } 81 | return this; 82 | } 83 | 84 | public MapCtrl zoomIn(boolean animate) { 85 | if (animate) { 86 | mAMap.animateCamera(CameraUpdateFactory.zoomIn()); 87 | } else { 88 | mAMap.moveCamera(CameraUpdateFactory.zoomIn()); 89 | } 90 | return this; 91 | } 92 | 93 | public MapCtrl zoomOut(boolean animate) { 94 | if (animate) { 95 | mAMap.animateCamera(CameraUpdateFactory.zoomOut()); 96 | } else { 97 | mAMap.moveCamera(CameraUpdateFactory.zoomOut()); 98 | } 99 | return this; 100 | } 101 | 102 | public float zoom() { 103 | return mAMap.getCameraPosition().zoom; 104 | } 105 | 106 | public MapCtrl zoom(float zoom, boolean animate) { 107 | CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoom); 108 | if (animate) { 109 | mAMap.animateCamera(cameraUpdate); 110 | } else { 111 | mAMap.moveCamera(cameraUpdate); 112 | } 113 | return this; 114 | } 115 | 116 | public MapCtrl centerZoom(LatLng latLng, float zoom, boolean animate) { 117 | CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, zoom); 118 | if (animate) { 119 | mAMap.animateCamera(cameraUpdate); 120 | } else { 121 | mAMap.moveCamera(cameraUpdate); 122 | } 123 | return this; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi/libgdinamapv4sdk752.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xesam/MoveMarker/a947295d4e690f50dbfebfa5ab2568e82144c241/app/src/main/jniLibs/armeabi/libgdinamapv4sdk752.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi/libgdinamapv4sdk752ex.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xesam/MoveMarker/a947295d4e690f50dbfebfa5ab2568e82144c241/app/src/main/jniLibs/armeabi/libgdinamapv4sdk752ex.so -------------------------------------------------------------------------------- /app/src/main/res/drawable/car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xesam/MoveMarker/a947295d4e690f50dbfebfa5ab2568e82144c241/app/src/main/res/drawable/car.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xesam/MoveMarker/a947295d4e690f50dbfebfa5ab2568e82144c241/app/src/main/res/drawable/icon_car.png -------------------------------------------------------------------------------- /app/src/main/res/layout/a_infowindow.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 |