Browse Source

首页导航权限设置

huyuguo 4 years ago
parent
commit
9ed947b87c

+ 1 - 1
app/src/main/AndroidManifest.xml

3
    xmlns:tools="http://schemas.android.com/tools"
3
    xmlns:tools="http://schemas.android.com/tools"
4
    package="com.electric.chargingpile"
4
    package="com.electric.chargingpile"
5
    android:versionCode="96"
5
    android:versionCode="96"
6
    android:versionName="3.5.8">
6
    android:versionName="3.5.10">
7
7
8
    <uses-permission android:name="android.permission.BLUETOOTH" />
8
    <uses-permission android:name="android.permission.BLUETOOTH" />
9
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
9
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

+ 101 - 69
app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java

22
import android.net.ConnectivityManager;
22
import android.net.ConnectivityManager;
23
import android.net.NetworkInfo;
23
import android.net.NetworkInfo;
24
import android.net.Uri;
24
import android.net.Uri;
25
import android.nfc.Tag;
25
import android.os.Build;
26
import android.os.Build;
26
import android.os.Bundle;
27
import android.os.Bundle;
27
import android.os.Environment;
28
import android.os.Environment;
377
    public static boolean isStatusBack = false;
378
    public static boolean isStatusBack = false;
378
379
379
    private static final int RC_CAMERA_PERM = 123;
380
    private static final int RC_CAMERA_PERM = 123;
380
    private static final int RC_SAVE_PERM = 124;
381
    private static final int RC_Location_PERM = 124;
381
382
382
    private String adfloatUrl = "";
383
    private String adfloatUrl = "";
383
384
916
917
917
        mapView = (MapView) findViewById(R.id.mapView);
918
        mapView = (MapView) findViewById(R.id.mapView);
918
        mapView.onCreate(savedInstanceState);
919
        mapView.onCreate(savedInstanceState);
920
919
        initViews();
921
        initViews();
920
        getRecyclerViewData();
922
        getRecyclerViewData();
921
        File databasePath = getDatabasePath("zhan_list");
923
        File databasePath = getDatabasePath("zhan_list");
1220
1222
1221
        ll_title = (LinearLayout) findViewById(R.id.ll_title);
1223
        ll_title = (LinearLayout) findViewById(R.id.ll_title);
1222
1224
1223
1224
        if (aMap == null) {
1225
        if (aMap == null) {
1225
            aMap = mapView.getMap();
1226
1227
            Util.setMapCustomStyleFile(aMap, getApplicationContext());
1228
            maxZoomLevel = aMap.getMaxZoomLevel();
1229
            minZoomLevel = aMap.getMinZoomLevel();
1230
            MyLocationStyle myLocationStyle = new MyLocationStyle();
1231
            myLocationStyle.myLocationIcon(BitmapDescriptorFactory
1232
                    .fromResource(R.drawable.point_icon));// 设置小蓝点的图标
1233
            myLocationStyle.strokeColor(getResources().getColor(R.color.transparent));
1234
            myLocationStyle.radiusFillColor(getResources().getColor(R.color.transparent));
1235
            aMap.setMyLocationStyle(myLocationStyle);
1236
            mUiSettings = aMap.getUiSettings();
1237
            setUpMap();
1226
            setUpMap();
1238
        }
1227
        }
1239
1228
1240
1241
        iv_find = (ImageView) findViewById(R.id.iv_find);
1229
        iv_find = (ImageView) findViewById(R.id.iv_find);
1242
        iv_main = (ImageView) findViewById(R.id.iv_main);
1230
        iv_main = (ImageView) findViewById(R.id.iv_main);
1243
        iv_screening = (ImageView) findViewById(R.id.iv_screening);
1231
        iv_screening = (ImageView) findViewById(R.id.iv_screening);
1289
     * 设置一些amap的属性
1277
     * 设置一些amap的属性
1290
     */
1278
     */
1291
    private void setUpMap() {
1279
    private void setUpMap() {
1280
        aMap = mapView.getMap();
1281
1282
        Util.setMapCustomStyleFile(aMap, getApplicationContext());
1283
        maxZoomLevel = aMap.getMaxZoomLevel();
1284
        minZoomLevel = aMap.getMinZoomLevel();
1285
        MyLocationStyle myLocationStyle = new MyLocationStyle();
1286
        myLocationStyle.myLocationIcon(BitmapDescriptorFactory
1287
                .fromResource(R.drawable.point_icon));// 设置小蓝点的图标
1288
        myLocationStyle.strokeColor(getResources().getColor(R.color.transparent));
1289
        myLocationStyle.radiusFillColor(getResources().getColor(R.color.transparent));
1290
        aMap.setMyLocationStyle(myLocationStyle);
1291
        mUiSettings = aMap.getUiSettings();
1292
//        aMap.setOnMarkerClickListener(this);// 设置点击marker事件监听器
1292
//        aMap.setOnMarkerClickListener(this);// 设置点击marker事件监听器
1293
1293
1294
        aMap.setOnCameraChangeListener(this);
1294
        aMap.setOnCameraChangeListener(this);
1295
        aMap.setLocationSource(this);// 设置定位监听
1295
        aMap.setLocationSource(this);// 设置定位监听
1296
        aMap.setMyLocationEnabled(true);
1296
        aMap.setOnMapClickListener(this);
1297
        aMap.setOnMapClickListener(this);
1297
        aMap.setOnMarkerClickListener(this);
1298
        aMap.setOnMarkerClickListener(this);
1298
        aMap.setInfoWindowAdapter(this);
1299
        aMap.setInfoWindowAdapter(this);
1370
            if (!isFirstLoc) {
1371
            if (!isFirstLoc) {
1371
                isFirstLoc = true;
1372
                isFirstLoc = true;
1372
                mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy);
1373
                mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy);
1373
                aMap.setLocationSource(this);// 设置定位监听
1374
                aMap.setMyLocationEnabled(true);// 是否可触发定位并显示定位层
1375
                aMap.moveCamera(CameraUpdateFactory.zoomTo(14));
1374
                aMap.moveCamera(CameraUpdateFactory.zoomTo(14));
1376
                mlocationClient.startLocation();
1375
                mlocationClient.startLocation();
1377
            }
1376
            }
1377
            if (!hasLocationPermission()) {
1378
                requestLocationPermission();
1379
            }
1378
            againPoint = "";
1380
            againPoint = "";
1379
            back = "";
1381
            back = "";
1380
        }
1382
        }
1400
        MainApplication.search_wei = wei;
1402
        MainApplication.search_wei = wei;
1401
1403
1402
        final LatLng screenCity = new LatLng(wei, jing);
1404
        final LatLng screenCity = new LatLng(wei, jing);
1403
        aMap = mapView.getMap();
1405
        if (aMap == null) {
1406
            setUpMap();
1407
        }
1408
1404
        Util.setMapCustomStyleFile(aMap, getApplicationContext());
1409
        Util.setMapCustomStyleFile(aMap, getApplicationContext());
1405
        new Handler().postDelayed(new Runnable() {
1410
        new Handler().postDelayed(new Runnable() {
1406
            @Override
1411
            @Override
1428
    protected void onPause() {
1433
    protected void onPause() {
1429
        super.onPause();
1434
        super.onPause();
1430
        mapView.onPause();
1435
        mapView.onPause();
1431
//        Log.e("onPause", "onPause");
1432
        deactivate();
1433
    }
1436
    }
1434
1437
1438
    @Override
1439
    public void deactivate() {
1440
        mListener = null;
1441
        if (mlocationClient != null) {
1442
            mlocationClient.stopLocation();
1443
            mlocationClient.onDestroy();
1444
        }
1445
        mlocationClient = null;
1446
    }
1447
1448
1449
1435
    /**
1450
    /**
1436
     * 方法必须重写
1451
     * 方法必须重写
1437
     */
1452
     */
1492
            // 在单次定位情况下,定位无论成功与否,都无需调用stopLocation()方法移除请求,定位sdk内部会移除
1507
            // 在单次定位情况下,定位无论成功与否,都无需调用stopLocation()方法移除请求,定位sdk内部会移除
1493
            // 设置是否只定位一次,默认为false
1508
            // 设置是否只定位一次,默认为false
1494
            mLocationOption.setOnceLocation(false);
1509
            mLocationOption.setOnceLocation(false);
1495
1496
            //设置是否强制刷新WIFI,默认为强制刷新
1510
            //设置是否强制刷新WIFI,默认为强制刷新
1497
            //mLocationOption.setWifiActiveScan(false);
1511
            //mLocationOption.setWifiActiveScan(false);
1498
            mLocationOption.setWifiScan(true);
1512
            mLocationOption.setWifiScan(true);
1499
            mlocationClient.startLocation();
1500
        }
1501
    }
1502
1513
1503
    @Override
1504
    public void deactivate() {
1505
        mListener = null;
1506
        if (mlocationClient != null) {
1507
            mlocationClient.stopLocation();
1508
            mlocationClient.onDestroy();
1514
            if (!ProfileManager.getInstance().getRequestLocationPermission(MainMapActivity.this)) {
1515
                requestLocationPermission();
1516
                ProfileManager.getInstance().setRequestLocationPermission(MainMapActivity.this, true);
1517
            }
1509
        }
1518
        }
1510
        mlocationClient = null;
1511
    }
1519
    }
1512
1520
1513
    @Override
1521
    @Override
1564
                }
1572
                }
1565
            } else {
1573
            } else {
1566
                String errText = "定位失败," + amapLocation.getErrorCode() + ": " + amapLocation.getErrorInfo();
1574
                String errText = "定位失败," + amapLocation.getErrorCode() + ": " + amapLocation.getErrorInfo();
1567
//                Log.e("AmapErr", errText);
1568
//                mLocationErrText.setVisibility(View.VISIBLE);
1569
                Toast.makeText(this, errText, Toast.LENGTH_SHORT).show();
1575
                Log.e(TAG, errText);
1576
                Toast.makeText(this, "定位失败", Toast.LENGTH_SHORT).show();
1570
            }
1577
            }
1571
1572
        }
1578
        }
1573
    }
1579
    }
1574
1580
2262
        SharedPreferencesUtil sharedPreferencesUtil = new SharedPreferencesUtil(getApplication());
2268
        SharedPreferencesUtil sharedPreferencesUtil = new SharedPreferencesUtil(getApplication());
2263
        switch (v.getId()) {
2269
        switch (v.getId()) {
2264
            case R.id.iv_tuijian:
2270
            case R.id.iv_tuijian:
2265
                if (null != center) {
2271
                if (hasLocationPermission()) {
2266
                    MobclickAgent.onEvent(getApplicationContext(), "0111");
2272
                    MobclickAgent.onEvent(getApplicationContext(), "0111");
2267
                    Intent i = new Intent(getApplicationContext(), RecommendZhanActivity.class);
2273
                    Intent i = new Intent(getApplicationContext(), RecommendZhanActivity.class);
2268
                    i.putExtra("center_jing", String.valueOf(center.longitude));
2274
                    i.putExtra("center_jing", String.valueOf(center.longitude));
2269
                    i.putExtra("center_wei", String.valueOf(center.latitude));
2275
                    i.putExtra("center_wei", String.valueOf(center.latitude));
2270
                    startActivity(i);
2276
                    startActivity(i);
2277
                    MobclickAgent.onEvent(context, "0068");
2271
                } else {
2278
                } else {
2272
                    ToastUtil.showToast(getApplicationContext(), "没有获取到您当前的位置,请检查网络或定位权限", Toast.LENGTH_SHORT);
2279
                    requestLocationPermission();
2273
                }
2280
                }
2274
                MobclickAgent.onEvent(context, "0068");
2275
                break;
2281
                break;
2276
            case R.id.iv_clear_address:
2282
            case R.id.iv_clear_address:
2277
                tv_search.setText("请输入地址/关键字");
2283
                tv_search.setText("请输入地址/关键字");
2359
2365
2360
                break;
2366
                break;
2361
            case R.id.iv_route:
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
                break;
2374
                break;
2365
            case R.id.second_hand_car:
2375
            case R.id.second_hand_car:
2366
                Intent adfloatIntent = new Intent(this, MyWebViewActivity.class);
2376
                Intent adfloatIntent = new Intent(this, MyWebViewActivity.class);
2395
                break;
2405
                break;
2396
            //地图&列表切换按钮
2406
            //地图&列表切换按钮
2397
            case R.id.iv_list:
2407
            case R.id.iv_list:
2408
                if (!hasLocationPermission()) {
2409
                    requestLocationPermission();
2410
                    return;
2411
                }
2412
2398
                sharedPreferencesUtil.putBoolean("cdz_recommend_more_detail", true);
2413
                sharedPreferencesUtil.putBoolean("cdz_recommend_more_detail", true);
2399
                String jing, wei;
2414
                String jing, wei;
2400
                if (MainApplication.search_jing != 0.0 && MainApplication.search_wei != 0.0) {
2415
                if (MainApplication.search_jing != 0.0 && MainApplication.search_wei != 0.0) {
2427
                if (!isFirstLoc) {
2442
                if (!isFirstLoc) {
2428
                    isFirstLoc = true;
2443
                    isFirstLoc = true;
2429
                    mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy);
2444
                    mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy);
2430
                    aMap.setLocationSource(this);// 设置定位监听
2431
                    aMap.setMyLocationEnabled(true);// 是否可触发定位并显示定位层
2432
                    aMap.moveCamera(CameraUpdateFactory.zoomTo(14));
2445
                    aMap.moveCamera(CameraUpdateFactory.zoomTo(14));
2433
                    mlocationClient.startLocation();
2446
                    mlocationClient.startLocation();
2434
                }
2447
                }
2448
2449
                if (!hasLocationPermission()) {
2450
                    requestLocationPermission();
2451
                }
2452
2435
                windowLayout.setVisibility(View.GONE);
2453
                windowLayout.setVisibility(View.GONE);
2436
                rl_control.setVisibility(View.VISIBLE);
2454
                rl_control.setVisibility(View.VISIBLE);
2437
                ll_open.setVisibility(View.GONE);
2455
                ll_open.setVisibility(View.GONE);
2756
2774
2757
    @Override
2775
    @Override
2758
    public void onPermissionsGranted(int requestCode, List<String> perms) {
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
    @Override
2779
    @Override
2773
    public void onPermissionsDenied(int requestCode, List<String> perms) {
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
        if (requestCode == RC_CAMERA_PERM) {
2781
        if (requestCode == RC_CAMERA_PERM) {
2780
            new AlertDialogCommon(MainMapActivity.this).builder()
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
                        @Override
2798
                        @Override
2784
                        public void onClick(View v) {
2799
                        public void onClick(View v) {
2785
                            SystemTypeUtil.goToPermissionManager(MainMapActivity.this);
2800
                            SystemTypeUtil.goToPermissionManager(MainMapActivity.this);
2787
                    }).setNegativeButton("取消", new View.OnClickListener() {
2802
                    }).setNegativeButton("取消", new View.OnClickListener() {
2788
                @Override
2803
                @Override
2789
                public void onClick(View v) {
2804
                public void onClick(View v) {
2790
                    android.os.Process.killProcess(android.os.Process.myPid());
2791
                }
2805
                }
2792
            }).show();
2806
            }).show();
2793
        }
2807
        }
2800
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
2814
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
2801
    }
2815
    }
2802
2816
2803
    private boolean isPermissionOK() {
2817
    private boolean hasLocationPermission() {
2804
        return EasyPermissions.hasPermissions(this,
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
    private boolean hasCameraPermission() {
2836
    private boolean hasCameraPermission() {
2812
        return EasyPermissions.hasPermissions(this, Manifest.permission.CAMERA);
2837
        return EasyPermissions.hasPermissions(this, Manifest.permission.CAMERA);
2831
        } else {
2856
        } else {
2832
            EasyPermissions.requestPermissions(
2857
            EasyPermissions.requestPermissions(
2833
                    this,
2858
                    this,
2834
                    "扫码充电需要开启摄像头权限,是否前往开启",
2859
                    "扫码充电需要开启相机权限,是否前往开启?",
2835
                    RC_CAMERA_PERM,
2860
                    RC_CAMERA_PERM,
2836
                    Manifest.permission.CAMERA);
2861
                    Manifest.permission.CAMERA);
2837
        }
2862
        }
3252
            MainApplication.search_wei = wei;
3277
            MainApplication.search_wei = wei;
3253
3278
3254
            final LatLng screenCity = new LatLng(wei, jing);
3279
            final LatLng screenCity = new LatLng(wei, jing);
3255
            aMap = mapView.getMap();
3280
            if (aMap == null) {
3281
                setUpMap();
3282
            }
3256
            Util.setMapCustomStyleFile(aMap, getApplicationContext());
3283
            Util.setMapCustomStyleFile(aMap, getApplicationContext());
3257
            new Handler().postDelayed(new Runnable() {
3284
            new Handler().postDelayed(new Runnable() {
3258
                @Override
3285
                @Override
3276
            double jing = Double.valueOf(data.getStringExtra("jing"));
3303
            double jing = Double.valueOf(data.getStringExtra("jing"));
3277
            double wei = Double.valueOf(data.getStringExtra("wei"));
3304
            double wei = Double.valueOf(data.getStringExtra("wei"));
3278
            final LatLng screenCity = new LatLng(wei, jing);
3305
            final LatLng screenCity = new LatLng(wei, jing);
3279
            aMap = mapView.getMap();
3306
            if (aMap == null) {
3307
                setUpMap();
3308
            }
3309
3280
            Util.setMapCustomStyleFile(aMap, getApplicationContext());
3310
            Util.setMapCustomStyleFile(aMap, getApplicationContext());
3281
            new Handler().postDelayed(new Runnable() {
3311
            new Handler().postDelayed(new Runnable() {
3282
                @Override
3312
                @Override
5683
                isFirstLoc = true;
5713
                isFirstLoc = true;
5684
                mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy);
5714
                mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy);
5685
                aMap.setLocationSource(this);// 设置定位监听
5715
                aMap.setLocationSource(this);// 设置定位监听
5686
                aMap.setMyLocationEnabled(true);// 是否可触发定位并显示定位层
5687
                aMap.moveCamera(CameraUpdateFactory.zoomTo(14));
5716
                aMap.moveCamera(CameraUpdateFactory.zoomTo(14));
5688
                mlocationClient.setLocationListener(this);
5717
                mlocationClient.setLocationListener(this);
5689
                mlocationClient.startLocation();
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
    public void onPermissionsDenied(int requestCode, List<String> perms) {
94
    public void onPermissionsDenied(int requestCode, List<String> perms) {
95
        if (requestCode == RC_PHONE_PERM) {
95
        if (requestCode == RC_PHONE_PERM) {
96
            new AlertDialogCommon(PermissionAgreementActivity.this).builder()
96
            new AlertDialogCommon(PermissionAgreementActivity.this).builder()
97
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的电话使用权限,请允许。")
98
                    .setPositiveButton("去设置", new View.OnClickListener() {
97
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的电话使用权限,是否前往开启?")
98
                    .setPositiveButton("去开启", new View.OnClickListener() {
99
                        @Override
99
                        @Override
100
                        public void onClick(View v) {
100
                        public void onClick(View v) {
101
                            SystemTypeUtil.goToPermissionManager(PermissionAgreementActivity.this);
101
                            SystemTypeUtil.goToPermissionManager(PermissionAgreementActivity.this);
108
            }).show();
108
            }).show();
109
        } else if (requestCode == RC_STORAGE_PERM) {
109
        } else if (requestCode == RC_STORAGE_PERM) {
110
            new AlertDialogCommon(PermissionAgreementActivity.this).builder()
110
            new AlertDialogCommon(PermissionAgreementActivity.this).builder()
111
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的存储权限,请允许。")
112
                    .setPositiveButton("去设置", new View.OnClickListener() {
111
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的存储权限,是否前往开启?")
112
                    .setPositiveButton("去开启", new View.OnClickListener() {
113
                        @Override
113
                        @Override
114
                        public void onClick(View v) {
114
                        public void onClick(View v) {
115
                            SystemTypeUtil.goToPermissionManager(PermissionAgreementActivity.this);
115
                            SystemTypeUtil.goToPermissionManager(PermissionAgreementActivity.this);

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

15
    private static final String KEY_GUIDE = "key_guide";
15
    private static final String KEY_GUIDE = "key_guide";
16
    private static final String KEY_PRIVACY_AGREEMENT = "key_privacy_agreement";
16
    private static final String KEY_PRIVACY_AGREEMENT = "key_privacy_agreement";
17
    private static final String KEY_PRIVACY_PERMISSION = "key_privacy_permission";
17
    private static final String KEY_PRIVACY_PERMISSION = "key_privacy_permission";
18
    private static final String KEY_LOCATION_PERMISSION = "key_location_permission";
18
    private static final String KEY_TYPE = "key_type";
19
    private static final String KEY_TYPE = "key_type";
19
    private static final String KEY_USERID = "key_userid";
20
    private static final String KEY_USERID = "key_userid";
20
    private static final String KEY_USERICON = "key_usericon";
21
    private static final String KEY_USERICON = "key_usericon";
592
                false);
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
    public void setFirstssyd(Context context, boolean firstssyd) {
606
    public void setFirstssyd(Context context, boolean firstssyd) {
597
        PreferenceManager.getInstance(context).putBoolean(KEY_FIRSTSSYD, firstssyd);
607
        PreferenceManager.getInstance(context).putBoolean(KEY_FIRSTSSYD, firstssyd);