浏览代码

完成App内部更新

hy 1 年之前
父节点
当前提交
25ddb62bb8

+ 4 - 3
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="104"
6
    android:versionName="3.5.18">
5
    android:versionCode="105"
6
    android:versionName="3.5.19">
7 7
8 8
   <!-- <uses-permission android:name="android.permission.BLUETOOTH" />
9 9
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />-->
@ -76,7 +76,6 @@
76 76
    <application
77 77
        android:extractNativeLibs="true"
78 78
        android:name=".application.MainApplication"
79
        android:allowBackup="true"
80 79
        android:icon="@drawable/icon626"
81 80
        android:label="@string/app_name"
82 81
        android:largeHeap="true"
@ -84,6 +83,8 @@
84 83
        android:requestLegacyExternalStorage="true"
85 84
        android:resizeableActivity="true"
86 85
        android:theme="@style/AppTheme"
86
        tools:replace="android:allowBackup"
87
        android:allowBackup="false"
87 88
        tools:ignore="LockedOrientationActivity">
88 89
        <activity
89 90
            android:name=".activity.CarOwnerCertificateListActivity"

+ 20 - 1
app/src/main/java/com/electric/chargingpile/activity/CarOwnerCertificateActivity.java

@ -15,11 +15,13 @@ import android.graphics.drawable.Drawable;
15 15
import android.net.Uri;
16 16
import android.os.Build;
17 17
import android.os.Bundle;
18
import android.text.Html;
18 19
import android.text.TextUtils;
19 20
import android.util.Base64;
20 21
import android.view.View;
21 22
import android.view.WindowManager;
22 23
import android.widget.Button;
24
import android.widget.CheckBox;
23 25
import android.widget.EditText;
24 26
import android.widget.ImageView;
25 27
import android.widget.LinearLayout;
@ -30,6 +32,7 @@ import com.bumptech.glide.Glide;
30 32
import com.bumptech.glide.load.engine.DiskCacheStrategy;
31 33
import com.bumptech.glide.request.target.CustomTarget;
32 34
import com.bumptech.glide.request.transition.Transition;
35
import com.electric.chargingpile.BuildConfig;
33 36
import com.electric.chargingpile.R;
34 37
import com.electric.chargingpile.application.MainApplication;
35 38
import com.electric.chargingpile.data.CarOwnerCertificateBean;
@ -82,6 +85,8 @@ import okhttp3.Call;
82 85
import pub.devrel.easypermissions.AfterPermissionGranted;
83 86
import pub.devrel.easypermissions.EasyPermissions;
84 87
88
import static android.text.Html.FROM_HTML_MODE_LEGACY;
89
85 90
/**
86 91
 * 车主认证
87 92
 */
@ -99,7 +104,7 @@ public class CarOwnerCertificateActivity extends AppCompatActivity implements Vi
99 104
    private TextImageView driving_license_type_first;
100 105
    private TextImageView driving_license_type_second;
101 106
    private TextImageView driving_license_type_third;
102
    private TextView add_car_model_btn;
107
    private TextView add_car_model_btn,tvAuthorize;
103 108
    private LoadingDialog loadDialog;
104 109
    private ArrayList<CarBrandGroupEntity> groups;
105 110
    private CarModelEntity carModelEntity;
@ -118,6 +123,7 @@ public class CarOwnerCertificateActivity extends AppCompatActivity implements Vi
118 123
    private EditText plate_num;
119 124
    private EditText engine_num;
120 125
    private EditText register_date;
126
    private CheckBox checkBox;
121 127
122 128
    private String drivingLicenseBase64Data;
123 129
    private Boolean edit;
@ -160,6 +166,8 @@ public class CarOwnerCertificateActivity extends AppCompatActivity implements Vi
160 166
        });
161 167
162 168
        add_car_model_btn = findViewById(R.id.add_car_model_btn);
169
        checkBox = findViewById(R.id.checkBox);
170
        tvAuthorize = findViewById(R.id.tvAuthorize);
163 171
        car_model_constraint_layout = findViewById(R.id.car_model_constraint_layout);
164 172
        car_model_selected_constraint_layout = findViewById(R.id.car_model_selected_constraint_layout);
165 173
        add_car_model_btn.setOnClickListener(this);
@ -245,6 +253,12 @@ public class CarOwnerCertificateActivity extends AppCompatActivity implements Vi
245 253
        } else {
246 254
            nav_title.setText("车主认证");
247 255
        }
256
        tvAuthorize.setText(Html.fromHtml("勾选后,即您同意<font color='#3EC34C'>《个人信息处理授权书》</font>并确认授权", FROM_HTML_MODE_LEGACY));
257
        tvAuthorize.setOnClickListener(v->{
258
            Intent intent = new Intent(getApplication(), MyWebViewActivity.class);
259
            intent.putExtra("url", "https://www.d1ev.com/special/change-map/authorization-agreement.html");
260
            startActivity(intent);
261
        });
248 262
    }
249 263
250 264
    private void brandListRequest(Boolean showLoading) {
@ -552,6 +566,11 @@ public class CarOwnerCertificateActivity extends AppCompatActivity implements Vi
552 566
    }
553 567
554 568
    private void  addCarOwnerCertification() {
569
        if (!checkBox.isChecked()){
570
            ToastUtil.showToast(this, "请阅读授权协议并勾选确认", Toast.LENGTH_SHORT);
571
            return;
572
        }
573
555 574
        if (carModelEntity == null) {
556 575
            ToastUtil.showToast(this, "请添加车型", Toast.LENGTH_SHORT);
557 576
            return;

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

@ -114,13 +114,10 @@ public class CarOwnerCertificateListActivity extends AppCompatActivity {
114 114
        });
115 115
116 116
        LinearLayout join_car_friends_group = findViewById(R.id.join_car_friends_group);
117
        join_car_friends_group.setOnClickListener(new View.OnClickListener() {
118
            @Override
119
            public void onClick(View v) {
120
                Intent i = new Intent(getApplication(), MyWebViewActivity.class);
121
                i.putExtra("url", "https://cdz.evcharge.cc/zhannew/share/share-2.html");
122
                startActivity(i);
123
            }
117
        join_car_friends_group.setOnClickListener(v -> {
118
            Intent i = new Intent(getApplication(), MyWebViewActivity.class);
119
            i.putExtra("url", " http://fans.d1ev.com");
120
            startActivity(i);
124 121
        });
125 122
    }
126 123

+ 32 - 26
app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java

@ -157,6 +157,7 @@ import com.zhy.autolayout.AutoLayout;
157 157
import com.zhy.http.okhttp.OkHttpUtils;
158 158
import com.zhy.http.okhttp.callback.FileCallBack;
159 159
import com.zhy.http.okhttp.callback.StringCallback;
160
import com.zhy.http.okhttp.request.RequestCall;
160 161
161 162
import org.greenrobot.eventbus.Subscribe;
162 163
import org.greenrobot.eventbus.ThreadMode;
@ -496,12 +497,16 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
496 497
                                now_versionCode = JsonUtils.getKeyResult(android, "versionCode");
497 498
                                now_versionName = JsonUtils.getKeyResult(android, "versionName");
498 499
                                String[] key = now_versionName.split("\\.");
499
                                if (key.length - 1 > 2) {
500
                                int code = Integer.parseInt(now_versionCode);
501
                                if (code - getVersionCode(getApplication()) > 0) {
500 502
                                    permissionTask();
501
                                } else {
502
                                    dialogup();
503
//                                    permissionTask();
504 503
                                }
504
//                                if (key.length - 1 > 2) {
505
//                                permissionTask();
506
//                                } else {
507
//                                    dialogup();
508
//                                    permissionTask();
509
//                                }
505 510
                            }
506 511
507 512
                        }
@ -719,6 +724,8 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
719 724
    private TextView tvNotification;
720 725
    private RelativeLayout layoutNotification;
721 726
    private boolean isShowNotification= false;
727
    private RequestCall downloadCall;
728
722 729
    @Override
723 730
    protected void onCreate(Bundle savedInstanceState) {
724 731
        super.onCreate(savedInstanceState);
@ -3427,7 +3434,13 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
3427 3434
3428 3435
    private void showProgressWindow() {
3429 3436
        updateDialog = new UpdateDialog(MainMapActivity.this);
3430
        updateDialog.builder().setMsg("").setCancelable(false).show();
3437
        updateDialog.builder().setMsg("")
3438
                .setBtnCancel(v->{
3439
                    if (downloadCall!=null){
3440
                        downloadCall.cancel();
3441
                    }
3442
                })
3443
                .setCancelable(false).show();
3431 3444
    }
3432 3445
3433 3446
    private void dialogup_other() {
@ -3439,32 +3452,25 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
3439 3452
            alterDialog.builder()
3440 3453
                    .setTitle("更新提示 " + now_versionName)
3441 3454
                    .setMsg(title.trim())
3442
                    .setPositiveButton("更新", new View.OnClickListener() {
3443
                        @Override
3444
                        public void onClick(View v) {
3445
                            showProgressWindow();
3446
                            ToastUtil.showToast(getApplicationContext(), "正在下载中", Toast.LENGTH_SHORT);
3447
                            downLoadFile();
3448
                        }
3449
                    }).setNegativeButton("退出", new View.OnClickListener() {
3450
                @Override
3451
                public void onClick(View v) {
3452
                    SharedPreferences mySharedPreferences = getSharedPreferences("showdialog",
3453
                            Activity.MODE_PRIVATE);
3454
                    SharedPreferences.Editor editor1 = mySharedPreferences.edit();
3455
                    editor1.clear();
3456
                    finish();
3457
                    ProfileManager.getInstance().setSearchAddress(getApplicationContext(), "");
3458
                    Process.killProcess(Process.myPid());
3459
                }
3460
            }).setCancelable(false).show();
3455
                    .setPositiveButton("更新", v -> {
3456
                        ToastUtil.showToast(getApplicationContext(), "正在下载中", Toast.LENGTH_SHORT);
3457
                        downLoadFile();
3458
                    }).setNegativeButton("退出", v -> {
3459
    //                    SharedPreferences mySharedPreferences = getSharedPreferences("showdialog",
3460
    //                            Activity.MODE_PRIVATE);
3461
    //                    SharedPreferences.Editor editor1 = mySharedPreferences.edit();
3462
    //                    editor1.clear();
3463
    //                    finish();
3464
    //                    ProfileManager.getInstance().setSearchAddress(getApplicationContext(), "");
3465
    //                    Process.killProcess(Process.myPid());
3466
                    }).setCancelable(false).show();
3461 3467
        }
3462 3468
    }
3463 3469
    private void downLoadFile() {
3464 3470
        showProgressWindow();
3465 3471
        ToastUtil.showToast(getApplicationContext(), "正在下载中", Toast.LENGTH_SHORT);
3466
        OkHttpUtils.get().url("http://cdz.evcharge.cc/app/app.apk").build()
3467
                .execute(new FileCallBack(PhotoUtils.DOWNLOADS, "cdz_install") {
3472
        downloadCall = OkHttpUtils.get().url("http://cdz.evcharge.cc/app/app.apk").build();
3473
        downloadCall.execute(new FileCallBack(PhotoUtils.DOWNLOADS, "cdz_install") {
3468 3474
                    @Override
3469 3475
                    public void inProgress(final float progress, long total) {
3470 3476

+ 158 - 10
app/src/main/java/com/electric/chargingpile/activity/UserCenterMoreActivity.java

@ -11,10 +11,17 @@ import android.content.pm.PackageInfo;
11 11
import android.content.pm.PackageManager;
12 12
import android.graphics.drawable.ColorDrawable;
13 13
import android.net.Uri;
14
import android.os.Build;
14 15
import android.os.Bundle;
15 16
import android.os.Handler;
17
import android.os.Looper;
16 18
import android.os.Message;
19
20
import androidx.annotation.NonNull;
17 21
import androidx.appcompat.app.AlertDialog;
22
import androidx.core.content.FileProvider;
23
24
import android.os.Process;
18 25
import android.text.TextUtils;
19 26
import android.util.Log;
20 27
import android.view.Display;
@ -32,6 +39,8 @@ import android.widget.TextView;
32 39
import android.widget.Toast;
33 40
34 41
import com.alibaba.fastjson.JSON;
42
import com.blankj.utilcode.util.AppUtils;
43
import com.blankj.utilcode.util.LogUtils;
35 44
import com.electric.chargingpile.R;
36 45
import com.electric.chargingpile.application.MainApplication;
37 46
import com.electric.chargingpile.manager.ProfileManager;
@ -42,43 +51,59 @@ import com.electric.chargingpile.util.ImageTools;
42 51
import com.electric.chargingpile.util.JsonUtils;
43 52
import com.electric.chargingpile.util.LoadingDialog;
44 53
import com.electric.chargingpile.util.OkHttpUtil;
54
import com.electric.chargingpile.util.PhotoUtils;
55
import com.electric.chargingpile.util.ToastUtil;
56
import com.electric.chargingpile.view.AlertDialogUpdate;
57
import com.electric.chargingpile.view.UpdateDialog;
45 58
import com.squareup.okhttp.Request;
46 59
import com.squareup.okhttp.Response;
47 60
import com.umeng.analytics.MobclickAgent;
48 61
import com.zhy.http.okhttp.OkHttpUtils;
62
import com.zhy.http.okhttp.callback.FileCallBack;
49 63
import com.zhy.http.okhttp.callback.StringCallback;
64
import com.zhy.http.okhttp.request.RequestCall;
50 65
51 66
import org.json.JSONException;
52 67
import org.json.JSONObject;
53 68
54 69
import java.io.BufferedReader;
55 70
import java.io.BufferedWriter;
71
import java.io.File;
56 72
import java.io.InputStreamReader;
57 73
import java.io.OutputStreamWriter;
58 74
import java.io.PrintWriter;
59 75
import java.net.Socket;
60 76
import java.net.URLEncoder;
61 77
import java.security.MessageDigest;
78
import java.text.NumberFormat;
62 79
63 80
import okhttp3.Call;
81
import pub.devrel.easypermissions.AfterPermissionGranted;
64 82
import pub.devrel.easypermissions.EasyPermissions;
65 83
66 84
public class UserCenterMoreActivity extends Activity implements View.OnClickListener {
67 85
    private static final String TAG = "UserCenterMoreActivity";
86
    private static final int RC_READ_EXTERNAL_PERM = 127;
68 87
    private RelativeLayout rl_recommend, rl_feedback, rl_about, rl_message, rl_update, rl_alter_password;
69 88
    private ImageView iv_back, iv_message, iv_fen;
70 89
    private String now_version, app_version;
71 90
    private TextView tv_exit;
72
    private String now_versionCode, now_versionName;
91
    private String now_versionCode, now_versionName,title;
73 92
    private android.view.animation.Animation animation;
74 93
    private ImageView point, iv_message_f;
94
    private LinearLayout logOutLayout;
95
75 96
    private Socket socket;
76 97
    private String Token = "";
77 98
    static String token = "";
78 99
    public static long cha;
79 100
    LoadingDialog dialog;
101
    Context context;
102
    private AlertDialogUpdate alterDialog;
103
    private UpdateDialog updateDialog;
80 104
    Dialog et_dialog;
81
    private Handler handler = new Handler() {
105
    private RequestCall downloadCall;
106
    private Handler handler = new Handler(Looper.getMainLooper()) {
82 107
        // 主线程通过这个方法处理消息
83 108
        @Override
84 109
        public void handleMessage(Message msg) {
@ -117,6 +142,8 @@ public class UserCenterMoreActivity extends Activity implements View.OnClickList
117 142
118 143
                            now_versionCode = JsonUtils.getKeyResult(android, "versionCode");
119 144
                            now_versionName = JsonUtils.getKeyResult(android, "versionName");
145
                            title = JsonUtils.getKeyResult(jsonArray.toJSONString(), "title");
146
                            title = title.replace("\\n", "\n");
120 147
                        } catch (Exception e) {
121 148
                            e.printStackTrace();
122 149
                        }
@ -131,7 +158,7 @@ public class UserCenterMoreActivity extends Activity implements View.OnClickList
131 158
                        }
132 159
//
133 160
                        if (new_versionCode - getVersionCode(getApplication()) > 0) {
134
                            dialogup();
161
                            permissionTask();
135 162
                        } else {
136 163
                            Toast.makeText(UserCenterMoreActivity.this, "当前为最新版本" + now_versionName, Toast.LENGTH_SHORT).show();
137 164
                        }
@ -160,7 +187,33 @@ public class UserCenterMoreActivity extends Activity implements View.OnClickList
160 187
            }
161 188
        }
162 189
    };
163
    private LinearLayout logOutLayout;
190
    private Handler myHandler = new Handler(Looper.getMainLooper()) {
191
192
        @Override
193
        public void handleMessage(Message msg) {
194
            super.handleMessage(msg);
195
196
            switch (msg.what) {
197
198
                case 0x01:
199
200
                    Bundle data = msg.getData();
201
                    String format = data.getString("format");
202
                    String f = data.getString("progress");
203
                    String s = f.substring(0, f.indexOf("."));
204
//                    LogUtils.e(s);
205
206
                    updateDialog.updateMsg("当前已下载:" + format);
207
                    updateDialog.updateProgress(Integer.parseInt(s));
208
209
                    break;
210
211
            }
212
213
        }
214
    };
215
216
164 217
165 218
    @Override
166 219
    protected void onCreate(Bundle savedInstanceState) {
@ -169,6 +222,7 @@ public class UserCenterMoreActivity extends Activity implements View.OnClickList
169 222
        BarColorUtil.initStatusBarColor(UserCenterMoreActivity.this);
170 223
        dialog = new LoadingDialog(this);
171 224
        dialog.setCanceledOnTouchOutside(false);
225
        context = this;
172 226
        initView();
173 227
    }
174 228
@ -718,12 +772,8 @@ public class UserCenterMoreActivity extends Activity implements View.OnClickList
718 772
                .setPositiveButton("要,马上要", new View.OnClickListener() {
719 773
                    @Override
720 774
                    public void onClick(View v) {
721
                        Intent intent = new Intent();
722
                        intent.setAction("android.intent.action.VIEW");
723
                        intent.addCategory(Intent.CATEGORY_BROWSABLE);
724
                        Uri content_url = Uri.parse("http://cdz.evcharge.cc/app/app.apk");
725
                        intent.setData(content_url);
726
                        startActivity(Intent.createChooser(intent, "请选择浏览器"));
775
                        ToastUtil.showToast(getApplicationContext(), "正在下载中", Toast.LENGTH_SHORT);
776
                        downLoadFile();
727 777
                    }
728 778
                }).setNegativeButton("先退下", new View.OnClickListener() {
729 779
            @Override
@ -850,8 +900,106 @@ public class UserCenterMoreActivity extends Activity implements View.OnClickList
850 900
            }
851 901
        });
852 902
    }
903
    private void showProgressWindow() {
904
        updateDialog = new UpdateDialog(UserCenterMoreActivity.this);
905
        updateDialog.builder().setMsg("")
906
                .setBtnCancel(v->{
907
                    if (downloadCall!=null){
908
                        downloadCall.cancel();
909
                    }
910
                })
911
                .setCancelable(false).show();
912
    }
913
914
    private void downLoadFile() {
915
        showProgressWindow();
916
        ToastUtil.showToast(getApplicationContext(), "正在下载中", Toast.LENGTH_SHORT);
917
        downloadCall = OkHttpUtils.get().url("http://cdz.evcharge.cc/app/app.apk").build();
918
        downloadCall.execute(new FileCallBack(PhotoUtils.DOWNLOADS, "cdz_install") {
919
            @Override
920
            public void inProgress(final float progress, long total) {
921
922
                NumberFormat numberFormat = NumberFormat.getInstance();
923
924
                // 设置精确到小数点后2位
853 925
926
                numberFormat.setMaximumFractionDigits(2);
927
                String format = numberFormat.format(progress * 100);
854 928
929
                Message message = new Message();
930
                message.what = 0x01;
931
932
                Bundle bundle = new Bundle();
933
                bundle.putString("format", format + "%");
934
//                        LogUtils.e("当前:" + format);
935
                if (!format.contains(".")) {
936
                    bundle.putString("progress", format + ".");
937
                } else {
938
                    bundle.putString("progress", format);
939
                }
940
941
942
                message.setData(bundle);
943
                myHandler.sendMessage(message);
944
945
946
            }
947
948
            @Override
949
            public void onError(Call call, Exception e) {
950
                LogUtils.e(e.getMessage());
951
            }
952
953
            @Override
954
            public void onResponse(File response) {
955
                String path = getDatabasePath("zhan_list").getPath();
956
                com.blankj.utilcode.util.LogUtils.e(path);
957
                AppUtils.cleanAppData(path);
958
                Log.e("hyc","**------**"+response.getAbsolutePath());
959
                Log.e("hyc","**------**"+!response.exists());
960
                if (!response.exists()){
961
                    Toast.makeText(context, "文件不存在", Toast.LENGTH_SHORT).show();
962
                    return  ;
963
                }
964
965
                Intent intent = new Intent();
966
                intent.setAction(android.content.Intent.ACTION_VIEW);
967
                Uri uri;
968
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
969
                    Uri contentUri = FileProvider.getUriForFile(context,
970
                            context.getApplicationContext().getPackageName() + ".provider",
971
                            response);
972
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
973
                    intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
974
                    intent.setDataAndType(contentUri, "application/vnd.android.package-archive");
975
                } else {
976
                    uri = Uri.fromFile(response);
977
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
978
                    intent.setDataAndType(uri, "application/vnd.android.package-archive");
979
                }
980
                context.startActivity(intent);
981
                android.os.Process.killProcess(android.os.Process.myPid());
982
            }
983
        });
984
    }
985
986
    @AfterPermissionGranted(RC_READ_EXTERNAL_PERM)
987
    public void permissionTask() {
988
        if (isPermissionOK()) {
989
            dialogup();
990
        } else {
991
            EasyPermissions.requestPermissions(
992
                    this, "充电桩想要获取您的图片读取权限,是否允许?",
993
                    RC_READ_EXTERNAL_PERM,
994
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
995
                    Manifest.permission.READ_EXTERNAL_STORAGE);
996
        }
997
    }
998
    @Override
999
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
1000
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
1001
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
1002
    }
855 1003
    @Override
856 1004
    protected void onPause() {
857 1005
        super.onPause();

+ 20 - 4
app/src/main/java/com/electric/chargingpile/view/UpdateDialog.java

@ -8,7 +8,9 @@ import android.view.LayoutInflater;
8 8
import android.view.View;
9 9
import android.view.WindowManager;
10 10
import android.widget.FrameLayout;
11
import android.widget.ImageView;
11 12
import android.widget.LinearLayout;
13
import android.widget.ProgressBar;
12 14
import android.widget.TextView;
13 15
14 16
import com.electric.chargingpile.R;
@ -20,12 +22,13 @@ public class UpdateDialog {
20 22
    private android.app.Dialog dialog;
21 23
    private LinearLayout layout_bg;
22 24
    private TextView txt_msg;
25
    private ImageView imgCancel;
23 26
    private Display display;
24 27
    private boolean showTitle = false;
25 28
    private boolean showMsg = false;
26 29
    private boolean showPosBtn = false;
27 30
    private boolean showNegBtn = false;
28
    private QMUIProgressBar qmuiProgressBar;
31
    private ProgressBar qmuiProgressBar;
29 32
30 33
    public UpdateDialog(Context context) {
31 34
        this.context = context;
@ -41,12 +44,13 @@ public class UpdateDialog {
41 44
42 45
        // 获取自定义Dialog布局中的控件
43 46
        layout_bg = view.findViewById(R.id.layout_bg);
47
        imgCancel = view.findViewById(R.id.imgCancel);
44 48
45 49
        txt_msg = (TextView) view.findViewById(R.id.txt_msg);
46 50
        txt_msg.setVisibility(View.GONE);
47 51
48 52
        qmuiProgressBar = view.findViewById(R.id.qMUIProgressBar);
49
        qmuiProgressBar.setMaxValue(100);
53
        qmuiProgressBar.setMax(100);
50 54
51 55
        // 定义Dialog布局和参数
52 56
        dialog = new Dialog(context, R.style.AlertDialogStyle);
@ -54,7 +58,7 @@ public class UpdateDialog {
54 58
55 59
        // 调整dialog背景大小
56 60
        layout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
57
                .getWidth() * 0.85), LinearLayout.LayoutParams.WRAP_CONTENT));
61
                .getWidth() * 0.65), LinearLayout.LayoutParams.WRAP_CONTENT));
58 62
59 63
        return this;
60 64
    }
@ -73,6 +77,15 @@ public class UpdateDialog {
73 77
        dialog.setCancelable(cancel);
74 78
        return this;
75 79
    }
80
    public UpdateDialog setBtnCancel(View.OnClickListener listener) {
81
        if (imgCancel!=null){
82
            imgCancel.setOnClickListener(v -> {
83
                listener.onClick(v);
84
                dialog.dismiss();
85
            });
86
        }
87
        return this;
88
    }
76 89
77 90
78 91
    private void setLayout() {
@ -87,10 +100,13 @@ public class UpdateDialog {
87 100
    }
88 101
89 102
    public void updateMsg(String msg) {
90
        txt_msg.setText(msg);
103
91 104
    }
92 105
93 106
    public void updateProgress(int i) {
94 107
        qmuiProgressBar.setProgress(i);
108
        if (txt_msg!=null){
109
            txt_msg.setText(i+"%");
110
        }
95 111
    }
96 112
}

二进制
app/src/main/res/drawable-xxhdpi/ic_cancel_updata.png


二进制
app/src/main/res/drawable-xxhdpi/ic_no_check_square.png


二进制
app/src/main/res/drawable-xxhdpi/ic_select_check_square.png


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

@ -0,0 +1,8 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3
4
    <item android:drawable="@drawable/ic_select_check_square" android:state_checked="true"/>
5
    <item android:drawable="@drawable/ic_no_check_square"  android:state_checked="false"/>
6
    <item android:drawable="@drawable/ic_no_check_square"/>
7
8
</selector>

+ 39 - 0
app/src/main/res/drawable/progressbar_color.xml

@ -0,0 +1,39 @@
1
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
2
    android:layout_width="match_parent"
3
    android:layout_height="wrap_content">
4
5
    <!-- 背景  gradient是渐变,corners定义的是圆角 -->
6
    <item android:id="@android:id/background"
7
        android:layout_width="wrap_content">
8
        <shape>
9
            <corners android:radius="10dp" />
10
11
            <solid android:color="#ECECEC" />
12
        </shape>
13
    </item>
14
    <!-- 第二条进度条颜色 -->
15
    <item android:id="@android:id/secondaryProgress">
16
        <clip>
17
            <shape>
18
                <corners android:radius="10dp" />
19
20
                <gradient
21
                    android:angle="90.0"
22
                    android:centerColor="#aadfdf"
23
                    android:centerY="0.45"
24
                    android:endColor="#aadfdf"
25
                    android:startColor="#aadfdf" />
26
            </shape>
27
        </clip>
28
    </item>
29
    <!-- 进度条 -->
30
    <item android:id="@android:id/progress">
31
        <clip>
32
            <shape>
33
                <corners android:radius="10dp" />
34
                <solid android:color="#3EC34C" />
35
            </shape>
36
        </clip>
37
    </item>
38
39
</layer-list>

+ 30 - 3
app/src/main/res/layout/activity_car_owner_certificate.xml

@ -47,7 +47,7 @@
47 47
        android:layout_height="0dp"
48 48
        android:orientation="vertical"
49 49
        android:scrollbars="none"
50
        app:layout_constraintBottom_toTopOf="@+id/submit_btn"
50
        app:layout_constraintBottom_toTopOf="@+id/layoutAuthorize"
51 51
        app:layout_constraintTop_toBottomOf="@+id/nav_bar">
52 52
53 53
        <androidx.constraintlayout.widget.ConstraintLayout
@ -353,7 +353,7 @@
353 353
                android:layout_width="match_parent"
354 354
                android:layout_height="wrap_content"
355 355
                android:layout_marginTop="10dp"
356
                android:layout_marginBottom="30dp"
356
                android:layout_marginBottom="60dp"
357 357
                android:text="认证说明\n\n1.车型信息和行驶证主页为必填项;\n2.最多可认证三款车型;\n3.默认首款认证车型为主车型;\n4.上传行驶证详细页面,并保证所有信息清晰;\n5.首次车主认证审核通过有充电满减和折扣红包\n6.红包自发放日起有效期为一个月"
358 358
                android:textColor="#0D1120"
359 359
                android:textSize="14sp"
@ -361,7 +361,34 @@
361 361
                app:layout_constraintTop_toBottomOf="@+id/driving_license_type" />
362 362
        </androidx.constraintlayout.widget.ConstraintLayout>
363 363
    </ScrollView>
364
364
    <LinearLayout
365
        android:orientation="horizontal"
366
        android:gravity="center"
367
        android:layout_marginBottom="10dp"
368
        app:layout_constraintEnd_toEndOf="parent"
369
        app:layout_constraintStart_toStartOf="parent"
370
        android:id="@+id/layoutAuthorize"
371
        app:layout_constraintBottom_toTopOf="@+id/submit_btn"
372
        android:layout_width="0dp"
373
        android:layout_height="wrap_content">
374
        <CheckBox
375
            android:padding="5dp"
376
            android:layout_gravity="center"
377
            android:gravity="center"
378
            style="@style/SquareCheckboxTheme"
379
            android:id="@+id/checkBox"
380
            android:layout_width="wrap_content"
381
            android:layout_height="wrap_content"/>
382
        <TextView
383
            android:gravity="center"
384
            android:id="@+id/tvAuthorize"
385
            android:layout_width="wrap_content"
386
            android:layout_height="match_parent"
387
            android:text="勾选后,即您同意《个人信息处理授权书》并确认授权"
388
            android:textColor="#ff9b9b9b"
389
            android:textSize="12sp"
390
            />
391
    </LinearLayout>
365 392
    <Button
366 393
        android:id="@+id/submit_btn"
367 394
        android:layout_width="match_parent"

+ 32 - 15
app/src/main/res/layout/layout_update_dialog.xml

@ -1,34 +1,51 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    xmlns:app="http://schemas.android.com/apk/res-auto"
4
    xmlns:tools="http://schemas.android.com/tools"
4 5
    android:id="@+id/layout_bg"
5 6
    android:layout_width="match_parent"
6
    android:layout_height="200dp"
7
    android:layout_height="wrap_content"
7 8
    android:background="@drawable/offlinearrow_but_normal"
8 9
    android:orientation="vertical">
9
10 10
    <TextView
11
        android:id="@+id/txt_msg"
11
        android:gravity="center"
12
        android:text="下载中"
13
12 14
        android:layout_width="match_parent"
13 15
        android:layout_height="wrap_content"
14 16
        android:layout_gravity="center|left"
15
        android:textColor="@color/ui_62"
16
        android:layout_marginLeft="16dp"
17
        android:layout_marginTop="16dp"
18
        android:layout_marginBottom="16dp"
17
        android:textColor="@color/color_0e0e0e"
18
        android:layout_marginTop="30dp"
19
        android:layout_marginBottom="20dp"
19 20
        android:textSize="16sp" />
20 21
21
    <com.qmuiteam.qmui.widget.QMUIProgressBar
22
    <ProgressBar
23
        style="?android:attr/progressBarStyleHorizontal"
24
        tools:progress="45"
22 25
        android:id="@+id/qMUIProgressBar"
23 26
        android:layout_width="match_parent"
24
        android:layout_height="12dp"
25
        android:textColor="@color/lvse"
27
        android:layout_height="10dp"
28
        android:progressDrawable="@drawable/progressbar_color"
26 29
        android:textSize="12sp"
27
        android:layout_marginBottom="20dp"
30
        android:layout_marginBottom="6dp"
28 31
        android:layout_marginLeft="16dp"
29 32
        android:layout_marginRight="16dp"
30
        app:qmui_background_color="@color/ui_68"
31
        app:qmui_progress_color="@color/lvse"
32
        app:qmui_type="type_rect"/>
33
33
       />
34
    <TextView
35
        android:id="@+id/txt_msg"
36
        tools:text="12"
37
        android:textColor="#3EC34C"
38
        android:textSize="14sp"
39
        android:layout_marginEnd="18dp"
40
        android:layout_gravity="end"
41
        android:layout_marginBottom="30dp"
42
        android:layout_width="wrap_content"
43
        android:layout_height="wrap_content"/>
44
    <ImageView
45
        android:id="@+id/imgCancel"
46
        android:layout_marginBottom="30dp"
47
        android:layout_gravity="center"
48
        android:src="@drawable/ic_cancel_updata"
49
        android:layout_width="wrap_content"
50
        android:layout_height="wrap_content"/>
34 51
</LinearLayout>

+ 3 - 0
app/src/main/res/values/styles.xml

@ -377,4 +377,7 @@
377 377
    <style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
378 378
        <item name="android:button">@drawable/checkbox_style</item>
379 379
    </style>
380
    <style name="SquareCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
381
        <item name="android:button">@drawable/bg_car_owner_check</item>
382
    </style>
380 383
</resources>

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

@ -1,7 +1,7 @@
1 1
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2 2
          package="com.zhy.autolayout">
3 3
4
    <application android:allowBackup="true"
4
    <application android:allowBackup="false"
5 5
                 android:label="@string/app_name"
6 6
        >
7 7

+ 1 - 0
zxing/src/main/AndroidManifest.xml

@ -28,6 +28,7 @@
28 28
    <supports-screens android:xlargeScreens="true"
29 29
        android:largeScreens="true"
30 30
        android:normalScreens="true"
31
        android:allowBackup="false"
31 32
        android:smallScreens="true"
32 33
        android:anyDensity="true"/>
33 34

+ 2 - 1
zxing/src/main/java/com/google/zxing/client/android/constant/UrlConstants.java

@ -5,7 +5,8 @@ public interface UrlConstants {
5 5
//    String HOST_URL = "http://59.110.68.162/zhannew/basic/web/index.php/"; //测试链接
6 6
7 7
    String USER_CHARGING_CHECK_URL = HOST_URL + "api/charge/check-user";
8
    String START_CHARGING_URL = HOST_URL + "api/charge/start";
8
//    String START_CHARGING_URL = HOST_URL + "api/charge/start";
9
    String START_CHARGING_URL = HOST_URL + "api/charge/start2";
9 10
    String CHARGING_STATUS_URL = HOST_URL + "api/charge/query";
10 11
    String STOP_CHARGING_URL = HOST_URL + "api/charge/close";//关闭充电
11 12