Parcourir la Source

隐私政策和权限设置调整

huyuguo 4 ans auparavant
Parent
commit
3158c4254a

+ 25 - 20
app/src/main/AndroidManifest.xml

@ -2,8 +2,8 @@
2 2
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    xmlns:tools="http://schemas.android.com/tools"
4 4
    package="com.electric.chargingpile"
5
    android:versionCode="95"
6
    android:versionName="3.5.7">
5
    android:versionCode="96"
6
    android:versionName="3.5.8">
7 7
8 8
    <uses-permission android:name="android.permission.BLUETOOTH" />
9 9
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
@ -81,11 +81,13 @@
81 81
            android:screenOrientation="portrait">
82 82
            <intent-filter>
83 83
                <action android:name="android.intent.action.MAIN" />
84
85 84
                <category android:name="android.intent.category.LAUNCHER" />
86 85
            </intent-filter>
87 86
        </activity>
88 87
        <activity
88
            android:name=".activity.PermissionAgreementActivity"
89
            android:screenOrientation="portrait"></activity>
90
        <activity
89 91
            android:name=".activity.CarModelActivity"
90 92
            android:launchMode="singleTop"
91 93
            android:screenOrientation="portrait" />
@ -809,18 +811,18 @@
809 811
        <!-- Rich push 核心功能 since 2.0.6-->
810 812
        <activity
811 813
            android:name="cn.jpush.android.ui.PopWinActivity"
812
            android:theme="@style/MyDialogStyle"
813
            android:exported="false">
814
        </activity>
814
            android:exported="false"
815
            android:theme="@style/MyDialogStyle"></activity>
815 816
816 817
        <!-- Required SDK核心功能-->
817 818
        <activity
818 819
            android:name="cn.jpush.android.ui.PushActivity"
819 820
            android:configChanges="orientation|keyboardHidden"
820
            android:theme="@android:style/Theme.NoTitleBar"
821
            android:exported="false">
821
            android:exported="false"
822
            android:theme="@android:style/Theme.NoTitleBar">
822 823
            <intent-filter>
823 824
                <action android:name="cn.jpush.android.ui.PushActivity" />
825
824 826
                <category android:name="android.intent.category.DEFAULT" />
825 827
                <category android:name="${applicationId}" />
826 828
            </intent-filter>
@ -841,11 +843,10 @@
841 843
842 844
        <!-- since 3.0.9 Required SDK 核心功能-->
843 845
        <provider
844
            android:authorities="${applicationId}.DataProvider"
845 846
            android:name="cn.jpush.android.service.DataProvider"
846
            android:process=":pushcore"
847
            android:authorities="${applicationId}.DataProvider"
847 848
            android:exported="false"
848
            />
849
            android:process=":pushcore" />
849 850
850 851
        <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
851 852
        <!-- 若不启用该功能可删除该组件,或把 enabled 设置成 false ;App 不会被其他 App 拉起,但会拉起其他的 App。 -->
@ -860,13 +861,14 @@
860 861
        </service>
861 862
862 863
        <!-- 可选,如果使用静态Activity方式拉起,该组件必须声明 -->
863
        <activity android:name="cn.jpush.android.service.DActivity"
864
        <activity
865
            android:name="cn.jpush.android.service.DActivity"
864 866
            android:enabled="true"
865 867
            android:exported="true"
866
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
867
            android:taskAffinity="jpush.custom">
868
            android:taskAffinity="jpush.custom"
869
            android:theme="@android:style/Theme.Translucent.NoTitleBar">
868 870
            <intent-filter>
869
                <action android:name="cn.jpush.android.intent.DActivity"/>
871
                <action android:name="cn.jpush.android.intent.DActivity" />
870 872
                <category android:name="${applicationId}" />
871 873
            </intent-filter>
872 874
        </activity>
@ -885,10 +887,9 @@
885 887
886 888
        <!-- since 3.1.0 Required SDK 核心功能-->
887 889
        <provider
888
            android:authorities="${applicationId}.DownloadProvider"
889 890
            android:name="cn.jpush.android.service.DownloadProvider"
890
            android:exported="true"
891
            />
891
            android:authorities="${applicationId}.DownloadProvider"
892
            android:exported="true" />
892 893
893 894
        <!-- Required SDK核心功能-->
894 895
        <receiver
@ -912,10 +913,14 @@
912 913
        </receiver>
913 914
914 915
        <!-- Required SDK核心功能-->
915
        <receiver android:name="cn.jpush.android.service.AlarmReceiver" android:exported="false"/>
916
        <receiver
917
            android:name="cn.jpush.android.service.AlarmReceiver"
918
            android:exported="false" />
916 919
917 920
        <!-- 3.5.0新增,用于定时展示功能 -->
918
        <receiver android:name="cn.jpush.android.service.SchedulerReceiver" android:exported="false"/>
921
        <receiver
922
            android:name="cn.jpush.android.service.SchedulerReceiver"
923
            android:exported="false" />
919 924
920 925
921 926
        <meta-data

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

@ -0,0 +1,126 @@
1
package com.electric.chargingpile.activity;
2
3
4
import android.Manifest;
5
import android.app.Activity;
6
import android.content.Intent;
7
import android.os.Bundle;
8
import android.view.View;
9
import android.widget.TextView;
10
import androidx.annotation.NonNull;
11
import com.electric.chargingpile.R;
12
import com.electric.chargingpile.manager.ProfileManager;
13
import com.electric.chargingpile.util.BarColorUtil;
14
import com.electric.chargingpile.util.SystemTypeUtil;
15
import com.electric.chargingpile.view.AlertDialogCommon;
16
import java.util.List;
17
import pub.devrel.easypermissions.AfterPermissionGranted;
18
import pub.devrel.easypermissions.EasyPermissions;
19
20
public class PermissionAgreementActivity extends Activity implements EasyPermissions.PermissionCallbacks {
21
22
    private static final int RC_PHONE_PERM = 100;
23
    private static final int RC_STORAGE_PERM = 101;
24
25
    @Override
26
    protected void onCreate(Bundle savedInstanceState) {
27
        super.onCreate(savedInstanceState);
28
        setContentView(R.layout.activity_permission_agreement);
29
        ProfileManager.getInstance().setKeyPermissionAgreement(PermissionAgreementActivity.this, true);
30
        BarColorUtil.initStatusBarColor(PermissionAgreementActivity.this);
31
        initView();
32
    }
33
34
    private void initView() {
35
        TextView agreement_btn = findViewById(R.id.agreement_btn);
36
        agreement_btn.setOnClickListener(new View.OnClickListener() {
37
            @Override
38
            public void onClick(View v) {
39
                requestPhonePermission();
40
            }
41
        });
42
    }
43
44
    @AfterPermissionGranted(RC_PHONE_PERM)
45
    private void requestPhonePermission() {
46
        if (isPhonePermissionOK()) {
47
            requestStoragePermission();
48
        } else {
49
            EasyPermissions.requestPermissions(
50
                    this, "为保证您正常、安全的使用充电桩,需要获取您的电话使用权限,请允许。",
51
                    RC_PHONE_PERM,
52
                    Manifest.permission.READ_PHONE_STATE);
53
        }
54
    }
55
56
    private boolean isPhonePermissionOK() {
57
        return EasyPermissions.hasPermissions(this,
58
                Manifest.permission.READ_PHONE_STATE
59
        );
60
    }
61
62
    @AfterPermissionGranted(RC_STORAGE_PERM)
63
    private void requestStoragePermission() {
64
        if (isStoragePermissionOK()) {
65
                startActivity(new Intent(PermissionAgreementActivity.this, WelcomeActivity.class));
66
                finish();
67
        } else {
68
            EasyPermissions.requestPermissions(
69
                    this, "为保证您正常、安全的使用充电桩,需要获取您的存储权限,请允许。",
70
                    RC_STORAGE_PERM,
71
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
72
                    Manifest.permission.READ_EXTERNAL_STORAGE);
73
        }
74
    }
75
76
    private boolean isStoragePermissionOK() {
77
        return EasyPermissions.hasPermissions(this,
78
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
79
                Manifest.permission.READ_EXTERNAL_STORAGE
80
        );
81
    }
82
83
    @Override
84
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
85
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
86
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
87
    }
88
89
    @Override
90
    public void onPermissionsGranted(int requestCode, List<String> perms) {
91
    }
92
93
    @Override
94
    public void onPermissionsDenied(int requestCode, List<String> perms) {
95
        if (requestCode == RC_PHONE_PERM) {
96
            new AlertDialogCommon(PermissionAgreementActivity.this).builder()
97
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的电话使用权限,请允许。")
98
                    .setPositiveButton("去设置", new View.OnClickListener() {
99
                        @Override
100
                        public void onClick(View v) {
101
                            SystemTypeUtil.goToPermissionManager(PermissionAgreementActivity.this);
102
                        }
103
                    }).setNegativeButton("取消", new View.OnClickListener() {
104
                @Override
105
                public void onClick(View v) {
106
                    android.os.Process.killProcess(android.os.Process.myPid());
107
                }
108
            }).show();
109
        } else if (requestCode == RC_STORAGE_PERM) {
110
            new AlertDialogCommon(PermissionAgreementActivity.this).builder()
111
                    .setMsg("为保证您正常、安全的使用充电桩,需要获取您的存储权限,请允许。")
112
                    .setPositiveButton("去设置", new View.OnClickListener() {
113
                        @Override
114
                        public void onClick(View v) {
115
                            SystemTypeUtil.goToPermissionManager(PermissionAgreementActivity.this);
116
                        }
117
                    }).setNegativeButton("取消", new View.OnClickListener() {
118
                @Override
119
                public void onClick(View v) {
120
                    android.os.Process.killProcess(android.os.Process.myPid());
121
                }
122
            }).show();
123
        }
124
    }
125
126
}

+ 19 - 16
app/src/main/java/com/electric/chargingpile/activity/PrivacyAgreementActivity.java

@ -11,21 +11,15 @@ import android.text.Spanned;
11 11
import android.text.TextPaint;
12 12
import android.text.method.LinkMovementMethod;
13 13
import android.text.style.ClickableSpan;
14
import android.text.style.ForegroundColorSpan;
15 14
import android.text.style.StyleSpan;
16 15
import android.view.View;
17
import android.view.Window;
18
import android.view.WindowManager;
19 16
import android.widget.Button;
20 17
import android.widget.TextView;
21
import android.widget.Toast;
22 18
23 19
import com.electric.chargingpile.R;
24
import com.electric.chargingpile.application.MainApplication;
25 20
import com.electric.chargingpile.manager.ProfileManager;
26 21
import com.electric.chargingpile.util.BarColorUtil;
27
28
import cn.jpush.android.api.JPushInterface;
22
import com.electric.chargingpile.view.AlertDialogCommon;
29 23
30 24
public class PrivacyAgreementActivity extends Activity {
31 25
@ -39,6 +33,9 @@ public class PrivacyAgreementActivity extends Activity {
39 33
        if (ProfileManager.getInstance().getPrivacyAgreement(this)) {
40 34
            startActivity(new Intent(PrivacyAgreementActivity.this, WelcomeActivity.class));
41 35
            finish();
36
        } else if (ProfileManager.getInstance().getPermissionAgreement(PrivacyAgreementActivity.this)) {
37
            startActivity(new Intent(PrivacyAgreementActivity.this, PermissionAgreementActivity.class));
38
            finish();
42 39
        } else {
43 40
            initView();
44 41
        }
@ -47,13 +44,14 @@ public class PrivacyAgreementActivity extends Activity {
47 44
    private void initView() {
48 45
        agree_enter_text_view = findViewById(R.id.agree_enter_text_view);
49 46
50
        String str = "你选择「同意并进入」即表示充分阅读、理解并接受《充电桩APP用户协议和隐私政策》的全部内容"; //23-40 前包括后不包括
47
//        String str = "你选择「同意并进入」即表示充分阅读、理解并接受《充电桩APP用户协议和隐私政策》的全部内容"; //23-40 前包括后不包括
48
        String str = "如您同意《充电桩隐私政策》,请点击「同意」开始使用我们的产品和服务,我们尽全力保护您的个人信息安全"; // 4-13 前包括后不包括
51 49
        //超链接的块对象
52 50
        ClickableSpan clickableSpan = new ClickableSpan() {
53 51
            @Override
54 52
            public void onClick(View widget) {
55 53
                Intent intent = new Intent(getApplication(), MyWebViewActivity.class);
56
                intent.putExtra("url", "http://evcharge.cc/pc/agreement.html");
54
                intent.putExtra("url", "http://evcharge.cc/pc/privacy.html");
57 55
                startActivity(intent);
58 56
            }
59 57
@ -70,8 +68,8 @@ public class PrivacyAgreementActivity extends Activity {
70 68
        SpannableString span = new SpannableString(str);
71 69
        //设置局部效果
72 70
        //(局部的效果对象,局部的起始位置,结束位置,包括方式) INCLUSIVE表示包裹, EXCLUSIVE不包括
73
        span.setSpan(clickableSpan, 23, 40, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);//此处为前包括后不包括
74
        span.setSpan(new StyleSpan(Typeface.BOLD), 3, 10, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
71
        span.setSpan(clickableSpan, 4, 13, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);//此处为前包括后不包括
72
        span.setSpan(new StyleSpan(Typeface.BOLD), 18, 20, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
75 73
        //将文本特效设置到文本框中
76 74
        agree_enter_text_view.setText(span, TextView.BufferType.SPANNABLE);
77 75
        //设置触摸监听的解析对象
@ -82,18 +80,23 @@ public class PrivacyAgreementActivity extends Activity {
82 80
        agreement_btn.setOnClickListener(new View.OnClickListener() {
83 81
            @Override
84 82
            public void onClick(View v) {
85
                startActivity(new Intent(PrivacyAgreementActivity.this, WelcomeActivity.class));
83
                startActivity(new Intent(PrivacyAgreementActivity.this, PermissionAgreementActivity.class));
86 84
                finish();
87 85
            }
88 86
        });
89 87
90
        Button exit_btn = findViewById(R.id.exit_btn);
91
        exit_btn.setOnClickListener(new View.OnClickListener() {
88
        Button disagreement_btn = findViewById(R.id.disagreement_btn);
89
        disagreement_btn.setOnClickListener(new View.OnClickListener() {
92 90
            @Override
93 91
            public void onClick(View v) {
94
                android.os.Process.killProcess(android.os.Process.myPid());
92
                new AlertDialogCommon(PrivacyAgreementActivity.this).builder()
93
                        .setMsg("您需要同意《充电桩隐私协议》方可使用本软件")
94
                        .setPositiveButton("知道了", new View.OnClickListener() {
95
                            @Override
96
                            public void onClick(View v) {
97
                            }
98
                        }).show();
95 99
            }
96 100
        });
97 101
    }
98
99 102
}

+ 10 - 115
app/src/main/java/com/electric/chargingpile/activity/WelcomeActivity.java

@ -48,6 +48,7 @@ import com.electric.chargingpile.util.BarColorUtil;
48 48
import com.electric.chargingpile.util.DES3;
49 49
import com.electric.chargingpile.util.JsonUtils;
50 50
import com.electric.chargingpile.util.OkHttpUtil;
51
import com.electric.chargingpile.util.SystemTypeUtil;
51 52
import com.electric.chargingpile.view.AlertDialogTwo;
52 53
import com.electric.chargingpile.view.ViewPagerAdapter;
53 54
import com.google.gson.Gson;
@ -84,7 +85,7 @@ import okhttp3.Call;
84 85
import pub.devrel.easypermissions.AfterPermissionGranted;
85 86
import pub.devrel.easypermissions.EasyPermissions;
86 87

87
public class WelcomeActivity extends Activity implements OnClickListener, EasyPermissions.PermissionCallbacks {
88
public class WelcomeActivity extends Activity implements OnClickListener {
88 89
    private static final String TAG = "WelcomeActivity";
89 90
    private ViewPager viewPager;
90 91
    private List<View> views;
@ -287,10 +288,14 @@ public class WelcomeActivity extends Activity implements OnClickListener, EasyPe
287 288
        MapsInitializer.sdcardDir = MAP_FILE_PATH;
288 289
        mTimer = new Timer();
289 290
        if (ProfileManager.getInstance().getGuide(this)) {
290
            saveTask();
291
        } else {
291
            new Handler().postDelayed(new Runnable() {
292
                @Override
293
                public void run() {
294
                    eteinit("{\"fun\":\"timer\"}");
295
                }
296
            }, 1000);
292 297

293
            cameraTask();
298
        } else {
294 299
            androidd.setVisibility(View.GONE);
295 300
            ll_1.setVisibility(View.GONE);
296 301
            viewPager = (ViewPager) findViewById(R.id.viewpager);
@ -318,7 +323,6 @@ public class WelcomeActivity extends Activity implements OnClickListener, EasyPe
318 323
    }
319 324

320 325
    private void openNotification() {
321

322 326
        AlertDialog.Builder builder = new AlertDialog.Builder(WelcomeActivity.this);
323 327
        builder.setTitle("\"充电桩\"想给您发送通知");
324 328
        builder.setMessage("\"通知\"可能包括提醒、声音和图标标记。这些可以在\"设置\"中配置。");
@ -326,19 +330,7 @@ public class WelcomeActivity extends Activity implements OnClickListener, EasyPe
326 330
        builder.setPositiveButton("允许", new DialogInterface.OnClickListener() {
327 331
            @Override
328 332
            public void onClick(DialogInterface dialog, int which) {
329
                Intent localIntent = new Intent();
330
                localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
331
                if (Build.VERSION.SDK_INT >= 9) {
332
                    localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
333
                    localIntent.setData(Uri.fromParts("package", WelcomeActivity.this.getPackageName(), null));
334
                } else if (Build.VERSION.SDK_INT <= 8) {
335
                    localIntent.setAction(Intent.ACTION_VIEW);
336

337
                    localIntent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
338

339
                    localIntent.putExtra("com.android.settings.ApplicationPkgName", WelcomeActivity.this.getPackageName());
340
                }
341
                startActivity(localIntent);
333
                SystemTypeUtil.goToPermissionManager(WelcomeActivity.this);
342 334
                dialog.dismiss();
343 335
            }
344 336
        });
@ -668,103 +660,6 @@ public class WelcomeActivity extends Activity implements OnClickListener, EasyPe
668 660
        });
669 661
    }
670 662

671
    @Override
672
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
673
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
674
        // EasyPermissions handles the request result.
675
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
676
    }
677

678
    @Override
679
    public void onPermissionsGranted(int requestCode, List<String> perms) {
680
        for (String s : perms) {
681
            if (s.equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
682
                new Handler().postDelayed(new Runnable() {
683
                    @Override
684
                    public void run() {
685
                        eteinit("{\"fun\":\"timer\"}");
686
                    }
687
                }, 1000);
688
            }
689
            break;
690
        }
691
    }
692

693
    @Override
694
    public void onPermissionsDenied(int requestCode, List<String> perms) {
695
        for (String s : perms) {
696
            if (s.equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
697
                AlertDialog.Builder builder = new AlertDialog.Builder(WelcomeActivity.this);
698
                builder.setMessage("充电桩想要获取您的相关权限,是否允许?");
699
                builder.setCancelable(false);
700
                builder.setPositiveButton("去设置", new DialogInterface.OnClickListener() {
701
                    @Override
702
                    public void onClick(DialogInterface dialog, int which) {
703
                        EasyPermissions.requestPermissions(
704
                                WelcomeActivity.this, "充电桩想要获取您的相关权限,是否允许?",
705
                                RC_SAVE_PERM,
706
                                Manifest.permission.WRITE_EXTERNAL_STORAGE,
707
                                Manifest.permission.READ_EXTERNAL_STORAGE);
708
                    }
709
                });
710
                builder.create().show();
711
            }
712
            break;
713
        }
714
    }
715

716
    @AfterPermissionGranted(RC_CAMERA_PERM)
717
    public void cameraTask() {
718
        if (isPermissionOK()) {
719
        } else {
720
            // Ask for one permission
721
            EasyPermissions.requestPermissions(
722
                    this, "充电桩想要获取您的相关权限,是否允许?",
723
                    RC_CAMERA_PERM,
724
                    Manifest.permission.ACCESS_FINE_LOCATION,
725
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
726
                    Manifest.permission.READ_EXTERNAL_STORAGE,
727
                    Manifest.permission.READ_PHONE_STATE);
728
        }
729
    }
730

731
    @AfterPermissionGranted(RC_SAVE_PERM)
732
    public void saveTask() {
733
        if (isSavePermissionOK()) {
734
            new Handler().postDelayed(new Runnable() {
735
                @Override
736
                public void run() {
737
                    eteinit("{\"fun\":\"timer\"}");
738
                }
739
            }, 1000);
740
            // Have permission, do the thing!
741
        } else {
742
            // Ask for one permission
743
            EasyPermissions.requestPermissions(
744
                    this, "充电桩想要获取您的相关权限,是否允许?",
745
                    RC_CAMERA_PERM,
746
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
747
                    Manifest.permission.READ_EXTERNAL_STORAGE);
748
        }
749
    }
750

751
    private boolean isPermissionOK() {
752
        return EasyPermissions.hasPermissions(this,
753
                Manifest.permission.ACCESS_FINE_LOCATION,
754
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
755
                Manifest.permission.READ_EXTERNAL_STORAGE,
756
                Manifest.permission.READ_PHONE_STATE
757
        );
758
    }
759

760
    private boolean isSavePermissionOK() {
761
        return EasyPermissions.hasPermissions(this,
762
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
763
                Manifest.permission.READ_EXTERNAL_STORAGE
764
        );
765
    }
766

767

768 663
    public static void DeleteFile(File file) {
769 664
        if (file.exists() == false) {
770 665
            return;

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

@ -14,6 +14,7 @@ public class ProfileManager {
14 14
    private static final String KEY_ID = "key_id";
15 15
    private static final String KEY_GUIDE = "key_guide";
16 16
    private static final String KEY_PRIVACY_AGREEMENT = "key_privacy_agreement";
17
    private static final String KEY_PRIVACY_PERMISSION = "key_privacy_permission";
17 18
    private static final String KEY_TYPE = "key_type";
18 19
    private static final String KEY_USERID = "key_userid";
19 20
    private static final String KEY_USERICON = "key_usericon";
@ -582,6 +583,15 @@ public class ProfileManager {
582 583
                false);
583 584
    }
584 585

586
    public void setKeyPermissionAgreement(Context context, boolean guide) {
587
        PreferenceManager.getInstance(context).putBoolean(KEY_PRIVACY_PERMISSION, guide);
588
    }
589

590
    public boolean getPermissionAgreement(Context context) {
591
        return PreferenceManager.getInstance(context).getBoolean(KEY_PRIVACY_PERMISSION,
592
                false);
593
    }
594

585 595

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

+ 2 - 0
app/src/main/java/com/electric/chargingpile/util/SystemTypeUtil.java

@ -123,6 +123,8 @@ public class SystemTypeUtil {
123 123
                e.printStackTrace();
124 124
                context.startActivity(getAppDetailSettingIntent(context));
125 125
            }
126
        } else {
127
            context.startActivity(getAppDetailSettingIntent(context));
126 128
        }
127 129
    }
128 130

+ 189 - 0
app/src/main/java/com/electric/chargingpile/view/AlertDialogCommon.java

@ -0,0 +1,189 @@
1
package com.electric.chargingpile.view;
2
3
import android.app.Dialog;
4
import android.content.Context;
5
import android.text.TextUtils;
6
import android.view.Display;
7
import android.view.Gravity;
8
import android.view.LayoutInflater;
9
import android.view.View;
10
import android.view.View.OnClickListener;
11
import android.view.ViewTreeObserver;
12
import android.view.WindowManager;
13
import android.widget.FrameLayout;
14
import android.widget.LinearLayout;
15
import android.widget.LinearLayout.LayoutParams;
16
import android.widget.TextView;
17
18
import com.electric.chargingpile.R;
19
import com.electric.chargingpile.application.MainApplication;
20
import com.electric.chargingpile.util.ScreenUtils;
21
22
public class AlertDialogCommon {
23
    private Context context;
24
    private Dialog dialog;
25
    private LinearLayout lLayout_bg;
26
    private TextView txt_title;
27
    private TextView txt_msg;
28
    private TextView btn_neg;
29
    private TextView btn_pos;
30
    private View btn_line;
31
    private Display display;
32
    private boolean showTitle = false;
33
    private boolean showMsg = false;
34
    private boolean showPosBtn = false;
35
    private boolean showNegBtn = false;
36
37
    public AlertDialogCommon(Context context) {
38
        this.context = context;
39
        WindowManager windowManager = (WindowManager) context
40
                .getSystemService(Context.WINDOW_SERVICE);
41
        display = windowManager.getDefaultDisplay();
42
    }
43
44
    public AlertDialogCommon builder() {
45
        // 获取Dialog布局
46
        View view = LayoutInflater.from(context).inflate(R.layout.view_alterdialog_common, null);
47
48
        // 获取自定义Dialog布局中的控件
49
        lLayout_bg = (LinearLayout) view.findViewById(R.id.lLayout_bg);
50
        txt_title = (TextView) view.findViewById(R.id.txt_title);
51
        txt_msg = (TextView) view.findViewById(R.id.txt_msg);
52
        btn_neg = (TextView) view.findViewById(R.id.btn_neg);
53
        btn_neg.setVisibility(View.GONE);
54
        btn_pos = (TextView) view.findViewById(R.id.btn_pos);
55
        btn_pos.setVisibility(View.GONE);
56
        btn_line = (View) view.findViewById(R.id.btn_line);
57
58
        // 定义Dialog布局和参数
59
        dialog = new Dialog(context, R.style.AlertDialogStyle);
60
        dialog.setContentView(view);
61
62
        int width = (int) (ScreenUtils.getScreenWidth(MainApplication.context) * 0.75);
63
        // 调整dialog背景大小
64
        lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams(width, LayoutParams.WRAP_CONTENT));
65
        return this;
66
    }
67
68
    public AlertDialogCommon setTitle(String title) {
69
        showTitle = true;
70
        if (TextUtils.isEmpty(title)) {
71
            txt_title.setVisibility(View.GONE);
72
        } else {
73
            txt_title.setText(title);
74
            txt_title.setVisibility(View.VISIBLE);
75
        }
76
        return this;
77
    }
78
79
    public AlertDialogCommon setMsg(String msg) {
80
        showMsg = true;
81
        if (TextUtils.isEmpty(msg)) {
82
            txt_msg.setVisibility(View.GONE);
83
        } else {
84
            txt_msg.setVisibility(View.VISIBLE);
85
            txt_msg.setText(msg);
86
        }
87
        ViewTreeObserver vto = txt_msg.getViewTreeObserver();
88
        vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
89
            @Override
90
            public boolean onPreDraw() {
91
                int lineCount = txt_msg.getLineCount();
92
                if (lineCount == 1) {
93
                    txt_msg.setGravity(Gravity.CENTER);
94
                } else {
95
                    txt_msg.setGravity(Gravity.CENTER | Gravity.LEFT);
96
                }
97
                return true;
98
            }
99
        });
100
        return this;
101
    }
102
103
    public AlertDialogCommon setCancelable(boolean cancel) {
104
        dialog.setCancelable(cancel);
105
        return this;
106
    }
107
108
    public AlertDialogCommon setPositiveButton(String text, final OnClickListener listener) {
109
        showPosBtn = true;
110
        if (TextUtils.isEmpty(text)) {
111
            btn_pos.setVisibility(View.GONE);
112
        } else {
113
            btn_pos.setText(text);
114
            btn_pos.setVisibility(View.VISIBLE);
115
        }
116
        btn_pos.setOnClickListener(new OnClickListener() {
117
            @Override
118
            public void onClick(View v) {
119
                try {
120
                    listener.onClick(v);
121
                    dialog.dismiss();
122
                } catch (Exception e) {
123
                    e.printStackTrace();
124
                }
125
126
            }
127
        });
128
        return this;
129
    }
130
131
    public AlertDialogCommon setNegativeButton(String text, final OnClickListener listener) {
132
        showNegBtn = true;
133
        if (TextUtils.isEmpty(text)) {
134
            btn_neg.setVisibility(View.GONE);
135
            btn_line.setVisibility(View.GONE);
136
        } else {
137
            btn_neg.setText(text);
138
            btn_neg.setVisibility(View.VISIBLE);
139
            btn_line.setVisibility(View.VISIBLE);
140
        }
141
        btn_neg.setOnClickListener(new OnClickListener() {
142
            @Override
143
            public void onClick(View v) {
144
                listener.onClick(v);
145
                dialog.dismiss();
146
            }
147
        });
148
        return this;
149
    }
150
151
    private void setLayout() {
152
        if (!showPosBtn && !showNegBtn) {
153
            btn_pos.setText("确定");
154
            btn_pos.setVisibility(View.VISIBLE);
155
            btn_pos.setOnClickListener(new OnClickListener() {
156
                @Override
157
                public void onClick(View v) {
158
                    dialog.dismiss();
159
                }
160
            });
161
        }
162
163
        if (showPosBtn && showNegBtn) {
164
            btn_pos.setVisibility(View.VISIBLE);
165
            btn_neg.setVisibility(View.VISIBLE);
166
        }
167
168
        if (showPosBtn && !showNegBtn) {
169
            btn_pos.setVisibility(View.VISIBLE);
170
        }
171
172
        if (!showPosBtn && showNegBtn) {
173
            btn_neg.setVisibility(View.VISIBLE);
174
        }
175
    }
176
177
    public void show() {
178
        setLayout();
179
        dialog.show();
180
    }
181
182
    public boolean isShowing() {
183
        if (dialog.isShowing()) {
184
            return true;
185
        } else {
186
            return false;
187
        }
188
    }
189
}

BIN
app/src/main/res/drawable-hdpi/private_camera.png


+ 9 - 0
app/src/main/res/drawable/common_alert_bottom_shape.xml

@ -0,0 +1,9 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:shape="rectangle">
4
    <!-- 圆角 -->
5
    <corners android:radius="8dp" />
6
    <!-- 边框颜色 -->
7
    <!-- 填充色 -->
8
    <solid android:color="#FFFFFF" />
9
</shape>

+ 8 - 0
app/src/main/res/drawable/privacy_disagreement_btn_shape.xml

@ -0,0 +1,8 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:shape="rectangle">
4
5
    <corners android:radius="5dp" /> <!-- 圆角大小 -->
6
    <solid android:color="@color/white" /> <!-- 填充颜色 -->
7
    <stroke android:color="@color/ui_green" android:width="1dp"/>
8
</shape>

+ 234 - 0
app/src/main/res/layout/activity_permission_agreement.xml

@ -0,0 +1,234 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:app="http://schemas.android.com/apk/res-auto"
4
    xmlns:tools="http://schemas.android.com/tools"
5
    android:layout_width="match_parent"
6
    android:layout_height="match_parent"
7
    android:background="@color/white"
8
    tools:context=".activity.PrivacyAgreementActivity">
9
10
    <TextView
11
        android:id="@+id/top_title"
12
        android:layout_width="match_parent"
13
        android:layout_height="wrap_content"
14
        android:layout_marginTop="40dp"
15
        android:paddingLeft="30dp"
16
        android:paddingTop="16dp"
17
        android:paddingBottom="16dp"
18
        android:text="充电桩向您申请如下权限:"
19
        android:textSize="20sp"
20
        app:layout_constraintTop_toTopOf="parent" />
21
22
    <ScrollView
23
        android:layout_width="match_parent"
24
        android:layout_height="0dp"
25
        android:paddingLeft="20dp"
26
        android:paddingRight="20dp"
27
        app:layout_constraintBottom_toTopOf="@id/bottom_btn"
28
        app:layout_constraintTop_toBottomOf="@id/top_title">
29
30
        <LinearLayout
31
            android:layout_width="match_parent"
32
            android:layout_height="match_parent"
33
            android:orientation="vertical">
34
35
            <LinearLayout
36
                android:layout_width="match_parent"
37
                android:layout_height="wrap_content"
38
                android:background="#f7f7f7"
39
                android:orientation="vertical"
40
                android:paddingLeft="15dp"
41
                android:paddingTop="20dp"
42
                android:paddingRight="15dp">
43
44
                <LinearLayout
45
                    android:layout_width="match_parent"
46
                    android:layout_height="wrap_content">
47
48
                    <ImageView
49
                        android:layout_width="20dp"
50
                        android:layout_height="match_parent"
51
                        android:layout_marginRight="10dp"
52
                        android:src="@drawable/private_phone" />
53
54
                    <TextView
55
                        android:layout_width="wrap_content"
56
                        android:layout_height="wrap_content"
57
                        android:text="设备/电话权限"
58
                        android:textColor="#444444"
59
                        android:textSize="16sp"
60
                        android:textStyle="bold" />
61
                </LinearLayout>
62
63
                <TextView
64
                    android:layout_width="match_parent"
65
                    android:layout_height="wrap_content"
66
                    android:layout_marginLeft="30dp"
67
                    android:text="为了保证您正常、安全的使用App,获取唯一设备标识符、运营商网络等软硬件特征信息进行身份验证,防止账号信息被盗"
68
                    android:textColor="#797979"
69
                    android:textSize="14sp" />
70
71
                <View
72
                    android:layout_width="match_parent"
73
                    android:layout_height="1dp"
74
                    android:layout_marginLeft="30dp"
75
                    android:layout_marginTop="20dp"
76
                    android:layout_marginBottom="20dp"
77
                    android:background="#dddddd" />
78
            </LinearLayout>
79
80
            <LinearLayout
81
                android:layout_width="match_parent"
82
                android:layout_height="wrap_content"
83
                android:background="#f7f7f7"
84
                android:orientation="vertical"
85
                android:paddingLeft="15dp"
86
                android:paddingRight="15dp"
87
                android:paddingBottom="15dp">
88
89
                <LinearLayout
90
                    android:layout_width="match_parent"
91
                    android:layout_height="wrap_content">
92
93
                    <ImageView
94
                        android:layout_width="20dp"
95
                        android:layout_height="match_parent"
96
                        android:layout_marginRight="10dp"
97
                        android:src="@drawable/private_storage" />
98
99
                    <TextView
100
                        android:layout_width="wrap_content"
101
                        android:layout_height="wrap_content"
102
                        android:text="存储权限"
103
                        android:textColor="#444444"
104
                        android:textSize="16sp"
105
                        android:textStyle="bold" />
106
                </LinearLayout>
107
108
                <TextView
109
                    android:layout_width="match_parent"
110
                    android:layout_height="wrap_content"
111
                    android:layout_marginLeft="30dp"
112
                    android:text="实现图片或视频的缓存和使用,降低流量消耗"
113
                    android:textColor="#797979"
114
                    android:textSize="14sp" />
115
116
                <View
117
                    android:layout_width="match_parent"
118
                    android:layout_height="1dp"
119
                    android:layout_marginLeft="30dp"
120
                    android:layout_marginTop="20dp"
121
                    android:layout_marginBottom="20dp"
122
                    android:background="#dddddd" />
123
124
            </LinearLayout>
125
126
            <LinearLayout
127
                android:layout_width="match_parent"
128
                android:layout_height="wrap_content"
129
                android:background="#f7f7f7"
130
                android:orientation="vertical"
131
                android:paddingLeft="15dp"
132
                android:paddingRight="15dp">
133
134
                <LinearLayout
135
                    android:layout_width="match_parent"
136
                    android:layout_height="wrap_content">
137
138
                    <ImageView
139
                        android:layout_width="20dp"
140
                        android:layout_height="match_parent"
141
                        android:layout_marginRight="10dp"
142
                        android:src="@drawable/private_location" />
143
144
                    <TextView
145
                        android:layout_width="wrap_content"
146
                        android:layout_height="wrap_content"
147
                        android:text="位置权限"
148
                        android:textColor="#444444"
149
                        android:textSize="16sp"
150
                        android:textStyle="bold" />
151
                </LinearLayout>
152
153
                <TextView
154
                    android:layout_width="match_parent"
155
                    android:layout_height="wrap_content"
156
                    android:layout_marginLeft="30dp"
157
                    android:text="为了定位您的位置,推荐充电桩,充电桩位置路线导航"
158
                    android:textColor="#797979"
159
                    android:textSize="14sp" />
160
161
                <View
162
                    android:layout_width="match_parent"
163
                    android:layout_height="1dp"
164
                    android:layout_marginLeft="30dp"
165
                    android:layout_marginTop="20dp"
166
                    android:layout_marginBottom="20dp"
167
                    android:background="#dddddd" />
168
            </LinearLayout>
169
170
            <LinearLayout
171
                android:layout_width="match_parent"
172
                android:layout_height="wrap_content"
173
                android:background="#f7f7f7"
174
                android:orientation="vertical"
175
                android:paddingLeft="15dp"
176
                android:paddingRight="15dp">
177
178
                <LinearLayout
179
                    android:layout_width="match_parent"
180
                    android:layout_height="wrap_content">
181
182
                    <ImageView
183
                        android:layout_width="20dp"
184
                        android:layout_height="match_parent"
185
                        android:layout_marginRight="10dp"
186
                        android:src="@drawable/private_camera" />
187
188
                    <TextView
189
                        android:layout_width="wrap_content"
190
                        android:layout_height="wrap_content"
191
                        android:text="摄像头权限"
192
                        android:textColor="#444444"
193
                        android:textSize="16sp"
194
                        android:textStyle="bold" />
195
                </LinearLayout>
196
197
                <TextView
198
                    android:layout_width="match_parent"
199
                    android:layout_height="wrap_content"
200
                    android:layout_marginLeft="30dp"
201
                    android:paddingBottom="20dp"
202
                    android:text="用于扫码充电终端二维码启动充电"
203
                    android:textColor="#797979"
204
                    android:textSize="14sp" />
205
            </LinearLayout>
206
207
        </LinearLayout>
208
    </ScrollView>
209
210
    <LinearLayout
211
        android:id="@+id/bottom_btn"
212
        android:layout_width="match_parent"
213
        android:layout_height="wrap_content"
214
        android:orientation="vertical"
215
        android:paddingLeft="20dp"
216
        android:paddingTop="10dp"
217
        android:paddingRight="20dp"
218
        android:paddingBottom="40dp"
219
        app:layout_constraintBottom_toBottomOf="parent">
220
221
        <TextView
222
            android:id="@+id/agreement_btn"
223
            android:layout_width="match_parent"
224
            android:layout_height="40dp"
225
            android:layout_marginTop="15dp"
226
            android:background="@drawable/privacy_agreement_btn_shape"
227
            android:gravity="center"
228
            android:text="知道了"
229
            android:textColor="@color/white"
230
            android:textSize="14sp" />
231
232
    </LinearLayout>
233
234
</androidx.constraintlayout.widget.ConstraintLayout>

+ 56 - 168
app/src/main/res/layout/activity_privacy_agreement.xml

@ -7,180 +7,48 @@
7 7
    android:background="@color/white"
8 8
    tools:context=".activity.PrivacyAgreementActivity">
9 9
10
    <TextView
11
        android:id="@+id/top_title"
12
        android:layout_width="match_parent"
13
        android:layout_height="wrap_content"
14
        android:layout_marginTop="40dp"
15
        android:paddingLeft="30dp"
16
        android:paddingTop="16dp"
17
        android:paddingBottom="16dp"
18
        android:text="充电桩向您申请如下权限:"
19
        android:textSize="20sp"
20
        app:layout_constraintTop_toTopOf="parent" />
21
22 10
    <ScrollView
23 11
        android:layout_width="match_parent"
24 12
        android:layout_height="0dp"
25
        android:paddingLeft="40dp"
26
        android:paddingRight="40dp"
13
        android:paddingLeft="20dp"
14
        android:paddingRight="20dp"
27 15
        app:layout_constraintBottom_toTopOf="@id/bottom_btn"
28
        app:layout_constraintTop_toBottomOf="@id/top_title">
16
        app:layout_constraintTop_toTopOf="parent">
29 17
30 18
        <LinearLayout
31 19
            android:layout_width="match_parent"
32 20
            android:layout_height="match_parent"
33 21
            android:orientation="vertical">
34 22
35
            <LinearLayout
36
                android:layout_width="match_parent"
37
                android:layout_height="wrap_content"
38
                android:background="#f7f7f7"
39
                android:orientation="vertical"
40
                android:paddingLeft="15dp"
41
                android:paddingTop="20dp"
42
                android:paddingRight="15dp">
43
44
                <LinearLayout
45
                    android:layout_width="match_parent"
46
                    android:layout_height="wrap_content">
47
48
                    <ImageView
49
                        android:layout_width="20dp"
50
                        android:layout_height="match_parent"
51
                        android:layout_marginRight="10dp"
52
                        android:src="@drawable/private_phone" />
53
54
                    <TextView
55
                        android:layout_width="wrap_content"
56
                        android:layout_height="wrap_content"
57
                        android:text="电话权限"
58
                        android:textColor="#444444"
59
                        android:textSize="16sp"
60
                        android:textStyle="bold" />
61
                </LinearLayout>
62
63
                <TextView
64
                    android:layout_width="match_parent"
65
                    android:layout_height="wrap_content"
66
                    android:layout_marginLeft="30dp"
67
                    android:text="为了正常识别手机设备、运营商网络和本机手机号,进行手机认证、保证账号安全"
68
                    android:textColor="#797979"
69
                    android:textSize="14sp" />
70
71
                <View
72
                    android:layout_width="match_parent"
73
                    android:layout_height="1dp"
74
                    android:layout_marginLeft="30dp"
75
                    android:layout_marginTop="20dp"
76
                    android:layout_marginBottom="20dp"
77
                    android:background="#dddddd" />
78
            </LinearLayout>
79
80
            <LinearLayout
23
            <ImageView
81 24
                android:layout_width="match_parent"
82 25
                android:layout_height="wrap_content"
83
                android:background="#f7f7f7"
84
                android:orientation="vertical"
85
                android:paddingLeft="15dp"
86
                android:paddingRight="15dp">
87
88
                <LinearLayout
89
                    android:layout_width="match_parent"
90
                    android:layout_height="wrap_content">
91
92
                    <ImageView
93
                        android:layout_width="20dp"
94
                        android:layout_height="match_parent"
95
                        android:layout_marginRight="10dp"
96
                        android:src="@drawable/private_location" />
97
98
                    <TextView
99
                        android:layout_width="wrap_content"
100
                        android:layout_height="wrap_content"
101
                        android:text="位置信息权限"
102
                        android:textColor="#444444"
103
                        android:textSize="16sp"
104
                        android:textStyle="bold" />
105
                </LinearLayout>
106
107
                <TextView
108
                    android:layout_width="match_parent"
109
                    android:layout_height="wrap_content"
110
                    android:layout_marginLeft="30dp"
111
                    android:text="为了定位您的位置,推荐充电桩,充电桩位置路线导航"
112
                    android:textColor="#797979"
113
                    android:textSize="14sp" />
114
115
                <View
116
                    android:layout_width="match_parent"
117
                    android:layout_height="1dp"
118
                    android:layout_marginLeft="30dp"
119
                    android:layout_marginTop="20dp"
120
                    android:layout_marginBottom="20dp"
121
                    android:background="#dddddd" />
122
            </LinearLayout>
123
124
            <LinearLayout
125
                android:layout_width="match_parent"
126
                android:layout_height="wrap_content"
127
                android:background="#f7f7f7"
128
                android:orientation="vertical"
129
                android:paddingLeft="15dp"
130
                android:paddingRight="15dp"
131
                android:paddingBottom="15dp">
132
133
                <LinearLayout
134
                    android:layout_width="match_parent"
135
                    android:layout_height="wrap_content">
136
137
                    <ImageView
138
                        android:layout_width="20dp"
139
                        android:layout_height="match_parent"
140
                        android:layout_marginRight="10dp"
141
                        android:src="@drawable/private_storage" />
142
143
                    <TextView
144
                        android:layout_width="wrap_content"
145
                        android:layout_height="wrap_content"
146
                        android:text="存储权限"
147
                        android:textColor="#444444"
148
                        android:textSize="16sp"
149
                        android:textStyle="bold" />
150
                </LinearLayout>
151
152
                <TextView
153
                    android:layout_width="match_parent"
154
                    android:layout_height="wrap_content"
155
                    android:layout_marginLeft="30dp"
156
                    android:text="实现图片或视频的缓存和使用,降低流量消耗"
157
                    android:textColor="#797979"
158
                    android:textSize="14sp" />
159
160
            </LinearLayout>
26
                android:layout_marginTop="40dp"
27
                android:src="@drawable/icon626" />
161 28
162 29
            <TextView
163
                android:layout_width="match_parent"
164
                android:layout_height="wrap_content"
165
                android:layout_marginTop="20dp"
166
                android:text="同时,充电桩采用严格的数据安全措施保护你的个人信息安全。"
167
                android:textColor="#444444"
168
                android:textSize="14sp" />
30
                android:layout_width="wrap_content"
31
                android:layout_height="match_parent"
32
                android:layout_gravity="center"
33
                android:layout_marginTop="5dp"
34
                android:text="充电桩隐私政策"
35
                android:textColor="@color/color_222222"
36
                android:textSize="24sp" />
169 37
170 38
            <TextView
171
                android:id="@+id/agree_enter_text_view"
172 39
                android:layout_width="match_parent"
173 40
                android:layout_height="wrap_content"
174
                android:layout_marginTop="5dp"
175
                android:textColor="#444444"
176
                android:textSize="14sp" />
41
                android:layout_marginTop="15dp"
42
                android:text="感谢您下载充电桩应用,当您开始使用本软件时,我们可能会对您的部分个人信息进行收集、使用和共享。请您仔细阅读《充电桩隐私政策》并确定了解我们对您个人信息的处理规则,包括:"
43
                android:textColor="@color/color_222222"
44
                android:textSize="16sp" />
177 45
178 46
            <TextView
179 47
                android:layout_width="match_parent"
180 48
                android:layout_height="wrap_content"
181
                android:layout_marginTop="5dp"
182
                android:text="你也可以选择「退出并关闭」,充电桩将无法为你提供产品或服务。"
183
                android:textColor="#444444"
49
                android:layout_marginTop="20dp"
50
                android:text="我们如何收集和使用您的个人信息\n我们如何使用Cookie和同类技术\n我们如何共享、转让、公开披露您的个人信息\n我们如何保护您的个人信息\n您如果管理您的个人信息\未成年人的个人信息保护\n通知和修订\n如何联系我们\n"
51
                android:textColor="@color/color_222222"
184 52
                android:textSize="14sp" />
185 53
        </LinearLayout>
186 54
    </ScrollView>
@ -190,31 +58,51 @@
190 58
        android:layout_width="match_parent"
191 59
        android:layout_height="wrap_content"
192 60
        android:orientation="vertical"
193
        android:paddingLeft="40dp"
61
        android:paddingLeft="20dp"
194 62
        android:paddingTop="20dp"
195
        android:paddingRight="40dp"
196
        android:paddingBottom="20dp"
63
        android:paddingRight="20dp"
64
        android:paddingBottom="40dp"
197 65
        app:layout_constraintBottom_toBottomOf="parent">
198 66
199
        <Button
200
            android:id="@+id/agreement_btn"
67
        <TextView
68
            android:id="@+id/agree_enter_text_view"
201 69
            android:layout_width="match_parent"
202 70
            android:layout_height="wrap_content"
203
            android:layout_marginTop="15dp"
204
            android:background="@drawable/privacy_agreement_btn_shape"
205
            android:text="同意并进入"
206
            android:textColor="@color/white"
71
            android:text="如您同意《充电桩隐私政策》,请点击「同意」开始使用我们的产品和服务,我们尽全力保护您的个人信息安全"
72
            android:textColor="@color/color_222222"
207 73
            android:textSize="14sp" />
208 74
209
        <Button
210
            android:id="@+id/exit_btn"
75
        <LinearLayout
211 76
            android:layout_width="match_parent"
212 77
            android:layout_height="wrap_content"
213
            android:layout_marginTop="15dp"
214
            android:background="@color/transparent"
215
            android:text="退出并关闭 App"
216
            android:textColor="#9c9c9c"
217
            android:textSize="14sp" />
78
            android:orientation="horizontal">
79
80
81
            <Button
82
                android:id="@+id/disagreement_btn"
83
                android:layout_width="match_parent"
84
                android:layout_height="40dp"
85
                android:layout_marginTop="15dp"
86
                android:layout_marginRight="5dp"
87
                android:layout_weight="1"
88
                android:background="@drawable/privacy_disagreement_btn_shape"
89
                android:text="不同意"
90
                android:textColor="@color/ui_green"
91
                android:textSize="14sp" />
92
93
            <Button
94
                android:id="@+id/agreement_btn"
95
                android:layout_width="match_parent"
96
                android:layout_height="40dp"
97
                android:layout_marginLeft="5dp"
98
                android:layout_marginTop="15dp"
99
                android:layout_weight="1"
100
                android:background="@drawable/privacy_agreement_btn_shape"
101
                android:text="同意"
102
                android:textColor="@color/white"
103
                android:textSize="14sp" />
104
        </LinearLayout>
105
218 106
    </LinearLayout>
219 107
220 108
</androidx.constraintlayout.widget.ConstraintLayout>

+ 92 - 0
app/src/main/res/layout/view_alterdialog_common.xml

@ -0,0 +1,92 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:app="http://schemas.android.com/apk/res-auto"
4
    xmlns:tools="http://schemas.android.com/tools"
5
    android:id="@+id/lLayout_bg"
6
    android:layout_width="272dp"
7
    android:layout_height="wrap_content"
8
    android:orientation="vertical">
9
10
    <LinearLayout
11
        android:layout_width="match_parent"
12
        android:layout_height="wrap_content"
13
        android:background="@drawable/common_alert_bottom_shape"
14
        android:orientation="vertical"
15
        android:paddingTop="20dp">
16
17
        <TextView
18
            android:id="@+id/txt_title"
19
            android:layout_width="match_parent"
20
            android:layout_height="wrap_content"
21
            android:paddingLeft="20dp"
22
            android:paddingRight="20dp"
23
            android:textAlignment="center"
24
            android:textColor="#444444"
25
            android:textSize="15sp"
26
            android:visibility="gone"
27
            tools:text="更新提示 3.5.2"
28
            tools:visibility="visible" />
29
30
        <TextView
31
            android:id="@+id/txt_msg"
32
            android:layout_width="match_parent"
33
            android:layout_height="wrap_content"
34
            android:layout_marginLeft="18dp"
35
            android:layout_marginTop="12dp"
36
            android:layout_marginRight="18dp"
37
            android:gravity="center|left"
38
            android:textColor="#444444"
39
            android:textSize="13sp"
40
            android:visibility="gone"
41
            tools:text="1-新增“聊聊”新能源车主社区版块。可以通过短图文和视频的方式,聊聊你的新能源汽车和生活\n\n2-修改已知BUG"
42
            tools:visibility="visible" />
43
44
        <View
45
            android:layout_width="match_parent"
46
            android:layout_height="1dp"
47
            android:layout_marginTop="20dp"
48
            android:background="@color/ui_line" />
49
50
        <LinearLayout
51
            android:layout_width="match_parent"
52
            android:layout_height="40dp"
53
            android:gravity="center_horizontal"
54
            android:orientation="horizontal">
55
56
            <TextView
57
                android:id="@+id/btn_neg"
58
                android:layout_width="match_parent"
59
                android:layout_height="match_parent"
60
                android:layout_weight="1"
61
                android:gravity="center"
62
                android:textColor="#999999"
63
                android:textSize="14sp"
64
                android:visibility="gone"
65
                tools:text="取消"
66
                tools:visibility="visible" />
67
68
            <View
69
                android:id="@+id/btn_line"
70
                android:layout_width="1dp"
71
                android:layout_height="match_parent"
72
                android:background="@color/ui_line"
73
                android:visibility="gone"
74
                tools:visibility="visible" />
75
76
            <TextView
77
                android:id="@+id/btn_pos"
78
                android:layout_width="match_parent"
79
                android:layout_height="match_parent"
80
                android:layout_weight="1"
81
                android:gravity="center"
82
                android:textColor="@color/ui_green"
83
                android:textSize="14sp"
84
                android:visibility="gone"
85
                tools:text="确定"
86
                tools:visibility="visible" />
87
88
        </LinearLayout>
89
    </LinearLayout>
90
91
92
</LinearLayout>