extends Fragment implements CommonMapFunction {
20 | /**
21 | * 当前地图的状态
22 | */
23 | protected static final int REAL_LOCATION = 0;
24 | protected static final int EQUIPMENT_DETAIL = 1;
25 | protected static final int TRACE_PLAYBACK = 2;
26 |
27 | /**
28 | * 当前的模式
29 | * 10 车辆
30 | * 11 用户
31 | * 12 自由模式
32 | */
33 | public static final int CAR_STYLE = 10;
34 | public static final int USER_STYLE = 11;
35 | public static final int FREEDOM_STYLE = 12;
36 |
37 | protected int currentMapStatus;
38 |
39 | protected OnMapClickCallback onMapClickCallback = null;
40 | protected OnMapLoaded onMapLoadedListener = null;
41 | protected OnMarkerOnclickListener mOnMarkerOnclickListener;
42 | protected OnPKMapTouch mOnPKMapTouch;
43 | protected PKSmoothListener mPKSmoothListener;
44 | /**
45 | * 当前的地图的显示模式
46 | * 10 车辆
47 | * 11 个人
48 | * 12 自由
49 | */
50 | protected int currentPositionType;
51 |
52 |
53 | public static int ZOOM = 16;
54 | public static final float SKEW = 0.0f;
55 | public static final int ROTATE = 0;
56 |
57 | protected final static int TIME_INTERVAL = 1;
58 | protected final static int TIME_PER_INTERVAL = 5;
59 |
60 | protected int PADDING_MAP;
61 |
62 | protected MapHelper mapHelper;
63 |
64 |
65 | public View onCreateView(LayoutInflater layoutinflater,
66 | ViewGroup viewgroup, Bundle bundle) {
67 | currentMapStatus = REAL_LOCATION;
68 | return super.onCreateView(layoutinflater, viewgroup, bundle);
69 | }
70 |
71 | public void registOnMapClickCallback(OnMapClickCallback clickCallback) {
72 | this.onMapClickCallback = clickCallback;
73 | }
74 |
75 | protected abstract MapHelper createMapHelper(T fiveMap, Context context);
76 |
77 | public abstract void addMyLocationMarker();
78 |
79 | public void setOnMarkerOnclickListener(OnMarkerOnclickListener listener) {
80 | mOnMarkerOnclickListener = listener;
81 | }
82 |
83 | protected MapCenterChangeListener mMapCenterChangeListener;
84 |
85 | public void setMapCenterChangeListener(MapCenterChangeListener mapCenterChangeListener) {
86 | this.mMapCenterChangeListener = mapCenterChangeListener;
87 | }
88 |
89 | public void setOnPKMapTouchListener(OnPKMapTouch fiveMapTouchListener) {
90 | this.mOnPKMapTouch = fiveMapTouchListener;
91 | }
92 |
93 | public void setSmoothListener(PKSmoothListener fiveSmoothListener) {
94 | mPKSmoothListener = fiveSmoothListener;
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/MapFramentFactory.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map;
2 |
3 | import android.os.Bundle;
4 |
5 | import pk.com.lib.map.amp.AmapFragment;
6 |
7 |
8 | /**
9 | * Created by pukai on 2016-4-26.
10 | *
11 | * 地图工厂类,根据CODE创建地图
12 | */
13 | public class MapFramentFactory {
14 | public final static int TENCENT_MAP_CODE = 0;
15 | public final static int AMAP_MAP_CODE = 1;
16 |
17 | public static MapFrament createMapFrament(int mapCode, Bundle bundle) {
18 | MapFrament mapFrament = null;
19 |
20 | if (mapCode == AMAP_MAP_CODE) {
21 | mapFrament = AmapFragment.newInstance(bundle);
22 | }
23 | return mapFrament;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/MapHelper.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map;
2 |
3 | import android.content.Context;
4 |
5 | import pk.com.lib.map.control.IControl;
6 | import pk.com.lib.map.navi.INavi;
7 | import pk.com.lib.map.overlay.IOverLay;
8 | import pk.com.lib.map.smooth.ISmooth;
9 | import pk.com.lib.map.trace.ITrace;
10 |
11 |
12 | /**
13 | * Created by pukai on 16/12/21.
14 | */
15 | public abstract class MapHelper {
16 | private T mFiveMap;
17 | private Context mContext;
18 | public INavi mINavi;
19 | public ITrace mITrace;
20 | public IControl mIControl;
21 | public ISmooth mISoomth;
22 | public IOverLay mIOverLay;
23 |
24 | public MapHelper(T fiveMap, Context context) {
25 | mFiveMap = fiveMap;
26 | mContext = context;
27 | mINavi = createNaive(mFiveMap, mContext);
28 | mITrace = createTrace(mFiveMap, mContext);
29 | mIControl = createControl(mFiveMap, mContext);
30 | mISoomth = createSmooth(mFiveMap, mContext);
31 | mIOverLay = createOverLay(mFiveMap, mContext);
32 | }
33 |
34 | protected abstract INavi createNaive(T fiveMap, Context context);
35 |
36 | protected abstract ITrace createTrace(T fiveMap, Context context);
37 |
38 | protected abstract IControl createControl(T fiveMap, Context context);
39 |
40 | protected abstract ISmooth createSmooth(T fiveMap, Context context);
41 |
42 | protected abstract IOverLay createOverLay(T fiveMap, Context context);
43 |
44 |
45 | public void destrory() {
46 | mFiveMap = null;
47 | mContext = null;
48 | if (mINavi != null) {
49 | mINavi.destroy();
50 | mINavi = null;
51 | }
52 | if (mITrace != null) {
53 | mITrace.destroy();
54 | mITrace = null;
55 | }
56 | if (mIControl != null) {
57 | mIControl.destroy();
58 | mIControl = null;
59 | }
60 | if (mIOverLay != null) {
61 | mIOverLay.destroy();
62 | mIOverLay = null;
63 | }
64 | if (mISoomth != null) {
65 | mISoomth.destroy();
66 | mISoomth = null;
67 | }
68 | }
69 |
70 | public MapHelper(INavi mINavi, ITrace mITrace, IControl mIControl, ISmooth mISoomth, IOverLay mIOverLay) {
71 | this.mINavi = mINavi;
72 | this.mITrace = mITrace;
73 | this.mIControl = mIControl;
74 | this.mISoomth = mISoomth;
75 | this.mIOverLay = mIOverLay;
76 | }
77 |
78 | public IOverLay getmIOverLay() {
79 | return mIOverLay;
80 | }
81 |
82 | public void setmIOverLay(IOverLay mIOverLay) {
83 | this.mIOverLay = mIOverLay;
84 | }
85 |
86 | public INavi getmINavi() {
87 | return mINavi;
88 | }
89 |
90 | public void setmINavi(INavi mINavi) {
91 | this.mINavi = mINavi;
92 | }
93 |
94 | public ITrace getmITrace() {
95 | return mITrace;
96 | }
97 |
98 | public void setmITrace(ITrace mITrace) {
99 | this.mITrace = mITrace;
100 | }
101 |
102 | public IControl getmIControl() {
103 | return mIControl;
104 | }
105 |
106 | public void setmIControl(IControl mIControl) {
107 | this.mIControl = mIControl;
108 | }
109 |
110 | public ISmooth getmISoomth() {
111 | return mISoomth;
112 | }
113 |
114 | public void setmISoomth(ISmooth mISoomth) {
115 | this.mISoomth = mISoomth;
116 | }
117 |
118 | }
119 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/MapResource.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map;
2 |
3 | import android.content.Context;
4 | import android.graphics.Point;
5 |
6 | /**
7 | * Created by pukai on 16/12/22.
8 | */
9 | public class MapResource {
10 | /**屏幕的左边界 最小间距 单位px**/
11 | private final static int LEFT_BORDER = 30;
12 | /**屏幕的右边界 最小间距 单位px**/
13 | private final static int RIGHT_BORDER = 30;
14 | /**屏幕的上边界 最小间距 单位px**/
15 | private final static int TOP_BORDER = 30;
16 | /**屏幕的下边界 最小间距 单位px**/
17 | private final static int BOTTOM_BORDER = 30;
18 | /** 当前地图的缩放等级**/
19 | public static float ZOOM = 16;
20 | /** 当前地图的方向**/
21 | public static float BEARING = 0;
22 | /**当前地图的旋转角度**/
23 | public static float TILT = 0;
24 | /**屏幕的宽高**/
25 | private Point screenPoint;
26 |
27 | /** 基础地图资源**/
28 | protected T mPKMap;
29 |
30 | protected Context mContext;
31 |
32 |
33 | public void initMapResource(T fiveMap, Context context) {
34 | mPKMap = fiveMap;
35 | mContext = context;
36 | }
37 |
38 | protected void destroy() {
39 | mPKMap = null;
40 | mContext = null;
41 | }
42 |
43 | /* private boolean isPointInCurrentScreen(LatLng latLng) {
44 | if (screenPoint == null || screenPoint.equals(0, 0)) {
45 | screenPoint = DensityUtil.getScrenWidth(mContext);
46 | }
47 | Point point = mFiveMap.getAMap().getProjection().toScreenLocation(latLng);
48 | return point.x < LEFT_BORDER | point.x > screenPoint.x - RIGHT_BORDER || point.y < TOP_BORDER || point.y > screenPoint.y - BOTTOM_BORDER;
49 | }*/
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/MapUtil.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.pm.PackageInfo;
6 | import android.content.pm.PackageManager;
7 | import android.net.Uri;
8 |
9 |
10 | import java.net.URISyntaxException;
11 | import java.text.DecimalFormat;
12 | import java.util.List;
13 |
14 | import pk.com.lib.map.modle.PKLatLng;
15 |
16 | /**
17 | * Created by dongfang on 2016/4/28.
18 | */
19 | public class MapUtil {
20 |
21 | /**
22 | * 百度地图安装标识
23 | */
24 | public static final int MAY_TYPE_BAIDU = 0x1;
25 | /**
26 | * 高德地图安装标识
27 | */
28 | public static final int MAY_TYPE_GAODE = 0x10;
29 | /**
30 | * Google地图安装标识
31 | */
32 | public static final int MAY_TYPE_GOOGLE = 0x100;
33 | /**
34 | * 腾讯地图内部导航
35 | */
36 | public static final int MAY_TYPE_TENCENT = 0x1000;
37 |
38 | private static final String MAP_PACKAGE_NAME_BAIDU = "com.baidu.BaiduMap";
39 | private static final String MAP_PACKAGE_NAME_GAODE = "com.autonavi.minimap";
40 | private static final String MAP_PACKAGE_NAME_GOOGLE = "com.google.android.apps.maps";
41 |
42 | private static double a = 6378245.0;
43 | private static double ee = 0.00669342162296594323;
44 | private static double pi = 3.14159265358979324;
45 | private static double x_pi = pi * 3000.0 / 180.0;
46 | private static DecimalFormat sDecimalFormat = new DecimalFormat("#.000000"); //保留6位
47 |
48 | /**
49 | * 获取终端上安装的导航软件
50 | *
51 | * 1. 百度导航值 {@link MapUtil#MAY_TYPE_BAIDU}
52 | * 2. 高德导航值 {@link MapUtil#MAY_TYPE_GAODE}
53 | * 3. 谷歌导航值 {@link MapUtil#MAY_TYPE_GOOGLE}
54 | *
55 | * @param context
56 | * @return 若没有安装导航软件,返回0 ,反正返回安装导航软件的‘与’值
57 | */
58 | public static int getMapInstallType(Context context) {
59 | int type = 0;
60 | final PackageManager packageManager = context.getPackageManager();
61 | // 获取所有已安装程序的包信息
62 | List pinfo = packageManager.getInstalledPackages(0);
63 | String packageName = "";
64 | for (int i = 0, l = pinfo.size(); i < l; i++) {
65 | packageName = pinfo.get(i).packageName;
66 | if (packageName.equalsIgnoreCase(MAP_PACKAGE_NAME_BAIDU)) {
67 | type |= MAY_TYPE_BAIDU;
68 | } else if (packageName.equalsIgnoreCase(MAP_PACKAGE_NAME_GAODE)) {
69 | type |= MAY_TYPE_GAODE;
70 | } else if (packageName.equalsIgnoreCase(MAP_PACKAGE_NAME_GOOGLE)) {
71 | type |= MAY_TYPE_GOOGLE;
72 | }
73 | }
74 | return type;
75 | }
76 |
77 | /**
78 | * 使用高德地图进行导航
79 | *
80 | * @param context
81 | * @param endLat 结束纬度
82 | * @param endLng 结束经度
83 | * @param endAdrress 地址名称
84 | */
85 | public static void navi2GaoDe(Context context, double endLat, double endLng, String endAdrress) {
86 | Intent intent = new Intent("android.intent.action.VIEW",
87 | Uri.parse("androidamap://navi?sourceApplication=" + endAdrress
88 | + "&lat=" + endLat
89 | + "&lon=" + endLng
90 | + "&dev=0"));
91 |
92 | intent.setPackage("com.autonavi.minimap");
93 | try {
94 | context.startActivity(intent); // 启动调用
95 | } catch (Exception e) {
96 | e.printStackTrace();
97 | }
98 | }
99 |
100 | /**
101 | * 使用百度地图进行导航
102 | *
103 | * @param context
104 | * @param startLat 开始纬度
105 | * @param startLng 开始经度
106 | * @param endLat 结束纬度
107 | * @param endLng 结束经度
108 | * @param endAdrress 地址名称
109 | */
110 | public static void navi2BaiDu(Context context,
111 | double startLat, double startLng,
112 | double endLat, double endLng, String endAdrress) {
113 | try {
114 | Intent intent = Intent.parseUri("intent://map/direction?"
115 | + "coord_type=gcj02" // 表示使用火星坐标系统
116 | + "&origin=|latlng:" + startLat + "," + startLng
117 | + "&destination=" + endAdrress
118 | + "|latlng:" + endLat + "," + endLng
119 | + "&mode=driving&src=" + context.getPackageName()
120 | + "|" + "RentPK" // 故意这么写的// + context.getString(R.string.app_name)
121 | + "#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end"
122 | , 0);
123 |
124 | context.startActivity(intent);
125 | } catch (URISyntaxException e) {
126 | e.printStackTrace();
127 | }
128 | }
129 |
130 | /**
131 | * 使用谷歌地图进行导航
132 | *
133 | * @param context
134 | * @param startLat 开始纬度
135 | * @param startLng 开始经度
136 | * @param endLat 结束纬度
137 | * @param endLng 结束经度
138 | */
139 | public static void navi2Google(Context context,
140 | double startLat, double startLng,
141 | double endLat, double endLng) {
142 | Uri uri = Uri.parse(
143 | "http://maps.google.com/maps?"
144 | + "saddr=" + startLat + "," + startLng
145 | + "&"
146 | + "daddr=" + endLat + "," + endLng
147 | );
148 | Intent intent = new Intent(Intent.ACTION_VIEW, uri);
149 | // If you want to get rid of the dialog,Before the startActivity() add this
150 | intent.setClassName(MAP_PACKAGE_NAME_GOOGLE, "com.google.android.maps.MapsActivity");
151 | context.startActivity(intent);
152 | }
153 |
154 | public static PKLatLng transGoogle2Amap(double lat, double lng) {
155 | return transform2Mars(lat, lng);
156 | }
157 |
158 | /**
159 | * 地球坐标转换火星坐标
160 | *
161 | * @param wgLat 地球纬度
162 | * @param wgLon 地球经度
163 | * @return
164 | */
165 | private static PKLatLng transform2Mars(double wgLat, double wgLon) {
166 | double dLat = transform2MarsLat(wgLon - 105.0, wgLat - 35.0);
167 | double dLon = transform2MarsLng(wgLon - 105.0, wgLat - 35.0);
168 | double radLat = wgLat / 180.0 * pi;
169 | double magic = Math.abs(radLat);
170 | magic = 1 - ee * magic * magic;
171 | double sqrtMagic = Math.sqrt(magic);
172 | dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
173 | dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
174 | double mgLat = wgLat + dLat;
175 | double mgLon = wgLon + dLon;
176 | return new PKLatLng(Double.valueOf(sDecimalFormat.format(mgLat)), Double.valueOf(sDecimalFormat.format(mgLon)));
177 | }
178 |
179 | /**
180 | * 火星坐标转换百度坐标
181 | *
182 | * @param gcLat 地球纬度
183 | * @param gcLng 地球经度
184 | * @return
185 | */
186 | public static PKLatLng transform2BaiDu(double gcLat, double gcLng) {
187 | double x = gcLng, y = gcLat;
188 | double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
189 | double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
190 | double bdLat = z * Math.sin(theta) + 0.006;
191 | double bdLng = z * Math.cos(theta) + 0.0065;
192 | return new PKLatLng(bdLat, bdLng);
193 | }
194 |
195 | /**
196 | * 地球坐标转换火星坐标
197 | *
198 | * @param wglat 地球纬度
199 | * @param wglng 地球经度
200 | * @return 纬度
201 | */
202 | private static double transform2MarsLat(double wglat, double wglng) {
203 | double ret = -100.0 + 2.0 * wglat + 3.0 * wglng + 0.2 * wglng * wglng + 0.1 * wglat * wglng + 0.2 * Math.sqrt(Math.abs(wglat));
204 | ret += (20.0 * Math.sin(6.0 * wglat * pi) + 20.0 * Math.sin(2.0 * wglat * pi)) * 2.0 / 3.0;
205 | ret += (20.0 * Math.sin(wglng * pi) + 40.0 * Math.sin(wglng / 3.0 * pi)) * 2.0 / 3.0;
206 | ret += (160.0 * Math.sin(wglng / 12.0 * pi) + 320 * Math.sin(wglng * pi / 30.0)) * 2.0 / 3.0;
207 | return ret;
208 | }
209 |
210 | /**
211 | * 地球坐标转换火星坐标
212 | *
213 | * @param wglat 地球纬度
214 | * @param wglng 地球经度
215 | * @return 经度
216 | */
217 | private static double transform2MarsLng(double wglat, double wglng) {
218 | double ret = 300.0 + wglat + 2.0 * wglng + 0.1 * wglat * wglat + 0.1 * wglat * wglng + 0.1 * Math.sqrt(Math.abs(wglat));
219 | ret += (20.0 * Math.sin(6.0 * wglat * pi) + 20.0 * Math.sin(2.0 * wglat * pi)) * 2.0 / 3.0;
220 | ret += (20.0 * Math.sin(wglat * pi) + 40.0 * Math.sin(wglat / 3.0 * pi)) * 2.0 / 3.0;
221 | ret += (150.0 * Math.sin(wglat / 12.0 * pi) + 300.0 * Math.sin(wglat / 30.0 * pi)) * 2.0 / 3.0;
222 | return ret;
223 | }
224 |
225 |
226 | /**
227 | * 火星坐标转百度坐标
228 | *
229 | * @param gcLat 火星坐标纬度
230 | * @param gcLng 火星坐标经度
231 | * @return 百度坐标经度
232 | */
233 | private static double transform2BaiDuLng(double gcLat, double gcLng) {
234 | double x = gcLng, y = gcLat;
235 | double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
236 | double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
237 | return z * Math.cos(theta) + 0.0065;
238 | }
239 |
240 | /**
241 | * 火星坐标转百度坐标
242 | *
243 | * @param gcLat 火星坐标纬度
244 | * @param gcLng 火星坐标经度
245 | * @return 百度坐标纬度
246 | */
247 | private static double transform2BaiDuLat(double gcLat, double gcLng) {
248 | double x = gcLng, y = gcLat;
249 | double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
250 | double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
251 | return z * Math.sin(theta) + 0.006;
252 | }
253 |
254 | public static boolean isTheSamePlace(PKLatLng fiveLatLng1, PKLatLng fiveLatLng2) {
255 | //// TODO: 17/2/14 判断两个点是否为同一个点
256 | return (Math.abs(fiveLatLng1.getLatitude() - fiveLatLng2.getLatitude()) < 0.0001 && Math.abs(fiveLatLng1.getLongitude() - fiveLatLng2.getLongitude()) < 0.0001);
257 | }
258 |
259 | public static boolean isTheSameLatlng(PKLatLng fiveLatLng1, PKLatLng fiveLatLng2) {
260 | // 17/2/14 判断两个点经纬度的误差
261 | return (Math.abs(fiveLatLng1.getLatitude() - fiveLatLng2.getLatitude()) < 0.0000001 && Math.abs(fiveLatLng1.getLongitude() - fiveLatLng2.getLongitude()) < 0.0000001);
262 | }
263 | }
264 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/NaviCallBack.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map;
2 |
3 | /**
4 | * Created by pukai on 16/5/19.
5 | */
6 | public interface NaviCallBack {
7 | void naviOnStart();
8 | void naviOnStop();
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/OnMapClickCallback.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map;
2 |
3 |
4 | import pk.com.lib.map.modle.PKMarker;
5 |
6 | /**
7 | * Created by pukai on 2016-4-27.
8 | *
9 | * 地图公共的点击回调接口
10 | */
11 | public interface OnMapClickCallback {
12 | /**
13 | * 地图点击的回调事件
14 | * @param fiveMarker 返回添加的标注
15 | */
16 | void onMapClicked(PKMarker fiveMarker);
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/OnMapLoaded.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map;
2 |
3 | import pk.com.lib.CommonMapFunction;
4 |
5 | /**
6 | * Created by pukai on 16/5/9.
7 | */
8 | public interface OnMapLoaded {
9 | void mapLoadSuccess(CommonMapFunction commonMapFunction);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/OnMarkerOnclickListener.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map;
2 |
3 | /**
4 | * Created by pukai on 17/2/14.
5 | */
6 | public interface OnMarkerOnclickListener {
7 | void markerIsClicked();
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/OnPKMapTouch.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map;
2 |
3 | /**
4 | * Created by pukai on 17/2/17.
5 | */
6 | public interface OnPKMapTouch {
7 | void onMapTouch();
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/amp/AMapHelper.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.amp;
2 |
3 | import android.content.Context;
4 |
5 | import com.amap.api.maps.AMap;
6 |
7 | import pk.com.lib.map.MapHelper;
8 | import pk.com.lib.map.control.AMapControl;
9 | import pk.com.lib.map.control.IControl;
10 | import pk.com.lib.map.navi.AMapNavi;
11 | import pk.com.lib.map.navi.INavi;
12 | import pk.com.lib.map.overlay.AMapOverLay;
13 | import pk.com.lib.map.overlay.IOverLay;
14 | import pk.com.lib.map.smooth.AMapSooth;
15 | import pk.com.lib.map.smooth.ISmooth;
16 | import pk.com.lib.map.trace.AMapTrace;
17 | import pk.com.lib.map.trace.ITrace;
18 |
19 |
20 | /**
21 | * Created by pukai on 16/12/22.
22 | */
23 | public class AMapHelper extends MapHelper {
24 | public AMapHelper(AMap aMap,Context context){
25 | super(aMap,context);
26 | }
27 | public INavi createNaive(AMap fiveMap, Context context){
28 | return new AMapNavi(fiveMap,context);
29 | }
30 |
31 | @Override
32 | protected ITrace createTrace(AMap fiveMap, Context context) {
33 | return new AMapTrace(fiveMap,context);
34 | }
35 |
36 | @Override
37 | protected IControl createControl(AMap fiveMap, Context context) {
38 | return new AMapControl(fiveMap,context);
39 | }
40 |
41 | @Override
42 | protected ISmooth createSmooth(AMap fiveMap, Context context) {
43 | return new AMapSooth(fiveMap,context);
44 | }
45 |
46 | @Override
47 | protected IOverLay createOverLay(AMap fiveMap, Context context) {
48 | return new AMapOverLay(fiveMap,context);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/amp/AmapFragment.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.amp;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.LayoutInflater;
7 | import android.view.MotionEvent;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 |
13 | import com.amap.api.maps.AMap;
14 | import com.amap.api.maps.MapView;
15 | import com.amap.api.maps.model.CameraPosition;
16 | import com.amap.api.maps.model.Marker;
17 |
18 | import java.util.List;
19 |
20 | import pk.com.lib.R;
21 | import pk.com.lib.map.MapFrament;
22 | import pk.com.lib.map.MapHelper;
23 | import pk.com.lib.map.modle.PKLatLng;
24 | import pk.com.lib.map.modle.PKListLatLngContainer;
25 | import pk.com.lib.map.modle.PKMarker;
26 |
27 | /**
28 | * Created by pukai on 2016-6-20.
29 | */
30 | public class AmapFragment extends MapFrament implements AMap.OnMapLoadedListener, AMap.OnMarkerClickListener, AMap.OnCameraChangeListener, AMap.OnMapTouchListener {
31 | private AMap mAMap;
32 | private MapView mMapView;
33 | //记录当前添加的marker 再次添加的时候 只需要更改marker的位置 setPotint();
34 | private PKMarker currentMaker;
35 |
36 | @Override
37 | public View onCreateView(LayoutInflater layoutinflater, ViewGroup viewgroup, Bundle bundle) {
38 | View view = layoutinflater.inflate(R.layout.fragment_gaode_map, viewgroup, false);
39 | mMapView = (MapView) view.findViewById(R.id.amapView);
40 | mMapView.onCreate(bundle);
41 | mAMap = mMapView.getMap();
42 |
43 | mAMap.getUiSettings().setLogoPosition(50);
44 | mAMap.getUiSettings().setZoomControlsEnabled(false);
45 |
46 | mapHelper = createMapHelper(mAMap, getContext());
47 | mAMap.setOnMarkerClickListener(this);
48 | mAMap.setOnMapLoadedListener(this);
49 | mAMap.setOnCameraChangeListener(this);
50 | mAMap.setOnMapTouchListener(this);
51 | return view;
52 | }
53 |
54 | @Override
55 | protected MapHelper createMapHelper(AMap fiveMap, Context context) {
56 | return new AMapHelper(fiveMap, context);
57 | }
58 |
59 |
60 | @Override
61 | public void onDestroy() {
62 | mMapView.onDestroy();
63 | mMapView = null;
64 | mapHelper.destrory();
65 | super.onDestroy();
66 | }
67 |
68 | @Override
69 | public void onResume() {
70 | super.onResume();
71 | mMapView.onResume();
72 | }
73 |
74 | @Override
75 | public void onPause() {
76 | super.onPause();
77 | mMapView.onPause();
78 | }
79 |
80 | @Override
81 | public void onSaveInstanceState(Bundle outState) {
82 | super.onSaveInstanceState(outState);
83 | mMapView.onSaveInstanceState(outState);
84 | }
85 |
86 | @Override
87 | public void onLowMemory() {
88 | super.onLowMemory();
89 | mMapView.onLowMemory();
90 | }
91 |
92 | @Override
93 | public void addMyLocationMarker() {
94 |
95 | }
96 |
97 | @Override
98 | public void onMapLoaded() {
99 | mapHelper.getmIControl().setCenter(new PKLatLng(31.2393627086, 121.4995369338));
100 | }
101 |
102 | @Override
103 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
104 | }
105 |
106 | /**
107 | * marker点击事件的回调 返回true 事件结束 返回false 继续交给底层处理事件
108 | *
109 | * @param marker
110 | * @return
111 | */
112 | @Override
113 | public boolean onMarkerClick(Marker marker) {
114 | return false;
115 | }
116 |
117 | public static MapFrament newInstance(Bundle bundle) {
118 | AmapFragment amapFragment = new AmapFragment();
119 | amapFragment.setArguments(bundle);
120 | return amapFragment;
121 | }
122 |
123 | @Override
124 | public void onCameraChange(CameraPosition cameraPosition) {
125 |
126 | }
127 |
128 | @Override
129 | public void onCameraChangeFinish(CameraPosition cameraPosition) {
130 |
131 | }
132 |
133 | @Override
134 | public void onTouch(MotionEvent motionEvent) {
135 |
136 | }
137 |
138 | @Override
139 | public void setMapCenter(PKLatLng fiveLatLng) {
140 | mapHelper.getmIControl().setCenter(fiveLatLng);
141 | }
142 |
143 | @Override
144 | public void addBusinessMarker(PKLatLng fiveLatLng, String title) {
145 | if (currentMaker == null) {
146 | currentMaker = mapHelper.getmIOverLay().addMarker(fiveLatLng, inflatCarStausView(title), 0.1f, 0.5f);
147 | } else {
148 | currentMaker.getAmaptMarker().setPosition(fiveLatLng.getAmapLatlng());
149 | }
150 | }
151 |
152 | @Override
153 | public void addPollyLine(List fiveLatLngList) {
154 | mapHelper.getmIOverLay().addPollyLine(new PKListLatLngContainer(fiveLatLngList));
155 | }
156 |
157 | @Override
158 | public void moveMap(List fiveLatLngList) {
159 | mapHelper.getmIControl().setLatLng(fiveLatLngList);
160 | }
161 |
162 |
163 | public View inflatCarStausView(String title) {
164 | View view = LayoutInflater.from(getContext()).inflate(R.layout.item_marker_car, null);
165 | TextView data = (TextView) view.findViewById(R.id.item_marker_car_data);
166 | ImageView imageView = (ImageView) view.findViewById(R.id.item_marker_car_image);
167 | imageView.setImageResource(R.drawable.btn_car_moving_press);
168 | data.setTextColor(getContext().getResources().getColor(R.color.ct0));
169 | data.setText(title);
170 | return view;
171 | }
172 | }
173 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/control/AMapControl.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.control;
2 |
3 | import android.content.Context;
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.model.CameraPosition;
9 | import com.amap.api.maps.model.LatLngBounds;
10 |
11 | import java.util.List;
12 |
13 | import pk.com.lib.map.modle.PKLatLng;
14 |
15 |
16 | /**
17 | * Created by pukai on 16/12/22.
18 | */
19 | public class AMapControl extends IControl {
20 | public AMapControl(AMap aMap, Context context) {
21 | initMapResource(aMap, context);
22 | }
23 |
24 | @Override
25 | public void setLatLng(List fiveLatLngs) {
26 | if (fiveLatLngs == null || fiveLatLngs.isEmpty()) {
27 | return;
28 | }
29 | LatLngBounds.Builder builder = new LatLngBounds.Builder();
30 | for (PKLatLng fiveLatLng : fiveLatLngs) {
31 | builder.include(fiveLatLng.getAmapLatlng());
32 | }
33 | int leftPadding = 100;
34 | int rightPadding = 100;
35 | int topPadding = 100;
36 | int bottomPadding = 251;
37 |
38 | CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBoundsRect(builder.build(), leftPadding, rightPadding, topPadding, bottomPadding);
39 | mPKMap.moveCamera(cameraUpdate);
40 | }
41 |
42 | @Override
43 | public void setCenter(PKLatLng fiveLatLng) {
44 | CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(new CameraPosition(fiveLatLng.getAmapLatlng(), ZOOM, 0, 0));
45 | mPKMap.moveCamera(cameraUpdate);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/control/IControl.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.control;
2 |
3 | import java.util.List;
4 |
5 | import pk.com.lib.map.MapResource;
6 | import pk.com.lib.map.modle.PKLatLng;
7 |
8 | /**
9 | * 地图的基础控制
10 | *
11 | *
12 | *
13 | * Created by pukai on 16/12/21.
14 | */
15 | public abstract class IControl extends MapResource {
16 | public abstract void setLatLng(List fiveLatLngs);
17 |
18 | public abstract void setCenter(PKLatLng fiveLatLng);
19 | }
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKContainer.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | /**
4 | * Created by pukai on 16/12/29.
5 | */
6 | public class PKContainer {
7 | private T data;
8 |
9 | public T getData() {
10 | return data;
11 | }
12 |
13 | public void setData(T data) {
14 | this.data = data;
15 | }
16 |
17 | public PKContainer(T data){
18 | this.data = data;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKEquipmentMarkerHolder.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | import com.amap.api.maps.model.Marker;
4 |
5 | import java.util.List;
6 |
7 | public class PKEquipmentMarkerHolder {
8 |
9 | public PKEquipmentMarkerHolder(PKLatLng fiveLatLng, List infos) {
10 | this.fiveLatLng = fiveLatLng;
11 | this.infos = infos;
12 | }
13 | public Marker marker;
14 | public PKLatLng fiveLatLng;
15 | public List infos;
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKEuipmentInfo.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | public class PKEuipmentInfo {
4 | public PKEuipmentInfo(int status, String title) {
5 | this.status = status;
6 | this.title = title;
7 | }
8 |
9 | public int status;
10 | public String title;
11 | }
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKLatLng.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import com.amap.api.maps.model.LatLng;
7 |
8 | import java.io.Serializable;
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * Created by pukai on 2016-4-26.
14 | * 用于接口传递数据的公共经纬度坐标类
15 | */
16 | public class PKLatLng implements Serializable, Parcelable {
17 | private static final long serialVersionUID = 1221039181121980934L;
18 | private double latitude;
19 | private double longitude;
20 | private String title;
21 | private String snippet;
22 |
23 | private double bearing; // 方向, 单位为度, 仅当位置来自GPS时可能有效.
24 | private int locationType; // 定位数据来源
25 | private long time; //时间戳 ,long
26 |
27 |
28 | public static long getSerialVersionUID() {
29 | return serialVersionUID;
30 | }
31 |
32 | public double getLatitude() {
33 | return latitude;
34 | }
35 |
36 | public void setLatitude(double latitude) {
37 | this.latitude = latitude;
38 | }
39 |
40 | public double getLongitude() {
41 | return longitude;
42 | }
43 |
44 | public void setLongitude(double longitude) {
45 | this.longitude = longitude;
46 | }
47 |
48 | public String getTitle() {
49 | return title;
50 | }
51 |
52 | public void setTitle(String title) {
53 | this.title = title;
54 | }
55 |
56 | public String getSnippet() {
57 | return snippet;
58 | }
59 |
60 | public void setSnippet(String snippet) {
61 | this.snippet = snippet;
62 | }
63 |
64 | public double getBearing() {
65 | return bearing;
66 | }
67 |
68 | public void setBearing(double bearing) {
69 | this.bearing = bearing;
70 | }
71 |
72 | public int getLocationType() {
73 | return locationType;
74 | }
75 |
76 | public void setLocationType(int locationType) {
77 | this.locationType = locationType;
78 | }
79 |
80 |
81 | public PKLatLng(double latitude, double longitude) {
82 | this.latitude = latitude;
83 | this.longitude = longitude;
84 | }
85 |
86 | public PKLatLng(double latitude, double longitude, String ttile, String snippet) {
87 | this.latitude = latitude;
88 | this.longitude = longitude;
89 | this.title = ttile;
90 | this.snippet = snippet;
91 | }
92 |
93 | public boolean hasZeroValue() {
94 | return latitude == 0.0 || longitude == 0.0;
95 | }
96 |
97 | public PKLatLng(double latitude, double longitude, double bearing, int locType, long time) {
98 | this.latitude = latitude;
99 | this.longitude = longitude;
100 | this.bearing = bearing;
101 | this.locationType = locType;
102 | this.time = time;
103 | }
104 |
105 | public LatLng getAmapLatlng() {
106 | return new LatLng(latitude, longitude);
107 | }
108 |
109 | /**
110 | * socket坐标上报有用,别修改返回格式
111 | *
112 | * @return
113 | */
114 | @Override
115 | public String toString() {
116 | return latitude + "," + longitude + "," + bearing + "," + locationType + "," + time;
117 | }
118 |
119 | @Override
120 | public int describeContents() {
121 | return 0;
122 | }
123 |
124 | @Override
125 | public void writeToParcel(Parcel dest, int flags) {
126 | dest.writeDouble(this.latitude);
127 | dest.writeDouble(this.longitude);
128 | dest.writeDouble(this.bearing);
129 | dest.writeLong(this.time);
130 | }
131 |
132 | protected PKLatLng(Parcel in) {
133 | this.latitude = in.readDouble();
134 | this.longitude = in.readDouble();
135 | this.bearing = in.readDouble();
136 | this.time = in.readLong();
137 | }
138 |
139 | public static final Creator CREATOR = new Creator() {
140 | @Override
141 | public PKLatLng createFromParcel(Parcel source) {
142 | return new PKLatLng(source);
143 | }
144 |
145 | @Override
146 | public PKLatLng[] newArray(int size) {
147 | return new PKLatLng[size];
148 | }
149 | };
150 |
151 | public static List listPKLatlng2AmapLatlng(List list) {
152 | List amapList = new ArrayList<>();
153 | if (list != null && !list.isEmpty()) {
154 | for (PKLatLng fiveLatLng : list) {
155 | amapList.add(fiveLatLng.getAmapLatlng());
156 | }
157 | }
158 | return amapList;
159 | }
160 |
161 | public static List listAmapLatlng2PKLatlng(List list) {
162 | List fiveLatLngs = new ArrayList<>();
163 | if (list != null && !list.isEmpty()) {
164 | for (LatLng amapLatlng : list) {
165 | fiveLatLngs.add(new PKLatLng(amapLatlng.latitude,amapLatlng.longitude));
166 | }
167 | }
168 | return fiveLatLngs;
169 | }
170 | }
171 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKListLatLngContainer.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | import com.amap.api.maps.model.LatLng;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * f防止各种地图类的List 在接口回调时,多次转换成List 节约时间和空间效率
9 | * Created by pukai on 16/12/26.
10 | */
11 | public class PKListLatLngContainer {
12 | private List aMaplist;
13 |
14 | private List fiveLatLngs;
15 |
16 | public List getaMaplist() {
17 | if (aMaplist == null || aMaplist.isEmpty()) {
18 | aMaplist = PKLatLng.listPKLatlng2AmapLatlng(fiveLatLngs);
19 | }
20 | return aMaplist;
21 | }
22 |
23 | public void setaMaplist(List aMaplist) {
24 | this.aMaplist = aMaplist;
25 | }
26 |
27 | public List getPKLatLngs() {
28 | if (fiveLatLngs == null || fiveLatLngs.isEmpty()) {
29 | fiveLatLngs = PKLatLng.listAmapLatlng2PKLatlng(aMaplist);
30 | }
31 | return fiveLatLngs;
32 | }
33 |
34 | public void setPKLatLngs(List fiveLatLngs) {
35 | this.fiveLatLngs = fiveLatLngs;
36 | }
37 |
38 | public PKListLatLngContainer(List aMaplist, List fiveLatLngs) {
39 | this.aMaplist = aMaplist;
40 | this.fiveLatLngs = fiveLatLngs;
41 | }
42 |
43 | public PKListLatLngContainer(List fiveLatLngs) {
44 | this.fiveLatLngs = fiveLatLngs;
45 | }
46 |
47 | public PKListLatLngContainer() {
48 |
49 | }
50 |
51 | public boolean isEmpty() {
52 | return !((fiveLatLngs != null && !fiveLatLngs.isEmpty()) || (aMaplist != null && !aMaplist.isEmpty()));
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKListTraceLocationContainer.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | import com.amap.api.trace.TraceLocation;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * 防止各种地图类的List 在接口回调时,多次转换成List 节约时间和空间效率
9 | * Created by pukai on 16/12/26.
10 | */
11 | public class PKListTraceLocationContainer {
12 | private List aMaplist;
13 |
14 | private List fiveTraceLocations;
15 |
16 | public List getaMaplist() {
17 | if(aMaplist==null||aMaplist.isEmpty()){
18 | aMaplist = PKTraceLocation.listPKTraceLocation2AmapTraceLocation(fiveTraceLocations);
19 | }
20 | return aMaplist;
21 | }
22 |
23 | public void setaMaplist(List aMaplist) {
24 | this.aMaplist = aMaplist;
25 | }
26 |
27 | public List getPKTraceLocations() {
28 | if(fiveTraceLocations==null||fiveTraceLocations.isEmpty()){
29 | fiveTraceLocations = PKTraceLocation.listAmapTraceLocation2PKTraceLocation(aMaplist);
30 | }
31 | return fiveTraceLocations;
32 | }
33 |
34 | public void setPKTraceLocations(List fiveTraceLocations) {
35 | this.fiveTraceLocations = fiveTraceLocations;
36 | }
37 |
38 | public PKListTraceLocationContainer(List aMaplist, List fiveTraceLocations) {
39 | this.aMaplist = aMaplist;
40 | this.fiveTraceLocations = fiveTraceLocations;
41 | }
42 |
43 | public PKListTraceLocationContainer(List fiveTraceLocations) {
44 | this.fiveTraceLocations = fiveTraceLocations;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKMarker.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | import com.amap.api.maps.model.Marker;
4 |
5 | /**
6 | * Created by pukai on 2016-4-27.
7 | *
8 | * 用于传递地图标注的公共标注类
9 | */
10 | public class PKMarker {
11 | private Marker amapMarker;
12 |
13 | public PKMarker(Marker amapMarker) {
14 | this.amapMarker = amapMarker;
15 | }
16 |
17 |
18 | public void remove() {
19 | if(amapMarker!=null){
20 | amapMarker.remove();
21 | }
22 | }
23 | public Marker getAmaptMarker(){
24 | return amapMarker;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKMarkerHolder.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | /**
4 | * Created by pukai on 17/2/14.
5 | */
6 | public class PKMarkerHolder {
7 | public PKMarkerHolder(PKLatLng latLng, String t, int s) {
8 | fiveLatLng = latLng;
9 | title = t;
10 | status = s;
11 | }
12 |
13 | public PKLatLng fiveLatLng;
14 | public String title;
15 | public int status;
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKMarkerOptions.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | import com.amap.api.maps.model.MarkerOptions;
4 |
5 | /**
6 | * Created by pukai on 16/5/20.
7 | */
8 | public class PKMarkerOptions {
9 | private MarkerOptions amapMarkerOptions;
10 |
11 | public MarkerOptions getAmapMarkerOptions() {
12 | return amapMarkerOptions;
13 | }
14 |
15 | public void setAmapMarkerOptions(MarkerOptions amapMarkerOptions) {
16 | this.amapMarkerOptions = amapMarkerOptions;
17 | }
18 | public PKMarkerOptions(MarkerOptions amapMarkerOptions) {
19 | this.amapMarkerOptions = amapMarkerOptions;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKTrace.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | /**
7 | * Created by pukai on 16/12/21.
8 | */
9 | public class PKTrace implements Parcelable {
10 | private long time;
11 | private double latitude;
12 | private double longitude;
13 | private float bearing;
14 |
15 | public long getTime() {
16 | return time;
17 | }
18 |
19 | public void setTime(long time) {
20 | this.time = time;
21 | }
22 |
23 | public double getLatitude() {
24 | return latitude;
25 | }
26 |
27 | public void setLatitude(double latitude) {
28 | this.latitude = latitude;
29 | }
30 |
31 | public double getLongitude() {
32 | return longitude;
33 | }
34 |
35 | public void setLongitude(double longitude) {
36 | this.longitude = longitude;
37 | }
38 |
39 | public float getBearing() {
40 | return bearing;
41 | }
42 |
43 | public void setBearing(float bearing) {
44 | this.bearing = bearing;
45 | }
46 |
47 |
48 | @Override
49 | public int describeContents() {
50 | return 0;
51 | }
52 |
53 | @Override
54 | public void writeToParcel(Parcel dest, int flags) {
55 | dest.writeLong(this.time);
56 | dest.writeDouble(this.latitude);
57 | dest.writeDouble(this.longitude);
58 | dest.writeFloat(this.bearing);
59 | }
60 |
61 | public PKTrace() {
62 | }
63 |
64 | protected PKTrace(Parcel in) {
65 | this.time = in.readLong();
66 | this.latitude = in.readDouble();
67 | this.longitude = in.readDouble();
68 | this.bearing = in.readFloat();
69 | }
70 |
71 | public static final Creator CREATOR = new Creator() {
72 | @Override
73 | public PKTrace createFromParcel(Parcel source) {
74 | return new PKTrace(source);
75 | }
76 |
77 | @Override
78 | public PKTrace[] newArray(int size) {
79 | return new PKTrace[size];
80 | }
81 | };
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/modle/PKTraceLocation.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.modle;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import com.amap.api.trace.TraceLocation;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | /**
12 | * Created by pukai on 16/12/26.
13 | */
14 | public class PKTraceLocation implements Parcelable {
15 |
16 | private String deviceId;
17 |
18 | private long receiveTime;
19 |
20 | private float speed;
21 |
22 | private double longitude;
23 |
24 | private double latitude;
25 |
26 | private int direction;
27 |
28 | private int carStatus;
29 |
30 | private int acc;
31 |
32 | private TraceLocation aMapTraceLocation;
33 |
34 | public TraceLocation getAmapTraceLocation() {
35 | if (aMapTraceLocation == null) {
36 | aMapTraceLocation = new TraceLocation();
37 | aMapTraceLocation.setSpeed(speed);
38 | aMapTraceLocation.setLatitude(latitude);
39 | aMapTraceLocation.setLongitude(latitude);
40 | aMapTraceLocation.setTime(receiveTime);
41 | aMapTraceLocation.setBearing(direction);
42 | }
43 | return aMapTraceLocation;
44 | }
45 |
46 | @Override
47 | public int describeContents() {
48 | return 0;
49 | }
50 |
51 | @Override
52 | public void writeToParcel(Parcel dest, int flags) {
53 | dest.writeString(this.deviceId);
54 | dest.writeLong(this.receiveTime);
55 | dest.writeFloat(this.speed);
56 | dest.writeDouble(this.longitude);
57 | dest.writeDouble(this.latitude);
58 | dest.writeInt(this.direction);
59 | dest.writeInt(this.carStatus);
60 | dest.writeInt(this.acc);
61 | }
62 |
63 | public PKTraceLocation() {
64 | }
65 |
66 | public PKTraceLocation(TraceLocation traceLocation) {
67 | if (traceLocation != null) {
68 | receiveTime = traceLocation.getTime();
69 | speed = traceLocation.getSpeed();
70 | longitude = traceLocation.getLongitude();
71 | latitude = traceLocation.getLatitude();
72 | direction = (int) traceLocation.getBearing();
73 | }
74 | }
75 |
76 | protected PKTraceLocation(Parcel in) {
77 | this.deviceId = in.readString();
78 | this.receiveTime = in.readLong();
79 | this.speed = in.readFloat();
80 | this.longitude = in.readDouble();
81 | this.latitude = in.readDouble();
82 | this.direction = in.readInt();
83 | this.carStatus = in.readInt();
84 | this.acc = in.readInt();
85 | }
86 |
87 | public static final Creator CREATOR = new Creator() {
88 | @Override
89 | public PKTraceLocation createFromParcel(Parcel source) {
90 | return new PKTraceLocation(source);
91 | }
92 |
93 | @Override
94 | public PKTraceLocation[] newArray(int size) {
95 | return new PKTraceLocation[size];
96 | }
97 | };
98 |
99 | public static List listPKTraceLocation2AmapTraceLocation(List fiveTraceLocationList) {
100 | List amapTraceLation = new ArrayList<>();
101 | if (fiveTraceLocationList == null || fiveTraceLocationList.isEmpty()) {
102 | } else {
103 | for (PKTraceLocation PKTraceLocation : fiveTraceLocationList) {
104 | amapTraceLation.add(PKTraceLocation.getAmapTraceLocation());
105 | }
106 | }
107 | return amapTraceLation;
108 | }
109 |
110 | public static List listAmapTraceLocation2PKTraceLocation(List aMapTracelocation) {
111 | List fiveTraceLation = new ArrayList<>();
112 | if (aMapTracelocation == null || aMapTracelocation.isEmpty()) {
113 | } else {
114 | for (TraceLocation amapTraceLocation : aMapTracelocation) {
115 | fiveTraceLation.add(new PKTraceLocation(amapTraceLocation));
116 | }
117 | }
118 | return fiveTraceLation;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/navi/AMapNavi.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.navi;
2 |
3 | import android.content.Context;
4 |
5 | import com.amap.api.maps.AMap;
6 |
7 | import java.util.List;
8 |
9 | import pk.com.lib.map.modle.PKLatLng;
10 |
11 |
12 | /**
13 | * Created by pukai on 16/12/22.
14 | */
15 | public class AMapNavi extends INavi{
16 | public AMapNavi(AMap aMap, Context context){
17 | initMapResource(aMap,context);
18 | }
19 | @Override
20 | public void startNavi(PKLatLng fiveStart, PKLatLng fiveEnd, List fivePassList) {
21 | }
22 |
23 | @Override
24 | public void stopNavi() {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/navi/INavi.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.navi;
2 |
3 | import java.util.List;
4 |
5 | import pk.com.lib.map.MapResource;
6 | import pk.com.lib.map.modle.PKLatLng;
7 |
8 | /**
9 | * Created by pukai on 16/12/21.
10 | */
11 | public abstract class INavi extends MapResource {
12 | abstract void startNavi(PKLatLng fiveStart, PKLatLng fiveEnd, List fivePassList);
13 |
14 | abstract void stopNavi();
15 | }
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/overlay/AMapOverLay.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.overlay;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.view.View;
6 |
7 | import com.amap.api.maps.AMap;
8 | import com.amap.api.maps.model.BitmapDescriptorFactory;
9 | import com.amap.api.maps.model.LatLng;
10 | import com.amap.api.maps.model.MarkerOptions;
11 | import com.amap.api.maps.model.PolylineOptions;
12 |
13 |
14 | import java.util.List;
15 |
16 | import pk.com.lib.map.modle.PKLatLng;
17 | import pk.com.lib.map.modle.PKListLatLngContainer;
18 | import pk.com.lib.map.modle.PKMarker;
19 | import pk.com.lib.map.modle.PKMarkerOptions;
20 |
21 | /**
22 | * Created by pukai on 16/12/22.
23 | */
24 | public class AMapOverLay extends IOverLay {
25 |
26 | public AMapOverLay(AMap aMap, Context context) {
27 | initMapResource(aMap, context);
28 | }
29 |
30 | @Override
31 | public PKMarker addMarker(PKMarkerOptions fiveMarkerOptions) {
32 | return null;
33 | }
34 |
35 | @Override
36 | public PKMarker addMarker(PKLatLng fiveLatLng, View view) {
37 | PKMarker fiveMarker = new PKMarker(mPKMap.addMarker(new MarkerOptions().position(fiveLatLng.getAmapLatlng()).title("")));
38 | fiveMarker.getAmaptMarker().setIcon(BitmapDescriptorFactory.fromView(view));
39 | return fiveMarker;
40 | }
41 |
42 | @Override
43 | public PKMarker addMarker(PKLatLng fiveLatLng, View view, float anchorX, float anchorY) {
44 | PKMarker fiveMarker = new PKMarker(mPKMap.addMarker(new MarkerOptions().position(fiveLatLng.getAmapLatlng()).title("").anchor(anchorX, anchorY)));
45 | fiveMarker.getAmaptMarker().setIcon(BitmapDescriptorFactory.fromView(view));
46 | return fiveMarker;
47 | }
48 |
49 | @Override
50 | public PKMarker addMarker(PKLatLng fiveLatLng, int imgId) {
51 | PKMarker fiveMarker = new PKMarker(mPKMap.addMarker(new MarkerOptions()
52 | .position(fiveLatLng.getAmapLatlng())
53 | .rotateAngle((float) fiveLatLng.getBearing())
54 | ));
55 | fiveMarker.getAmaptMarker().setIcon(BitmapDescriptorFactory.fromResource(imgId));
56 | return fiveMarker;
57 | }
58 |
59 | @Override
60 | public PKMarker addMarker(PKLatLng fiveLatLng, String title) {
61 | return null;
62 | }
63 |
64 | @Override
65 | public PKMarker addMarker(PKLatLng fiveLatLng, String title, boolean isInfoWindowShow) {
66 | return null;
67 | }
68 |
69 | @Override
70 | public PKMarker addMarker(PKLatLng fiveLatLng, String title, int imgID, boolean isInfoWindowShow) {
71 | return null;
72 | }
73 |
74 | @Override
75 | public PKMarker addMarker(PKLatLng fiveLatLng, String title, int imgID) {
76 | return null;
77 | }
78 |
79 | @Override
80 | public void addPollyLine(PKListLatLngContainer fiveListLatLngContainer) {
81 | if (fiveListLatLngContainer == null || fiveListLatLngContainer.isEmpty()) {
82 | return;
83 | }
84 | List list = fiveListLatLngContainer.getaMaplist();
85 | addPollyLine(list);
86 | }
87 |
88 | @Override
89 | public void addPollyLine(List list) {
90 | if (list == null || list.size() <= 1) {
91 | return;
92 | }
93 | mPKMap.addPolyline(new PolylineOptions().color(Color.BLUE)
94 | .addAll(list)
95 | .useGradient(true)
96 | .width(16));
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/overlay/IOverLay.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.overlay;
2 |
3 | import android.view.View;
4 |
5 | import com.amap.api.maps.model.LatLng;
6 |
7 |
8 | import java.util.List;
9 |
10 | import pk.com.lib.map.MapResource;
11 | import pk.com.lib.map.modle.PKLatLng;
12 | import pk.com.lib.map.modle.PKListLatLngContainer;
13 | import pk.com.lib.map.modle.PKMarker;
14 | import pk.com.lib.map.modle.PKMarkerOptions;
15 |
16 | /**
17 | * Created by pukai on 16/12/21.
18 | */
19 | public abstract class IOverLay extends MapResource {
20 | /**
21 | * 添加标注
22 | *
23 | * @param fiveMarkerOptions
24 | */
25 | public abstract PKMarker addMarker(PKMarkerOptions fiveMarkerOptions);
26 |
27 | /**
28 | * 添加标注
29 | *
30 | * @param fiveLatLng
31 | * @param view
32 | */
33 | public abstract PKMarker addMarker(PKLatLng fiveLatLng, View view);
34 |
35 | /**
36 | * 添加标注
37 | *
38 | * @param fiveLatLng
39 | * @param view
40 | * @param anchorX 锚点的x
41 | * @param anchorY 锚点的y
42 | */
43 | public abstract PKMarker addMarker(PKLatLng fiveLatLng, View view, float anchorX, float anchorY);
44 |
45 | /**
46 | * 添加标注
47 | *
48 | * @param fiveLatLng 经纬度坐标信息
49 | * @return 经过封装的PKarker类
50 | */
51 | public abstract PKMarker addMarker(PKLatLng fiveLatLng, int imgId);
52 |
53 | /**
54 | * 添加标注
55 | *
56 | * @param fiveLatLng 经纬度坐标信息
57 | * @param title 标题
58 | * @return 经过封装的PKarker类
59 | */
60 | public abstract PKMarker addMarker(PKLatLng fiveLatLng, String title);
61 |
62 | /**
63 | * 添加标注
64 | *
65 | * @param fiveLatLng 经纬度坐标信息
66 | * @param title 标题
67 | * @param isInfoWindowShow 标注框是否显示
68 | * @return 经过封装的PKarker类
69 | */
70 | public abstract PKMarker addMarker(PKLatLng fiveLatLng, String title, boolean isInfoWindowShow);
71 |
72 | /**
73 | * 添加标注
74 | *
75 | * @param fiveLatLng 经纬度坐标信息
76 | * @param title 标题
77 | * @param isInfoWindowShow 标注框是否显示
78 | * @return 经过封装的PKarker类
79 | */
80 | public abstract PKMarker addMarker(PKLatLng fiveLatLng, String title, int imgID, boolean isInfoWindowShow);
81 |
82 | /**
83 | * 添加标注使用特定的图标
84 | *
85 | * @param fiveLatLng 经纬度坐标信息
86 | * @param title 标题
87 | * @return 经过封装的PKarker类
88 | */
89 | public abstract PKMarker addMarker(PKLatLng fiveLatLng, String title, int imgID);
90 |
91 | public abstract void addPollyLine(PKListLatLngContainer fiveListLatLngContainer);
92 |
93 | public abstract void addPollyLine(List latLngs);
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/smooth/AMapSooth.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.smooth;
2 |
3 | import android.content.Context;
4 | import android.util.Pair;
5 |
6 | import com.amap.api.maps.AMap;
7 | import com.amap.api.maps.model.BitmapDescriptorFactory;
8 | import com.amap.api.maps.model.LatLng;
9 | import com.amap.api.maps.model.MarkerOptions;
10 | import com.amap.api.maps.model.PolylineOptions;
11 | import com.amap.api.maps.utils.SpatialRelationUtil;
12 | import com.amap.api.maps.utils.overlay.SmoothMoveMarker;
13 |
14 |
15 | import java.util.List;
16 |
17 | import pk.com.lib.R;
18 | import pk.com.lib.map.modle.PKLatLng;
19 | import pk.com.lib.map.modle.PKListLatLngContainer;
20 |
21 | /**
22 | * Created by pukai on 16/12/22.
23 | */
24 | public class AMapSooth extends ISmooth {
25 |
26 | private SmoothMoveMarker smoothMoveMarker;
27 | private PKSmoothListener mPKSmoothListener;
28 | private int color;
29 | private int currentIndex;
30 | private int mTotalDuration;
31 | private PKListLatLngContainer mPKListLatLngContainer;
32 |
33 | public AMapSooth(AMap aMap, Context context) {
34 | initMapResource(aMap, context);
35 | }
36 |
37 | @Override
38 | public void initSmooth(int color, int totalDuration, PKListLatLngContainer fiveListLatLngContainer, PKSmoothListener fiveSmoothListener) {
39 | if (fiveListLatLngContainer == null || fiveListLatLngContainer.isEmpty()) {
40 | return;
41 | }
42 |
43 | mTotalDuration = totalDuration;
44 | mPKListLatLngContainer = fiveListLatLngContainer;
45 | mPKSmoothListener = fiveSmoothListener;
46 | currentIndex = 0;
47 | this.color = color;
48 | final List points = fiveListLatLngContainer.getaMaplist();
49 | addLine(points);
50 | smoothMoveMarker = new SmoothMoveMarker(mPKMap);
51 | smoothMoveMarker.setDescriptor(BitmapDescriptorFactory.fromResource(R.drawable.icon_car));
52 | LatLng drivePoint = points.get(0);
53 | final Pair pair = SpatialRelationUtil.calShortestDistancePoint(points, drivePoint);
54 | points.set(pair.first, drivePoint);
55 | List subList = points.subList(pair.first, points.size());
56 | smoothMoveMarker.setPoints(subList);
57 | smoothMoveMarker.setTotalDuration(totalDuration);
58 | smoothMoveMarker.getMarker().hideInfoWindow();
59 | smoothMoveMarker.setMoveListener(new SmoothMoveMarker.MoveListener() {
60 | @Override
61 | public void move(final double distance) {
62 | if (mPKSmoothListener != null) {
63 | LatLng latLng = points.get(currentIndex++);
64 | mPKSmoothListener.move(distance, new PKLatLng(latLng.latitude, latLng.longitude), currentIndex);
65 | if (distance == 0) {
66 | mPKSmoothListener.smoothFinish();
67 | }
68 | }
69 | }
70 |
71 | });
72 | mPKMap.addMarker(new MarkerOptions().position(points.get(points.size() - 1)).icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_end)));
73 | // smoothMoveMarker.startSmoothMove();
74 | }
75 |
76 | private void addLine(List list) {
77 | mPKMap.addPolyline(new PolylineOptions().color(color)
78 | .addAll(list)
79 | .useGradient(true)
80 | .width(16));
81 | }
82 |
83 | @Override
84 | public void stopSmooth() {
85 | if (smoothMoveMarker != null) {
86 | smoothMoveMarker.stopMove();
87 | }
88 | }
89 |
90 | @Override
91 | public void reStartSmooth() {
92 | if (smoothMoveMarker != null) {
93 | smoothMoveMarker.destroy();
94 | mPKMap.clear();
95 | smoothMoveMarker = null;
96 | }
97 | initSmooth(color, mTotalDuration, mPKListLatLngContainer, mPKSmoothListener);
98 | startSmooth();
99 | }
100 |
101 | @Override
102 | public void startSmooth() {
103 | if (smoothMoveMarker != null) {
104 | smoothMoveMarker.startSmoothMove();
105 | }
106 | }
107 |
108 | @Override
109 | public void destroySmooth() {
110 | if (smoothMoveMarker != null) {
111 | smoothMoveMarker.stopMove();
112 | smoothMoveMarker.destroy();
113 | mPKListLatLngContainer = null;
114 | smoothMoveMarker = null;
115 | }
116 | }
117 |
118 | @Override
119 | public void changSpeed(int totalDuration) {
120 | smoothMoveMarker.setTotalDuration(totalDuration);
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/smooth/ISmooth.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.smooth;
2 |
3 |
4 | import pk.com.lib.map.MapResource;
5 | import pk.com.lib.map.modle.PKListLatLngContainer;
6 |
7 | /**
8 | * Created by pukai on 16/12/21.
9 | */
10 | public abstract class ISmooth extends MapResource {
11 | /**
12 | * 开始平滑移动
13 | *
14 | * @param fiveListLatLngContainer 点集合
15 | * @param fiveSmoothListener 移动的事件监听
16 | */
17 | public abstract void initSmooth(int color, int totalDuration, PKListLatLngContainer fiveListLatLngContainer, PKSmoothListener fiveSmoothListener);
18 |
19 | /**
20 | * 停止平滑移动
21 | */
22 | public abstract void stopSmooth();
23 |
24 | /**
25 | * 重新开始平滑移动 与@link stopSmooth 相对
26 | */
27 | public abstract void reStartSmooth();
28 |
29 | /**
30 | * 开始平滑移动
31 | */
32 | public abstract void startSmooth();
33 |
34 | /**
35 | * 开始平滑移动
36 | */
37 | public abstract void destroySmooth();
38 |
39 | public abstract void changSpeed(int totalDuration);
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/smooth/PKSmoothListener.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.smooth;
2 |
3 |
4 | import pk.com.lib.map.modle.PKLatLng;
5 |
6 | /**
7 | * Created by pukai on 16/12/27.
8 | */
9 | public interface PKSmoothListener {
10 | /**
11 | * 平滑移动过程中的回调
12 | *
13 | * @param distance 移动的当前距离
14 | * @param fiveLatLng 当前移动到的点
15 | */
16 | void move(double distance, PKLatLng fiveLatLng, int index);
17 |
18 | /**
19 | * 平滑移动结束后的回调
20 | */
21 | void smoothFinish();
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/trace/AMapTrace.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.trace;
2 |
3 | import android.content.Context;
4 |
5 | import com.amap.api.maps.AMap;
6 | import com.amap.api.maps.model.LatLng;
7 | import com.amap.api.trace.LBSTraceClient;
8 | import com.amap.api.trace.TraceListener;
9 | import com.amap.api.trace.TraceLocation;
10 |
11 | import java.util.List;
12 |
13 | import pk.com.lib.map.modle.PKListLatLngContainer;
14 | import pk.com.lib.map.modle.PKListTraceLocationContainer;
15 |
16 | /**高德地图轨迹纠偏的具体实现
17 | * Created by pukai on 16/12/22.
18 | */
19 | public class AMapTrace extends ITrace{
20 |
21 | //private TraceOverlay mTraceOverlay;
22 | private LBSTraceClient mTraceClient;
23 | private int mSequenceLineID = 1000;
24 | private int mCoordinateType = LBSTraceClient.TYPE_AMAP;
25 |
26 | private PKTraceListener mPKTraceListener;
27 |
28 | public AMapTrace(AMap aMap, Context context){
29 | initMapResource(aMap,context);
30 | }
31 | @Override
32 | public void startTrace(PKListTraceLocationContainer fiveListTraceLocationContainer, PKTraceListener fiveTraceListener) {
33 | mPKTraceListener = fiveTraceListener;
34 | if(fiveListTraceLocationContainer ==null){
35 | if(mPKTraceListener!=null){
36 | mPKTraceListener.onFinished(0,null,0,0);
37 | }
38 | return;
39 | }
40 | List traceLocations = fiveListTraceLocationContainer.getaMaplist();
41 | if(traceLocations==null||traceLocations.isEmpty()){
42 | if(mPKTraceListener!=null){
43 | mPKTraceListener.onFinished(0,null,0,0);
44 | }
45 | return;
46 | }
47 | if(mTraceClient==null){
48 | mTraceClient = new LBSTraceClient(mContext);
49 | }
50 | mTraceClient.queryProcessedTrace(mSequenceLineID,traceLocations,mCoordinateType,mTraceListener);
51 | }
52 | private TraceListener mTraceListener = new TraceListener() {
53 | @Override
54 | public void onRequestFailed(int lineID, String errorInfo) {
55 | if(mPKTraceListener!=null){
56 | mPKTraceListener.onRequestFailed(lineID,errorInfo);
57 | }
58 | }
59 |
60 | @Override
61 | public void onTraceProcessing(int lineID, int index, List list) {
62 | if(mPKTraceListener!=null){
63 | PKListLatLngContainer fiveListLatLngContainer = new PKListLatLngContainer();
64 | fiveListLatLngContainer.setaMaplist(list);
65 | mPKTraceListener.onTraceProcessing(lineID,index,fiveListLatLngContainer);
66 | }
67 | }
68 |
69 | @Override
70 | public void onFinished(int lineID, List list, int distance, int waitingTime) {
71 | if(mPKTraceListener!=null) {
72 | PKListLatLngContainer fiveListLatLngContainer = new PKListLatLngContainer();
73 | fiveListLatLngContainer.setaMaplist(list);
74 | mPKTraceListener.onFinished(lineID,fiveListLatLngContainer,distance,waitingTime);
75 | }
76 | }
77 | };
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/trace/ITrace.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.trace;
2 |
3 |
4 | import pk.com.lib.map.MapResource;
5 | import pk.com.lib.map.modle.PKListTraceLocationContainer;
6 |
7 | /**
8 | * Created by pukai on 16/12/21.
9 | */
10 | public abstract class ITrace extends MapResource {
11 | /**
12 | * 开始轨迹纠偏
13 | * @param fiveListTraceLocationContainer 轨迹的点集合
14 | * @param fiveTraceListener 轨迹纠偏的回调
15 | */
16 | abstract void startTrace(PKListTraceLocationContainer fiveListTraceLocationContainer, PKTraceListener fiveTraceListener);
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/pk/com/lib/map/trace/PKTraceListener.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib.map.trace;
2 |
3 |
4 | import pk.com.lib.map.modle.PKListLatLngContainer;
5 |
6 | /**
7 | * Created by pukai on 16/12/26.
8 | */
9 | public interface PKTraceListener {
10 | /**
11 | * 轨迹纠偏失败的回调
12 | *
13 | * @param lineID 路线的id
14 | * @param errorInfo 错误信息
15 | */
16 | void onRequestFailed(int lineID, String errorInfo);
17 |
18 | /**
19 | * 轨迹纠偏过程中的回调 返回当前已经纠偏过的点和线路id
20 | *
21 | * @param lineID 线路id
22 | * @param index 已纠偏的点的数目
23 | * @param fiveListLatLngContainer 点集合
24 | */
25 | void onTraceProcessing(int lineID, int index, PKListLatLngContainer fiveListLatLngContainer);
26 |
27 | /**
28 | * 轨迹纠偏完成的回调
29 | *
30 | * @param lineID 线路的id
31 | * @param fiveListLatLngContainer 纠偏后的所有的点集合
32 | * @param distance 距离
33 | * @param waitingTime 等待时间
34 | */
35 | void onFinished(int lineID, PKListLatLngContainer fiveListLatLngContainer, int distance, int waitingTime);
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752.so
--------------------------------------------------------------------------------
/app/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752ex.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752ex.so
--------------------------------------------------------------------------------
/app/src/main/jniLibs/armeabi/libgdinamapv4sdk752.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/jniLibs/armeabi/libgdinamapv4sdk752.so
--------------------------------------------------------------------------------
/app/src/main/jniLibs/armeabi/libgdinamapv4sdk752ex.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/jniLibs/armeabi/libgdinamapv4sdk752ex.so
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/btn_car_location_bkg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/drawable-xhdpi/btn_car_location_bkg.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/btn_car_location_exception.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/drawable-xhdpi/btn_car_location_exception.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/btn_car_location_exception_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/drawable-xhdpi/btn_car_location_exception_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/btn_car_location_moving.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/drawable-xhdpi/btn_car_location_moving.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/btn_car_location_moving_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/drawable-xhdpi/btn_car_location_moving_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/btn_car_location_parking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/drawable-xhdpi/btn_car_location_parking.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/btn_car_location_parking_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/drawable-xhdpi/btn_car_location_parking_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/icon_car.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/drawable-xhdpi/icon_car.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/icon_end.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/drawable-xhdpi/icon_end.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_car_exception_press.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_car_moving_press.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_car_parking_press.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_business.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
21 |
22 |
28 |
29 |
35 |
36 |
42 |
43 |
49 |
50 |
51 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
78 |
79 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_gaode_map.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_marker_car.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
21 |
22 |
23 |
28 |
29 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #4371ED
8 | #F3F4F5
9 |
10 |
11 | #FFFFFF
12 | #EEEEEE
13 | #CCCCCC
14 | #999999
15 | #878787
16 | #666666
17 | #222222
18 | #E5E5E5
19 |
20 |
21 | #E9665F
22 | #54AA00
23 | #9EB4FA
24 | #dd7ab4f5
25 | #80000000
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MapLibForApp
3 | 打点
4 | 画线
5 | 移动地图
6 | 绘制路径
7 | 导航
8 | 平滑移动
9 | 清除地图
10 | 退出
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
19 |
22 |
23 |
26 |
27 |
30 |
31 |
34 |
35 |
38 |
39 |
42 |
43 |
46 |
47 |
50 |
51 |
54 |
55 |
58 |
59 |
62 |
63 |
66 |
67 |
70 |
71 |
74 |
75 |
78 |
79 |
82 |
83 |
86 |
87 |
90 |
91 |
94 |
95 |
98 |
99 |
102 |
103 |
106 |
107 |
110 |
111 |
114 |
115 |
118 |
119 |
122 |
123 |
126 |
127 |
130 |
131 |
134 |
135 |
138 |
139 |
142 |
143 |
146 |
147 |
150 |
151 |
154 |
155 |
158 |
159 |
162 |
163 |
164 |
167 |
168 |
171 |
172 |
175 |
176 |
179 |
180 |
183 |
184 |
187 |
188 |
191 |
192 |
195 |
196 |
199 |
200 |
201 |
--------------------------------------------------------------------------------
/app/src/test/java/pk/com/lib/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package pk.com.lib;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.1.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pukaicom/MapLibForApp/c8bad60b39adeec199ec6a85023f45b9ab3eac24/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------