marker_label.setText(pm_val); ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) marker_label.getLayoutParams(); if (pm_val.length() == 1) { layoutParams.bottomMargin = DensityUtil.dip2px(RoutePlanMapActivity.this, 11); marker_label.setTextSize(20); layoutParams.rightMargin = DensityUtil.dip2px(RoutePlanMapActivity.this, 1); } else { layoutParams.bottomMargin = DensityUtil.dip2px(RoutePlanMapActivity.this, 12); layoutParams.rightMargin = DensityUtil.dip2px(RoutePlanMapActivity.this, 2); marker_label.setTextSize(16); } marker_label.setLayoutParams(layoutParams); return view; } private void creatSaveData() { RouteHistoryBean.InfoBean infoBean = new RouteHistoryBean.InfoBean(); RouteHistoryBean.InfoBean.StartBean startBean = new RouteHistoryBean.InfoBean.StartBean(); startBean.setName(save_start_name); startBean.setLat(start_wei); startBean.setLon(start_jing); infoBean.setStart(startBean); RouteHistoryBean.InfoBean.EndBean endBean = new RouteHistoryBean.InfoBean.EndBean(); endBean.setName(save_end_name); endBean.setLat(end_wei); endBean.setLon(end_jing); infoBean.setEnd(endBean); List<RouteHistoryBean.InfoBean.WaypointBean> list = new ArrayList<>(); for (int i = 0; i < list_zhong.size(); i++) { RouteHistoryBean.InfoBean.WaypointBean wpb = new RouteHistoryBean.InfoBean.WaypointBean(); wpb.setLon(list_zhong.get(i).getPoi_jing()); wpb.setLat(list_zhong.get(i).getPoi_wei()); wpb.setZhanId(list_zhong.get(i).getZhan_id()); wpb.setZhanName(list_zhong.get(i).getZhan_name()); list.add(wpb); } infoBean.setWaypoint(list); String json = new Gson().toJson(infoBean); saveRoute(json); } public void showInfoWindowData(final String zhan_id, final View infoWindow, final ZhanData zhanData, final Marker marker) { TextView mInfoWindowFast = infoWindow.findViewById(R.id.evsdk_tv_info_fast); //infowinow中慢充数的显示 TextView mInfoWindowSlow = infoWindow.findViewById(R.id.evsdk_tv_info_slow); //infowinow中运营商的显示 TextView mInfoWindowSupplier = infoWindow.findViewById(R.id.evsdk_tv_info_supplier); //infowinow中距离的显示 TextView mInfoWindowDistance = infoWindow.findViewById(R.id.evsdk_tv_info_distance); LatLng ll = new LatLng(Double.parseDouble(start_wei), Double.parseDouble(start_jing)); float distance = AMapUtils.calculateLineDistance(new LatLng(ll.latitude , ll.longitude), marker.getPosition()); mInfoWindowDistance.setText(Util.getDistance(distance)); //infowinow中站名称的显示 TextView mInfoWindowName = infoWindow.findViewById(R.id.evsdk_tv_info_name); if (zhanData != null) { mInfoWindowSlow.setText(zhanData.getSlow_num()); mInfoWindowFast.setText(zhanData.getFast_num()); mInfoWindowName.setText(zhanData.getZhan_name()); mInfoWindowSupplier.setText(zhanData.getSupplier()); } //infowinow中添加/删除途经点的显示 ImageView mInfoWindowDeal = infoWindow.findViewById(R.id.evsdk_iv_deal_waypoint); for (int i = 0; i < 16; i++) { if (marker.getTitle().equals(i + 1 + "")) { mInfoWindowDeal.setImageResource(R.drawable.evsdk_icon_delete_waypoint); } } RelativeLayout mInfoWindowAdd = infoWindow.findViewById(R.id.evsdk_rl_routeadd); mInfoWindowAdd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { routeNum = 1; routeOne.clear(); routeTwo.clear(); routeThree.clear(); exchangeView(1); boolean equal = false; for (Zhan zhan : list_zhong) { equal = zhan_id.equals(zhan.getZhan_id()); if (equal) break; } if (!equal) { if (list_zhong.size() < 16) { zhan = new Zhan(); zhan.setPoi_jing(String.valueOf(marker.getPosition().longitude)); zhan.setPoi_wei(String.valueOf(marker.getPosition().latitude)); zhan.setZhan_id(zhan_id); if (zhanData != null) { zhan.setZhan_name(zhanData.getZhan_name()); } list_zhong.add(zhan); Log.e("size===", list_zhong.size() + ""); if (list_zhong.size() > 0) { canRoute = true; canSave = true; } else { canRoute = false; canSave = false; } rela_paopao.setVisibility(View.GONE); amap.clear(); endLatlng = new NaviLatLng(Double.parseDouble(end_wei), Double.parseDouble(end_jing)); startLatlng = new NaviLatLng(Double.parseDouble(start_wei), Double.parseDouble(start_jing)); endList.clear(); startList.clear(); zhongList.clear(); startList.add(startLatlng); endList.add(endLatlng); for (int i = 0; i < list_zhong.size(); i++) { zhongLatlng = new NaviLatLng(Double.parseDouble(list_zhong.get(i).getPoi_wei()), Double.parseDouble(list_zhong.get(i).getPoi_jing())); zhongList.add(zhongLatlng); } int strategyFlag = 0; try { strategyFlag = aMapNavi.strategyConvert(ProfileManager.getInstance().getDbyd(getApplicationContext()), ProfileManager.getInstance().getBzgs(getApplicationContext()), ProfileManager.getInstance().getBmsf(getApplicationContext()), ProfileManager.getInstance().getGsyx(getApplicationContext()), true); } catch (Exception e) { e.printStackTrace(); } if (strategyFlag >= 0) { aMapNavi.calculateDriveRoute(startList, endList, zhongList, strategyFlag); } rl_infowindow.setVisibility(View.GONE); } else { Toast.makeText(getApplicationContext(), "您已经选择了三个途经点", Toast.LENGTH_SHORT).show(); } } else { for (Zhan zhan : list_zhong) { if (zhan_id.equals(zhan.getZhan_id())) { list_zhong.remove(zhan); break; } } if (list_zhong.size() > 0) { canRoute = true; canSave = true; } else { canRoute = false; canSave = false; } Log.e("list_zhong==!++", list_zhong.size() + ""); rela_paopao.setVisibility(View.GONE); amap.clear(); endLatlng = new NaviLatLng(Double.parseDouble(end_wei), Double.parseDouble(end_jing)); startLatlng = new NaviLatLng(Double.parseDouble(start_wei), Double.parseDouble(start_jing)); endList.clear(); startList.clear(); zhongList.clear(); startList.add(startLatlng); endList.add(endLatlng); for (int i = 0; i < list_zhong.size(); i++) { zhongLatlng = new NaviLatLng(Double.parseDouble(list_zhong.get(i).getPoi_wei()), Double.parseDouble(list_zhong.get(i).getPoi_jing())); zhongList.add(zhongLatlng); } int strategyFlag = 0; try { strategyFlag = aMapNavi.strategyConvert(ProfileManager.getInstance().getDbyd(getApplicationContext()), ProfileManager.getInstance().getBzgs(getApplicationContext()), ProfileManager.getInstance().getBmsf(getApplicationContext()), ProfileManager.getInstance().getGsyx(getApplicationContext()), true); } catch (Exception e) { e.printStackTrace(); } if (strategyFlag >= 0) { aMapNavi.calculateDriveRoute(startList, endList, zhongList, strategyFlag); } dialog.show(); } } }); LinearLayout mInfoWindow = infoWindow.findViewById(R.id.evsdk_rl_infowindow); mInfoWindow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { MainApplication.details_flag = "2"; Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class); intent.putExtra("zhan_id", zhan_id); startActivity(intent); } }); } private void getZhanInfo(final String zhan_id, final zhan_list markerInfo, final Marker marker, final View infoWindow) { String url = MainApplication.url + "/zhannew/basic/web/index.php/zhanlist/getzhan?zhan_id=" + zhan_id; OkHttpUtils.get() .url(url) .build() .execute(new StringCallback() { @Override public void onError(Call call, Exception e) { } @Override public void onResponse(String response) { LogUtils.e(response); String info = JsonUtils.getKeyResult(response, "info"); ZhanData zhanInfo = JsonUtils.parseToObjectBean(info, ZhanData.class); showInfoWindowData(zhan_id, infoWindow, zhanInfo, marker); } }); } @Override public void onMapClick(LatLng latLng) { LogUtils.e("onMapClick"); if (null != currentMarker && currentMarker.isInfoWindowShown() && canRefreshMarker == true) { currentMarker.hideInfoWindow(); resetPreviousMarker(currentMarker); } } private void getCommentNum(final String zhan_id) { String url = MainApplication.url + "/zhannew/basic/web/index.php/tpappcomments/getcont?zhanid=" + zhan_id; OkHttpUtils.get() .url(url) .build() .execute(new StringCallback() { @Override public void onError(Call call, Exception e) { } @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); String comment_num = jsonObject.getString("rtnMsg"); tv_num.setText("(" + comment_num + ")"); } catch (JSONException e) { e.printStackTrace(); } } }); } public static Bitmap getBitmapFromView(View view) { view.destroyDrawingCache(); view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec .makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); view.setDrawingCacheEnabled(true); Bitmap tmp = view.getDrawingCache(); Bitmap bitmap = tmp.copy(Bitmap.Config.ARGB_8888, false); tmp.recycle(); return bitmap; } private Bitmap getMarkerBmpYes(int i) { if (i == 1) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newmarker1); } else if (i == 2) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newbig1); } else if (i == 3) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newmarker2); } else if (i == 4) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newbig2); } else if (i == 5) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newmarker3); } else if (i == 6) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newbig3); } else if (i == 11) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newsmallr1); } else if (i == 12) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newsmallr2); } else if (i == 13) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newsmallr3); } else if (i == 21) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newbigr1); } else if (i == 22) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newbigr2); } else if (i == 23) { mIvMarkerBgYes.setImageResource(R.drawable.icon_newbigr3); } else if (i == 7) { mIvMarkerBgYes.setImageResource(R.drawable.icon_srapp); } else if (i == 8) { mIvMarkerBgYes.setImageResource(R.drawable.icon_brapp); } Bitmap bmp = getBitmapFromView(mMarkerViewYes); return bmp; } private void getGaode(Double jing, Double wei) { double x_pi = 3.14159265358979324 * 3000.0 / 180.0; double gg_lon; double gg_lat; double x = jing - 0.0065, y = wei - 0.006; double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); gg_lon = z * Math.cos(theta); gd_jing = String.valueOf(gg_lon); gg_lat = z * Math.sin(theta); gd_wei = String.valueOf(gg_lat); } private void showSimpleBottomSheetGrid() { final int TAG_SHARE_WECHAT_FRIEND = 0; final int TAG_SHARE_WECHAT_MOMENT = 1; final int TAG_SHARE_QQ = 2; QMUIBottomSheet.BottomGridSheetBuilder builder = new QMUIBottomSheet.BottomGridSheetBuilder(RoutePlanMapActivity.this); QMUIBottomSheet build = builder.addItem(R.drawable.icon_share_wechat, "微信", TAG_SHARE_WECHAT_FRIEND, QMUIBottomSheet.BottomGridSheetBuilder.FIRST_LINE) .addItem(R.drawable.icon_share_wechatquan, "朋友圈", TAG_SHARE_WECHAT_MOMENT, QMUIBottomSheet.BottomGridSheetBuilder.FIRST_LINE) .addItem(R.drawable.icon_share_qq, "QQ", TAG_SHARE_QQ, QMUIBottomSheet.BottomGridSheetBuilder.FIRST_LINE) .setOnSheetItemClickListener(new QMUIBottomSheet.BottomGridSheetBuilder.OnSheetItemClickListener() { @Override public void onClick(QMUIBottomSheet dialog, View itemView) { dialog.dismiss(); int tag = (int) itemView.getTag(); switch (tag) { case TAG_SHARE_WECHAT_FRIEND: share(Wechat.NAME); break; case TAG_SHARE_WECHAT_MOMENT: share(WechatMoments.NAME); break; case TAG_SHARE_QQ: share(QQ.NAME); break; } } }).build(); build.show(); iv_screenShot.setEnabled(true); } private void mapScreenShot() { amap.getMapScreenShot(new AMap.OnMapScreenShotListener() { @Override public void onMapScreenShot(Bitmap bitmap) { tv_zhan_num.setText(zhan_num + ""); iv_screen.setImageBitmap(bitmap); getViewBitmap(ll_share_ui, ll_share_ui.getWidth(), ll_share_ui.getHeight() + 70); if (dialog.isShowing()) { dialog.dismiss(); } showSimpleBottomSheetGrid(); } @Override public void onMapScreenShot(Bitmap bitmap, int status) { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); if (null == bitmap) { return; } try { FileOutputStream fos = new FileOutputStream(PhotoUtils.CACHE_DIR + "/test_" + sdf.format(new Date()) + ".png"); try { fos.flush(); } catch (IOException e) { e.printStackTrace(); } try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } catch (FileNotFoundException e) { e.printStackTrace(); } } }); } private void share(final String name) { MobclickAgent.onEvent(getApplicationContext(), "0311"); Platform.ShareParams paramsToShare = new Platform.ShareParams(); paramsToShare.setText(null); paramsToShare.setTitle(null); paramsToShare.setTitleUrl(null); paramsToShare.setUrl("http://a.app.qq.com/o/simple.jsp?pkgname=com.electric.chargingpile"); paramsToShare.setImagePath(PhotoUtils.CACHE_DIR + File.separator + "d1ev/share.png"); paramsToShare.setShareType(Platform.SHARE_IMAGE); Platform platform = ShareSDK.getPlatform(name); platform.setPlatformActionListener(new PlatformActionListener() { @Override public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) { if (platform.getName().equalsIgnoreCase(QQ.NAME)) { if (MainApplication.isLogin()) { shareStatus = "yes"; sharePlatform = "qq"; getShareIntegral(); } } else { getShareIntegral(); } Toast.makeText(getApplication(), "分享成功", Toast.LENGTH_SHORT).show(); LogUtils.e("分享成功"); } @Override public void onError(Platform platform, int i, Throwable throwable) { LogUtils.e(throwable.getMessage()); } @Override public void onCancel(Platform platform, int i) { } }); platform.share(paramsToShare); } public Bitmap getViewBitmap(View comBitmap, int width, int height) { Bitmap bitmap = null; if (comBitmap != null) { comBitmap.clearFocus(); comBitmap.setPressed(false); boolean willNotCache = comBitmap.willNotCacheDrawing(); comBitmap.setWillNotCacheDrawing(false); // Reset the drawing cache background color to fully transparent // for the duration of this operation int color = comBitmap.getDrawingCacheBackgroundColor(); comBitmap.setDrawingCacheBackgroundColor(0); float alpha = comBitmap.getAlpha(); comBitmap.setAlpha(1.0f); if (color != 0) { comBitmap.destroyDrawingCache(); } int widthSpec = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY); int heightSpec = View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY); comBitmap.measure(widthSpec, heightSpec); comBitmap.layout(0, 0, width, height); comBitmap.buildDrawingCache(); Bitmap cacheBitmap = comBitmap.getDrawingCache(); if (cacheBitmap == null) { Log.e("view.ProcessImageToBlur", "failed getViewBitmap(" + comBitmap + ")", new RuntimeException()); return null; } bitmap = Bitmap.createBitmap(cacheBitmap); // Restore the view comBitmap.setAlpha(alpha); comBitmap.destroyDrawingCache(); comBitmap.setWillNotCacheDrawing(willNotCache); comBitmap.setDrawingCacheBackgroundColor(color); } saveBitmap(imageZoom(bitmap)); return bitmap; } private static String getPath(String path) { File f = new File(path); if (!f.exists()) { f.mkdirs(); } return f.getAbsolutePath(); } private Bitmap imageZoom(Bitmap bm) { // 图片允许最大空间 单位:KB double maxSize = 200.00; // 将bitmap放至数组中,意在bitmap的大小(与实际读取的原文件要大) ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.JPEG, 100, baos); byte[] b = baos.toByteArray(); // 将字节换成KB double mid = b.length / 1024; // 判断bitmap占用空间是否大于允许最大空间 如果大于则压缩 小于则不压缩 if (mid > maxSize) { // 获取bitmap大小 是允许最大大小的多少倍 double i = mid / maxSize; // 开始压缩 此处用到平方根 将宽带和高度压缩掉对应的平方根倍 // (1.保持刻度和高度和原bitmap比率一致,压缩后也达到了最大大小占用空间的大小) bm = zoomImage(bm, bm.getWidth() / Math.sqrt(i), bm.getHeight() / Math.sqrt(i)); } return bm; } public Bitmap zoomImage(Bitmap bgimage, double newWidth, double newHeight) { // 获取这个图片的宽和高 float width = bgimage.getWidth(); float height = bgimage.getHeight(); // 创建操作图片用的matrix对象 Matrix matrix = new Matrix(); // 计算宽高缩放率 float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; // 缩放图片动作 matrix.postScale(scaleWidth, scaleHeight); Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, (int) width, (int) height, matrix, true); return bitmap; } private Bitmap addBitmap(Bitmap first, Bitmap second, Bitmap thrid) { int width = Math.max(first.getWidth(), second.getWidth()); int height = first.getHeight() + second.getHeight() + thrid.getHeight(); Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(result); canvas.drawBitmap(first, 0, 0, null); canvas.drawBitmap(second, 0, first.getHeight(), null); canvas.drawBitmap(thrid, 0, first.getHeight() + second.getHeight(), null); return result; } public void saveBitmap(Bitmap mBitmap) { LogUtils.e(mBitmap.getByteCount()); String dir_path = PhotoUtils.CACHE_DIR+ "d1ev/"; File directory = new File(dir_path); File f = new File(directory, "share.png"); try { if (!directory.exists()) { directory.mkdir();//没有目录先创建目录 } f.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block } FileOutputStream fOut = null; try { fOut = new FileOutputStream(f); } catch (Exception e) { e.printStackTrace(); } mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); try { fOut.flush(); } catch (IOException e) { e.printStackTrace(); } try { fOut.close(); } catch (IOException e) { e.printStackTrace(); } ContentResolver contentResolver = MainApplication.context.getContentResolver(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { Uri insert = contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new ContentValues()); try { OutputStream outputStream = contentResolver.openOutputStream(insert); if (outputStream!=null){ mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); } } catch (FileNotFoundException e) { e.printStackTrace(); } }else{ MediaStore.Images.Media.insertImage(contentResolver, mBitmap, "", ""); Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri uri = PhotoUtils.parseUri(new File(dir_path)); intent.setData(uri); getApplicationContext().sendBroadcast(intent); } } public void zoomToSpan(List<Zhan> list) { if (list != null && list.size() > 0) { if (amap == null) return; } } private LatLngBounds getLatLngBounds(List<Zhan> list) { LatLngBounds.Builder b = LatLngBounds.builder(); for (int i = 0; i < list.size(); i++) { b.include(new LatLng(Double.parseDouble(list.get(i).getPoi_wei()), Double.parseDouble(list.get(i).getPoi_jing()))); } return b.build(); } public void getAddress(final LatLonPoint latLonPoint) { RegeocodeQuery query = new RegeocodeQuery(latLonPoint, 200, GeocodeSearch.AMAP);// 第一个参数表示一个Latlng,第二参数表示范围多少米,第三个参数表示是火系坐标系还是GPS原生坐标系 geocoderSearch.getFromLocationAsyn(query);// 设置同步逆地理编码请求 } @Override public void onRegeocodeSearched(RegeocodeResult result, int i) { if (i == 1000) { if (result != null && result.getRegeocodeAddress() != null && result.getRegeocodeAddress().getFormatAddress() != null) { pl = result.getRegeocodeAddress().getPois(); if (tag.equals("start")) { tv_start.setText(pl.get(0).getTitle()); save_start_name = pl.get(0).getTitle(); } else if (tag.equals("end")) { tv_end.setText(pl.get(0).getTitle()); save_end_name = pl.get(0).getTitle(); } } } } @Override public void onGeocodeSearched(GeocodeResult geocodeResult, int i) { } private void getShareIntegral() { String url = MainApplication.url + "/zhannew/basic/web/index.php/member/insert-task?userid=" + MainApplication.userId; OkHttpUtils.get().url(url).build().execute(new StringCallback() { @Override public void onError(Call call, Exception e) { e.printStackTrace(); } @Override public void onResponse(String response) { LogUtils.e(response); String rtnCode = JsonUtils.getKeyResult(response, "rtnCode"); if ("01".equals(rtnCode)) { String plusScore = JsonUtils.getKeyResult(response, "plusScore"); if (!plusScore.equals("")) { if (sharePlatform.equals("qq")) { sharePoint = plusScore; } else { tv_point.setText(plusScore); rl_point.setVisibility(View.VISIBLE); rl_point.startAnimation(animation); new Handler().postDelayed(new Runnable() { public void run() { rl_point.setVisibility(View.GONE); } }, 1500); } } } else { } } }); } private void getRouteGuide() { String url = MainApplication.url + "/zhannew/basic/web/index.php/member/route-guide?userid=" + MainApplication.userId; OkHttpUtils.get().url(url).build().execute(new StringCallback() { @Override public void onError(Call call, Exception e) { } @Override public void onResponse(String response) { } }); } private void saveRoute(String json) { String url = MainApplication.url + "/zhannew/basic/web/index.php/question/create-guide?phone=" + MainApplication.userPhone + "&password=" + URLEncoder.encode(MainApplication.userPassword) + "&json_log=" + json + "&sign=" + MainMapActivity.getMD5(json) + "&id=" + save_id; OkHttpUtils.get().url(url).build().connTimeOut(5000).readTimeOut(5000).execute(new StringCallback() { @Override public void onError(Call call, Exception e) { } @Override public void onResponse(String response) { Log.e(TAG, "onResponse: " + response); String rtnCode = JsonUtils.getKeyResult(response, "rtnCode"); if ("01".equals(rtnCode)) { save_id = JsonUtils.getKeyResult(response, "rtnMsg"); ToastUtil.showToast(getApplicationContext(), "保存成功", Toast.LENGTH_SHORT); } else { ToastUtil.showToast(getApplicationContext(), "保存失败", Toast.LENGTH_SHORT); } } }); } public void screenChanged() { MobclickAgent.onEvent(getApplicationContext(), "0310"); list_zhan.clear(); zhanDataList.clear(); routeOne.clear(); routeTwo.clear(); routeThree.clear(); zhan_num = 0; if (null != routeIds) { select = routeNum; amap.clear(); for (int i = 0; i < routeIds.length; i++) { AMapNaviPath path = (aMapNavi.getNaviPaths()).get(routeIds[i]); //你可以通过这个AMapNaviPath生成一个RouteOverLay用于加在地图上 routeOverLay = new RouteOverLay(amap, path, this); routeOverLay.setStartPointBitmap(drawableToBitamp(getResources().getDrawable(R.drawable.icon_newstarr))); routeOverLay.setEndPointBitmap(drawableToBitamp(getResources().getDrawable(R.drawable.icon_newstopr))); routeOverLay.setWayPointBitmap(drawableToBitamp(getResources().getDrawable(R.drawable.icon_zhanwei))); //routeOverLay.setTrafficLightsVisible(false); routeOverLay.addToMap(); routeOverlays.put(routeIds[i], routeOverLay); } if (!calculateSuccess) { Toast.makeText(this, "请先算路", Toast.LENGTH_SHORT).show(); return; } if (routeIndex >= routeIds.length) routeIndex = 0; //突出选择的那条路 for (RouteOverLay routeOverLay : routeOverlays.values()) { routeOverLay.setTransparency(0.3f); } routeOverlays.get(routeIds[routeNum - 1]).setTransparency(0.8f); //必须告诉AMapNavi 你最后选择的哪条路 aMapNavi.selectRouteId(routeIds[routeNum - 1]); final List<NaviLatLng> nlll = (aMapNavi.getNaviPaths()).get(routeIds[routeNum - 1]).getCoordList(); routeIndex++; chooseRouteSuccess = true; dialog.show(); new Handler().postDelayed(new Runnable() { @Override public void run() { getZhanPoint(nlll); } }, 500); } } @Override public View getInfoWindow(Marker marker) { LogUtils.e(marker.getTitle()); Bundle bundle = (Bundle) marker.getObject(); final zhan_list markerInfo = (zhan_list) bundle.getSerializable("info"); View infoWindow = getLayoutInflater().inflate(R.layout.evsdk_layout_infowindow, null); getZhanInfo(String.valueOf(markerInfo.getId()), markerInfo, marker, infoWindow); try { Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } return infoWindow; } @Override public View getInfoContents(Marker marker) { return null; } @Override public void onPointerCaptureChanged(boolean hasCapture) { } } Karina Brobst - Gogs: Go Git Service
Karina Brobst online-crypto-casino0530