m lines-num-old"> 1573 1579
    }
1574 1580
@ -2262,16 +2268,16 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
2262 2268
        SharedPreferencesUtil sharedPreferencesUtil = new SharedPreferencesUtil(getApplication());
2263 2269
        switch (v.getId()) {
2264 2270
            case R.id.iv_tuijian:
2265
                if (null != center) {
2271
                if (hasLocationPermission()) {
2266 2272
                    MobclickAgent.onEvent(getApplicationContext(), "0111");
2267 2273
                    Intent i = new Intent(getApplicationContext(), RecommendZhanActivity.class);
2268 2274
                    i.putExtra("center_jing", String.valueOf(center.longitude));
2269 2275
                    i.putExtra("center_wei", String.valueOf(center.latitude));
2270 2276
                    startActivity(i);
2277
                    MobclickAgent.onEvent(context, "0068");
2271 2278
                } else {
2272
                    ToastUtil.showToast(getApplicationContext(), "没有获取到您当前的位置,请检查网络或定位权限", Toast.LENGTH_SHORT);
2279
                    requestLocationPermission();
2273 2280
                }
2274
                MobclickAgent.onEvent(context, "0068");
2275 2281
                break;
2276 2282
            case R.id.iv_clear_address:
2277 2283
                tv_search.setText("请输入地址/关键字");
@ -2359,8 +2365,12 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
2359 2365
2360 2366
                break;
2361 2367
            case R.id.iv_route:
2362
                startActivity(new Intent(getApplication(), RoutePlanShowAddressActivity.class));
2363
                MobclickAgent.onEvent(getApplicationContext(), "0112");
2368
                if (hasLocationPermission()) {
2369
                    startActivity(new Intent(getApplication(), RoutePlanShowAddressActivity.class));
2370
                    MobclickAgent.onEvent(getApplicationContext(), "0112");
2371
                } else {
2372
                    requestLocationPermission();
2373
                }
2364 2374
                break;
2365 2375
            case R.id.second_hand_car:
2366 2376
                Intent adfloatIntent = new Intent(this, MyWebViewActivity.class);
@ -2395,6 +2405,11 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
2395 2405
                break;
2396 2406
            //地图&列表切换按钮
2397 2407
            case R.id.iv_list:
2408
                if (!hasLocationPermission()) {
2409
                    requestLocationPermission();
2410
                    return;
2411
                }
2412
2398 2413
                sharedPreferencesUtil.putBoolean("cdz_recommend_more_detail", true);
2399 2414
                String jing, wei;
2400 2415
                if (MainApplication.search_jing != 0.0 && MainApplication.search_wei != 0.0) {
@ -2427,11 +2442,14 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
2427 2442
                if (!isFirstLoc) {
2428 2443
                    isFirstLoc = true;
2429 2444
                    mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy);
2430
                    aMap.setLocationSource(this);// 设置定位监听
2431
                    aMap.setMyLocationEnabled(true);// 是否可触发定位并显示定位层
2432 2445
                    aMap.moveCamera(CameraUpdateFactory.zoomTo(14));
2433 2446
                    mlocationClient.startLocation();
2434 2447
                }
2448
2449
                if (!hasLocationPermission()) {
2450
                    requestLocationPermission();
2451
                }
2452
2435 2453
                windowLayout.setVisibility(View.GONE);
2436 2454
                rl_control.setVisibility(View.VISIBLE);
2437 2455
                ll_open.setVisibility(View.GONE);
@ -2756,30 +2774,27 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
2756 2774
2757 2775
    @Override
2758 2776
    public void onPermissionsGranted(int requestCode, List<String> perms) {
2759
        if (requestCode == RC_CAMERA_PERM) {
2760
            Intent iintent = new Intent(getApplicationContext(), com.google.zxing.client.android.CaptureActivity.class);
2761
            iintent.putExtra("url", MainApplication.url);
2762
            iintent.putExtra("user_id", MainApplication.userId);
2763
            iintent.putExtra("user_password", MainApplication.userPassword);
2764
            iintent.putExtra("user_phone", MainApplication.userPhone);
2765
            iintent.putExtra("cha", MainMapActivity.cha);
2766
            iintent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
2767
            startActivity(iintent);
2768
            overridePendingTransition(0, 0);
2769
        }
2770 2777
    }
2771 2778
2772 2779
    @Override
2773 2780
    public void onPermissionsDenied(int requestCode, List<String> perms) {
2774
2775
//        if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
2776
//            new AppSettingsDialog.Builder(MainMapActivity.this).build().show();
2777
//        }
2778
2779 2781
        if (requestCode == RC_CAMERA_PERM) {
2780 2782
            new AlertDialogCommon(MainMapActivity.this).builder()
2781
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的相机权限,请允许。")
2782
                    .setPositiveButton("去设置", new View.OnClickListener() {
2783
                    .setMsg("扫码充电需要开启位置权限,是否前往开启?")
2784
                    .setPositiveButton("去开启", new View.OnClickListener() {
2785
                        @Override
2786
                        public void onClick(View v) {
2787
                            SystemTypeUtil.goToPermissionManager(MainMapActivity.this);
2788
                        }
2789
                    }).setNegativeButton("取消", new View.OnClickListener() {
2790
                @Override
2791
                public void onClick(View v) {
2792
                }
2793
            }).show();
2794
        } else if (requestCode == RC_Location_PERM) {
2795
            new AlertDialogCommon(MainMapActivity.this).builder()
2796
                    .setMsg("为了定位您的位置,推荐充电桩,充电桩位置路线导航需要开启位置权限,是否前往开启?")
2797
                    .setPositiveButton("去开启", new View.OnClickListener() {
2783 2798
                        @Override
2784 2799
                        public void onClick(View v) {
2785 2800
                            SystemTypeUtil.goToPermissionManager(MainMapActivity.this);
@ -2787,7 +2802,6 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
2787 2802
                    }).setNegativeButton("取消", new View.OnClickListener() {
2788 2803
                @Override
2789 2804
                public void onClick(View v) {
2790
                    android.os.Process.killProcess(android.os.Process.myPid());
2791 2805
                }
2792 2806
            }).show();
2793 2807
        }
@ -2800,13 +2814,24 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
2800 2814
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
2801 2815
    }
2802 2816
2803
    private boolean isPermissionOK() {
2817
    private boolean hasLocationPermission() {
2804 2818
        return EasyPermissions.hasPermissions(this,
2805
                Manifest.permission.CAMERA,
2806
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
2807
                Manifest.permission.READ_EXTERNAL_STORAGE
2819
                Manifest.permission.ACCESS_FINE_LOCATION
2808 2820
        );
2809 2821
    }
2822
    @AfterPermissionGranted(RC_Location_PERM)
2823
    public void requestLocationPermission() {
2824
        if (hasLocationPermission()) {
2825
            mlocationClient.startLocation();
2826
        } else {
2827
            EasyPermissions.requestPermissions(
2828
                    this,
2829
                    "为了定位您的位置,推荐充电桩,充电桩位置路线导航需要开启位置权限,是否前往开启?",
2830
                    RC_Location_PERM,
2831
                    Manifest.permission.ACCESS_FINE_LOCATION);
2832
        }
2833
    }
2834
2810 2835
2811 2836
    private boolean hasCameraPermission() {
2812 2837
        return EasyPermissions.hasPermissions(this, Manifest.permission.CAMERA);
@ -2831,7 +2856,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
2831 2856
        } else {
2832 2857
            EasyPermissions.requestPermissions(
2833 2858
                    this,
2834
                    "扫码充电需要开启摄像头权限,是否前往开启",
2859
                    "扫码充电需要开启相机权限,是否前往开启?",
2835 2860
                    RC_CAMERA_PERM,
2836 2861
                    Manifest.permission.CAMERA);
2837 2862
        }
@ -3252,7 +3277,9 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
3252 3277
            MainApplication.search_wei = wei;
3253 3278
3254 3279
            final LatLng screenCity = new LatLng(wei, jing);
3255
            aMap = mapView.getMap();
3280
            if (aMap == null) {
3281
                setUpMap();
3282
            }
3256 3283
            Util.setMapCustomStyleFile(aMap, getApplicationContext());
3257 3284
            new Handler().postDelayed(new Runnable() {
3258 3285
                @Override
@ -3276,7 +3303,10 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
3276 3303
            double jing = Double.valueOf(data.getStringExtra("jing"));
3277 3304
            double wei = Double.valueOf(data.getStringExtra("wei"));
3278 3305
            final LatLng screenCity = new LatLng(wei, jing);
3279
            aMap = mapView.getMap();
3306
            if (aMap == null) {
3307
                setUpMap();
3308
            }
3309
3280 3310
            Util.setMapCustomStyleFile(aMap, getApplicationContext());
3281 3311
            new Handler().postDelayed(new Runnable() {
3282 3312
                @Override
@ -5683,11 +5713,13 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
5683 5713
                isFirstLoc = true;
5684 5714
                mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy);
5685 5715
                aMap.setLocationSource(this);// 设置定位监听
5686
                aMap.setMyLocationEnabled(true);// 是否可触发定位并显示定位层
5687 5716
                aMap.moveCamera(CameraUpdateFactory.zoomTo(14));
5688 5717
                mlocationClient.setLocationListener(this);
5689 5718
                mlocationClient.startLocation();
5690 5719
            }
5720
            if (!hasLocationPermission()) {
5721
                requestLocationPermission();
5722
            }
5691 5723
        }
5692 5724
    }
5693 5725

+ 4 - 4
app/src/main/java/com/electric/chargingpile/activity/PermissionAgreementActivity.java

@ -94,8 +94,8 @@ public class PermissionAgreementActivity extends Activity implements EasyPermiss
94 94
    public void onPermissionsDenied(int requestCode, List<String> perms) {
95 95
        if (requestCode == RC_PHONE_PERM) {
96 96
            new AlertDialogCommon(PermissionAgreementActivity.this).builder()
97
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的电话使用权限,请允许。")
98
                    .setPositiveButton("去设置", new View.OnClickListener() {
97
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的电话使用权限,是否前往开启?")
98
                    .setPositiveButton("去开启", new View.OnClickListener() {
99 99
                        @Override
100 100
                        public void onClick(View v) {
101 101
                            SystemTypeUtil.goToPermissionManager(PermissionAgreementActivity.this);
@ -108,8 +108,8 @@ public class PermissionAgreementActivity extends Activity implements EasyPermiss
108 108
            }).show();
109 109
        } else if (requestCode == RC_STORAGE_PERM) {
110 110
            new AlertDialogCommon(PermissionAgreementActivity.this).builder()
111
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的存储权限,请允许。")
112
                    .setPositiveButton("去设置", new View.OnClickListener() {
111
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的存储权限,是否前往开启?")
112
                    .setPositiveButton("去开启", new View.OnClickListener() {
113 113
                        @Override
114 114
                        public void onClick(View v) {
115 115
                            SystemTypeUtil.goToPermissionManager(PermissionAgreementActivity.this);

+ 10 - 0
app/src/main/java/com/electric/chargingpile/manager/ProfileManager.java

@ -15,6 +15,7 @@ public class ProfileManager {
15 15
    private static final String KEY_GUIDE = "key_guide";
16 16
    private static final String KEY_PRIVACY_AGREEMENT = "key_privacy_agreement";
17 17
    private static final String KEY_PRIVACY_PERMISSION = "key_privacy_permission";
18
    private static final String KEY_LOCATION_PERMISSION = "key_location_permission";
18 19
    private static final String KEY_TYPE = "key_type";
19 20
    private static final String KEY_USERID = "key_userid";
20 21
    private static final String KEY_USERICON = "key_usericon";
@ -592,6 +593,15 @@ public class ProfileManager {
592 593
                false);
593 594
    }
594 595

596
    public void setRequestLocationPermission(Context context, boolean permission) {
597
        PreferenceManager.getInstance(context).putBoolean(KEY_LOCATION_PERMISSION, permission);
598
    }
599

600
    public boolean getRequestLocationPermission(Context context) {
601
        return PreferenceManager.getInstance(context).getBoolean(KEY_LOCATION_PERMISSION,
602
                false);
603
    }
604

595 605

596 606
    public void setFirstssyd(Context context, boolean firstssyd) {
597 607
        PreferenceManager.getInstance(context).putBoolean(KEY_FIRSTSSYD, firstssyd);

dudu/cdzApp - Gogs: Go Git Service

289 Commits (85396acb186375367fcd00eee65d9807549e6cdc)

Author SHA1 Message Date
  huyuguo 85396acb18 添加站点开发 6 years ago
  huyuguo 5331e99d35 站点气泡页开发完成 6 years ago
  huyuguo 17f36089fa 站点详情修改完成 6 years ago
  huyuguo 5b496a783e 添加新站点 6 years ago
  huyuguo af5b3734eb 关于我们修改完成 6 years ago
  huyuguo 6192d368be 红包功能开发完成 6 years ago
  huyuguo e4c98644ca 红包需求开发 6 years ago
  huyuguo 7ccfd7dd31 内容更新 6 years ago
  huyuguo ae06683ab6 关闭隐私协议,启动站点说明界面 6 years ago
  huyuguo c93823ebbc dmp数据添加 6 years ago
  huyuguo 09987309b1 Merge remote-tracking branch 'origin/change_h5_take_photo' 6 years ago
  huyuguo 84eab5f732 h5页面拍照问题修改 6 years ago
  huyuguo b107dbc225 代码修改 6 years ago
  huyuguo f544c3c6e1 线上版本切换 6 years ago
  huyuguo ad6ab1b304 测试数据显示 6 years ago
  huyuguo 9256f9d717 测试环境配置 6 years ago
  huyuguo 1882ddef5e 删除冗余代码 6 years ago
  huyuguo da50298b50 启屏广告优化 6 years ago
  huyuguo 36c7fba9bb 用户协议与隐私政策 6 years ago
  huyuguo 9014fe157a h5电话拨打问题解决 6 years ago
  huyuguo b7fb0e7bb1 logo更新 6 years ago
  huyuguo 29413f33a0 版本信息更新 6 years ago
  huyuguo b908fbce45 用户隐私协议添加 6 years ago
  huyuguo 72a323bc17 微信支付8.0系统bug修复 6 years ago
  huyuguo a0a472cb3e 找回密码崩溃修复 6 years ago
  huyuguo 04346a6eb5 用户隐私协议添加 6 years ago
  huyuguo 26215b8a71 Delete test.txt 6 years ago
  huyuguo 4b8af94402 Merge branch 'master' of http://59.110.68.162:3000/dudu/cdzApp 6 years ago
  huyuguo 02aa217d17 Create test.txt 6 years ago
  huyuguo 3f53132d2f 支付宝sdk更新 6 years ago
  huyuguo f91342ac03 代码更新 6 years ago
  huyuguo 099ffd484e Update RecommendChargingStationActivity.java 6 years ago
  huyuguo 305724f316 代码更新 6 years ago
  huyuguo 10e0806bc5 bug修改 7 years ago
  huyuguo 72e278b9a8 Update activity_about.xml 7 years ago
  huyuguo 331cbd2b87 推荐列表开发完成 7 years ago
  huyuguo 71b37e5893 列表开发完成 7 years ago
  huyuguo ba1d7c7c07 埋点添加 7 years ago
  huyuguo c7840fa629 智能推荐开发完成 7 years ago
  huyuguo f8ff221448 导航开发完成 7 years ago
  huyuguo 2007eca462 推荐列表开发 7 years ago
  huyuguo 9f927f0d57 列表开发 7 years ago
  huyuguo d495da0a56 推荐功能开发 7 years ago
  huyuguo 7325d16814 代码整理 7 years ago
  huyuguo bdd218f8cd 首页推荐提醒添加 7 years ago
  huyuguo 3e8e0a92ee 关于我们 7 years ago
  huyuguo 3661fc2a83 站点详情页,中间聊聊入口隐藏 7 years ago
  huyuguo 1354e6e3de 首页气泡弹窗,聊聊入口隐藏 7 years ago
  huyuguo 92572f0d54 数据埋点完成 7 years ago
  huyuguo 91d946ab3e flutter配置添加 7 years ago