|
@ -28,6 +28,7 @@ import android.os.Environment;
|
28
|
28
|
import android.os.Handler;
|
29
|
29
|
import android.os.Message;
|
30
|
30
|
import android.support.annotation.NonNull;
|
|
31
|
import android.support.annotation.Nullable;
|
31
|
32
|
import android.support.constraint.ConstraintLayout;
|
32
|
33
|
import android.support.v4.app.ActivityCompat;
|
33
|
34
|
import android.support.v4.content.FileProvider;
|
|
@ -85,6 +86,11 @@ import com.blankj.utilcode.util.ActivityUtils;
|
85
|
86
|
import com.blankj.utilcode.util.AppUtils;
|
86
|
87
|
import com.blankj.utilcode.util.EmptyUtils;
|
87
|
88
|
import com.blankj.utilcode.util.LogUtils;
|
|
89
|
import com.bumptech.glide.Glide;
|
|
90
|
import com.bumptech.glide.load.DataSource;
|
|
91
|
import com.bumptech.glide.load.engine.GlideException;
|
|
92
|
import com.bumptech.glide.request.RequestListener;
|
|
93
|
import com.bumptech.glide.request.target.Target;
|
88
|
94
|
import com.electric.chargingpile.R;
|
89
|
95
|
import com.electric.chargingpile.application.MainApplication;
|
90
|
96
|
import com.electric.chargingpile.base.BaseEvent;
|
|
@ -376,6 +382,8 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
|
376
|
382
|
private static final int RC_SAVE_PERM = 124;
|
377
|
383
|
private static final int READ_PHONE_STATE = 125;
|
378
|
384
|
|
|
385
|
private String adfloatUrl = "";
|
|
386
|
|
379
|
387
|
private UpdateDialog updateDialog;
|
380
|
388
|
//标识,用于判断是否只显示一次定位信息和用户重新定位
|
381
|
389
|
private boolean isFirstLoc = true;
|
|
@ -425,26 +433,23 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
|
425
|
433
|
boolean showedPrivateProtocol = sharedPreferencesUtil.hasKey("cdz_private_protocol");
|
426
|
434
|
try {
|
427
|
435
|
String data = JsonUtils.getKeyResult(msg.obj.toString(), "data");
|
428
|
|
// Log.e("data===!!!", msg.obj.toString());
|
429
|
436
|
if (!data.equals("")) {
|
430
|
437
|
|
|
438
|
// 二手车广告
|
|
439
|
String adfloat = JsonUtils.getKeyResult(data, "ad_float");
|
|
440
|
if (adfloat != null || !adfloat.equals("")) {
|
|
441
|
List<Adin> listAdfloat = JsonUtils.parseToObjectList(adfloat, Adin.class);
|
|
442
|
if (listAdfloat.size() > 0) {
|
|
443
|
loadAdfloatImg(listAdfloat.get(0));
|
|
444
|
}
|
|
445
|
}
|
|
446
|
|
431
|
447
|
String adin = JsonUtils.getKeyResult(data, "adin");
|
432
|
448
|
if (null == adin) {
|
433
|
|
// if (gestureguide == true) {
|
434
|
|
// new Handler().postDelayed(new Runnable() {
|
435
|
|
// public void run() {
|
436
|
|
// iv_yindaoye.setVisibility(View.VISIBLE);
|
437
|
|
// }
|
438
|
|
// }, 2000);
|
439
|
|
// }
|
440
|
449
|
if (!showedPrivateProtocol) {
|
441
|
450
|
rl_privacy_protocol.setVisibility(View.VISIBLE);
|
442
|
451
|
}
|
443
|
452
|
} else {
|
444
|
|
// Gson g = new Gson();
|
445
|
|
// List<Adin> ll = g.fromJson(adin, new TypeToken<List<Adin>>() {
|
446
|
|
// }.getType());
|
447
|
|
// Log.e(TAG, "handleMessage: adin" + adin);
|
448
|
453
|
List<Adin> listAdin = JsonUtils.parseToObjectList(adin, Adin.class);
|
449
|
454
|
System.out.print("size:" + listAdin.size());
|
450
|
455
|
if (listAdin.size() > 0) {
|
|
@ -464,17 +469,9 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
|
464
|
469
|
if (!showedPrivateProtocol) {
|
465
|
470
|
rl_privacy_protocol.setVisibility(View.VISIBLE);
|
466
|
471
|
}
|
467
|
|
// if (gestureguide == true) {
|
468
|
|
// new Handler().postDelayed(new Runnable() {
|
469
|
|
// public void run() {
|
470
|
|
// iv_yindaoye.setVisibility(View.VISIBLE);
|
471
|
|
// }
|
472
|
|
// }, 2000);
|
473
|
|
// }
|
474
|
472
|
}
|
475
|
473
|
}
|
476
|
474
|
|
477
|
|
|
478
|
475
|
String version = JsonUtils.getKeyResult(data, "version");
|
479
|
476
|
|
480
|
477
|
com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(version);
|
|
@ -488,27 +485,14 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
|
488
|
485
|
now_versionCode = JsonUtils.getKeyResult(android, "versionCode");
|
489
|
486
|
now_versionName = JsonUtils.getKeyResult(android, "versionName");
|
490
|
487
|
String[] key = now_versionName.split("\\.");
|
491
|
|
// Log.e("key===", key.length - 1 + "");
|
492
|
488
|
if (key.length - 1 > 2) {
|
493
|
489
|
dialogup_other();
|
494
|
490
|
} else {
|
495
|
491
|
dialogup();
|
496
|
492
|
}
|
497
|
|
|
498
|
493
|
}
|
499
|
494
|
|
500
|
|
|
501
|
|
// System.out.println("versionCode " + now_versionCode);
|
502
|
|
// System.out.println("versionName " + now_versionName);
|
503
|
495
|
} else {
|
504
|
|
// if (!ProfileManager.getInstance().getFirstssyd(getActivity())) {
|
505
|
|
// new Handler().postDelayed(new Runnable() {
|
506
|
|
// public void run() {
|
507
|
|
// startActivity(new Intent(getActivity(), ScreenActivity.class));
|
508
|
|
// }
|
509
|
|
// }, 5000);
|
510
|
|
// ProfileManager.getInstance().setFirstssyd(getActivity(), true);
|
511
|
|
// }
|
512
|
496
|
if (!showedPrivateProtocol) {
|
513
|
497
|
rl_privacy_protocol.setVisibility(View.VISIBLE);
|
514
|
498
|
}
|
|
@ -779,6 +763,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
|
779
|
763
|
private TextView windowLabelFreePark;
|
780
|
764
|
private ConstraintLayout windowChat;
|
781
|
765
|
private LatLng markerPosition;
|
|
766
|
private ImageView second_hand_car;
|
782
|
767
|
|
783
|
768
|
|
784
|
769
|
@Override
|
|
@ -1287,8 +1272,10 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
|
1287
|
1272
|
|
1288
|
1273
|
iv_tuijian = (ImageView) findViewById(R.id.iv_tuijian);
|
1289
|
1274
|
iv_route = (ImageView) findViewById(R.id.iv_route);
|
|
1275
|
second_hand_car = findViewById(R.id.second_hand_car);
|
1290
|
1276
|
iv_tuijian.setOnClickListener(this);
|
1291
|
1277
|
iv_route.setOnClickListener(this);
|
|
1278
|
second_hand_car.setOnClickListener(this);
|
1292
|
1279
|
|
1293
|
1280
|
iVpoint = findViewById(R.id.iv_point);
|
1294
|
1281
|
|
|
@ -1588,6 +1575,23 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
|
1588
|
1575
|
}
|
1589
|
1576
|
}
|
1590
|
1577
|
|
|
1578
|
private void loadAdfloatImg(Adin adin) {
|
|
1579
|
adfloatUrl = adin.getUrl();
|
|
1580
|
Glide.with(this).load(MainApplication.url + "/zhannew/uploadfile/" + adin.getIcon()).listener(new RequestListener<Drawable>() {
|
|
1581
|
@Override
|
|
1582
|
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
1583
|
second_hand_car.setVisibility(View.GONE);
|
|
1584
|
return false;
|
|
1585
|
}
|
|
1586
|
|
|
1587
|
@Override
|
|
1588
|
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
1589
|
second_hand_car.setVisibility(View.VISIBLE);
|
|
1590
|
return false;
|
|
1591
|
}
|
|
1592
|
}).into(second_hand_car);
|
|
1593
|
}
|
|
1594
|
|
1591
|
1595
|
/**
|
1592
|
1596
|
* 设置一些amap的属性
|
1593
|
1597
|
*/
|
|
@ -2883,6 +2887,11 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
|
2883
|
2887
|
startActivity(new Intent(getApplication(), RoutePlanShowAddressActivity.class));
|
2884
|
2888
|
MobclickAgent.onEvent(getApplicationContext(), "0112");
|
2885
|
2889
|
break;
|
|
2890
|
case R.id.second_hand_car:
|
|
2891
|
Intent adfloatIntent = new Intent(this, MyWebViewActivity.class);
|
|
2892
|
adfloatIntent.putExtra("url", adfloatUrl);
|
|
2893
|
startActivity(adfloatIntent);
|
|
2894
|
break;
|
2886
|
2895
|
case R.id.iv_roadCondition:
|
2887
|
2896
|
// Intent intenti = new Intent(getApplicationContext(),MyWebViewActivity.class);
|
2888
|
2897
|
// intenti.putExtra("url","http://evcharge.cc/test/test-js-native.html");
|