socket.getInputStream())); String msg = br.readLine(); if (null != msg) { Log.d("msg=====update", msg); String maxid = JsonUtils.getKeyResult(msg, "maxid"); Log.e(TAG, "run: max_id=" + maxid); if (null != maxid && Integer.parseInt(maxid) > Integer.parseInt(MainApplication.logid)) { MainApplication.logid = maxid; ProfileManager.getInstance().setLogid(getApplicationContext(), maxid); String data = JsonUtils.getKeyResult(msg, "data"); Log.e("updateZhanData===data", data); Gson g = new Gson(); if (null != data) { Log.e(TAG, "run: 有更新"); String add = JsonUtils.getKeyResult(data, "add"); if (null != add) { if (!add.equals("")) { List<DataRefresh> list_add = g.fromJson(add, new TypeToken<List<DataRefresh>>() { }.getType()); Log.e("list_add===", list_add.size() + ""); addData(list_add); } else { // Log.e("updateZhanData===", "add_null"); } } String up = JsonUtils.getKeyResult(data, "up"); // Log.e("updateZhanData===up", up); if (null != up) { List<DataRefresh> list_up = g.fromJson(up, new TypeToken<List<DataRefresh>>() { }.getType()); Log.e("list_up===", list_up.size() + ""); upData(list_up); } else { // Log.e("updateZhanData===", "up_null"); } String del = JsonUtils.getKeyResult(data, "del"); if (del != null) { List<DataRefresh> list_del = g.fromJson(del, new TypeToken<List<DataRefresh>>() { }.getType()); Log.e("list_del===", list_del.size() + ""); if (null != del || list_del.size() > 0) { delData(list_del); } else { // Log.e("updateZhanData===", "del_null"); } } } else { // Log.e("updateZhanData===", "data == null"); } } else { // Log.e(TAG, "run: 没有更新"); } } } catch (Exception e) { e.printStackTrace(); } } }).start(); } private void eteLocation(final String params) { new Thread(new Runnable() { @Override public void run() { try { // 创建Socket // socket = new Socket("192.168.1.110",54321); // if (mapView.getMap().getMapStatus().zoom < 9.5f) { // socket.close(); // stringTid.clear(); // } else { String host = ""; if (MainApplication.url.contains("cdz.evcharge.cc")) { host = "cdz.evcharge.cc"; } else { host = "59.110.68.162"; } socket = new Socket(host, 9503); // IP:10.14.114.127,端口54321 // 向服务器发送消息 PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); out.println(params); // out.println("{\"fun\":\"getcity\"}"); // 接收来自服务器的消息 BufferedReader br = new BufferedReader(new InputStreamReader( socket.getInputStream())); String msg = br.readLine(); // Log.d("dddddmsg===", msg); if (msg != null) { Message mes = new Message(); mes.obj = msg; mes.what = 5; hand.sendMessage(mes); } // if (msg != null) { // // mTextView.setText(msg); // } else { // // mTextView.setText("数据错误!"); // } // System.err.println("msg:"+msg); // String t1 = String.valueOf(new Date().getTime()/1000); // System.err.println(t1); // 关闭流 out.close(); br.close(); // 关闭Socket socket.close(); } } catch (Exception e) { e.printStackTrace(); } } }).start(); } public void ete1(final String params) { new Thread(new Runnable() { @Override public void run() { try { // 创建Socket // socket = new Socket("192.168.1.110",54321); // if (mapView.getMap().getMapStatus().zoom < 9.5f) { // socket.close(); // stringTid.clear(); // } else { String host = ""; if (MainApplication.url.contains("cdz.evcharge.cc")) { host = "cdz.evcharge.cc"; } else { host = "59.110.68.162"; } socket = new Socket(host, 9503); // IP:10.14.114.127,端口54321 socket.setReceiveBufferSize(99999); // 接收缓冲大小 socket.setSendBufferSize(99999); // 向服务器发送消息 PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); out.println(params); // out.println("{\"fun\":\"getcity\"}"); // 接收来自服务器的消息 BufferedReader br = new BufferedReader(new InputStreamReader( socket.getInputStream())); String msg = br.readLine(); // Log.d("dddddmsg", msg); if (msg != null) { Message mes = new Message(); mes.obj = msg; mes.what = 3; hand.sendMessage(mes); } out.close(); br.close(); // 关闭Socket socket.close(); } } catch (Exception e) { } } }).start(); } public void ete2(final String params) { new Thread(new Runnable() { @Override public void run() { try { String host = ""; if (MainApplication.url.contains("cdz.evcharge.cc")) { host = "cdz.evcharge.cc"; } else { host = "59.110.68.162"; } socket = new Socket(host, 9503); // 向服务器发送消息 PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); out.println(params); // out.println("{\"fun\":\"getcity\"}"); // 接收来自服务器的消息 BufferedReader br = new BufferedReader(new InputStreamReader( socket.getInputStream())); // Message message = handle.obtainMessage(); // message.obj = line; // message.arg1 = 1; // handle.sendMessage(message); String msg = br.readLine(); if (msg != null) { Message mes = new Message(); mes.obj = msg; mes.what = 2; hand.sendMessage(mes); } } catch (Exception e) { e.printStackTrace(); } } }).start(); } private void getCommentNum(final String zhan_id) { new Thread(new Runnable() { @Override public void run() { Request request = new Request.Builder().url(MainApplication.url + "/zhannew/basic/web/index.php/tpappcomments/getcont?zhanid=" + zhan_id).build(); Response response = null; try { response = OkHttpUtil.execute(request); if (response.code() == 200) { String json = ""; try { json = response.body().string(); Message msg = new Message(); msg.obj = json; msg.what = 1; hand.sendMessage(msg); } catch (Exception e) { e.printStackTrace(); Message msg = new Message(); msg.what = 2; hand.sendMessage(msg); } } } catch (Exception e) { e.printStackTrace(); Message msg = new Message(); msg.what = 2; hand.sendMessage(msg); } } }).start(); } public static String getMD5(String content) { try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(content.getBytes()); return getHashString(digest); } catch (Exception e) { e.printStackTrace(); } return null; } private static String getHashString(MessageDigest digest) { StringBuilder builder = new StringBuilder(); for (byte b : digest.digest()) { builder.append(Integer.toHexString((b >> 4) & 0xf)); builder.append(Integer.toHexString(b & 0xf)); } return builder.toString().toLowerCase(); } private Bitmap getMarkerBmpYes(int i) { if (i == 1) { mIvMarkerBgYes.setImageResource(R.drawable.icon_sgreen); } else if (i == 2) { mIvMarkerBgYes.setImageResource(R.drawable.icon_bgreen); } else if (i == 3) { mIvMarkerBgYes.setImageResource(R.drawable.icon_sorange); } else if (i == 4) { mIvMarkerBgYes.setImageResource(R.drawable.icon_borange); } else if (i == 5) { mIvMarkerBgYes.setImageResource(R.drawable.icon_sgift); } else if (i == 6) { mIvMarkerBgYes.setImageResource(R.drawable.icon_bgift); } else if (i == 7) { mIvMarkerBgYes.setImageResource(R.drawable.icon_sblue); } else if (i == 8) { mIvMarkerBgYes.setImageResource(R.drawable.icon_bblue); } Bitmap bmp = getBitmapFromView(mMarkerViewYes); return bmp; } private Bitmap getMarkerBmp(int num) { mIvMarkerBg.setImageResource(R.drawable.icon_konglog1105); if (num > 10) { mTvMarkerViewNum.setText(Integer.toString(num)); } else { mTvMarkerViewNum.setText(Integer.toString(num)); } Bitmap bmp = getBitmapFromView(mMarkerView); return bmp; } private Bitmap getMarkerApps(int num) { mIvMarkerAppS.setImageResource(R.drawable.icon_sapp); if (num > 10) { mTvMarkerViewNumAppS.setText(Integer.toString(num)); } else { mTvMarkerViewNumAppS.setText(Integer.toString(num)); } Bitmap bmp = getBitmapFromView(mMarkerViewAppS); return bmp; } private Bitmap getMarkerAppb(int num) { mIvMarkerAppB.setImageResource(R.drawable.icon_bapp); if (num > 10) { mTvMarkerViewNumAppB.setText(Integer.toString(num)); } else { mTvMarkerViewNumAppB.setText(Integer.toString(num)); } Bitmap bmp = getBitmapFromView(mMarkerViewAppB); return bmp; } private Bitmap getMarkerBmp1(int num) { mIvMarkerBg1.setImageResource(R.drawable.icon_konglogb); if (num > 10) { mTvMarkerViewNum1.setText(Integer.toString(num)); } else { mTvMarkerViewNum1.setText(Integer.toString(num)); } Bitmap bmp = getBitmapFromView(mMarkerView1); return bmp; } private Bitmap getMarkerBmpCity(String num) { String no = num; mIvMarkerBgcity.setImageResource(R.drawable.icon_cityno); mTvMarkerViewNumcity.setText(no); Bitmap bmp = getBitmapFromView(mMarkerViewcity); return bmp; } 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; } @Override public void onClick(View v) { SharedPreferencesUtil sharedPreferencesUtil = new SharedPreferencesUtil(getApplication()); switch (v.getId()) { case R.id.iv_tuijian: if (hasLocationPermission()) { if (center == null) { Toast.makeText(getApplication(), "没有定位到您的当前位置,请稍后重试", Toast.LENGTH_SHORT).show(); return; } MobclickAgent.onEvent(getApplicationContext(), "0111"); Intent i = new Intent(getApplicationContext(), RecommendZhanActivity.class); i.putExtra("center_jing", String.valueOf(center.longitude)); i.putExtra("center_wei", String.valueOf(center.latitude)); startActivity(i); MobclickAgent.onEvent(context, "0068"); } else { requestLocationPermission(); } break; case R.id.iv_clear_address: tv_search.setText("请输入地址/关键字"); iv_clear_address.setVisibility(View.INVISIBLE); ProfileManager.getInstance().setSearchAddress(this, ""); MainApplication.search_jing = 0.0; MainApplication.search_wei = 0.0; ete("{\"fun\":\"timer\"}"); if (search_marker != null) { search_marker.remove(); } break; case R.id.iv_example: MobclickAgent.onEvent(getApplicationContext(), "0114"); Intent intent_example = new Intent(getApplicationContext(), ExampleActivity.class); intent_example.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent_example); overridePendingTransition(0, 0); break; case R.id.iv_bg_example: break; case R.id.tv_sortDistance: MobclickAgent.onEvent(getApplicationContext(), "0057"); sortTye = 1; tv_sortDistance.setTextColor(getResources().getColor(R.color.lvse)); tv_sortDistance.setBackgroundResource(R.drawable.bg_lv); tv_sortStarLevel.setTextColor(getResources().getColor(R.color.ui_62)); tv_sortStarLevel.setBackgroundColor(getResources().getColor(R.color.white)); tv_sortFreeTime.setTextColor(getResources().getColor(R.color.ui_62)); tv_sortFreeTime.setBackgroundColor(getResources().getColor(R.color.white)); if (list1.size() > 0) { list.clear(); list.addAll(list1); adapter.notifyDataSetChanged(); } else { list.clear(); list = Util.getSortList(listt); adapter.notifyDataSetChanged(); } break; case R.id.tv_sortStarLevel: MobclickAgent.onEvent(getApplicationContext(), "0058"); sortTye = 2; tv_sortDistance.setTextColor(getResources().getColor(R.color.ui_62)); tv_sortDistance.setBackgroundColor(getResources().getColor(R.color.white)); tv_sortStarLevel.setTextColor(getResources().getColor(R.color.lvse)); tv_sortStarLevel.setBackgroundResource(R.drawable.bg_lv); tv_sortFreeTime.setTextColor(getResources().getColor(R.color.ui_62)); tv_sortFreeTime.setBackgroundColor(getResources().getColor(R.color.white)); if (list2.size() > 0) { list.clear(); list.addAll(list2); adapter.notifyDataSetChanged(); } else { list.clear(); list = Util.getSortPFList(listt); adapter.notifyDataSetChanged(); } break; case R.id.tv_sortFreeTime: MobclickAgent.onEvent(getApplicationContext(), "0059"); sortTye = 3; tv_sortDistance.setTextColor(getResources().getColor(R.color.ui_62)); tv_sortDistance.setBackgroundColor(getResources().getColor(R.color.white)); tv_sortStarLevel.setTextColor(getResources().getColor(R.color.ui_62)); tv_sortStarLevel.setBackgroundColor(getResources().getColor(R.color.white)); tv_sortFreeTime.setTextColor(getResources().getColor(R.color.lvse)); tv_sortFreeTime.setBackgroundResource(R.drawable.bg_lv); if (list3.size() > 0) { list.clear(); list.addAll(list3); adapter.notifyDataSetChanged(); } else { list.clear(); list = Util.getSortFTList(listt); adapter.notifyDataSetChanged(); } break; case R.id.iv_route: if (hasLocationPermission()) { startActivity(new Intent(getApplication(), RoutePlanShowAddressActivity.class)); MobclickAgent.onEvent(getApplicationContext(), "0112"); } else { requestLocationPermission(); } break; case R.id.second_hand_car: Intent adfloatIntent = new Intent(this, MyWebViewActivity.class); adfloatIntent.putExtra("url", adfloatUrl); startActivity(adfloatIntent); break; case R.id.iv_roadCondition: MobclickAgent.onEvent(getApplicationContext(), "0113"); if (ProfileManager.getInstance().getRoadCondition(getApplicationContext()) == false) { iv_roadCondition.setImageResource(R.drawable.icon_youlukuang_main); ProfileManager.getInstance().setRoadCondition(this, true); aMap.setTrafficEnabled(true); ToastUtil.showToast(this, "实时路况已打开", Toast.LENGTH_SHORT); MobclickAgent.onEvent(getApplicationContext(), "0066"); } else { iv_roadCondition.setImageResource(R.drawable.icon_wulukuang_main); ProfileManager.getInstance().setRoadCondition(this, false); aMap.setTrafficEnabled(false); ToastUtil.showToast(this, "实时路况已关闭", Toast.LENGTH_SHORT); MobclickAgent.onEvent(getApplicationContext(), "0067"); } break; case R.id.zoomin: aMap.moveCamera(CameraUpdateFactory.zoomIn()); controlZoomShow(); break; case R.id.zoomout: aMap.moveCamera(CameraUpdateFactory.zoomOut()); controlZoomShow(); break; //地图&列表切换按钮 case R.id.iv_list: if (!hasLocationPermission()) { requestLocationPermission(); return; } sharedPreferencesUtil.putBoolean("cdz_recommend_more_detail", true); String jing, wei; if (MainApplication.search_jing != 0.0 && MainApplication.search_wei != 0.0) { Log.e(TAG, "onClick: 有搜索"); jing = String.valueOf(MainApplication.search_jing); wei = String.valueOf(MainApplication.search_wei); } else { Log.e(TAG, "onClick: 当前位置"); if (null == center) { ToastUtil.showToast(getApplicationContext(), "请确认当前定位是否可用", Toast.LENGTH_SHORT); break; } else { jing = String.valueOf(center.longitude); wei = String.valueOf(center.latitude); } } if (null != jing && null != wei) { MobclickAgent.onEvent(getApplicationContext(), "1135"); Intent intent = new Intent(getApplicationContext(), RecommendChargingStationActivity.class); intent.putExtra("center_jing", jing); intent.putExtra("center_wei", wei); startActivity(intent); } break; //定位刷新按钮 case R.id.iv_point_again: if (!isFirstLoc) { isFirstLoc = true; mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy); aMap.moveCamera(CameraUpdateFactory.zoomTo(14)); mlocationClient.startLocation(); } if (!hasLocationPermission()) { requestLocationPermission(); } windowLayout.setVisibility(View.GONE); rl_control.setVisibility(View.VISIBLE); ll_open.setVisibility(View.GONE); break; //条件筛选按钮 case R.id.tv_person: windowLayout.setVisibility(View.GONE); rl_control.setVisibility(View.VISIBLE); if (nMarker != null) { nMarker.hideInfoWindow(); MarkerOptions markerOptionss = new MarkerOptions(); if (current_chargePoint.getOwn_pay().equals("1")) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker1)); } else { if (current_chargePoint.getSuit_car().equals("特斯拉")) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker3)); } else { if (WelcomeActivity.canCost.contains(current_chargePoint.getSupplier())) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker2)); } else { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker3)); } } } } Intent intent = new Intent(getApplication(), NewScreenActivity.class); startActivity(intent); MobclickAgent.onEvent(getApplicationContext(), "0110"); break; case R.id.tv_shaixuan: isListShow = true; windowLayout.setVisibility(View.GONE); if (null != current_chargePoint) { resetMarker(); } MobclickAgent.onEvent(getApplicationContext(), "0110"); Intent intentt = new Intent(getApplication(), NewScreenActivity.class); startActivity(intentt); break; case R.id.tv_switch_city: startNewSelectCityActivity(); break; case R.id.tab_screening: if (socket != null) { try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } if (!MainApplication.isLogin()) { startActivity(new Intent(getApplication(), LoginActivity.class)); } else { requestCameraPermission(); } break; //发现界面tab case R.id.ll_tab_find: if (socket != null) { try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } Intent intent1 = new Intent(getApplication(), FindActivity.class); intent1.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent1); overridePendingTransition(0, 0); if (count == 1) { MobclickAgent.onEvent(getApplicationContext(), "0105"); count = 2; } break; case R.id.tab_qa: if (socket != null) { try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } Intent i = new Intent(getApplication(), ChatActivity.class);//聊聊页面 i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(i); overridePendingTransition(0, 0); if (count == 1) { MobclickAgent.onEvent(getApplicationContext(), "0999"); count = 2; } break; //用户中心tab case R.id.tab_me: if (socket != null) { try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } Intent intent2 = new Intent(getApplication(), UserCenterActivity.class); intent2.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent2); if (sav.getVisibility() == View.VISIBLE) { sav.setVisibility(View.GONE); } overridePendingTransition(0, 0); if (count == 1) { MobclickAgent.onEvent(getApplicationContext(), "0106"); count = 2; } break; case R.id.iv_clear: rl_ad.setVisibility(View.GONE); break; case R.id.rl_search: if (isListShow == false) { windowLayout.setVisibility(View.GONE); rl_control.setVisibility(View.VISIBLE); } if (null != current_chargePoint) { resetMarker(); } MobclickAgent.onEvent(getApplicationContext(), "0108"); startActivityForResult(new Intent(getApplication(), SearchActivity.class), SEARCH_CODE); if (ll_tuijian.getVisibility() == View.VISIBLE) { ll_tuijian.setVisibility(View.GONE); rl_tuijian_tip.setVisibility(View.VISIBLE); ll_top_right.setVisibility(View.VISIBLE); ll_map_control.setVisibility(View.VISIBLE); } break; default: break; } } private void startNewSelectCityActivity() { if (isListShow == false) { windowLayout.setVisibility(View.GONE); rl_control.setVisibility(View.VISIBLE); } if (null != current_chargePoint) { resetMarker(); } MobclickAgent.onEvent(getApplicationContext(), "0107"); startActivity(new Intent(getApplicationContext(), NewSelectCityActivity.class)); if (ll_tuijian.getVisibility() == View.VISIBLE) { ll_tuijian.setVisibility(View.GONE); rl_tuijian_tip.setVisibility(View.VISIBLE); ll_top_right.setVisibility(View.VISIBLE); ll_map_control.setVisibility(View.VISIBLE); } } public void showMap() { if (MainApplication.isMap) { if (list.size() == 0) { ete("{\"fun\":\"timer\"}"); } MainApplication.isMap = false; //显示列表站点 lvZhan.setVisibility(View.VISIBLE); isListShow = true; if (list.size() > 0) { rl_mapList.setVisibility(View.VISIBLE); tv_tishi.setVisibility(View.GONE); } else if (list.size() == 0) { rl_mapList.setVisibility(View.VISIBLE); tv_tishi.setVisibility(View.VISIBLE); } iv_sceen.setVisibility(View.GONE); iv_example.setVisibility(View.GONE); if (windowLayout.getVisibility() == View.VISIBLE) { paoShow = true; windowLayout.setVisibility(View.GONE); } else { rl_control.setVisibility(View.GONE); } iv_roadCondition.setVisibility(View.GONE); MobclickAgent.onEvent(getApplicationContext(), "0063"); } else { //显示地图站点 MainApplication.isMap = true; lvZhan.setVisibility(View.GONE); rl_mapList.setVisibility(View.GONE); tv_tishi.setVisibility(View.GONE); if (paoShow == true && isListShow == false) { windowLayout.setVisibility(View.VISIBLE); rl_control.setVisibility(View.GONE); paoShow = false; } else { rl_control.setVisibility(View.VISIBLE); } isListShow = false; iv_sceen.setVisibility(View.VISIBLE); iv_example.setVisibility(View.VISIBLE); sortTye = 1; tv_sortDistance.setTextColor(getResources().getColor(R.color.lvse)); tv_sortStarLevel.setTextColor(getResources().getColor(R.color.ui_62)); tv_sortFreeTime.setTextColor(getResources().getColor(R.color.ui_62)); tv_sortDistance.setBackgroundResource(R.drawable.bg_lv); tv_sortStarLevel.setBackgroundColor(getResources().getColor(R.color.white)); tv_sortFreeTime.setBackgroundColor(getResources().getColor(R.color.white)); iv_roadCondition.setVisibility(View.VISIBLE); } } private void showUi(boolean status) { if (status == true) { lvZhan.setVisibility(View.GONE); rl_mapList.setVisibility(View.GONE); tv_tishi.setVisibility(View.GONE); rl_control.setVisibility(View.VISIBLE); iv_sceen.setVisibility(View.VISIBLE); sortTye = 1; tv_sortDistance.setTextColor(getResources().getColor(R.color.lvse)); tv_sortStarLevel.setTextColor(getResources().getColor(R.color.ui_62)); tv_sortFreeTime.setTextColor(getResources().getColor(R.color.ui_62)); tv_sortDistance.setBackgroundResource(R.drawable.bg_lv); tv_sortStarLevel.setBackgroundColor(getResources().getColor(R.color.white)); tv_sortFreeTime.setBackgroundColor(getResources().getColor(R.color.white)); iv_roadCondition.setVisibility(View.VISIBLE); iv_example.setVisibility(View.VISIBLE); } else { lvZhan.setVisibility(View.VISIBLE); if (list.size() > 0) { rl_mapList.setVisibility(View.VISIBLE); tv_tishi.setVisibility(View.GONE); } else if (list.size() == 0) { rl_mapList.setVisibility(View.VISIBLE); tv_tishi.setVisibility(View.VISIBLE); } rl_control.setVisibility(View.GONE); iv_sceen.setVisibility(View.GONE); if (windowLayout.getVisibility() == View.VISIBLE) { windowLayout.setVisibility(View.GONE); rl_control.setVisibility(View.VISIBLE); ll_open.setVisibility(View.GONE); } iv_roadCondition.setVisibility(View.GONE); iv_example.setVisibility(View.GONE); } } @Override public void onMapLoaded() { aMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false // 设置定位的类型为定位模式 ,可以由定位、跟随或地图根据面向方向旋转几种 aMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE); aMap.moveCamera(CameraUpdateFactory.zoomTo(14)); } @Override public void onCameraChange(CameraPosition cameraPosition) { } @Override public void onCameraChangeFinish(CameraPosition cameraPosition) { } @Override public void onMapClick(LatLng latLng) { float zoom = aMap.getCameraPosition().zoom; aMap.moveCamera(CameraUpdateFactory.zoomTo(zoom)); Animation animation = AnimationUtils.loadAnimation(this, R.anim.out); animation.setDuration(500); windowLayout.startAnimation(animation); new Handler().postDelayed(new Runnable() { @Override public void run() { windowLayout.setVisibility(View.GONE); } }, 500); SharedPreferencesUtil sharedPreferencesUtil1 = new SharedPreferencesUtil(getApplication()); sharedPreferencesUtil1.setFileName("CurrentMarkerInfo"); sharedPreferencesUtil1.clearData(); rl_control.setVisibility(View.VISIBLE); ll_open.setVisibility(View.GONE); } @Override public void onWeatherLiveSearched(LocalWeatherLiveResult weatherLiveResult, int rCode) { if (rCode == 1000) { if (weatherLiveResult != null & weatherLiveResult.getLiveResult() != null) { LocalWeatherLive weatherlive = weatherLiveResult.getLiveResult(); } else { } } else { ToastUtil.showToast(MainMapActivity.this, rCode + "", Toast.LENGTH_SHORT); } } @Override public void onWeatherForecastSearched(LocalWeatherForecastResult localWeatherForecastResult, int i) { if (i == 1000) { if (localWeatherForecastResult != null & localWeatherForecastResult.getForecastResult() != null) { LocalWeatherForecast weatherlive = localWeatherForecastResult.getForecastResult(); Log.e(TAG, "onWeatherLiveSearched: " + "-------" + weatherlive.getCity() + "-------" + weatherlive.getAdCode() + "-------" + weatherlive.getWeatherForecast() + "-------" + weatherlive.getProvince() + "-------" + weatherlive.getReportTime()); List<LocalDayWeatherForecast> list = weatherlive.getWeatherForecast(); list.get(0).getDate(); for (int a = 0; a < list.size(); a++) { Log.e(TAG, "onWeatherForecastSearched: " + list.get(a).getDate()); Log.e(TAG, "onWeatherForecastSearched: " + list.get(a).getDayTemp()); Log.e(TAG, "onWeatherForecastSearched: " + list.get(a).getDayWeather()); Log.e(TAG, "onWeatherForecastSearched: " + list.get(a).getNightTemp()); Log.e(TAG, "onWeatherForecastSearched: " + list.get(a).getNightWeather()); } } else { } } else { } } @Override public void onPermissionsGranted(int requestCode, List<String> perms) { } @Override public void onPermissionsDenied(int requestCode, List<String> perms) { if (SystemTypeUtil.isEmui()) { return; } if (requestCode == RC_CAMERA_PERM) { new AlertDialogCommon(MainMapActivity.this).builder() .setMsg("扫码充电需要开启位置权限,是否前往开启?") .setPositiveButton("去开启", new View.OnClickListener() { @Override public void onClick(View v) { SystemTypeUtil.goToPermissionManager(MainMapActivity.this); } }).setNegativeButton("取消", new View.OnClickListener() { @Override public void onClick(View v) { } }).show(); } else if (requestCode == RC_Location_PERM) { new AlertDialogCommon(MainMapActivity.this).builder() .setMsg("为了定位您的位置,推荐充电桩,充电桩位置路线导航需要开启位置权限,是否前往开启?") .setPositiveButton("去开启", new View.OnClickListener() { @Override public void onClick(View v) { SystemTypeUtil.goToPermissionManager(MainMapActivity.this); } }).setNegativeButton("取消", new View.OnClickListener() { @Override public void onClick(View v) { } }).show(); } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this); } private boolean hasLocationPermission() { return EasyPermissions.hasPermissions(this, Manifest.permission.ACCESS_FINE_LOCATION ); } @AfterPermissionGranted(RC_Location_FIRST_PERM) public void requestLocationFirstPermission() { if (hasLocationPermission()) { mlocationClient.startLocation(); } } @AfterPermissionGranted(RC_Location_PERM) public void requestLocationPermission() { if (hasLocationPermission()) { mlocationClient.startLocation(); } else { EasyPermissions.requestPermissions( this, "为了定位您的位置,推荐充电桩,充电桩位置路线导航需要开启位置权限,是否前往开启?", RC_Location_PERM, Manifest.permission.ACCESS_FINE_LOCATION); } } private boolean hasCameraPermission() { return EasyPermissions.hasPermissions(this, Manifest.permission.CAMERA); } @AfterPermissionGranted(RC_CAMERA_PERM) public void requestCameraPermission() { if (hasCameraPermission()) { Intent intent = new Intent(getApplicationContext(), com.google.zxing.client.android.CaptureActivity.class); intent.putExtra("url", MainApplication.url); intent.putExtra("user_id", MainApplication.userId); intent.putExtra("user_password", MainApplication.userPassword); intent.putExtra("user_phone", ProfileManager.getInstance().getUsername(getApplicationContext())); intent.putExtra("cha", MainMapActivity.cha); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent); overridePendingTransition(0, 0); if (count == 1) { MobclickAgent.onEvent(getApplicationContext(), "0104"); count = 2; } } else { EasyPermissions.requestPermissions( this, "扫码充电需要开启相机权限,是否前往开启?", RC_CAMERA_PERM, Manifest.permission.CAMERA); } } @Override public boolean onMarkerClick(Marker marker) { return false; } /** * 监听自定义infowindow窗口的infowindow时间回调 * add by hyg * * @param marker * @return */ @Override public View getInfoWindow(Marker marker) { if (infoWindow == null) { infoWindow = getLayoutInflater().inflate(R.layout.custom_info_window, null); } return infoWindow; } @Override public View getInfoContents(Marker marker) { return null; } /** * 自定义infowindow窗口 * 如果想修改自定义Infow中内容,请通过view找到它并修改 */ public void updateInfoWindow(String text) { if (nMarker == null) { return; } if (infoWindow == null) { return; } infoWindow.findViewById(R.id.infoWindowNavigate).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { MobclickAgent.onEvent(getApplicationContext(), "1120"); infoViewNavigate(); } }); TextView distance = infoWindow.findViewById(R.id.distance); distance.setText(text); } /** * 点击自定义气泡,进行导航操作 * add by hyg * * @param marker */ @Override public void onInfoWindowClick(Marker marker) { } public class ZhanAdapter extends BaseAdapter { @Override public int getCount() { if (list.size() > 30) { return 30; } else { return list.size(); } } @Override public Object getItem(int position) { return list.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { convertView = LayoutInflater.from(getApplication()).inflate( R.layout.item_zhandian, null); viewHolder = new ViewHolder(); viewHolder.item_zhan_name = (TextView) convertView.findViewById(R.id.item_zhan_name); viewHolder.item_zhan_go = (TextView) convertView.findViewById(R.id.item_zhan_go); viewHolder.item_zhan_distance = (TextView) convertView.findViewById(R.id.item_zhan_distance); viewHolder.item_zhan_cost = (TextView) convertView.findViewById(R.id.item_zhan_cost); viewHolder.item_fast_num = (TextView) convertView.findViewById(R.id.item_fast_num); viewHolder.item_fastable = (TextView) convertView.findViewById(R.id.item_fastable); viewHolder.item_fastable_num = (TextView) convertView.findViewById(R.id.item_fastable_num); viewHolder.item_slowable = (TextView) convertView.findViewById(R.id.item_slowable); viewHolder.item_slowable_num = (TextView) convertView.findViewById(R.id.item_slowable_num); viewHolder.item_slow_num = (TextView) convertView.findViewById(R.id.item_slow_num); viewHolder.item_grade_pic = (ImageView) convertView.findViewById(R.id.item_grade_pic); viewHolder.item_layout = (LinearLayout) convertView.findViewById(R.id.item_layout); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (list.size() > 0) { viewHolder.item_zhan_name.setText(list.get(position).getZhan_name()); if (list.get(position).getStar_level().equals("") || list.get(position).getStar_level().equals("0")) { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_0xing); } else { String star_level = list.get(position).getStar_level().toString(); double d; d = Double.parseDouble(star_level); String grade = String.format("%.1f", d); if (d > 0 && d < 1) { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_05xing); } else if (d >= 1 && d < 1.5) { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_1xing); } else if (d >= 1.5 && d < 2) { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_15xing); } else if (d >= 2 && d < 2.5) { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_2xing); } else if (d >= 2.5 && d < 3) { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_25xing); } else if (d >= 3 && d < 3.5) { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_3xing); } else if (d >= 3.5 && d < 4) { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_35xing); } else if (d >= 4 && d < 4.5) { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_4xing); } else if (d >= 4.5 && d < 5) { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_45xing); } else { viewHolder.item_grade_pic.setImageResource(R.drawable.icon_5xing); } } if (list.get(position).getOwn_pay().equals("1")) { viewHolder.item_zhan_cost.setText("可使用本APP扫码支付"); } else { if (list.get(position).getCharge_cost_way2().equals("")) { viewHolder.item_zhan_cost.setText("暂无"); } else { if (list.get(position).getCharge_cost_way2().equals("微信支付")) { viewHolder.item_zhan_cost.setText(list.get(position).getCharge_cost_way2()); } else { viewHolder.item_zhan_cost.setText(list.get(position).getCharge_cost_way2() + "支付"); } } } String fast = list.get(position).getFast_num(); String slow = list.get(position).getSlow_num(); String acNum = null, dcNum = null, acableNum = null, dcableNum = null; acNum = list.get(position).getAcNum(); dcNum = list.get(position).getDcNum(); acableNum = list.get(position).getAcableNum(); dcableNum = list.get(position).getDcableNum(); if (null != acableNum && null != acNum && null != dcableNum && null != dcNum && !acableNum.equals("") && !acNum.equals("") && !dcableNum.equals("") && !dcNum.equals("")) { viewHolder.item_fast_num.setText(dcNum); viewHolder.item_fastable_num.setText(dcableNum); viewHolder.item_fastable.setVisibility(View.VISIBLE); viewHolder.item_fastable_num.setVisibility(View.VISIBLE); viewHolder.item_slow_num.setText(acNum); viewHolder.item_slowable_num.setText(acableNum); viewHolder.item_slowable.setVisibility(View.VISIBLE); viewHolder.item_slowable_num.setVisibility(View.VISIBLE); } else { viewHolder.item_fast_num.setText(fast); viewHolder.item_fastable.setVisibility(View.GONE); viewHolder.item_fastable_num.setVisibility(View.GONE); viewHolder.item_slow_num.setText(slow); viewHolder.item_slowable.setVisibility(View.GONE); viewHolder.item_slowable_num.setVisibility(View.GONE); } if ("0m".equals(list.get(position).getDistance())) { viewHolder.item_zhan_distance.setText("未知"); } else { viewHolder.item_zhan_distance.setText(list.get(position).getDistance()); } viewHolder.item_zhan_go.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MobclickAgent.onEvent(getApplicationContext(), "0060"); if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap") && !isAvilible(getApplicationContext(), "com.autonavi.minimap")) { getGaode(Double.parseDouble(list.get(position).getPoi_jing()), Double.parseDouble(list.get(position).getPoi_wei())); Intent intent = new Intent(getApplication(), BasicNaviActivity.class); intent.putExtra("start_jing", center.longitude + ""); intent.putExtra("start_wei", center.latitude + ""); intent.putExtra("stop_jing", gd_jing + ""); intent.putExtra("stop_wei", gd_wei + ""); startActivity(intent); detailsBack = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", list.get(position).getZhan_name()); map.put("CostWay", list.get(position).getCharge_cost_way()); map.put("City", list.get(position).getCity()); MobclickAgent.onEvent(context, "0033", map); map.clear(); } else { if (center != null) { LayoutInflater inflater1 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); popupWindowView = inflater1.inflate(R.layout.item_selectmap, null); popupWindow = new PopupWindow(popupWindowView, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, true); popupWindow.setBackgroundDrawable(new BitmapDrawable()); // 设置PopupWindow的弹出和消失效果 popupWindow.setAnimationStyle(R.style.popupAnimation); LinearLayout ll_tvTwo = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvTwo); if (!isAvilible(getApplicationContext(), "com.autonavi.minimap")) { ll_tvTwo.setVisibility(View.GONE); } LinearLayout ll_tvOne = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvOne); if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap")) { ll_tvOne.setVisibility(View.GONE); } cancleButton = (Button) popupWindowView .findViewById(R.id.cancleButton); cancleButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Toast.makeText(ZhanDetailsNew.this, "NO", Toast.LENGTH_SHORT).show(); popupWindow.dismiss(); } }); tvThree = (TextView) popupWindowView.findViewById(R.id.tvThree); tvThree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getGaode(Double.parseDouble(list.get(position).getPoi_jing()), Double.parseDouble(list.get(position).getPoi_wei())); Intent intent = new Intent(getApplication(), BasicNaviActivity.class); intent.putExtra("start_jing", center.longitude + ""); intent.putExtra("start_wei", center.latitude + ""); intent.putExtra("stop_jing", gd_jing + ""); intent.putExtra("stop_wei", gd_wei + ""); startActivity(intent); detailsBack = true; popupWindow.dismiss(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", list.get(position).getZhan_name()); map.put("CostWay", list.get(position).getCharge_cost_way()); map.put("City", list.get(position).getCity()); MobclickAgent.onEvent(context, "0033", map); map.clear(); } }); tvOne = (TextView) popupWindowView.findViewById(R.id.tvOne); tvOne.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = null; // try { //// intent = Intent.getIntent("intent://map/direction?origin=latlng:"+center.latitude+","+center.longitude+"&destination=latlng:"+ll.latitude+","+ll.longitude+"|name:"+finalMarkerInfo.getZhan_name()+"&mode=driving&region=&src=充电桩#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end"); // } catch (URISyntaxException e) { // e.printStackTrace(); // } double dwei = Double.parseDouble(list.get(position).getPoi_wei()); double djing = Double.parseDouble(list.get(position).getPoi_jing()); getBaidu(center.longitude, center.latitude); try { String s = "intent://map/direction?" + "origin=" + bd_lat + "," + bd_lon + "&" + "destination=" + dwei + "," + djing + "&mode=driving&" + "src=充电桩#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end"; // Log.e("sss", s); intent = Intent.getIntent(s); detailsBack = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", list.get(position).getZhan_name()); map.put("CostWay", list.get(position).getCharge_cost_way()); map.put("City", list.get(position).getCity()); MobclickAgent.onEvent(context, "0031", map); map.clear(); } catch (URISyntaxException e) { e.printStackTrace(); } startActivity(intent); // if (MainFragment.center != null) { // double dwei = Double.parseDouble(zhan.getPoi_wei()); // double djing = Double.parseDouble(zhan.getPoi_jing()); // LatLng ll = new LatLng(dwei, djing); // // startNavi(MainFragment.center, ll); // // } // startNavi(center, ll); popupWindow.dismiss(); } }); tvTwo = (TextView) popupWindowView.findViewById(R.id.tvTwo); tvTwo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { // getBeginGaode(center.longitude, center.latitude); getGaode(Double.parseDouble(list.get(position).getPoi_jing()), Double.parseDouble(list.get(position).getPoi_wei())); Intent intent4 = new Intent("android.intent.action.VIEW", android.net.Uri.parse("androidamap://route?sourceApplication=amap&slat=" + center.latitude + "&slon=" + center.longitude + "&sname=我的位置&dlat=" + gd_wei + "&dlon=" + gd_jing + "&dname=" + list.get(position).getZhan_name() + "&dev=0&m=0&t=2")); intent4.setPackage("com.autonavi.minimap"); startActivity(intent4); detailsBack = true; popupWindow.dismiss(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", list.get(position).getZhan_name()); map.put("CostWay", list.get(position).getCharge_cost_way()); map.put("City", list.get(position).getCity()); MobclickAgent.onEvent(context, "0032", map); map.clear(); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplication(), "请您确认是否安装高德地图APP", Toast.LENGTH_SHORT).show(); } } }); popupWindow.showAtLocation(cancleButton, Gravity.CENTER, 0, 0); // startNavi(center, ll); } else { Toast.makeText(getApplication(), "没有定位到您的当前位置", Toast.LENGTH_SHORT) .show(); } } } }); } return convertView; } class ViewHolder { TextView item_zhan_name, item_zhan_go, item_zhan_distance, item_zhan_cost, item_fast_num, item_fastable, item_fastable_num, item_slowable, item_slowable_num, item_slow_num; ImageView item_grade_pic; LinearLayout item_layout; } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) { // 判断气泡弹窗视图是否已经隐藏 if (windowLayout.getVisibility() == View.VISIBLE) { Animation animation = AnimationUtils.loadAnimation(this, R.anim.out); animation.setDuration(500); windowLayout.startAnimation(animation); new Handler().postDelayed(new Runnable() { @Override public void run() { windowLayout.setVisibility(View.GONE); rl_control.setVisibility(View.VISIBLE); } }, 500); return false; } if ((System.currentTimeMillis() - exitTime) > 2000) { Toast.makeText(getApplicationContext(), "再按一次退出程序", Toast.LENGTH_SHORT).show(); exitTime = System.currentTimeMillis(); } else { // ActivityManagerApplication.destoryActivity("MainMapActivity"); if (MainMapActivity.mainMapActivity != null) { MainMapActivity.mainMapActivity.finish(); } SharedPreferences mySharedPreferences = getSharedPreferences("showdialog", Activity.MODE_PRIVATE); SharedPreferences.Editor editor1 = mySharedPreferences.edit(); editor1.clear(); ProfileManager.getInstance().setSearchAddress(this, ""); ActivityUtils.finishAllActivities(); // finish(); android.os.Process.killProcess(android.os.Process.myPid()); } } return true; // return super.onKeyDown(keyCode, event); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (isListShow == false) { windowLayout.setVisibility(View.GONE); rl_control.setVisibility(View.VISIBLE); } if (requestCode == SEARCH_CODE && resultCode == 101) { double jing = Double.valueOf(data.getStringExtra("jing")); double wei = Double.valueOf(data.getStringExtra("wei")); MainApplication.search_jing = jing; MainApplication.search_wei = wei; final LatLng screenCity = new LatLng(wei, jing); if (aMap == null) { setUpMap(); } Util.setMapCustomStyleFile(aMap, getApplicationContext()); new Handler().postDelayed(new Runnable() { @Override public void run() { aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(screenCity, 14.0f)); } }, 500); if (search_marker != null) { search_marker.remove(); } if (MainApplication.search_jing != 0.0 && MainApplication.search_wei != 0.0) { LatLng latLng = new LatLng(MainApplication.search_wei, MainApplication.search_jing); search_marker = aMap.addMarker(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.icon_search_address)))); search_marker.setPeriod(8); } ete("{\"fun\":\"timer\"}"); } else if (requestCode == SEARCH_CODE && resultCode == 102) { double jing = Double.valueOf(data.getStringExtra("jing")); double wei = Double.valueOf(data.getStringExtra("wei")); final LatLng screenCity = new LatLng(wei, jing); if (aMap == null) { setUpMap(); } Util.setMapCustomStyleFile(aMap, getApplicationContext()); new Handler().postDelayed(new Runnable() { @Override public void run() { aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(screenCity, 14.0f)); } }, 500); } } private void dialogup() { int code = Integer.parseInt(now_versionCode); if (code - getVersionCode(getApplication()) > 0) { new AlertDialogUpdate(MainMapActivity.this).builder() .setTitle("更新提示 " + now_versionName) .setMsg(title.trim()) .setPositiveButton("更新", new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("http://cdz.evcharge.cc/app/app.apk"); intent.setData(content_url); startActivity(intent); } }).setNegativeButton("忽略", new View.OnClickListener() { @Override public void onClick(View v) { } }).show(); } } private void showProgressWindow() { updateDialog = new UpdateDialog(MainMapActivity.this); updateDialog.builder().setMsg("").setCancelable(false).show(); } private void dialogup_other() { int code = Integer.parseInt(now_versionCode); if (code - getVersionCode(getApplication()) > 0) { alterDialog = new AlertDialogUpdate(MainMapActivity.this); alterDialog.builder() .setTitle("更新提示 " + now_versionName) .setMsg(title.trim()) .setPositiveButton("更新", new View.OnClickListener() { @Override public void onClick(View v) { showProgressWindow(); ToastUtil.showToast(getApplicationContext(), "正在下载中", Toast.LENGTH_SHORT); OkHttpUtils.get().url("http://cdz.evcharge.cc/app/app.apk").build() .execute(new FileCallBack(Environment.getExternalStorageDirectory().getAbsolutePath(), "cdz_install") { @Override public void inProgress(final float progress, long total) { NumberFormat numberFormat = NumberFormat.getInstance(); // 设置精确到小数点后2位 numberFormat.setMaximumFractionDigits(2); String format = numberFormat.format(progress * 100); Message message = new Message(); message.what = 0x01; Bundle bundle = new Bundle(); bundle.putString("format", format + "%"); LogUtils.e("当前:" + format); if (!format.contains(".")) { bundle.putString("progress", format + "."); } else { bundle.putString("progress", format); } message.setData(bundle); myHandler.sendMessage(message); } @Override public void onError(Call call, Exception e) { // LogUtils.e(e.getMessage()); } @Override public void onResponse(File response) { String path = getDatabasePath("zhan_list").getPath(); com.blankj.utilcode.util.LogUtils.e(path); AppUtils.cleanAppData(path); Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); Uri uri; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { Uri contentUri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", response); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setDataAndType(contentUri, "application/vnd.android.package-archive"); } else { uri = Uri.fromFile(response); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(uri, "application/vnd.android.package-archive"); } context.startActivity(intent); android.os.Process.killProcess(android.os.Process.myPid()); } }); } }).setNegativeButton("退出", new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences mySharedPreferences = getSharedPreferences("showdialog", Activity.MODE_PRIVATE); SharedPreferences.Editor editor1 = mySharedPreferences.edit(); editor1.clear(); finish(); ProfileManager.getInstance().setSearchAddress(getApplicationContext(), ""); android.os.Process.killProcess(android.os.Process.myPid()); } }).setCancelable(false).show(); } } public static int getVersionCode(Context context)//获取版本号(内部识别号) { try { PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); // Log.e("versionCode", pi.versionCode + ""); return pi.versionCode; } catch (PackageManager.NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); return 0; } } public void getVersion() { try { PackageManager manager = getApplication().getPackageManager(); PackageInfo info = manager.getPackageInfo(getApplication().getPackageName(), 0); app_version = info.versionName; // return this.getString(R.string.version_name) + version; // Log.e("version", app_version); } catch (Exception e) { e.printStackTrace(); // return this.getString(R.string.can_not_find_version_name); } } private void getPingLun() { new Thread(new Runnable() { @Override public void run() { String url = null; try { url = MainApplication.url + "/zhannew/basic/web/index.php/tpmember/commentcount?userid=" + MainApplication.userId; } catch (Exception e) { e.printStackTrace(); } submitPingLun(url); } }).start(); } private void submitPingLun(String sms) { // Log.e("url", sms); Request request = new Request.Builder().url(sms).build(); Response response = null; try { if (request == null) { Message msg = new Message(); msg.what = 5; hand.sendMessage(msg); return; } response = OkHttpUtil.execute(request); if (response.code() == 200) { String json = ""; try { json = response.body().string(); Message msg = new Message(); msg.obj = json; msg.what = 17; hand.sendMessage(msg); // Log.e("url", json); } catch (Exception e) { e.printStackTrace(); Message msg = new Message(); msg.what = 5; hand.sendMessage(msg); } } } catch (Exception e) { e.printStackTrace(); Message msg = new Message(); msg.what = 5; hand.sendMessage(msg); } } //获取系统消息 private void getMessage() { new Thread(new Runnable() { @Override public void run() { long appTime1 = System.currentTimeMillis() / 1000; // Log.i("appTime(long)---", appTime1 + ""); String token = String.valueOf(appTime1); // Log.e("token", token); String url = null; if (MainApplication.msgTime.equals("0")) { MainApplication.firstOpenTime = token; ProfileManager.getInstance().setFirstOpenTime(getApplicationContext(), token); MainApplication.msgTime = token; ProfileManager.getInstance().setSystemMsgTime(getApplicationContext(), token); } try { url = MainApplication.url + "/zhannew/basic/web/index.php/zhangonggao/release?timer=" + MainApplication.msgTime; // Log.e("890", url); } catch (Exception e) { e.printStackTrace(); } submitMessage(url); } }).start(); } private void submitMessage(String sms) { // Log.e("url", sms); Request request = new Request.Builder().url(sms).build(); Response response = null; try { if (request == null) { Message msg = new Message(); msg.what = 5; hand.sendMessage(msg); return; } response = OkHttpUtil.execute(request); if (response.code() == 200) { String json = ""; try { json = response.body().string(); Message msg = new Message(); msg.obj = json; msg.what = 7; hand.sendMessage(msg); // Log.e("url", json); } catch (Exception e) { e.printStackTrace(); Message msg = new Message(); msg.what = 5; hand.sendMessage(msg); } } } catch (Exception e) { e.printStackTrace(); Message msg = new Message(); msg.what = 5; hand.sendMessage(msg); } } public void MainMapp() { eteCityTime("{\"fun\":\"timer\"}"); clickMarker = false; SharedPreferencesUtil sharedPreferencesUtil = new SharedPreferencesUtil(getApplication()); sharedPreferencesUtil.setFileName("CurrentMarkerInfo"); sharedPreferencesUtil.clearData(); } public void eteCityTime(final String params) { new Thread(new Runnable() { @Override public void run() { try { String host = ""; if (MainApplication.url.contains("cdz.evcharge.cc")) { host = "cdz.evcharge.cc"; } else { host = "59.110.68.162"; } socket = new Socket(host, 9503); // IP:10.14.114.127,端口54321 // 向服务器发送消息 PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); out.println(params); // out.println("{\"fun\":\"getcity\"}"); // 接收来自服务器的消息 BufferedReader br = new BufferedReader(new InputStreamReader( socket.getInputStream())); // Message message = handle.obtainMessage(); // message.obj = line; // message.arg1 = 1; // handle.sendMessage(message); String msg = br.readLine(); // Log.d("dddddss",msg); // System.out.print("www:"+qqq); // Log.d("qqq",key); // if (msg != null) { // Message mes = new Message(); // mes.obj = msg; // mes.what = 2; // hand.sendMessage(mes); // } // Message message = handler.obtainMessage(); // message.obj = line; // message.arg1 = 17; // handler.sendMessage(message); token = msg; int time = (int) (System.currentTimeMillis() / 1000); // cha = String.valueOf(time - Integer.parseInt(msg)); cha = time - Integer.parseInt(msg); Token = getMD5(String.valueOf((System.currentTimeMillis() / 1000 - cha) / 10) + "qwerty"); // url = "http://cdz.d1ev.com/zhannew/basic/web/index.php/zhanlist/getlist?poi_lux=" + locLeftTop.longitude + "" + "&poi_luy=" + locLeftTop.latitude + "" + "&poi_rdx=" + llRightBottom.longitude + "" + "&poi_rdy=" + llRightBottom.latitude + "" + "&suit_car2=" + MainApplication.userTpye + "&status=" + MainApplication.mapStatus + "&charge_cost_way=" + MainApplication.costWay; String url = "{\"fun\":\"getcity\",\"suit_car2\":" + "\"" + MainApplication.userTpye + "\"" + ",\"status\":" + "\"" + MainApplication.mapStatus + "\"" + ",\"charge_cost_way\":" + "\"" + MainApplication.costWay + "\"" + ",\"belong_attribute\":" + "\"" + MainApplication.shuxing + "\"" + ",\"speed\":" + "\"" + MainApplication.sudu + "\"" + ",\"timer\":" + "\"" + Token + "\"" + "}"; // Log.d("wwwww", url); // System.out.print("qazwsx:"+url); if (MainApplication.userTpye == "") { MainApplication.userTpye = "1"; } eteCity("{\"fun\":\"getcity\",\"suit_car2\":" + "\"" + MainApplication.userTpye + "\"" + ",\"status\":" + "\"" + MainApplication.mapStatus + "\"" + ",\"charge_cost_way\":" + "\"" + MainApplication.costWay + "\"" + ",\"belong_attribute\":" + "\"" + MainApplication.shuxing + "\"" + ",\"speed\":" + "\"" + MainApplication.sudu + "\"" + ",\"timer\":" + "\"" + Token + "\"" + "}"); } catch (Exception e) { } } }).start(); } public void eteCity(final String params) { new Thread(new Runnable() { @Override public void run() { try { String host = ""; if (MainApplication.url.contains("cdz.evcharge.cc")) { host = "cdz.evcharge.cc"; } else { host = "59.110.68.162"; } socket = new Socket(host, 9503); // IP:10.14.114.127,端口54321 // 向服务器发送消息 PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); out.println(params); // out.println("{\"fun\":\"getcity\"}"); // 接收来自服务器的消息 BufferedReader br = new BufferedReader(new InputStreamReader( socket.getInputStream())); String msg = br.readLine(); // Log.d("dddddmsg",msg); if (msg != null) { Message mes = new Message(); mes.obj = msg; mes.what = 4; hand.sendMessage(mes); } // 关闭流 out.close(); br.close(); // 关闭Socket socket.close(); // } } catch (Exception e) { } } }).start(); } //登陆状态判断 private void setlogin() { if (TextUtils .isEmpty(ProfileManager.getInstance().getId(getApplication()))) { if (MainApplication.userNickname.equals("")) { // userLogin.setText(MainApplication.userNickname); } else { // userLogin.setText(Util.handlePhone("")); } MainApplication.sql = ProfileManager.getInstance().getSQL(this); } else { MainApplication.userPhone = ProfileManager.getInstance().getUsername(getApplication()); MainApplication.userId = ProfileManager.getInstance().getUserid(getApplication()); MainApplication.userIcon = ProfileManager.getInstance().getUsericon(getApplication()); MainApplication.userNickname = ProfileManager.getInstance().getNickname(getApplication()); MainApplication.sql = ProfileManager.getInstance().getSQL(getApplication()); // Log.e("MainApplication.sql===", MainApplication.sql); if (!MainApplication.userId.equals("")) { getPingLun(); } } } private boolean isAvilible(Context context, String packageName) { //获取packagemanager final PackageManager packageManager = context.getPackageManager(); //获取所有已安装程序的包信息 List<PackageInfo> packageInfos = packageManager.getInstalledPackages(0); //用于存储所有已安装程序的包名 List<String> packageNames = new ArrayList<String>(); //从pinfo中将包名字逐一取出,压入pName list中 if (packageInfos != null) { for (int i = 0; i < packageInfos.size(); i++) { String packName = packageInfos.get(i).packageName; packageNames.add(packName); } } //判断packageNames中是否有目标程序的包名,有TRUE,没有FALSE return packageNames.contains(packageName); } 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 getBaidu(Double jing, Double wei) { double x_pi = 3.14159265358979324 * 3000.0 / 180.0; double x = jing; double y = wei; 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); bd_lon = z * Math.cos(theta) + 0.0065; bd_lat = z * Math.sin(theta) + 0.006; } private void getBaidu1(Double jing, Double wei) { double x_pi = 3.14159265358979324 * 3000.0 / 180.0; double x = jing; double y = wei; 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); bd_jing = z * Math.cos(theta) + 0.0065; bd_wei = z * Math.sin(theta) + 0.006; } private void getBeginGaode(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); bg_jing = String.valueOf(gg_lon); gg_lat = z * Math.sin(theta); bg_wei = String.valueOf(gg_lat); } private void setUserData() { if (!ProfileManager.getInstance().getGuide(this)) { MainApplication.messageToken = "0"; MainApplication.userTpye = "1"; ProfileManager.getInstance().setGuide(this, true); MainApplication.sql = ProfileManager.getInstance().getSQL(this); MainApplication.sudu = ProfileManager.getInstance().getSudu(this); } else { MainApplication.userTpye = ProfileManager.getInstance().getTpey(this); MainApplication.mapStatus = ProfileManager.getInstance().getMapstatus(this); MainApplication.costWay = ProfileManager.getInstance().getCostway(this); MainApplication.map = ProfileManager.getInstance().getMap(this); MainApplication.shuxing = ProfileManager.getInstance().getShuxing(this); MainApplication.sudu = ProfileManager.getInstance().getSudu(this); MainApplication.atCity = ProfileManager.getInstance().getAtCity(this); MainApplication.sql = ProfileManager.getInstance().getSQL(this); MainApplication.support = ProfileManager.getInstance().getSupport(this); MainApplication.freestop = ProfileManager.getInstance().getFreeStop(this); MainApplication.selecthotel = ProfileManager.getInstance().getSelectHotel(this); MainApplication.selectexpressway = ProfileManager.getInstance().getSelectExpressway(this); MainApplication.selectjingdian = ProfileManager.getInstance().getSelectJingdian(this); MainApplication.logid = ProfileManager.getInstance().getLogid(this); MainApplication.messageToken = ProfileManager.getInstance().getKeyMessageToken(this); } } private void userChargingCheck() { OkHttpUtils.get().url(UrlConstants.USER_CHARGING_CHECK_URL) .addParams(ChargingConstants.USERID, MainApplication.userId) .addParams(ChargingConstants.PWD, MainApplication.userPassword) .build().connTimeOut(10000).readTimeOut(10000).execute(new StringCallback() { @Override public void onError(Call call, Exception e) { } @Override public void onResponse(final String response) { LogUtils.e(response); if (EmptyUtils.isNotEmpty(response)) { String rtnCode = JsonUtils.getKeyResult(response, "rtnCode"); if ("306".equals(rtnCode)) { LogUtils.e("有订单"); rl_charging_notice.setVisibility(View.VISIBLE); if (firstCheck) { if (isStatusBack == false) { String data = JsonUtils.getKeyResult(response, "data"); String orderid = JsonUtils.getKeyResult(data, "orderId"); Intent intent = new Intent(getApplicationContext(), ChargingStatusActivity.class); intent.putExtra(ChargingConstants.ORDERID, orderid); startActivity(intent); } firstCheck = false; } rl_charging_notice.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String data = JsonUtils.getKeyResult(response, "data"); String orderid = JsonUtils.getKeyResult(data, "orderId"); Intent intent = new Intent(getApplicationContext(), ChargingStatusActivity.class); intent.putExtra(ChargingConstants.ORDERID, orderid); startActivity(intent); } }); } else { LogUtils.e("没有订单"); rl_charging_notice.setVisibility(View.GONE); MainApplication.isAppStart = false; ProfileManager.getInstance().setAppStart(getApplicationContext(), MainApplication.isAppStart); } } } }); } private void getZhanListData(int level) { aMap.clear(); ZhanDBHelper dbHelper = new ZhanDBHelper(this); try { dbHelper.createDataBase(); SQLiteDatabase db = dbHelper.getWritableDatabase(); db.beginTransaction(); String sql = ""; if (level == 3) { sql = "SELECT count(*) as cnt,substr(poi_jing,0,4) as pjing,substr(poi_wei,0,3) as pwei,avg(poi_jing) as pjing2,avg(poi_wei) as pwei2 FROM zhan_list where city != '1'" + MainApplication.sql + "GROUP BY pjing,pwei"; } else if (level == 2) { sql = "SELECT count(*) as cnt,substr(poi_jing,0,6) as pjing,substr(poi_wei,0,5) as pwei,avg(poi_jing) as pjing2,avg(poi_wei) as pwei2 FROM zhan_list where city != '1'" + MainApplication.sql + "GROUP BY pjing,pwei"; } Cursor cursor = db.rawQuery(sql, null); ZhanDB zhan_db; while (cursor.moveToNext()) { zhan_db = new ZhanDB(); zhan_db.setCnt(cursor.getString(cursor.getColumnIndex("cnt"))); zhan_db.setPjing2(cursor.getString(cursor.getColumnIndex("pjing2"))); zhan_db.setPwei2(cursor.getString(cursor.getColumnIndex("pwei2"))); list_db.add(zhan_db); } cursor.close(); db.endTransaction(); db.close(); } catch (IOException e) { e.printStackTrace(); } } private void delData(List<DataRefresh> list_del) { String dbPath = "/data/user/0/com.electric.chargingpile/databases/zhan_list"; try { SQLiteDatabase db = SQLiteDatabase.openDatabase(dbPath, null, SQLiteDatabase.OPEN_READWRITE); db.beginTransaction();//开始事务 try { for (int i = 0; i < list_del.size(); i++) { String[] args = {String.valueOf(list_del.get(i).getId())}; int mub = db.delete("zhan_list", "id=?", args); } db.setTransactionSuccessful();//调用此方法会在执行到endTransaction() 时提交当前事务,如果不调用此方法会回滚事务 } finally { db.endTransaction();//由事务的标志决定是提交事务,还是回滚事务 } db.close(); } catch (Exception e) { e.printStackTrace(); } } private void addData(List<DataRefresh> list_add) { String dbPath = "/data/user/0/com.electric.chargingpile/databases/zhan_list"; try { SQLiteDatabase db = SQLiteDatabase.openDatabase(dbPath, null, SQLiteDatabase.OPEN_READWRITE); db.beginTransaction();//开始事务 try { for (int i = 0; i < list_add.size(); i++) { ContentValues cv = new ContentValues(); cv.put("id", list_add.get(i).getId()); cv.put("status", list_add.get(i).getStatus()); cv.put("poi_jing", list_add.get(i).getPoi_jing()); cv.put("poi_wei", list_add.get(i).getPoi_wei()); cv.put("total_num", list_add.get(i).getTotal_num()); cv.put("fast_num", list_add.get(i).getFast_num()); cv.put("slow_num", list_add.get(i).getSlow_num()); cv.put("charge_cost_way", list_add.get(i).getCharge_cost_way()); cv.put("belong_attribute", list_add.get(i).getBelong_attribute()); cv.put("suit_car", list_add.get(i).getSuit_car()); cv.put("own_pay", list_add.get(i).getOwn_pay()); cv.put("city", list_add.get(i).getCity()); cv.put("supplier", list_add.get(i).getSupplier()); long mub = db.insert("zhan_list", null, cv); if (mub > 0) { Log.e(TAG, "添加成功"); } else { Log.e(TAG, "添加失败---" + list_add.get(i).getId()); } } db.setTransactionSuccessful();//调用此方法会在执行到endTransaction() 时提交当前事务,如果不调用此方法会回滚事务 } finally { db.endTransaction();//由事务的标志决定是提交事务,还是回滚事务 } db.close(); } catch (Exception e) { e.printStackTrace(); } } private void upData(List<DataRefresh> list_up) { String dbPath = "/data/user/0/com.electric.chargingpile/databases/zhan_list"; try { SQLiteDatabase db = SQLiteDatabase.openDatabase(dbPath, null, SQLiteDatabase.OPEN_READWRITE); db.beginTransaction();//开始事务 try { for (int i = 0; i < list_up.size(); i++) { String[] args = {String.valueOf(list_up.get(i).getId())}; ContentValues cv = new ContentValues(); cv.put("id", list_up.get(i).getId()); cv.put("status", list_up.get(i).getStatus()); cv.put("poi_jing", list_up.get(i).getPoi_jing()); cv.put("poi_wei", list_up.get(i).getPoi_wei()); cv.put("total_num", list_up.get(i).getTotal_num()); cv.put("fast_num", list_up.get(i).getFast_num()); cv.put("slow_num", list_up.get(i).getSlow_num()); cv.put("charge_cost_way", list_up.get(i).getCharge_cost_way()); cv.put("belong_attribute", list_up.get(i).getBelong_attribute()); cv.put("suit_car", list_up.get(i).getSuit_car()); cv.put("own_pay", list_up.get(i).getOwn_pay()); cv.put("city", list_up.get(i).getCity()); cv.put("supplier", list_up.get(i).getSupplier()); long mub = db.update("zhan_list", cv, "id=?", args); if (mub > 0) { Log.e(TAG, "up成功"); } else { Log.e(TAG, "up失败---" + list_up.get(i).getId()); } } db.setTransactionSuccessful();//调用此方法会在执行到endTransaction() 时提交当前事务,如果不调用此方法会回滚事务 } finally { db.endTransaction();//由事务的标志决定是提交事务,还是回滚事务 } db.close(); } catch (Exception e) { e.printStackTrace(); } } public String getAssetsCacheFile(Context context, String fileName) throws Exception { File cacheFile = new File(context.getCacheDir(), fileName); try { InputStream inputStream = context.getAssets().open(fileName); try { FileOutputStream outputStream = new FileOutputStream(cacheFile); try { byte[] buf = new byte[1024]; int len; while ((len = inputStream.read(buf)) > 0) { outputStream.write(buf, 0, len); } } finally { outputStream.close(); } } finally { inputStream.close(); } } catch (IOException e) { e.printStackTrace(); } getZhanData(); return cacheFile.getAbsolutePath(); } class NetworkChangeReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if (null != networkInfo && networkInfo.isAvailable()) { } else { Toast.makeText(context, "当前网络不可用", Toast.LENGTH_SHORT).show(); } } } private void getZhanData() throws Exception { if (zhan_lists != null) { zhan_lists.clear(); } if (mClusterOverlay != null) { mClusterOverlay.onDestroy(); } DaoMaster daoMaster = new DaoMaster(SQLiteDatabase.openOrCreateDatabase(getDatabasePath("zhan_list"), null)); DaoSession mDaoSession = daoMaster.newSession(); zhan_listDao = mDaoSession.getZhan_listDao(); zhan_lists = zhan_listDao.queryRaw("where status = ? " + MainApplication.sql, new String[]{"4"}); if (onResumeRefresh == true) { ToastUtil.showToast(getApplicationContext(), "共" + zhan_lists.size() + "个符合条件的站点", Toast.LENGTH_SHORT); } new Thread() { public void run() { List<ClusterItem> items = new ArrayList<ClusterItem>(); if (zhan_lists != null && zhan_lists.size() > 0) { for (int i = 0; i < zhan_lists.size(); i++) { String jing = zhan_lists.get(i).getPoi_jing(); String wei = zhan_lists.get(i).getPoi_wei(); if (jing != null && !jing.equals("") && !wei.equals("") && wei != null) { int position_jing = jing.length() - jing.indexOf(".") - 1; int position_wei = wei.length() - wei.indexOf(".") - 1; LatLng ll; if (position_jing > 13 || position_wei > 13) { ll = new LatLng(Double.parseDouble(wei), Double.parseDouble(jing)); } else { double dwei = Double.parseDouble(wei); double djing = Double.parseDouble(jing); getGaode(djing, dwei); ll = new LatLng(Double.parseDouble(gd_wei), Double.parseDouble(gd_jing)); } if (null != String.valueOf(ll.longitude) && null != String.valueOf(ll.latitude)) { if (null != zhan_lists) { zhan_lists.get(i).setPoi_jing(String.valueOf(ll.longitude)); zhan_lists.get(i).setPoi_wei(String.valueOf(ll.latitude)); } } } } } for (int i = 0; i < zhan_lists.size(); i++) { if (null != zhan_lists.get(i).getPoi_jing() && null != zhan_lists.get(i).getPoi_wei()) { double lat, lon; if (zhan_lists.get(i).getPoi_wei().equals("") || zhan_lists.get(i).getPoi_wei() == null) { lat = 0.00; } else { lat = Double.parseDouble(zhan_lists.get(i).getPoi_wei()); } if (zhan_lists.get(i).getPoi_jing().equals("") || zhan_lists.get(i).getPoi_jing() == null) { lon = 0.00; } else { lon = Double.parseDouble(zhan_lists.get(i).getPoi_jing()); } LatLng latLng = new LatLng(lat, lon, false); RegionItem regionItem = new RegionItem(latLng, "test" + i); //注意这里在设置数据的时候把 自己的原始点的信息设置到区域Item中 方便在回调方法中拿到这些数据 // zhan_lists.get(i).setPoi_jing(String.valueOf(ll.longitude)); // zhan_lists.get(i).setPoi_wei(String.valueOf(ll.latitude)); regionItem.setChargePoint(zhan_lists.get(i)); items.add(regionItem); } } mClusterOverlay = new ClusterOverlay(aMap, items, dp2px(getApplicationContext(), clusterRadius), getApplicationContext()); mClusterOverlay.setClusterRenderer(MainMapActivity.this); mClusterOverlay.setOnClusterClickListener(MainMapActivity.this); } }.start(); } private void showMapMarker() { List<ClusterItem> items = new ArrayList<ClusterItem>(); for (int i = 0; i < zhan_lists.size(); i++) { if (null != zhan_lists.get(i).getPoi_jing() && null != zhan_lists.get(i).getPoi_wei()) { double lat, lon; if (zhan_lists.get(i).getPoi_wei().equals("") || zhan_lists.get(i).getPoi_wei() == null) { lat = 0.00; } else { lat = Double.parseDouble(zhan_lists.get(i).getPoi_wei()); } if (zhan_lists.get(i).getPoi_jing().equals("") || zhan_lists.get(i).getPoi_jing() == null) { lon = 0.00; } else { lon = Double.parseDouble(zhan_lists.get(i).getPoi_jing()); } LatLng latLng = new LatLng(lat, lon, false); RegionItem regionItem = new RegionItem(latLng, "test" + i); //注意这里在设置数据的时候把 自己的原始点的信息设置到区域Item中 方便在回调方法中拿到这些数据 // zhan_lists.get(i).setPoi_jing(String.valueOf(ll.longitude)); // zhan_lists.get(i).setPoi_wei(String.valueOf(ll.latitude)); regionItem.setChargePoint(zhan_lists.get(i)); items.add(regionItem); } } mClusterOverlay = new ClusterOverlay(aMap, items, dp2px(getApplicationContext(), clusterRadius), getApplicationContext()); mClusterOverlay.setClusterRenderer(MainMapActivity.this); mClusterOverlay.setOnClusterClickListener(MainMapActivity.this); } private void initDataBase() throws IOException { File databasePath = getDatabasePath("zhan_list"); databasePath.getParentFile().mkdirs(); databasePath.createNewFile(); InputStream inputStream = getAssets().open("zhan_list.db"); FileOutputStream fileOutputStream = new FileOutputStream(databasePath); byte[] buf = new byte[1024 * 10]; int length = 0; while ((length = inputStream.read(buf)) != -1) { fileOutputStream.write(buf, 0, length); fileOutputStream.flush(); } inputStream.close(); fileOutputStream.close(); // Log.d(TAG, "initDataBase: length=" + databasePath.length()); eteinit("{\"fun\":\"timer\"}"); try { getZhanData(); } catch (Exception e) { e.printStackTrace(); } } @Override public Drawable getDrawAble(int clusterNum) { int radius = dp2px(getApplicationContext(), 60); if (clusterNum == 1) { Drawable bitmapDrawable = mBackDrawAbles.get(1); if (bitmapDrawable == null) { bitmapDrawable = getApplication().getResources().getDrawable( R.drawable.icon_sorange); mBackDrawAbles.put(1, bitmapDrawable); } return bitmapDrawable; } else if (clusterNum > 1 && clusterNum < 999) { Drawable bitmapDrawable = mBackDrawAbles.get(2); if (bitmapDrawable == null) { bitmapDrawable = getApplication().getResources().getDrawable( R.drawable.icon_marker1_999); mBackDrawAbles.put(2, bitmapDrawable); // bitmapDrawable = new BitmapDrawable(null, drawCircle(radius, // Color.argb(159, 210, 154, 6))); // mBackDrawAbles.put(2, bitmapDrawable); } return bitmapDrawable; } else if (clusterNum > 1000) { Drawable bitmapDrawable = mBackDrawAbles.get(3); if (bitmapDrawable == null) { bitmapDrawable = getApplication().getResources().getDrawable( R.drawable.icon_marker1000); // bitmapDrawable = new BitmapDrawable(null, drawCircle(radius, // Color.argb(199, 217, 114, 0))); mBackDrawAbles.put(3, bitmapDrawable); } return bitmapDrawable; } else { Drawable bitmapDrawable = mBackDrawAbles.get(4); if (bitmapDrawable == null) { bitmapDrawable = getApplication().getResources().getDrawable( R.drawable.icon_marker1_999); // bitmapDrawable = new BitmapDrawable(null, drawCircle(radius, // Color.argb(235, 215, 66, 2))); mBackDrawAbles.put(4, bitmapDrawable); } return bitmapDrawable; } } private Bitmap drawCircle(int radius, int color) { Bitmap bitmap = BitmapFactory.decodeResource(MainApplication.context.getResources(), R.drawable.icon_newmarker4); Bitmap bitmap1 = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth(), bitmap.getHeight(), false); // Bitmap bitmap = Bitmap.createBitmap(radius * 2, radius * 2, // Bitmap.Config.ARGB_8888); // Canvas canvas = new Canvas(bitmap1); // Paint paint = new Paint(); // RectF rectF = new RectF(0, 0, radius * 2, radius * 2); //// paint.setColor(color); // canvas.drawArc(rectF, 0, 360, true, paint); return bitmap1; } /** * 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public int dp2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } @Override public void onClick(Marker marker, List<ClusterItem> clusterItems) { LatLngBounds.Builder builder = new LatLngBounds.Builder(); for (ClusterItem clusterItem : clusterItems) { builder.include(clusterItem.getPosition()); } //这里处理一下Marker的点击事件 if (clusterItems.size() == 1) { MobclickAgent.onEvent(context, "0102"); Log.e(TAG, "onClick: !!" + "!!"); rl_control.setVisibility(View.GONE); moveRefresh = false; ClusterItem clusterItem = clusterItems.get(0); markerPosition = clusterItem.getPosition(); RegionItem regionItem = (RegionItem) clusterItems.get(0); zhan_list chargePoint = regionItem.getChargePoint(); String own_pay = chargePoint.getOwn_pay(); String supplier = chargePoint.getSupplier(); String suit_car = chargePoint.getSuit_car(); if (null != own_pay && own_pay.equals("1")) { marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newbig1)); } else { if (null != suit_car && suit_car.equals("特斯拉")) { marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newbig3)); } else { if (null != supplier && WelcomeActivity.canCost.contains(supplier)) { marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newbig2)); } else { marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newbig3)); } } } // Log.e(TAG, "onClick: " + own_pay + "=====" + supplier); if (nMarker != null && current_chargePoint.getId() != chargePoint.getId()) { MarkerOptions markerOptionss = new MarkerOptions(); if (null != current_chargePoint.getOwn_pay() && current_chargePoint.getOwn_pay().equals("1")) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker1)); } else { if (null != current_chargePoint.getSuit_car() && current_chargePoint.getSuit_car().equals("特斯拉")) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker3)); } else { if (null != current_chargePoint.getSupplier() && WelcomeActivity.canCost.contains(current_chargePoint.getSupplier())) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker2)); } else { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker3)); } } } nMarker = aMap.addMarker(markerOptionss); } // Log.d(TAG, "onClick: latitude=" + position.latitude + " long=" + position.longitude + "\n" + ((RegionItem) clusterItem).getChargePoint().toString()); Long zhan_id = ((RegionItem) clusterItem).getChargePoint().getId(); nMarker = marker; zhanInfo = null; // add by hyg 显示气泡 nMarker.showInfoWindow(); current_chargePoint = chargePoint; dialog.show(); if (null != marker.getPosition()) { getSingleZhanInfo(String.valueOf(zhan_id), marker.getPosition()); } } else { LatLngBounds latLngBounds = builder.build(); aMap.animateCamera(CameraUpdateFactory.newLatLngBounds(latLngBounds, 0)); } } private void clickMarkAndMove(int adHeight) { if (markerPosition == null) { return; } float zoom = aMap.getCameraPosition().zoom; int width = mapView.getMeasuredWidth(); int height = mapView.getMeasuredHeight(); if (height > 1122) { Point point = aMap.getProjection().toScreenLocation(markerPosition); int y = point.y - (height - 1122) - DensityUtil.dip2px(getApplicationContext(), adHeight); aMap.moveCamera(CameraUpdateFactory.scrollBy(point.x - width / 2, y)); } else { aMap.animateCamera(CameraUpdateFactory.newLatLngZoom(markerPosition, zoom)); } } private void getSingleZhanInfo(String zhan_id, final LatLng ll) { String url = MainApplication.url + "/zhannew/basic/web/index.php/zhanlist/zhan-info2?zhan_id=" + zhan_id + "&version=" + MainApplication.current_code; // Log.e(TAG, "getSingleZhanInfo: url="+url ); OkHttpUtils.get().url(url).build().execute(new StringCallback() { @Override public void onError(Call call, Exception e) { } @Override public void onResponse(String response) { Log.e(TAG, "onResponse: " + response); dialog.cancel(); String info = JsonUtils.getKeyResult(response, "info"); // String info = "JbCMZl5FRHmpKqIywO0ntFtBJfaZYHk7bQGy9WjREYixObR+49H+MAJTiHTKnvSQz73LDfLo4MQMAldzbOFyNkhapUrlWOF5Og7H8HmFX/0A1mLAIDGIXMepmpS45gYVdzn8xvGDh3JXdiNU1AAohz4R3WdpSIo5Pvt+RbsIqH+/Uuk3/mRrizGxZmWhQzzIpc9KMY/69vUAEaxTz8YQLgdbHWUE/wD1e79BiXKTRmrbqayVFd8tFDrM6pvovDE15wUomION2gKdHLCvA2Dg5loIiany/FVkB7tmQLu2SiiCgfHArwWqr/axUP9Vbu878PrJRxLYSW616iFSBFYJHVe1PIDTXA6g8mvxUnCCnfhUVoRJ5mn18hXo2EsTdqbLnp3UpOAXicoGWoP4ztXu/M2P0xA+MnPk7Wa4NunMhPVeKpmTsYXV2RzQaUQknwtEgSRvtTEX6HSUxPnrNESiQML5fLCNiWms2z5vp2GUSFYQTGKnCsqlw7HsAJCf0VBJAz6Ii46kr8NBtk3WwOfld5ZO/pIhTuS3Mg1HHlu9nR1Vqu6/UPJiu0zF1AfOUB1f1mSM3d1p2tsPSGKbugRIP7vWOQ57vgUYK3n3UUo51aCemgpy3eIxo9cCdtTEXU5O4A4FpyQEKP8uIiAp7dIUqvkCGfatTI/dJVJ70Sv5sCpXCfdYIRpiWVj63nt8p4KUnxF7x5KrMDiZY+ntQLXzufgIHa+pL6E/ToJ2lznXaMOaMSt0O2bWz++2qa2TvpOj7S9qsaJgtySs7Mwrk+Yg3UULyp8BkMK6lcRxBv4jz43pt84fPO4imm42SDr/H0X/88CmmyhzJtLExchpZQA1nqmTyWkfj9V0Z62s+9IAcw90bHm/J6x5vSY3K+N5chBR47VEt77tg6DKPTW2u9R+lDGEPluYvPjZ2i20qeDkUJ19U6vM+QnYF8Sa4AlzT3G9SJlqHGyXRyTn7WOLnvg6pSKSAsTp/lFAaeNHAvJtx1bSq+43vDlFbs6jXPQXcVvTZf6ALge/rLFItYA8muOwKj2DxFftshKFwkufxA/nTS19rJoDNvLtVbTfe6E3Za2ei7LCaWNV5UtrDJOSdEGzFKqroB59Ika0Ijdn1ZI2f54feYgnUYZHKDb8UUbGQlRWzwcYBv4PjDGVVKbSWUMkeDA0FB4t+X1Rfu28UnSJ2GShL8cotnm6vwD1Psy3NDAShfvCBVqSx6O6PqTic0KBQq2Ufjlx1OWKexE08qEWWUEyEvMOPkTx2t94zdxQZVCIfR1DIvHCklvBTh7zyfcLXQol/6AnoTBh6X+R8Hh1Ih8FLnlZfeB4bde8hHZbNS2GyQb8Hs4haZmeYyVdUYy3OuXIBFd1Ve5UzKv+AY1JipsKI/ha/h19Xozpvr86sQUYDhlpbKyYAVtrZhYvTFcKuj6Jl46KGkJMXv6GU1QpYvjxF8W156HfGv9uN35Q1bVVcHOXerM4e8DXqUvXTK6g5zMTPes0smYLlTn73CO1iuc4c2wDmEiTEk367qJf6VDefWPRZpkOsKZHxc06OTfw3tAuEK9X8mnVaVhb+6OHkPKtnD//5K/6VYYPcXaIoSAcFdkgcMkYe5vSKyw7TNfgSBSGNlxFrYPkhotshDoKt6FP/KTn9lFxQtl/BKG6if5wfp2hp7Ufn339wJh6SKd7ibtM38AS3HFHxvq7pC+wREAkhW4gyD8t7S3BZKsw+M50vhI3rmg9gebH4MJxC2iK5JDhPnHyw6fVz72pgluqD0cWpvy/3hFt+QxFfpbVnMhC6fvmspLpk/WZf3CKIb5T8TLoUOSMX7wBlTrl+oh6A0c/OdUpScoIv1dFGSN/7FXXnWLlMz4nkRcsN3ob6RT/QXqaE3cpo8HmR/6x9A+qNkMvVndDLBw3v/S4Fq6pr1DVsJpYAhwmgx461Z1pQTB+ORKDZOdiz+WAeHzNH5tD2Ers4VK8IWoK/FX1JABSC3Qxad3gUTAGc7Bpx4VZ8fdGzr6gfMeg8HT5WSeCkffepjLTQ0+Z4S+vjQ=="; Log.e(TAG, "onResponse: info=" + info); String info_decode = ""; try { info_decode = DES3S.decode(info); } catch (Exception e) { e.printStackTrace(); } Log.e(TAG, "onResponse: info_decode=" + info_decode); if (null != info_decode && !info_decode.equals("")) { showInfoWindow(info_decode, ll); } } }); } private void showInfoWindow(String info, final LatLng ll) { zhanInfo = info; final String id = JsonUtils.getKeyResult(info, "id"); getCommentNum(id); zhanGrade(id); final String zhan_name = JsonUtils.getKeyResult(info, "zhan_name"); String stop_cost = JsonUtils.getKeyResult(info, "stop_cost"); String own_pay = JsonUtils.getKeyResult(info, "own_pay"); // 1:可支付 String charge_cost_way2 = JsonUtils.getKeyResult(info, "charge_cost_way2"); final String charge_cost_way = JsonUtils.getKeyResult(info, "charge_cost_way"); String other_cost = JsonUtils.getKeyResult(info, "other_cost"); String charge_cost = JsonUtils.getKeyResult(info, "charge_cost"); String total_num = JsonUtils.getKeyResult(info, "total_num"); String slow_num = JsonUtils.getKeyResult(info, "slow_num"); String fast_num = JsonUtils.getKeyResult(info, "fast_num"); String remind = JsonUtils.getKeyResult(info, "remind"); String charge_record_cnt = JsonUtils.getKeyResult(info, "charge_record_cnt"); String zongjia = JsonUtils.getKeyResult(info, "zongjia"); String belong_attribute = JsonUtils.getKeyResult(info, "belong_attribute"); String park_location = JsonUtils.getKeyResult(info, "park_location"); final String city = JsonUtils.getKeyResult(info, "city"); final String poi_jing = JsonUtils.getKeyResult(info, "poi_jing"); final String poi_wei = JsonUtils.getKeyResult(info, "poi_wei"); final String fenshi_is = JsonUtils.getKeyResult(info, "fenshi_is"); final String telephone = JsonUtils.getKeyResult(info, "telephone"); TextView fenshi_info_textview = findViewById(R.id.fenshi_info_textview); fenshi_info_textview.setText(""); if ("1".equals(fenshi_is)) { final String fenshi_info = JsonUtils.getKeyResult(info, "fenshi_info"); ArrayList<PileData.FenshiInfoBean> fenshiList = (ArrayList<PileData.FenshiInfoBean>) JsonUtils.parseToObjectList(fenshi_info, PileData.FenshiInfoBean.class); if (fenshiList.size() == 1) { fenshi_info_textview.setText("全天价格统一"); } else { Calendar calendar = Calendar.getInstance(); int hours = calendar.get(Calendar.HOUR_OF_DAY); int minutes = calendar.get(Calendar.MINUTE); int totalMinutes = hours * 60 + minutes; for (PileData.FenshiInfoBean bean : fenshiList) { if (bean.getStartTotalMinutes() > totalMinutes) { double service_free = 0; double charge_free = 0; try { service_free = Double.valueOf(bean.getService_free()); charge_free = Double.valueOf(bean.getCharge_free()); } catch (Exception e) { e.printStackTrace(); } fenshi_info_textview.setText(String.format("%s开始 %.2f元/度", bean.getStart(), service_free + charge_free)); break; } } } } else { double totalPrice = 0; try { totalPrice = Double.valueOf(zongjia); } catch (Exception e) { e.printStackTrace(); } if (totalPrice != 0) { fenshi_info_textview.setText("全天价格统一"); } } if (belong_attribute != null && belong_attribute.contains("私人")) { private_telephone.setVisibility(View.VISIBLE); private_telephone.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new com.electric.chargingpile.view.AlertDialog(MainMapActivity.this).builder() .setMsg(zhan_name + " " + telephone) .setPositiveButton("呼叫", new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setAction("android.intent.action.CALL"); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("tel:" + telephone)); startActivity(intent); } }).setNegativeButton("取消", new View.OnClickListener() { @Override public void onClick(View v) { } }).show(); } }); } else { private_telephone.setVisibility(View.GONE); } // remind 0 正常 2 休息中 other 故障 // own_pay 1 可支付 // 显示顺序 故障>可支付>休息中 if (remind.equals("0")) { if ("1".equals(own_pay)) { iv_guzhang.setVisibility(View.VISIBLE); iv_guzhang.setImageResource(R.drawable.icon_is_cost); } else { iv_guzhang.setVisibility(View.GONE); } } else if (remind.equals("2")) { iv_guzhang.setVisibility(View.VISIBLE); iv_guzhang.setImageResource(R.drawable.icon_rest); } else { iv_guzhang.setVisibility(View.VISIBLE); iv_guzhang.setImageResource(R.drawable.icon_guzhang_window); } windowName.setText(zhan_name); if (stop_cost != null && !stop_cost.equals("")) { stopCost.setVisibility(View.VISIBLE); stopCost.setText("停车费:" + stop_cost); } else { stopCost.setVisibility(View.GONE); } if (center != null) { String wei = poi_wei; String jing = poi_jing; int position_jing = jing.length() - jing.indexOf(".") - 1; int position_wei = wei.length() - wei.indexOf(".") - 1; LatLng latLng; if (position_jing > 13 || position_wei > 13) { latLng = new LatLng(Double.parseDouble(wei), Double.parseDouble(jing)); } else { double dwei = Double.parseDouble(wei); double djing = Double.parseDouble(jing); getGaode(djing, dwei); latLng = new LatLng(Double.parseDouble(gd_wei), Double.parseDouble(gd_jing)); } // OK double d = AMapUtils.calculateLineDistance(center, latLng); if ("0m".equals(Util.getDistance(d))) { // windowDistance.setText("未知"); updateInfoWindow("未知距离"); } else { String text = Util.getDistance(d); // windowDistance.setText(text); updateInfoWindow("距您 " + text); } } if (charge_record_cnt != null) { int count = Integer.parseInt(charge_record_cnt); // 成功充电次数 if (count == 0) { windowChargeRecordCnt.setText(""); windowChargeRecordCntLine.setVisibility(View.GONE); } else { windowChargeRecordCntLine.setVisibility(View.VISIBLE); if (count < 1000) { windowChargeRecordCnt.setText(count + "次充电"); } else if (count < 10000) { windowChargeRecordCnt.setText(count / 1000 + "k+次充电"); } else { windowChargeRecordCnt.setText(count / 10000 + "w+次充电"); } } } else { windowChargeRecordCnt.setText(""); windowChargeRecordCntLine.setVisibility(View.GONE); } if (zongjia != null) { double zongjiaValue = Double.parseDouble(zongjia); if (zongjiaValue == 0) { windowZongjiaLayout.setVisibility(View.GONE); } else { windowZongjiaLayout.setVisibility(View.VISIBLE); windowZongjia.setText(String.format("%.2f", zongjiaValue)); } } else { windowZongjiaLayout.setVisibility(View.GONE); } // 气泡红包显示 windowRedPaperBag.setVisibility("1".equals(own_pay) ? View.VISIBLE : View.GONE); windowLabelPublic.setText(belong_attribute); windowLabelGround.setText("0".equals(park_location) ? "地下" : "地上"); windowLabelFreePark.setVisibility(stop_cost.contains("免费") ? View.VISIBLE : View.GONE); String acNum = null, dcNum = null, acableNum = null, dcableNum = null; if (null != JsonUtils.getKeyResult(info, "acNum")) { acNum = JsonUtils.getKeyResult(info, "acNum"); dcNum = JsonUtils.getKeyResult(info, "dcNum"); acableNum = JsonUtils.getKeyResult(info, "acableNum"); dcableNum = JsonUtils.getKeyResult(info, "dcableNum"); // Log.e("dcableNum", dcableNum); } if (null != acableNum && null != acNum && null != dcableNum && null != dcNum) { // 有桩状态 window_tv_fast_free_num.setText(dcableNum); // 快充空闲桩数量 window_tv_fast_total_num.setText("/" + dcNum); // 快充桩总数 window_tv_fast_free_label.setVisibility(View.VISIBLE); window_tv_fast_total_num.setVisibility(View.VISIBLE); window_tv_slow_free_num.setText(acableNum); // 慢充空闲桩数量 window_tv_slow_total_num.setText("/" + acNum); window_tv_slow_free_label.setVisibility(View.VISIBLE); window_tv_slow_total_num.setVisibility(View.VISIBLE); } else { // 没有桩状态 if (fast_num.equals("")) { window_tv_fast_free_num.setText("0"); } else { window_tv_fast_free_num.setText(fast_num); } window_tv_fast_free_label.setVisibility(View.GONE); window_tv_fast_total_num.setVisibility(View.GONE); if (slow_num.equals("")) { window_tv_slow_free_num.setText("0"); } else { window_tv_slow_free_num.setText(slow_num); } window_tv_slow_free_label.setVisibility(View.GONE); window_tv_slow_total_num.setVisibility(View.GONE); } //OK if (own_pay.equals("1")) { windowCost.setText("可使用本APP扫码支付"); } else { if (charge_cost_way2.equals("")) { windowCost.setText("暂无"); } else { windowCost.setText(charge_cost_way2); } } windowZhanDetails.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class); intent.putExtra("zhan_id", id); intent.putExtra("poi_jing", poi_jing); intent.putExtra("poi_wei", poi_wei); startActivity(intent); MainMapActivity.isR = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("type", "详情"); MobclickAgent.onEvent(context, "0102", map); map.clear(); } }); windowLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: mPosX = motionEvent.getX(); mPosY = motionEvent.getY(); mCurPosX = 0; mCurPosY = 0; break; case MotionEvent.ACTION_MOVE: mCurPosX = motionEvent.getX(); mCurPosY = motionEvent.getY(); break; case MotionEvent.ACTION_UP: if (mCurPosY != 0 && mCurPosY > mPosY && Math.abs(mCurPosY - mPosY) > 25) { // 向下滑动 // 取消气泡选中状态 if (nMarker != null) { nMarker.hideInfoWindow(); if (current_chargePoint.getOwn_pay().equals("1")) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker1)); } else { if (current_chargePoint.getSuit_car().equals("特斯拉")) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker3)); } else { if (WelcomeActivity.canCost.contains(current_chargePoint.getSupplier())) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker2)); } else { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker3)); } } } } // 隐藏气泡弹窗视图 Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.out); animation.setDuration(500); windowLayout.startAnimation(animation); new Handler().postDelayed(new Runnable() { @Override public void run() { windowLayout.setVisibility(View.GONE); rl_control.setVisibility(View.VISIBLE); } }, 500); } else if (mCurPosY != 0 && mCurPosY < mPosY && Math.abs(mCurPosY - mPosY) > 25) { // 向上活动 System.out.println("up"); } else if (mCurPosX != 0 && mCurPosX > mPosX && Math.abs(mCurPosX - mPosX) > 25) { // 向右滑动 System.out.println("right"); } else if (mCurPosX != 0 && mCurPosX < mPosX && Math.abs(mCurPosX - mPosX) > 25) { // 向左滑动 System.out.println("left"); } else { // 点击事件 Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class); intent.putExtra("zhan_id", id); intent.putExtra("poi_jing", poi_jing); intent.putExtra("poi_wei", poi_wei); startActivity(intent); MainMapActivity.isR = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("type", "详情"); MobclickAgent.onEvent(context, "0102", map); map.clear(); } break; } return true; } }); windowComments.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class); intent.putExtra("zhan_id", id); intent.putExtra("poi_jing", poi_jing); intent.putExtra("poi_wei", poi_wei); MainApplication.details_flag = "3"; startActivity(intent); HashMap<String, String> map = new HashMap<String, String>(); map.put("type", "评论"); MobclickAgent.onEvent(context, "0102", map); map.clear(); } }); //站点广告 // Log.e(TAG, "showInfoWindow: MainApplication.list_addetail="+MainApplication.list_addetail.size() ); if (MainApplication.list_addetail != null) { Random random = new Random(); final int result = random.nextInt(MainApplication.list_addetail.size()); Picasso.with(MainApplication.context) .load("http://cdz.evcharge.cc/zhannew/uploadfile/" + MainApplication.list_addetail.get(result).getImg()) .into(windowAd); windowAd.setVisibility(View.VISIBLE); clickMarkAndMove(0); windowAd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MobclickAgent.onEvent(context, "0052"); if (MainApplication.list_addetail.get(result).getIs_dui().equals("1")) { long appTime11 = System.currentTimeMillis() / 1000; long updatetime1 = appTime11 - MainMapActivity.cha - 5; String token1 = String.valueOf(updatetime1); String encode_token = null; try { encode_token = DES3.encode(token1); } catch (Exception e) { e.printStackTrace(); } String replace = URLEncoder.encode(encode_token); Intent intent11 = new Intent(); intent11.setClass(getApplicationContext(), CreditActivity.class); intent11.putExtra("navColor", "#fcfcfc"); //配置导航条的背景颜色,请用#ffffff长格式。 intent11.putExtra("titleColor", "#222222"); //配置导航条标题的颜色,请用#ffffff长格式。 MainApplication.goods_type = "details"; MainApplication.current_url = MainApplication.list_addetail.get(result).getUrl(); // MainApplication.current_url = "http://www.duiba.com.cn/mobile/appItemDetail?appItemId=453087"; if (!MainApplication.isLogin()) { intent11.putExtra("url", "http://cdz.evcharge.cc/zhannew/basic/web/index.php/duiba/active?token=" + replace + "&url=" + MainApplication.current_url); //配置自动登陆地址,每次需服务端动态生成。 } else { intent11.putExtra("url", "http://cdz.evcharge.cc/zhannew/basic/web/index.php/duiba/active?user_id=" + MainApplication.userId + "&token=" + replace + "&url=" + MainApplication.current_url); //配置自动登陆地址,每次需服务端动态生成。 } startActivity(intent11); overridePendingTransition(0, 0); CreditActivity.creditsListener = new CreditActivity.CreditsListener() { /** * 当点击分享按钮被点击 * @param shareUrl 分享的地址 * @param shareThumbnail 分享的缩略图 * @param shareTitle 分享的标题 * @param shareSubtitle 分享的副标题 */ public void onShareClick(WebView webView, String shareUrl, String shareThumbnail, String shareTitle, String shareSubtitle) { //当分享按钮被点击时,会调用此处代码。在这里处理分享的业务逻辑。 ChargingShareBean chargingShareBean = new ChargingShareBean(); chargingShareBean.setIcon(shareThumbnail); chargingShareBean.setTitle(shareTitle); chargingShareBean.setUrl(shareUrl); chargingShareBean.setText(""); showSimpleBottomSheetGrid(chargingShareBean); } /** * 当点击“请先登录”按钮唤起登录时,会调用此处代码。 * 用户登录后,需要将CreditsActivity.IS_WAKEUP_LOGIN变量设置为true。 * @param webView 用于登录成功后返回到当前的webview刷新登录状态。 * @param currentUrl 当前页面的url */ public void onLoginClick(WebView webView, final String currentUrl) { //当未登录的用户点击去登录时,会调用此处代码。 //用户登录后,需要将CreditsActivity.IS_WAKEUP_LOGIN变量设置为true。 //为了用户登录后能回到未登录前的页面(currentUrl)。 //当用户登录成功后,需要重新请求一次服务端,带上currentUrl。 //用该方法中的webview变量加载请求链接。 //服务端收到请求后在生成免登录url时,将currentUrl放入redirect参数,通知客户端302跳转到新生成的免登录URL。 new android.app.AlertDialog.Builder(webView.getContext()) .setTitle("跳转登录") .setMessage("跳转到登录页面?") .setPositiveButton("是", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // MainApplication.current_url = currentUrl; MainApplication.current_url = currentUrl; context.startActivity(new Intent(getApplicationContext(), LoginActivity.class)); } }) .setNegativeButton("否", null) .show(); } /** * 当点击“复制”按钮时,触发该方法,回调获取到券码code * @param webView webview对象。 * @param code 复制的券码 */ public void onCopyCode(WebView webView, String code) { //当未登录的用户点击去登录时,会调用此处代码。 new android.app.AlertDialog.Builder(webView.getContext()) .setTitle("复制券码") .setMessage("已复制,券码为:" + code) .setPositiveButton("是", null) .setNegativeButton("否", null) .show(); } /** * 积分商城返回首页刷新积分时,触发该方法。 */ public void onLocalRefresh(WebView mWebView, String credits) { //String credits为积分商城返回的最新积分,不保证准确。 //触发更新本地积分,这里建议用ajax向自己服务器请求积分值,比较准确。 // Toast.makeText(getApplicationContext(), "触发本地刷新积分:" + credits, Toast.LENGTH_SHORT).show(); } }; } else { Intent intent145 = new Intent(getApplication(), MyWebViewActivity.class); String url = MainApplication.list_addetail.get(result).getUrl(); if (EmptyUtils.isNotEmpty(url)) { if (url.contains("?")) { url = MainApplication.list_addetail.get(result).getUrl() + "&cdzshareid=" + MainApplication.list_addetail.get(result).getId(); } else { url = MainApplication.list_addetail.get(result).getUrl() + "?cdzshareid=" + MainApplication.list_addetail.get(result).getId(); } // url = "http://192.168.1.104:8000/"; // url = "https://www.d1ev.com/special/t/application.html?s=JUU1JUE1JTg3JUU3JTkxJTlFJUU1JUIwJThGJUU4JTlBJTgyJUU4JTlBJTgxLCVFNiVBQyVBNyVFNiU4QiU4OVIxLCVFNSU4QyU5NyVFNiVCMSVCREVDMw=="; // intent_text,intent_icon,intent_title,intent_url; intent145.putExtra("url", url); // intent145.putExtra("tag", "8"); // intent145.putExtra("intent_text", MainApplication.list_addetail.get(result).getContent()); // intent145.putExtra("intent_icon", MainApplication.list_addetail.get(result).getIcon()); // intent145.putExtra("intent_title", MainApplication.list_addetail.get(result).getTitle()); // intent145.putExtra("intent_url", MainApplication.list_addetail.get(result).getUrl()); startActivity(intent145); } } } }); } else { windowAd.setVisibility(View.GONE); clickMarkAndMove(65); } //站点导航 final String finalRemind = remind; windowGo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { infoViewNavigate(); } }); Animation animation = AnimationUtils.loadAnimation(this, R.anim.in); animation.setDuration(500); windowLayout.startAnimation(animation); windowLayout.setVisibility(View.VISIBLE); SharedPreferencesUtil sharedPreferencesUtil = new SharedPreferencesUtil(getApplication()); boolean showedExampleActivity = sharedPreferencesUtil.hasKey("cdz_showed_example_activity"); if (!showedExampleActivity) { Intent pIntent = new Intent(getApplicationContext(), ExampleActivity.class); pIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(pIntent); overridePendingTransition(0, 0); } } /** * 点击气泡进行导航 * add by hyg */ private void infoViewNavigate() { if (!hasLocationPermission()) { requestLocationPermission(); return; } if (zhanInfo == null) { return; } if (nMarker == null) { return; } final LatLng ll = nMarker.getPosition(); final String id = JsonUtils.getKeyResult(zhanInfo, "id"); final String zhan_name = JsonUtils.getKeyResult(zhanInfo, "zhan_name"); String stop_cost = JsonUtils.getKeyResult(zhanInfo, "stop_cost"); String own_pay = JsonUtils.getKeyResult(zhanInfo, "own_pay"); String charge_cost_way2 = JsonUtils.getKeyResult(zhanInfo, "charge_cost_way2"); final String charge_cost_way = JsonUtils.getKeyResult(zhanInfo, "charge_cost_way"); String other_cost = JsonUtils.getKeyResult(zhanInfo, "other_cost"); String charge_cost = JsonUtils.getKeyResult(zhanInfo, "charge_cost"); String total_num = JsonUtils.getKeyResult(zhanInfo, "total_num"); String slow_num = JsonUtils.getKeyResult(zhanInfo, "slow_num"); String fast_num = JsonUtils.getKeyResult(zhanInfo, "fast_num"); String remind = JsonUtils.getKeyResult(zhanInfo, "remind"); // remind 0 正常 2 休息中 other 故障 final String city = JsonUtils.getKeyResult(zhanInfo, "city"); final String poi_jing = JsonUtils.getKeyResult(zhanInfo, "poi_jing"); final String poi_wei = JsonUtils.getKeyResult(zhanInfo, "poi_wei"); String belongAttribute = JsonUtils.getKeyResult(zhanInfo, "belong_attribute"); HashMap<String, String> mapp = new HashMap<String, String>(); mapp.put("type", "导航"); MobclickAgent.onEvent(context, "0102", mapp); mapp.clear(); if (remind.equals("0")) { // 正常显示导航 if (belongAttribute.contains("私人")) { new com.electric.chargingpile.view.AlertDialog(MainMapActivity.this).builder() .setMsg("该站为私人站点,建议\n先联系桩主后再前往") .setPositiveButton("继续", new View.OnClickListener() { @Override public void onClick(View v) { if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap") && !isAvilible(getApplicationContext(), "com.autonavi.minimap")) { if (null == center) { ToastUtil.showToast(getApplicationContext(), "请检查您当前网络或定位权限是否开启", Toast.LENGTH_SHORT); } else { Intent intent = new Intent(getApplication(), BasicNaviActivity.class); intent.putExtra("start_jing", center.longitude + ""); intent.putExtra("start_wei", center.latitude + ""); intent.putExtra("stop_jing", ll.longitude + ""); intent.putExtra("stop_wei", ll.latitude + ""); startActivity(intent); detailsBack = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0033", map); map.clear(); } } else { if (center != null) { LayoutInflater inflater1 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); popupWindowView = inflater1.inflate(R.layout.item_selectmap, null); popupWindow = new PopupWindow(popupWindowView, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, true); popupWindow.setBackgroundDrawable(new BitmapDrawable()); // 设置PopupWindow的弹出和消失效果 popupWindow.setAnimationStyle(R.style.popupAnimation); LinearLayout ll_tvTwo = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvTwo); if (!isAvilible(getApplicationContext(), "com.autonavi.minimap")) { ll_tvTwo.setVisibility(View.GONE); } LinearLayout ll_tvOne = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvOne); if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap")) { ll_tvOne.setVisibility(View.GONE); } cancleButton = (Button) popupWindowView.findViewById(R.id.cancleButton); cancleButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { popupWindow.dismiss(); } }); tvThree = (TextView) popupWindowView.findViewById(R.id.tvThree); tvThree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplication(), BasicNaviActivity.class); intent.putExtra("start_jing", center.longitude + ""); intent.putExtra("start_wei", center.latitude + ""); intent.putExtra("stop_jing", ll.longitude + ""); intent.putExtra("stop_wei", ll.latitude + ""); startActivity(intent); detailsBack = true; popupWindow.dismiss(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0033", map); map.clear(); } }); tvOne = (TextView) popupWindowView.findViewById(R.id.tvOne); tvOne.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = null; int position_jing = poi_jing.length() - poi_jing.indexOf(".") - 1; int position_wei = poi_wei.length() - poi_wei.indexOf(".") - 1; if (position_jing > 13 || position_wei > 13) { getBaidu1(Double.parseDouble(poi_jing), Double.parseDouble(poi_wei)); } else { bd_jing = Double.parseDouble(poi_jing); bd_wei = Double.parseDouble(poi_wei); } getBaidu(center.longitude, center.latitude); try { String s = "intent://map/direction?" + "origin=" + bd_lat + "," + bd_lon + "&" + "destination=" + bd_wei + "," + bd_jing + "&mode=driving&" + "src=充电桩#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end"; intent = Intent.getIntent(s); detailsBack = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0031", map); map.clear(); } catch (URISyntaxException e) { e.printStackTrace(); } startActivity(intent); popupWindow.dismiss(); } }); tvTwo = (TextView) popupWindowView.findViewById(R.id.tvTwo); tvTwo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { Intent intent4 = new Intent("android.intent.action.VIEW", android.net.Uri.parse("androidamap://route?sourceApplication=amap&slat=" + center.latitude + "&slon=" + center.longitude + "&sname=我的位置&dlat=" + ll.latitude + "&dlon=" + ll.longitude + "&dname=" + zhan_name + "&dev=0&m=0&t=2")); intent4.setPackage("com.autonavi.minimap"); startActivity(intent4); detailsBack = true; popupWindow.dismiss(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0032", map); map.clear(); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplication(), "请您确认是否安装高德地图APP", Toast.LENGTH_SHORT).show(); } } }); popupWindow.showAtLocation(cancleButton, Gravity.CENTER, 0, 0); } else { Toast.makeText(getApplication(), "没有定位到您的当前位置", Toast.LENGTH_SHORT).show(); } } } }).setNegativeButton("取消", new View.OnClickListener() { @Override public void onClick(View v) { } }).show(); } else { if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap") && !isAvilible(getApplicationContext(), "com.autonavi.minimap")) { if (null == center) { ToastUtil.showToast(getApplicationContext(), "请检查您当前网络或定位权限是否开启", Toast.LENGTH_SHORT); } else { Intent intent = new Intent(getApplication(), BasicNaviActivity.class); intent.putExtra("start_jing", center.longitude + ""); intent.putExtra("start_wei", center.latitude + ""); intent.putExtra("stop_jing", ll.longitude + ""); intent.putExtra("stop_wei", ll.latitude + ""); startActivity(intent); detailsBack = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0033", map); map.clear(); } } else { if (center != null) { LayoutInflater inflater1 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); popupWindowView = inflater1.inflate(R.layout.item_selectmap, null); popupWindow = new PopupWindow(popupWindowView, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, true); popupWindow.setBackgroundDrawable(new BitmapDrawable()); // 设置PopupWindow的弹出和消失效果 popupWindow.setAnimationStyle(R.style.popupAnimation); LinearLayout ll_tvTwo = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvTwo); if (!isAvilible(getApplicationContext(), "com.autonavi.minimap")) { ll_tvTwo.setVisibility(View.GONE); } LinearLayout ll_tvOne = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvOne); if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap")) { ll_tvOne.setVisibility(View.GONE); } cancleButton = (Button) popupWindowView.findViewById(R.id.cancleButton); cancleButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { popupWindow.dismiss(); } }); tvThree = (TextView) popupWindowView.findViewById(R.id.tvThree); tvThree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplication(), BasicNaviActivity.class); intent.putExtra("start_jing", center.longitude + ""); intent.putExtra("start_wei", center.latitude + ""); intent.putExtra("stop_jing", ll.longitude + ""); intent.putExtra("stop_wei", ll.latitude + ""); startActivity(intent); detailsBack = true; popupWindow.dismiss(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0033", map); map.clear(); } }); tvOne = (TextView) popupWindowView.findViewById(R.id.tvOne); tvOne.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = null; int position_jing = poi_jing.length() - poi_jing.indexOf(".") - 1; int position_wei = poi_wei.length() - poi_wei.indexOf(".") - 1; if (position_jing > 13 || position_wei > 13) { getBaidu1(Double.parseDouble(poi_jing), Double.parseDouble(poi_wei)); } else { bd_jing = Double.parseDouble(poi_jing); bd_wei = Double.parseDouble(poi_wei); } getBaidu(center.longitude, center.latitude); try { String s = "intent://map/direction?" + "origin=" + bd_lat + "," + bd_lon + "&" + "destination=" + bd_wei + "," + bd_jing + "&mode=driving&" + "src=充电桩#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end"; intent = Intent.getIntent(s); detailsBack = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0031", map); map.clear(); } catch (URISyntaxException e) { e.printStackTrace(); } startActivity(intent); popupWindow.dismiss(); } }); tvTwo = (TextView) popupWindowView.findViewById(R.id.tvTwo); tvTwo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { Intent intent4 = new Intent("android.intent.action.VIEW", android.net.Uri.parse("androidamap://route?sourceApplication=amap&slat=" + center.latitude + "&slon=" + center.longitude + "&sname=我的位置&dlat=" + ll.latitude + "&dlon=" + ll.longitude + "&dname=" + zhan_name + "&dev=0&m=0&t=2")); intent4.setPackage("com.autonavi.minimap"); startActivity(intent4); detailsBack = true; popupWindow.dismiss(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0032", map); map.clear(); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplication(), "请您确认是否安装高德地图APP", Toast.LENGTH_SHORT).show(); } } }); popupWindow.showAtLocation(cancleButton, Gravity.CENTER, 0, 0); } else { Toast.makeText(getApplication(), "没有定位到您的当前位置", Toast.LENGTH_SHORT).show(); } } } } else if (remind.equals("2")) { new com.electric.chargingpile.view.AlertDialog(MainMapActivity.this).builder() .setTitle("暂时未营业") .setMsg("该站点当前不在营业时间\n" + "可能无法正常充电,是否继续前往") .setPositiveButton("继续", new View.OnClickListener() { @Override public void onClick(View v) { if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap") && !isAvilible(getApplicationContext(), "com.autonavi.minimap")) { Intent intent = new Intent(getApplication(), BasicNaviActivity.class); intent.putExtra("start_jing", center.longitude + ""); intent.putExtra("start_wei", center.latitude + ""); intent.putExtra("stop_jing", ll.longitude + ""); intent.putExtra("stop_wei", ll.latitude + ""); startActivity(intent); detailsBack = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0033", map); map.clear(); } else { if (center != null) { LayoutInflater inflater1 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); popupWindowView = inflater1.inflate(R.layout.item_selectmap, null); popupWindow = new PopupWindow(popupWindowView, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, true); popupWindow.setBackgroundDrawable(new BitmapDrawable()); // 设置PopupWindow的弹出和消失效果 popupWindow.setAnimationStyle(R.style.popupAnimation); LinearLayout ll_tvTwo = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvTwo); if (!isAvilible(getApplicationContext(), "com.autonavi.minimap")) { ll_tvTwo.setVisibility(View.GONE); } LinearLayout ll_tvOne = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvOne); if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap")) { ll_tvOne.setVisibility(View.GONE); } cancleButton = (Button) popupWindowView .findViewById(R.id.cancleButton); cancleButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { popupWindow.dismiss(); } }); tvThree = (TextView) popupWindowView.findViewById(R.id.tvThree); tvThree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplication(), BasicNaviActivity.class); intent.putExtra("start_jing", center.longitude + ""); intent.putExtra("start_wei", center.latitude + ""); intent.putExtra("stop_jing", ll.longitude + ""); intent.putExtra("stop_wei", ll.latitude + ""); startActivity(intent); detailsBack = true; popupWindow.dismiss(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0033", map); map.clear(); } }); tvOne = (TextView) popupWindowView.findViewById(R.id.tvOne); tvOne.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = null; int position_jing = poi_jing.length() - poi_jing.indexOf(".") - 1; int position_wei = poi_wei.length() - poi_wei.indexOf(".") - 1; if (position_jing > 13 || position_wei > 13) { getBaidu1(Double.parseDouble(poi_jing), Double.parseDouble(poi_wei)); } else { bd_jing = Double.parseDouble(poi_jing); bd_wei = Double.parseDouble(poi_wei); } getBaidu(center.longitude, center.latitude); try { String s = "intent://map/direction?" + "origin=" + bd_lat + "," + bd_lon + "&" + "destination=" + bd_wei + "," + bd_jing + "&mode=driving&" + "src=充电桩#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end"; intent = Intent.getIntent(s); detailsBack = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0031", map); map.clear(); } catch (URISyntaxException e) { e.printStackTrace(); } startActivity(intent); popupWindow.dismiss(); } }); tvTwo = (TextView) popupWindowView.findViewById(R.id.tvTwo); tvTwo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { Intent intent4 = new Intent("android.intent.action.VIEW", android.net.Uri.parse("androidamap://route?sourceApplication=amap&slat=" + center.latitude + "&slon=" + center.longitude + "&sname=我的位置&dlat=" + ll.latitude + "&dlon=" + ll.longitude + "&dname=" + zhan_name + "&dev=0&m=0&t=2")); intent4.setPackage("com.autonavi.minimap"); startActivity(intent4); detailsBack = true; popupWindow.dismiss(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0032", map); map.clear(); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplication(), "请您确认是否安装高德地图APP", Toast.LENGTH_SHORT).show(); } } }); popupWindow.showAtLocation(cancleButton, Gravity.CENTER, 0, 0); } else { ToastUtil.showToast(getApplicationContext(), "请检查您当前网络或定位权限是否开启", Toast.LENGTH_SHORT); } } } }).setNegativeButton("取消", new View.OnClickListener() { @Override public void onClick(View v) { } }).show(); } else { new com.electric.chargingpile.view.AlertDialog(MainMapActivity.this).builder() .setTitle("站点故障") .setMsg("该站点充电桩均为离线或故障\n" + "可能无法正常充电,是否继续前往") .setPositiveButton("继续", new View.OnClickListener() { @Override public void onClick(View v) { if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap") && !isAvilible(getApplicationContext(), "com.autonavi.minimap")) { Intent intent = new Intent(getApplication(), BasicNaviActivity.class); intent.putExtra("start_jing", center.longitude + ""); intent.putExtra("start_wei", center.latitude + ""); intent.putExtra("stop_jing", ll.longitude + ""); // Log.e("123", ll.longitude + ""); intent.putExtra("stop_wei", ll.latitude + ""); // Log.e("123", ll.latitude + ""); startActivity(intent); detailsBack = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0033", map); map.clear(); } else { if (center != null) { LayoutInflater inflater1 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); popupWindowView = inflater1.inflate(R.layout.item_selectmap, null); popupWindow = new PopupWindow(popupWindowView, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, true); popupWindow.setBackgroundDrawable(new BitmapDrawable()); // 设置PopupWindow的弹出和消失效果 popupWindow.setAnimationStyle(R.style.popupAnimation); LinearLayout ll_tvTwo = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvTwo); if (!isAvilible(getApplicationContext(), "com.autonavi.minimap")) { ll_tvTwo.setVisibility(View.GONE); } LinearLayout ll_tvOne = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvOne); if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap")) { ll_tvOne.setVisibility(View.GONE); } cancleButton = (Button) popupWindowView .findViewById(R.id.cancleButton); cancleButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Toast.makeText(ZhanDetailsNew.this, "NO", Toast.LENGTH_SHORT).show(); popupWindow.dismiss(); } }); tvThree = (TextView) popupWindowView.findViewById(R.id.tvThree); tvThree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplication(), BasicNaviActivity.class); intent.putExtra("start_jing", center.longitude + ""); intent.putExtra("start_wei", center.latitude + ""); intent.putExtra("stop_jing", ll.longitude + ""); intent.putExtra("stop_wei", ll.latitude + ""); startActivity(intent); detailsBack = true; popupWindow.dismiss(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0033", map); map.clear(); } }); tvOne = (TextView) popupWindowView.findViewById(R.id.tvOne); tvOne.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = null; int position_jing = poi_jing.length() - poi_jing.indexOf(".") - 1; int position_wei = poi_wei.length() - poi_wei.indexOf(".") - 1; if (position_jing > 13 || position_wei > 13) { getBaidu1(Double.parseDouble(poi_jing), Double.parseDouble(poi_wei)); } else { bd_jing = Double.parseDouble(poi_jing); bd_wei = Double.parseDouble(poi_wei); } getBaidu(center.longitude, center.latitude); try { String s = "intent://map/direction?" + "origin=" + bd_lat + "," + bd_lon + "&" + "destination=" + bd_wei + "," + bd_jing + "&mode=driving&" + "src=充电桩#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end"; // Log.e("sss", s); intent = Intent.getIntent(s); detailsBack = true; HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0031", map); map.clear(); } catch (URISyntaxException e) { e.printStackTrace(); } startActivity(intent); popupWindow.dismiss(); } }); tvTwo = (TextView) popupWindowView.findViewById(R.id.tvTwo); tvTwo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { Intent intent4 = new Intent("android.intent.action.VIEW", android.net.Uri.parse("androidamap://route?sourceApplication=amap&slat=" + center.latitude + "&slon=" + center.longitude + "&sname=我的位置&dlat=" + ll.latitude + "&dlon=" + ll.longitude + "&dname=" + zhan_name + "&dev=0&m=0&t=2")); intent4.setPackage("com.autonavi.minimap"); startActivity(intent4); detailsBack = true; popupWindow.dismiss(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", zhan_name); map.put("CostWay", charge_cost_way); map.put("City", city); MobclickAgent.onEvent(context, "0032", map); map.clear(); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplication(), "请您确认是否安装高德地图APP", Toast.LENGTH_SHORT).show(); } } }); popupWindow.showAtLocation(cancleButton, Gravity.CENTER, 0, 0); // startNavi(center, ll); } else { ToastUtil.showToast(getApplicationContext(), "请检查您当前网络或定位权限是否开启", Toast.LENGTH_SHORT); } } } }).setNegativeButton("取消", new View.OnClickListener() { @Override public void onClick(View v) { } }).show(); } } private void zhanGrade(String zhan_id) { long appTime1 = System.currentTimeMillis() / 1000; long updatetime = appTime1 - MainMapActivity.cha - 3; String token = String.valueOf(updatetime); String url = MainApplication.url + "/zhannew/basic/web/index.php/zhanstar/getstar" + "?supplier=星星充电&timer=" + token + "&ver=1.0&zhan_id=" + zhan_id + "&sign=" + Md5Util.md5("supplier=星星充电&timer=" + token + "&zhan_id=" + zhan_id + "&key=661f9efdcb4f46fe7ab5f2e78a705a2a"); // Log.e("zhanGrade===", url); OkHttpUtils.get() .url(url) .build() .execute(new StringCallback() { @Override public void onError(Call call, Exception e) { } @Override public void onResponse(String response) { if (null != response) { // Log.e("zhanGrade===", response); String code = JsonUtils.getKeyResult(response, "code"); String star_num = JsonUtils.getKeyResult(response, "star_level"); if (star_num.equals("") || star_num.equals("0")) { windowGrade.setText("暂无评分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_0xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); } else { String star_level = star_num; double d; d = Double.parseDouble(star_level); String grade = String.format("%.1f", d); if (d > 0 && d < 1) { windowGrade.setText(grade + "分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_05xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); } else if (d >= 1 && d < 1.5) { windowGrade.setText(grade + "分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_1xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); } else if (d >= 1.5 && d < 2) { windowGrade.setText(grade + "分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_15xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); } else if (d >= 2 && d < 2.5) { windowGrade.setText(grade + "分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_2xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); } else if (d >= 2.5 && d < 3) { windowGrade.setText(grade + "分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_25xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); } else if (d >= 3 && d < 3.5) { windowGrade.setText(grade + "分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_3xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); } else if (d >= 3.5 && d < 4) { windowGrade.setText(grade + "分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_35xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); } else if (d >= 4 && d < 4.5) { windowGrade.setText(grade + "分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_4xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); } else if (d >= 4.5 && d < 5) { windowGrade.setText(grade + "分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_45xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); } else { windowGrade.setText(grade + "分"); Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_5xing); rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); windowGrade.setCompoundDrawables(rightDrawable, null, null, null); windowGrade.setCompoundDrawablePadding(dp2px(MainApplication.context, 6)); } } } } }); } private void resetMarker() { if (nMarker != null) { nMarker.hideInfoWindow(); if (current_chargePoint.getOwn_pay().equals("1")) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker1)); } else { if (current_chargePoint.getSuit_car().equals("特斯拉")) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker3)); } else { if (WelcomeActivity.canCost.contains(MainMapActivity.current_chargePoint.getSupplier())) { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker2)); } else { nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker3)); } } } } } 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) { } @Override public void onResponse(String response) { Log.e(TAG, "onResponse: getShareIntegral=" + response); String rtnCode = JsonUtils.getKeyResult(response, "rtnCode"); if (rtnCode.equals("01")) { } else { // ToastUtil.showToast(getApplicationContext(),"分享成功",Toast.LENGTH_SHORT); } } }); } private void getMessageNum() { long appTime1 = System.currentTimeMillis() / 1000; String token = String.valueOf(appTime1); if (MainApplication.msgTime.equals("0")) { MainApplication.firstOpenTime = token; ProfileManager.getInstance().setFirstOpenTime(getApplicationContext(), token); MainApplication.msgTime = token; ProfileManager.getInstance().setSystemMsgTime(getApplicationContext(), token); } String url = MainApplication.url + "/zhannew/basic/web/index.php/question/center?user_id=" + MainApplication.userId + "&timer=" + MainApplication.msgTime + "&phone=" + MainApplication.userPhone + "&password=" + MainApplication.userPassword; // Log.e(TAG, "getMessageNum: url="+url ); OkHttpUtils.get().tag(MainMapActivity.this).url(url).build().connTimeOut(6000).readTimeOut(6000).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)) { String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg"); question_unread = Integer.parseInt(JsonUtils.getKeyResult(rtnMsg, "question_unread")); comment_unread = Integer.parseInt(JsonUtils.getKeyResult(rtnMsg, "comment_unread")); system_unread = Integer.parseInt(JsonUtils.getKeyResult(rtnMsg, "system_unread")); total_unread = question_unread + comment_unread + system_unread; if (total_unread > 0) { tv_msg_num.setVisibility(View.VISIBLE); tv_msg_num.setText(total_unread + ""); } else { tv_msg_num.setVisibility(View.GONE); } } } }); } //Eventbus的方法 @Subscribe(threadMode = ThreadMode.MAIN) public void handleEvent(BaseEvent event) { if (event.getType().equals(BaseConstants.EVENT_SELECT_CITY)) { String locationCity = MainApplication.getInstance().getmCurrentCity(); tv_atCity.setText(locationCity); MainApplication.atCity = locationCity; final LatLng cityLatLng = new LatLng(event.getPoi_lat(), event.getPoi_lon()); new Handler().postDelayed(new Runnable() { @Override public void run() { aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(cityLatLng, 14.0f)); } }, 500); } else { if (!isFirstLoc) { isFirstLoc = true; mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy); aMap.setLocationSource(this);// 设置定位监听 aMap.moveCamera(CameraUpdateFactory.zoomTo(14)); mlocationClient.setLocationListener(this); mlocationClient.startLocation(); } if (!hasLocationPermission()) { requestLocationPermission(); } } } private void showSimpleBottomSheetGrid(final ChargingShareBean chargingShareBean) { 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(MainMapActivity.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, chargingShareBean); break; case TAG_SHARE_WECHAT_MOMENT: share(WechatMoments.NAME, chargingShareBean); break; case TAG_SHARE_QQ: share(QQ.NAME, chargingShareBean); break; } } }).build(); // build. build.show(); } private void share(final String name, ChargingShareBean chargingShareBean) { Platform.ShareParams paramsToShare = new Platform.ShareParams(); paramsToShare.setText(chargingShareBean.getText()); paramsToShare.setTitle(chargingShareBean.getTitle()); paramsToShare.setTitleUrl(chargingShareBean.getUrl()); paramsToShare.setUrl(chargingShareBean.getUrl()); paramsToShare.setImageUrl(chargingShareBean.getIcon()); paramsToShare.setShareType(Platform.SHARE_WEBPAGE); Platform platform = ShareSDK.getPlatform(name); platform.setPlatformActionListener(new PlatformActionListener() { @Override public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) { if (MainApplication.isLogin()) { getShareIntegral(); } // ToastUtil.showToast(getApplicationContext(),"分享成功",Toast.LENGTH_SHORT); } @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); } private void getRecyclerViewData() { String findDate = ProfileManager.getInstance().getFindDate(MainMapActivity.this); if (EmptyUtils.isEmpty(findDate)) { findDate = String.valueOf(System.currentTimeMillis() / 1000); ProfileManager.getInstance().setFindDate(MainMapActivity.this, findDate); } String url = MainApplication.url + "/zhannew/basic/web/index.php/discovery/menu-list"; OkHttpUtils.get().url(url).addParams("timer", findDate).build().execute(new StringCallback() { @Override public void onError(Call call, Exception e) { } @Override public void onResponse(String response) { if (EmptyUtils.isNotEmpty(response)) { String rtnCode = JsonUtils.getKeyResult(response, "rtnCode"); if ("01".equals(rtnCode)) { String data = JsonUtils.getKeyResult(response, "data"); List<FindData> list = JsonUtils.parseToObjectList(data, FindData.class); if (list.size() > 0) { for (FindData findData : list) { if (findData.getUnread().equals("0")) { FindActivity.haveFindMessage = true; iVpoint.setVisibility(View.VISIBLE); return; } } } } } } }); } private void loadDmpData() { OkHttpUtils.get().url(MainApplication.url + "/zhannew/xd_url.php").build().connTimeOut(3000).readTimeOut(3000) .execute(new StringCallback() { @Override public void onError(Call call, Exception e) { e.printStackTrace(); } @Override public void onResponse(String response) { String show_url = JsonUtils.getKeyResult(response, "show_url"); String click_url = JsonUtils.getKeyResult(response, "click_url"); uploadDmp(show_url); sav.setClick_url(click_url); } }); } private void uploadDmp(String url) { url = Util.generateDmpUrl(url); OkHttpUtils.get().url(url).build().connTimeOut(3000).readTimeOut(3000) .execute(new StringCallback() { @Override public void onError(Call call, Exception e) { e.printStackTrace(); } @Override public void onResponse(String response) { } }); } } top-crypto-casino0110/4718040 - Gogs: Go Git Service

Este repositorio está vacío, por favor, ¡vuelva más tarde!