huyuguo %!s(int64=4) %!d(string=hace) años
padre
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();