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>

代码优化 · f8edf7d85c - Gogs: Go Git Service
Ver Código Fonte

代码优化

huyuguo 4 anos atrás
pai
commit
f8edf7d85c

+ 21 - 12
app/src/main/java/com/electric/chargingpile/activity/CarOwnerCertificateListActivity.java

@ -5,6 +5,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
5 5
import androidx.recyclerview.widget.RecyclerView;
6 6
7 7
import android.content.Intent;
8
import android.graphics.Color;
8 9
import android.os.Bundle;
9 10
import android.util.Log;
10 11
import android.view.View;
@ -25,6 +26,7 @@ import com.zhy.http.okhttp.OkHttpUtils;
25 26
import com.zhy.http.okhttp.callback.StringCallback;
26 27
27 28
import java.net.URLEncoder;
29
import java.util.ArrayList;
28 30
import java.util.List;
29 31
30 32
import okhttp3.Call;
@ -36,7 +38,8 @@ public class CarOwnerCertificateListActivity extends AppCompatActivity {
36 38
    private TextView add;
37 39
    private CarOwnerCertificateListAdapter adapter;
38 40
    private TextView no_data;
39
41
    List<CarOwnerCertificateBean> mList = new ArrayList<>();
42
    boolean canAdd = true;
40 43
    private boolean firstTime;
41 44
42 45
    @Override
@ -61,6 +64,8 @@ public class CarOwnerCertificateListActivity extends AppCompatActivity {
61 64
        add.setOnClickListener(new View.OnClickListener() {
62 65
            @Override
63 66
            public void onClick(View v) {
67
                if (canAdd == false)
68
                    return;
64 69
                startActivity(new Intent(getApplication(), CarOwnerCertificateActivity.class));
65 70
            }
66 71
        });
@ -68,19 +73,20 @@ public class CarOwnerCertificateListActivity extends AppCompatActivity {
68 73
        no_data = findViewById(R.id.no_data);
69 74
70 75
        String data = getIntent().getStringExtra("data");
71
        List<CarOwnerCertificateBean> list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
72
        if (list.size() >= 3) {
73
            add.setVisibility(View.GONE);
76
        mList = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
77
        if (mList.size() >= 3) {
78
            canAdd = false;
79
            add.setTextColor(Color.parseColor("#CCCCCC"));
74 80
        }
75 81
        recycler_view = findViewById(R.id.recycler_view);
76
        adapter = new CarOwnerCertificateListAdapter(this, list);
82
        adapter = new CarOwnerCertificateListAdapter(this, mList);
77 83
        recycler_view.setLayoutManager(new LinearLayoutManager(this));
78 84
        recycler_view.setAdapter(adapter);
79 85
        adapter.setRecyclerItemTypeClickListener(new RecyclerItemTypeClickListener() {
80 86
            @Override
81 87
            public void onItemClickListener(int position, int index) { // index 1:删除操作 2:编辑操作 3:设为主车型
82 88
83
                CarOwnerCertificateBean bean = list.get(position);
89
                CarOwnerCertificateBean bean = mList.get(position);
84 90
                if (index == 1) {
85 91
                    deleteCarOwnerCertificate(bean.getId());
86 92
                } else if (index == 2) {
@ -190,7 +196,7 @@ public class CarOwnerCertificateListActivity extends AppCompatActivity {
190 196
            e.printStackTrace();
191 197
        }
192 198
193
        String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&token=" + token;
199
        String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&order=1" + "&token=" + token;
194 200
        OkHttpUtils.get().url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
195 201
            @Override
196 202
            public void onError(Call call, Exception e) {
@ -205,14 +211,17 @@ public class CarOwnerCertificateListActivity extends AppCompatActivity {
205 211
                String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
206 212
                if ("01".equals(rtnCode)) {
207 213
                    String data = JsonUtils.getKeyResult(response, "data");
208
                    List<CarOwnerCertificateBean> list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
209
                    adapter.setData(list);
210
                    no_data.setVisibility(list.size() == 0 ? View.VISIBLE : View.GONE);
214
                    mList = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
215
                    adapter.setData(mList);
216
                    no_data.setVisibility(mList.size() == 0 ? View.VISIBLE : View.GONE);
211 217
212
                    if (list.size() >= 3) {
213
                        add.setVisibility(View.GONE);
218
                    if (mList.size() >= 3) {
219
                        canAdd = false;
220
                        add.setTextColor(Color.parseColor("#CCCCCC"));
214 221
                    } else {
222
                        canAdd = true;
215 223
                        add.setVisibility(View.VISIBLE);
224
                        add.setTextColor(Color.parseColor("#030303"));
216 225
                    }
217 226
                } else {
218 227
                    String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");

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

@ -1073,7 +1073,7 @@ public class UserCenterActivity extends Activity implements View.OnClickListener
1073 1073
            e.printStackTrace();
1074 1074
        }
1075 1075
1076
        String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&token=" + token;
1076
        String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&order=1" + "&token=" + token;
1077 1077
        OkHttpUtils.get().url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
1078 1078
            @Override
1079 1079
            public void onError(Call call, Exception e) {

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

@ -1068,7 +1068,7 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
1068 1068
            e.printStackTrace();
1069 1069
        }
1070 1070
1071
        String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&token=" + token;
1071
        String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&order=1" + "&token=" + token;
1072 1072
        OkHttpUtils.get().url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
1073 1073
            @Override
1074 1074
            public void onError(Call call, Exception e) {

+ 1 - 0
app/src/main/java/com/electric/chargingpile/application/MainApplication.java

@ -156,6 +156,7 @@ public class MainApplication extends MultiDexApplication {
156 156
        JPushInterface.setDebugMode(true);
157 157
        JPushInterface.init(this);
158 158

159

159 160
        String rid = JPushInterface.getRegistrationID(getApplicationContext());
160 161
        push_id = rid;
161 162
        Intent intent = new Intent();