//import com.electric.chargingpile.util.JsonUtils;
36
//import com.electric.chargingpile.util.LoadingDialog;
37
//import com.electric.chargingpile.util.Md5Util;
38
//import com.electric.chargingpile.util.ToastUtil;
39
//import com.zhy.http.okhttp.OkHttpUtils;
40
//import com.zhy.http.okhttp.callback.StringCallback;
41
//
42
//import net.sourceforge.zbar.Config;
43
//import net.sourceforge.zbar.Image;
44
//import net.sourceforge.zbar.ImageScanner;
45
//import net.sourceforge.zbar.Symbol;
46
//import net.sourceforge.zbar.SymbolSet;
47
//
48
//import java.io.IOException;
49
//import java.lang.reflect.Field;
50
//import java.net.URLEncoder;
51
//
52
//import okhttp3.Call;
53
//
54
//public class MyCaptureActivity extends Activity implements OnClickListener {
55
//    private static final String TAG = "MyCaptureActivity";
56
//    private Camera mCamera;
57
//    private CameraPreview mPreview;
58
//    private Handler autoFocusHandler;
59
//    private CameraManager mCameraManager;
60
//
61
//    private TextView scanResult, capture_flashlight, tv_input_code;
62
//    private FrameLayout scanPreview;
63
//    private Button scanRestart;
64
//    private RelativeLayout scanContainer;
65
//    private RelativeLayout scanCropView;
66
//    private ImageView scanLine;
67
//
68
//    private Rect mCropRect = null;
69
//    private boolean barcodeScanned = false;
70
//    private boolean previewing = true;
71
//    private ImageScanner mImageScanner = null;
72
//    private boolean flag = true;
73
//    private LoadingDialog dialog;
74
//    private String stubGroupId;
75
//    private String password = "";
76
//    private ImageView iv_back;
77
//
78
//    static {
79
//        System.loadLibrary("iconv");
80
//    }
81
//
82
//    @Override
83
//    public void onCreate(Bundle savedInstanceState) {
84
//        super.onCreate(savedInstanceState);
85
//        setContentView(R.layout.activity_my_capture);
86
//        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
87
//        dialog = new LoadingDialog(this);
88
//        dialog.setCanceledOnTouchOutside(false);
89
//        findViewById();
90
//        addEvents();
91
//        initViews();
92
//
93
//    }
94
//
95
//    private void findViewById() {
96
//        scanPreview = (FrameLayout) findViewById(R.id.capture_preview);
97
//        scanResult = (TextView) findViewById(R.id.capture_scan_result);
98
//        scanRestart = (Button) findViewById(R.id.capture_restart_scan);
99
//        scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
100
//        scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
101
//        scanLine = (ImageView) findViewById(R.id.capture_scan_line);
102
//        capture_flashlight = (TextView) findViewById(R.id.capture_flashlight);
103
//        capture_flashlight.setOnClickListener(this);
104
//        tv_input_code = (TextView) findViewById(R.id.tv_input_code);
105
//        tv_input_code.setOnClickListener(this);
106
//        iv_back = (ImageView) findViewById(R.id.iv_back);
107
//        iv_back.setOnClickListener(this);
108
//    }
109
//
110
//    private void addEvents() {
111
//        scanRestart.setOnClickListener(new OnClickListener() {
112
//            public void onClick(View v) {
113
//
114
//            }
115
//        });
116
//    }
117
//
118
//    private void scanRestart() {
119
//        if (barcodeScanned) {
120
//            barcodeScanned = false;
121
//            if (null == mCamera) {
122
//                mCamera = mCameraManager.getCamera();
123
//            }
124
//            mCamera.setPreviewCallback(previewCb);
125
//            mCamera.startPreview();
126
//            previewing = true;
127
//            mCamera.autoFocus(autoFocusCB);
128
//        }
129
//    }
130
//
131
//    public void light() {
132
//        if (this.flag) {
133
//            mCameraManager.openLight();
134
//            this.flag = false;
135
//            this.capture_flashlight.setText("关灯");
136
//            return;
137
//        }
138
//        mCameraManager.offLight();
139
//        this.flag = true;
140
//        this.capture_flashlight.setText("开灯");
141
//    }
142
//
143
//    private void initViews() {
144
//        mImageScanner = new ImageScanner();
145
//        mImageScanner.setConfig(0, Config.X_DENSITY, 3);
146
//        mImageScanner.setConfig(0, Config.Y_DENSITY, 3);
147
//
148
//        autoFocusHandler = new Handler();
149
//        mCameraManager = new CameraManager(this);
150
//        try {
151
//            mCameraManager.openDriver();
152
//        } catch (IOException e) {
153
//            e.printStackTrace();
154
//        }
155
//
156
//        mCamera = mCameraManager.getCamera();
157
//        mPreview = new CameraPreview(this, mCamera, previewCb, autoFocusCB);
158
//        scanPreview.addView(mPreview);
159
//
160
//        TranslateAnimation animation = new TranslateAnimation(
161
//                Animation.RELATIVE_TO_PARENT, 0.0f,
162
//                Animation.RELATIVE_TO_PARENT, 0.0f,
163
//                Animation.RELATIVE_TO_PARENT, 0.0f,
164
//                Animation.RELATIVE_TO_PARENT, 0.85f);
165
//        animation.setDuration(3000);
166
//        animation.setRepeatCount(-1);
167
//        animation.setRepeatMode(Animation.REVERSE);
168
//        scanLine.startAnimation(animation);
169
//    }
170
//
171
//    @Override
172
//    public void onPause() {
173
//        Log.e(TAG, "onPause: 11");
174
//        super.onPause();
175
////		scanRestart();
176
////        releaseCamera();
177
//    }
178
//
179
//    @Override
180
//    protected void onDestroy() {
181
//        super.onDestroy();
182
//        releaseCamera();
183
//    }
184
//
185
//    @Override
186
//    public boolean onKeyDown(int keyCode, KeyEvent event) {
187
//        System.out.println("Page01 -->onKeyDown: keyCode: " + keyCode);
188
//        if (KeyEvent.KEYCODE_HOME == keyCode) {
189
//            System.out.println("HOME has been pressed yet ...");
190
//            // android.os.Process.killProcess(android.os.Process.myPid());
191
//            Toast.makeText(getApplicationContext(), "HOME 键已被禁用...",
192
//                    Toast.LENGTH_LONG).show();
193
//            return true;
194
//        }
195
//        return super.onKeyDown(keyCode, event); // 不会回到 home 页面
196
//    }
197
//
198
//    @Override
199
//    protected void onResume() {
200
//        super.onResume();
201
//        scanRestart();
202
//    }
203
//
204
//    private void releaseCamera() {
205
//        if (mCamera != null) {
206
//            previewing = false;
207
//            mCamera.setPreviewCallback(null);
208
//            mCamera.release();
209
//            mCamera = null;
210
//        }
211
//    }
212
//
213
//    private Runnable doAutoFocus = new Runnable() {
214
//        public void run() {
215
//            if (previewing)
216
//
217
//                mCamera.autoFocus(autoFocusCB);
218
//        }
219
//    };
220
//
221
//    PreviewCallback previewCb = new PreviewCallback() {
222
//        public void onPreviewFrame(byte[] data, Camera camera) {
223
//            try {
224
//                Size size = camera.getParameters().getPreviewSize();
225
//
226
//                // 这里需要将获取的data翻转一下,因为相机默认拿的的横屏的数据
227
//                byte[] rotatedData = new byte[data.length];
228
//                for (int y = 0; y < size.height; y++) {
229
//                    for (int x = 0; x < size.width; x++)
230
//                        rotatedData[x * size.height + size.height - y - 1] = data[x
231
//                                + y * size.width];
232
//                }
233
//
234
//                // 宽高也要调整
235
//                int tmp = size.width;
236
//                size.width = size.height;
237
//                size.height = tmp;
238
//
239
//                initCrop();
240
//
241
//                Image barcode = new Image(size.width, size.height, "Y800");
242
//                barcode.setData(rotatedData);
243
//                barcode.setCrop(mCropRect.left, mCropRect.top, mCropRect.width(),
244
//                        mCropRect.height());
245
//
246
//                int result = mImageScanner.scanImage(barcode);
247
//                String resultStr = null;
248
//
249
//                if (result != 0) {
250
//                    SymbolSet syms = mImageScanner.getResults();
251
//                    for (Symbol sym : syms) {
252
//                        resultStr = sym.getData();
253
//                    }
254
//                }
255
//
256
//                if (!TextUtils.isEmpty(resultStr)) {
257
//                    previewing = false;
258
//                    mCamera.setPreviewCallback(null);
259
//                    mCamera.stopPreview();
260
//
261
//                    barcodeScanned = true;
262
////                ToastUtil.showToast(getApplicationContext(),resultStr,Toast.LENGTH_SHORT);
263
////                Log.e(TAG, "onPreviewFrame: result="+resultStr );
264
//
265
//                    getChargingPile(resultStr);
266
//
267
//                }
268
//
269
//            } catch (Exception e) {
270
//                e.printStackTrace();
271
//            }
272
//        }
273
//    };
274
//
275
//    // Mimic continuous auto-focusing
276
//    AutoFocusCallback autoFocusCB = new AutoFocusCallback() {
277
//        public void onAutoFocus(boolean success, Camera camera) {
278
//            autoFocusHandler.postDelayed(doAutoFocus, 1000);
279
//        }
280
//    };
281
//
282
//    /**
283
//     * 初始化截取的矩形区域
284
//     */
285
//    private void initCrop() {
286
//        int cameraWidth = mCameraManager.getCameraResolution().y;
287
//        int cameraHeight = mCameraManager.getCameraResolution().x;
288
//
289
//        /** 获取布局中扫描框的位置信息 */
290
//        int[] location = new int[2];
291
//        scanCropView.getLocationInWindow(location);
292
//
293
//        int cropLeft = location[0];
294
//        int cropTop = location[1] - getStatusBarHeight();
295
//
296
//        int cropWidth = scanCropView.getWidth();
297
//        int cropHeight = scanCropView.getHeight();
298
//
299
//        /** 获取布局容器的宽高 */
300
//        int containerWidth = scanContainer.getWidth();
301
//        int containerHeight = scanContainer.getHeight();
302
//
303
//        /** 计算最终截取的矩形的左上角顶点x坐标 */
304
//        int x = cropLeft * cameraWidth / containerWidth;
305
//        /** 计算最终截取的矩形的左上角顶点y坐标 */
306
//        int y = cropTop * cameraHeight / containerHeight;
307
//
308
//        /** 计算最终截取的矩形的宽度 */
309
//        int width = cropWidth * cameraWidth / containerWidth;
310
//        /** 计算最终截取的矩形的高度 */
311
//        int height = cropHeight * cameraHeight / containerHeight;
312
//
313
//        /** 生成最终的截取的矩形 */
314
//        mCropRect = new Rect(x, y, width + x, height + y);
315
//    }
316
//
317
//    private int getStatusBarHeight() {
318
//        try {
319
//            Class<?> c = Class.forName("com.android.internal.R$dimen");
320
//            Object obj = c.newInstance();
321
//            Field field = c.getField("status_bar_height");
322
//            int x = Integer.parseInt(field.get(obj).toString());
323
//            return getResources().getDimensionPixelSize(x);
324
//        } catch (Exception e) {
325
//            e.printStackTrace();
326
//        }
327
//        return 0;
328
//    }
329
//
330
//    @Override
331
//    public void onClick(View v) {
332
//        switch (v.getId()) {
333
//            case R.id.capture_flashlight:
334
//                light();
335
//                break;
336
//            case R.id.tv_input_code:
337
//                startActivity(new Intent(getApplication(), InputCodeActivity.class));
338
//                finish();
339
//                break;
340
//            case R.id.iv_back:
341
//                finish();
342
//                break;
343
//        }
344
//    }
345
//
346
//    private void checkJd(final String chargingCode) {
347
//        String url = MainApplication.url + "/zhannew/basic/web/index.php/polyelectric/info?pile_code=" + chargingCode;
348
//        Log.e("jd_url===", url);
349
//        OkHttpUtils.get()
350
//                .url(url)
351
//                .build()
352
//                .execute(new StringCallback() {
353
//                    @Override
354
//                    public void onError(Call call, Exception e) {
355
//
356
//                    }
357
//
358
//                    @Override
359
//                    public void onResponse(String response) {
360
//                        dialog.cancel();
361
//                        String code = JsonUtils.getKeyResult(response, "code");
362
//                        if (code.equals("200")) {
363
//                            String group_id = JsonUtils.getKeyResult(response, "group_id");
364
//                            startJdCharging(group_id, chargingCode);
365
//                        } else {
366
//                            String error_messge = JsonUtils.getKeyResult(response, "error_message");
367
//                            if (!error_messge.equals("")) {
368
//                                ToastUtil.showToast(getApplicationContext(), error_messge, Toast.LENGTH_SHORT);
369
//                                new Handler().postDelayed(new Runnable() {
370
//                                    public void run() {
371
//                                        scanRestart();
372
//                                    }
373
//                                }, 1500);
374
//
375
//                            }
376
//                        }
377
//                    }
378
//                });
379
//    }
380
//
381
//    private void startJdCharging(String zhan_id, String zhuang_id) {
382
//        dialog.show();
383
//        long appTime1 = System.currentTimeMillis() / 1000;
384
//        long updatetime = appTime1 - MainMapActivity.cha - 3;
385
//        String token = String.valueOf(updatetime);
386
//        String s = "group_id=" + zhan_id + "&pile_code=" + zhuang_id + "&timer=" + token + "&user_id=" + MainApplication.userId + "&key=661f9efdcb4f46fe7ab5f2e78a705a2a";
387
//        Log.e("s_url==", s);
388
//        final String url = MainApplication.url + "/zhannew/basic/web/index.php/polyelectric/start?ver=1.0&sign=" + Md5Util.md5(s) + "&timer=" + token + "&group_id=" + zhan_id + "&user_id=" + MainApplication.userId + "&pile_code=" + zhuang_id;
389
//        Log.e("jd_url==", url);
390
//        OkHttpUtils.get()
391
//                .url(url)
392
//                .build()
393
//                .execute(new StringCallback() {
394
//                    @Override
395
//                    public void onError(Call call, Exception e) {
396
//
397
//                    }
398
//
399
//                    @Override
400
//                    public void onResponse(String response) {
401
//                        Log.e("start===", response);
402
//                        dialog.cancel();
403
//                        String code = JsonUtils.getKeyResult(response, "code");
404
//                        if (code != null) {
405
//                            if (code.equals("400")) {
406
//                                String error_message = JsonUtils.getKeyResult(response, "error_message");
407
//                                String urll = "http://123.57.6.131/zhannew/basic/web/index.php/log/write";
408
//                                OkHttpUtils.post()
409
//                                        .url(urll)
410
//                                        .addParams("url", url)
411
//                                        .addParams("code", code)
412
//                                        .addParams("message", error_message)
413
//                                        .addParams("type", "android")
414
//                                        .build()
415
//                                        .execute(new StringCallback() {
416
//                                            @Override
417
//                                            public void onError(Call call, Exception e) {
418
//
419
//                                            }
420
//
421
//                                            @Override
422
//                                            public void onResponse(String response) {
423
//
424
//                                            }
425
//                                        });
426
//                                new AlertDialog(MyCaptureActivity.this).builder()
427
//                                        .setMsg(error_message)
428
//                                        .setNegativeButton("确定", new View.OnClickListener() {
429
//                                            @Override
430
//                                            public void onClick(View v) {
431
//                                                if (mCamera != null) {
432
//                                                    scanRestart();
433
//                                                }
434
////                                        startActivity(new Intent(getApplication(),ChargingStatusActivity.class));
435
//
436
////                                                startCharging();
437
//                                            }
438
//                                        }).show();
439
//
440
//
441
//                            } else if (code.equals("200")) {
442
//                                Intent intent = new Intent(getApplication(), ChargingStatusActivity.class);
443
////									intent.putExtra("stubId",zhuang_num);
444
////									intent.putExtra("stubGroupId",stubGroupId);
445
//                                intent.putExtra("type", "jd");
446
//                                startActivity(intent);
447
//                                if (mCamera != null) {
448
//                                    scanRestart();
449
//                                }
450
//                                finish();
451
//                            } else if (code.equals("104")) {
452
//                                String error_message = JsonUtils.getKeyResult(response, "error_message");
453
//                                String urll = "http://123.57.6.131/zhannew/basic/web/index.php/log/write";
454
//                                OkHttpUtils.post()
455
//                                        .url(urll)
456
//                                        .addParams("url", url)
457
//                                        .addParams("code", code)
458
//                                        .addParams("message", error_message)
459
//                                        .addParams("type", "android")
460
//                                        .build()
461
//                                        .execute(new StringCallback() {
462
//                                            @Override
463
//                                            public void onError(Call call, Exception e) {
464
//
465
//                                            }
466
//
467
//                                            @Override
468
//                                            public void onResponse(String response) {
469
//
470
//                                            }
471
//                                        });
472
//                                new AlertDialog(MyCaptureActivity.this).builder()
473
//                                        .setMsg("您的余额不足1元,可能无法满\n足您此次充电")
474
//                                        .setPositiveButton("去充值", new View.OnClickListener() {
475
//                                            @Override
476
//                                            public void onClick(View v) {
477
//                                                startActivity(new Intent(getApplication(), AccountRechargeActivity.class));
478
//                                            }
479
//                                        }).setNegativeButton("取消", new View.OnClickListener() {
480
//                                    @Override
481
//                                    public void onClick(View v) {
482
//                                        if (mCamera != null) {
483
//                                            scanRestart();
484
//                                        }
485
////                                        startActivity(new Intent(getApplication(),ChargingStatusActivity.class));
486
//                                    }
487
//                                }).show();
488
//                            } else if (code.equals("0")) {
489
//                                if (mCamera != null) {
490
//                                    scanRestart();
491
//                                }
492
//                                ToastUtil.showToast(getApplicationContext(), "该桩正在充电中,请移步到附近充电桩", Toast.LENGTH_SHORT);
493
//                            } else if (code.equals("40000")) {
494
//                                if (mCamera != null) {
495
//                                    scanRestart();
496
//                                }
497
//                                ToastUtil.showToast(getApplicationContext(), "未插充电枪或该桩已离线", Toast.LENGTH_SHORT);
498
//                            } else if (code.equals("600")) {
499
//                                if (mCamera != null) {
500
//                                    scanRestart();
501
//                                }
502
//                                ToastUtil.showToast(getApplicationContext(), "由于网络原因,您有一笔订单未结算,请稍候再试", Toast.LENGTH_SHORT);
503
//                            } else {
504
//                                if (mCamera != null) {
505
//                                    scanRestart();
506
//                                }
507
//                                String error_message = JsonUtils.getKeyResult(response, "error_message");
508
//                                String urll = "http://123.57.6.131/zhannew/basic/web/index.php/log/write";
509
//                                OkHttpUtils.post()
510
//                                        .url(urll)
511
//                                        .addParams("url", url)
512
//                                        .addParams("code", code)
513
//                                        .addParams("message", error_message)
514
//                                        .addParams("type", "android")
515
//                                        .build()
516
//                                        .execute(new StringCallback() {
517
//                                            @Override
518
//                                            public void onError(Call call, Exception e) {
519
//
520
//                                            }
521
//
522
//                                            @Override
523
//                                            public void onResponse(String response) {
524
//
525
//                                            }
526
//                                        });
527
//                                ToastUtil.showToast(getApplicationContext(), error_message, Toast.LENGTH_SHORT);
528
//                            }
529
//                        }
530
//                    }
531
//                });
532
//    }
533
//
534
//    private void checkoutInfo(final String zhuang_num) {
535
//        long appTime1 = System.currentTimeMillis() / 1000;
536
//        Log.i("appTime(long)---", appTime1 + "");
537
//        long updatetime = appTime1 - MainMapActivity.cha - 3;
538
//        Log.i("updatetime(long)---", updatetime + "");
539
//        Log.i("cha---", MainMapActivity.cha + "");
540
//        String token = String.valueOf(updatetime);
541
//        final String url = MainApplication.url + "/zhannew/basic/web/index.php/xxapi/info" +
542
//                "?stubId=" + zhuang_num + "&supplier=星星充电&timer=" + token + "&user_id=" + MainApplication.userId + "&ver=1.0&sign="
543
//                + Md5Util.md5("stubId=" + zhuang_num + "&supplier=星星充电&timer=" + token + "&user_id=" + MainApplication.userId + "&key=661f9efdcb4f46fe7ab5f2e78a705a2a");
544
//
545
//        Log.e("url", url);
546
//        OkHttpUtils
547
//                .get()
548
//                .url(url)
549
//                .build()
550
//                .connTimeOut(20000)
551
//                .readTimeOut(20000)
552
//                .execute(new StringCallback() {
553
//                    @Override
554
//                    public void onError(Call call, Exception e) {
555
//                        Toast.makeText(getApplicationContext(), "网络不给力", Toast.LENGTH_SHORT).show();
556
//                        dialog.cancel();
557
//                    }
558
//
559
//                    @Override
560
//                    public void onResponse(String response) {
561
//                        Log.e("response====", response);
562
//                        String error_message = JsonUtils.getKeyResult(response, "error_message");
563
//                        String code = JsonUtils.getKeyResult(response, "code");
564
//                        dialog.cancel();
565
//                        if (code != null) {
566
//                            if (code.equals("104")) {
567
//                                String urll = "http://123.57.6.131/zhannew/basic/web/index.php/log/write";
568
//                                OkHttpUtils.post()
569
//                                        .url(urll)
570
//                                        .addParams("url", url)
571
//                                        .addParams("code", code)
572
//                                        .addParams("message", error_message)
573
//                                        .addParams("type", "android")
574
//                                        .build()
575
//                                        .execute(new StringCallback() {
576
//                                            @Override
577
//                                            public void onError(Call call, Exception e) {
578
//
579
//                                            }
580
//
581
//                                            @Override
582
//                                            public void onResponse(String response) {
583
//
584
//                                            }
585
//                                        });
586
//                                new AlertDialog(MyCaptureActivity.this).builder()
587
//                                        .setMsg("您的余额不足1元,可能无法满\n足您此次充电")
588
//                                        .setPositiveButton("去充值", new View.OnClickListener() {
589
//                                            @Override
590
//                                            public void onClick(View v) {
591
//                                                startActivity(new Intent(getApplication(), AccountRechargeActivity.class));
592
//                                            }
593
//                                        }).setNegativeButton("取消", new View.OnClickListener() {
594
//                                    @Override
595
//                                    public void onClick(View v) {
596
//                                        if (mCamera != null) {
597
//                                            scanRestart();
598
//                                        }
599
//                                    }
600
//                                }).show();
601
//                            } else if (code.equals("106")) {
602
//                                if (mCamera != null) {
603
//                                    scanRestart();
604
//                                }
605
//                                String urll = "http://123.57.6.131/zhannew/basic/web/index.php/log/write";
606
//                                OkHttpUtils.post()
607
//                                        .url(urll)
608
//                                        .addParams("url", url)
609
//                                        .addParams("code", code)
610
//                                        .addParams("message", error_message)
611
//                                        .addParams("type", "android")
612
//                                        .build()
613
//                                        .execute(new StringCallback() {
614
//                                            @Override
615
//                                            public void onError(Call call, Exception e) {
616
//
617
//                                            }
618
//
619
//                                            @Override
620
//                                            public void onResponse(String response) {
621
//
622
//                                            }
623
//                                        });
624
//                                ToastUtil.showToast(getApplicationContext(), "无此电桩,请重新扫码", Toast.LENGTH_SHORT);
625
//                            } else if (code.equals("301")) {
626
//                                if (mCamera != null) {
627
//                                    scanRestart();
628
//                                }
629
//                                String urll = "http://123.57.6.131/zhannew/basic/web/index.php/log/write";
630
//                                OkHttpUtils.post()
631
//                                        .url(urll)
632
//                                        .addParams("url", url)
633
//                                        .addParams("code", code)
634
//                                        .addParams("message", error_message)
635
//                                        .addParams("type", "android")
636
//                                        .build()
637
//                                        .execute(new StringCallback() {
638
//                                            @Override
639
//                                            public void onError(Call call, Exception e) {
640
//
641
//                                            }
642
//
643
//                                            @Override
644
//                                            public void onResponse(String response) {
645
//
646
//                                            }
647
//                                        });
648
//                                ToastUtil.showToast(getApplicationContext(), "终端系统错误", Toast.LENGTH_SHORT);
649
//                            } else if (code.equals("200")) {
650
////                            00:空闲,01:充电中,02:故障,03:车位占用,04:维护中,
651
////                            05:离线,06:在建中,07:升级中,99:删除
652
//
653
//                                String data = JsonUtils.getKeyResult(response, "data");
654
//                                Log.e("data===", data);
655
//                                String status = JsonUtils.getKeyResult(data, "status");
656
//                                if (status.equals("00")) {
657
//                                    stubGroupId = JsonUtils.getKeyResult(data, "stubGroupId");
658
//                                    try {
659
//                                        startCharging(zhuang_num);
660
//                                    } catch (Exception e) {
661
//                                        e.printStackTrace();
662
//                                    }
663
//
664
//
665
//                                } else if (status.equals("01")) {
666
//                                    new AlertDialog(MyCaptureActivity.this).builder()
667
//                                            .setMsg("充电中")
668
//                                            .setNegativeButton("确定", new View.OnClickListener() {
669
//                                                @Override
670
//                                                public void onClick(View v) {
671
//                                                    scanRestart();
672
////                                        startActivity(new Intent(getApplication(),ChargingStatusActivity.class));
673
//                                                }
674
//                                            }).show();
675
//                                } else if (status.equals("02")) {
676
//                                    scanRestart();
677
//                                    ToastUtil.showToast(getApplicationContext(), "故障", Toast.LENGTH_SHORT);
678
//                                } else if (status.equals("03")) {
679
//                                    scanRestart();
680
//                                    ToastUtil.showToast(getApplicationContext(), "车位占用", Toast.LENGTH_SHORT);
681
//                                } else if (status.equals("04")) {
682
//                                    scanRestart();
683
//                                    ToastUtil.showToast(getApplicationContext(), "维护中", Toast.LENGTH_SHORT);
684
//                                } else if (status.equals("05")) {
685
//                                    scanRestart();
686
//                                    ToastUtil.showToast(getApplicationContext(), "离线", Toast.LENGTH_SHORT);
687
//                                } else if (status.equals("06")) {
688
//                                    scanRestart();
689
//                                    ToastUtil.showToast(getApplicationContext(), "在建中", Toast.LENGTH_SHORT);
690
//                                } else if (status.equals("07")) {
691
//                                    scanRestart();
692
//                                    ToastUtil.showToast(getApplicationContext(), "升级中", Toast.LENGTH_SHORT);
693
//                                } else if (status.equals("99")) {
694
//                                    scanRestart();
695
//                                    ToastUtil.showToast(getApplicationContext(), "删除", Toast.LENGTH_SHORT);
696
//                                }
697
//                            } else if (code.equals("600")) {
698
//                                scanRestart();
699
//                                ToastUtil.showToast(getApplicationContext(), "由于网络原因,您有一笔订单未结算,请稍候再试", Toast.LENGTH_SHORT);
700
//                            } else {
701
//                                ToastUtil.showToast(getApplicationContext(), "无此电桩,请重新扫码", Toast.LENGTH_SHORT);
702
//                                scanRestart();
703
//                            }
704
//                        } else {
705
//                            ToastUtil.showToast(getApplicationContext(), "code为空", Toast.LENGTH_SHORT);
706
//                        }
707
//                    }
708
//                });
709
//    }
710
//
711
//    private void sp() {
712
//        SharedPreferences sharedPreferences = getApplication().getSharedPreferences("userInfo",
713
//                Activity.MODE_PRIVATE);
714
//        password = sharedPreferences.getString("password", "");
715
//    }
716
//
717
//    private void startCharging(final String zhuang_num) throws Exception {
718
//        sp();
719
//        dialog.show();
720
//        long appTime1 = System.currentTimeMillis() / 1000;
721
//        long updatetime = appTime1 - MainMapActivity.cha - 3;
722
//        String token = String.valueOf(updatetime);
723
//        String s = "password=" + DES3.encode(password) + "&stubGroupId=" + stubGroupId + "&stubId=" + zhuang_num + "&supplier=" + "星星充电&timer=" + token + "&user_id=" + MainApplication.userId + "&key=661f9efdcb4f46fe7ab5f2e78a705a2a";
724
//        final String url = MainApplication.url + "/zhannew/basic/web/index.php/charge/start" +
725
//                "?password=" + URLEncoder.encode(DES3.encode(password)) + "&stubGroupId=" + stubGroupId + "&stubId=" + zhuang_num + "&supplier=" + URLEncoder.encode("星星充电") + "&timer=" + token + "&user_id=" + MainApplication.userId + "&ver=1.0&sign="
726
//                + Md5Util.md5(s);
727
//        Log.e("urlstart===", URLEncoder.encode(url));
728
//        OkHttpUtils.get()
729
//                .url(url)
730
//                .build()
731
//                .connTimeOut(10000)
732
//                .readTimeOut(10000)
733
//                .execute(new StringCallback() {
734
//                    @Override
735
//                    public void onError(Call call, Exception e) {
736
//                        Toast.makeText(getApplicationContext(), "网络不给力", Toast.LENGTH_SHORT).show();
737
//                        dialog.cancel();
738
//                    }
739
//
740
//                    @Override
741
//                    public void onResponse(String response) {
742
//                        Log.e("start===", response);
743
//                        dialog.cancel();
744
//                        String code = JsonUtils.getKeyResult(response, "code");
745
//                        if (code != null) {
746
//                            if (code.equals("400")) {
747
//                                String error_message = JsonUtils.getKeyResult(response, "error_message");
748
//                                String urll = "http://123.57.6.131/zhannew/basic/web/index.php/log/write";
749
//                                OkHttpUtils.post()
750
//                                        .url(urll)
751
//                                        .addParams("url", url)
752
//                                        .addParams("code", code)
753
//                                        .addParams("message", error_message)
754
//                                        .addParams("type", "android")
755
//                                        .build()
756
//                                        .execute(new StringCallback() {
757
//                                            @Override
758
//                                            public void onError(Call call, Exception e) {
759
//
760
//                                            }
761
//
762
//                                            @Override
763
//                                            public void onResponse(String response) {
764
//
765
//                                            }
766
//                                        });
767
//                                new AlertDialog(MyCaptureActivity.this).builder()
768
//                                        .setMsg(error_message)
769
//                                        .setNegativeButton("确定", new View.OnClickListener() {
770
//                                            @Override
771
//                                            public void onClick(View v) {
772
//                                                if (mCamera != null) {
773
//                                                    scanRestart();
774
//                                                }
775
////                                        startActivity(new Intent(getApplication(),ChargingStatusActivity.class));
776
//
777
////                                                startCharging();
778
//                                            }
779
//                                        }).show();
780
//
781
//
782
//                            } else if (code.equals("200")) {
783
//                                Intent intent = new Intent(getApplication(), ChargingStatusActivity.class);
784
////								intent.putExtra("stubId",zhuang_num);
785
////								intent.putExtra("stubGroupId",stubGroupId);
786
//                                intent.putExtra("type", "xx");
787
//                                startActivity(intent);
788
//                                if (mCamera != null) {
789
//                                    scanRestart();
790
//                                }
791
//                                finish();
792
//                            } else {
793
//                                if (mCamera != null) {
794
//                                    scanRestart();
795
//                                }
796
//                                String error_message = JsonUtils.getKeyResult(response, "error_message");
797
//                                String urll = "http://123.57.6.131/zhannew/basic/web/index.php/log/write";
798
//                                OkHttpUtils.post()
799
//                                        .url(urll)
800
//                                        .addParams("url", url)
801
//                                        .addParams("code", code)
802
//                                        .addParams("message", error_message)
803
//                                        .addParams("type", "android")
804
//                                        .build()
805
//                                        .execute(new StringCallback() {
806
//                                            @Override
807
//                                            public void onError(Call call, Exception e) {
808
//
809
//                                            }
810
//
811
//                                            @Override
812
//                                            public void onResponse(String response) {
813
//
814
//                                            }
815
//                                        });
816
//
817
//                                ToastUtil.showToast(getApplicationContext(), error_message, Toast.LENGTH_SHORT);
818
//                            }
819
//                        }
820
//                    }
821
//                });
822
//    }
823
//
824
//    private void checkTlD(final String chargingCode) {
825
//        final String url = MainApplication.url + "/zhannew/basic/web/index.php/special/info?pile_id=" + chargingCode + "&user_id=" + MainApplication.userId;
826
//        Log.e("checkTlD_url===", url);
827
//        dialog.show();
828
//        OkHttpUtils.get().url(url).build().execute(new StringCallback() {
829
//            @Override
830
//            public void onError(Call call, Exception e) {
831
//
832
//            }
833
//
834
//            @Override
835
//            public void onResponse(String response) {
836
//                dialog.cancel();
837
//                Log.e("checkTlD_response", response);
838
//                String code = JsonUtils.getKeyResult(response, "code");
839
//                if (code.equals("200")) {
840
//                    String group_id = JsonUtils.getKeyResult(response, "group_id");
841
//                    String eletype = JsonUtils.getKeyResult(response, "eletype");
842
//                    Intent intent = new Intent(getApplicationContext(), TLDLoadingActivity.class);
843
//                    intent.putExtra("eletype", eletype);
844
//                    intent.putExtra("chargingCode", chargingCode);
845
//                    intent.putExtra("group_id", group_id);
846
//                    startActivity(intent);
847
//                    finish();
848
//
849
////                    startTLD(chargingCode,group_id);
850
//                } else {
851
//                    String error_messge = JsonUtils.getKeyResult(response, "error_message");
852
//                    Toast.makeText(getApplicationContext(), error_messge, Toast.LENGTH_SHORT).show();
853
//                    new Handler().postDelayed(new Runnable() {
854
//                        public void run() {
855
//                            if (mCamera != null) {
856
//                                scanRestart();
857
//                            }
858
//                        }
859
//                    }, 1500);
860
//                }
861
//            }
862
//        });
863
//    }
864
//
865
//    private void getChargingPile(final String result) {
866
//        String url = MainApplication.url + "/zhannew/basic/web/index.php/interface/info?flag=1&user_id=" + MainApplication.userId + "&url=" + result;
867
//        Log.e(TAG, "getChargingPile: url=" + url);
868
//        OkHttpUtils.get().url(url).build().execute(new StringCallback() {
869
//            @Override
870
//            public void onError(Call call, Exception e) {
871
//
872
//            }
873
//
874
//            @Override
875
//            public void onResponse(String response) {
876
//                Log.e(TAG, "onResponse: getChargingPile11=" + response);
877
//                String code = JsonUtils.getKeyResult(response, "code");
878
//                if (code.equals("200")) {
879
//                    String group_id = JsonUtils.getKeyResult(response, "group_id");
880
//                    String eletype = JsonUtils.getKeyResult(response, "eletype");
881
//                    String type = JsonUtils.getKeyResult(response, "type");
882
//                    String pile_code = JsonUtils.getKeyResult(response, "pile_code");
883
//                    if (type.equals("jd")) {
884
//                        startHssy(pile_code, group_id, type);
885
//                    } else {
886
//                        Intent intent = new Intent(getApplicationContext(), TLDLoadingActivity.class);
887
//                        intent.putExtra("type", type);
888
//                        intent.putExtra("eletype", eletype);
889
//                        intent.putExtra("chargingCode", pile_code);
890
//                        intent.putExtra("group_id", group_id);
891
//                        startActivity(intent);
892
//                        finish();
893
//                    }
894
//
895
//                } else {
896
//                    String error_message = JsonUtils.getKeyResult(response, "error_message");
897
//                    ToastUtil.showToast(getApplicationContext(), error_message, Toast.LENGTH_SHORT);
898
//                    new Handler().postDelayed(new Runnable() {
899
//                        public void run() {
900
//                            if (mCamera != null) {
901
//                                scanRestart();
902
//                            }
903
//
904
//                        }
905
//                    }, 1500);
906
//                }
907
//            }
908
//        });
909
//    }
910
//
911
//    private void startHssy(String pile_code, String group_id, String type) {
912
//        long appTime1 = System.currentTimeMillis() / 1000;
913
//        long updatetime = appTime1 - MainMapActivity.cha - 3;
914
//        String token = String.valueOf(updatetime);
915
//        String s = "group_id=" + group_id + "&password=" + MainApplication.userPassword + "&pile_code=" + pile_code + "&timer=" + token + "&type=" + type + "&user_id=" + MainApplication.userId + "&key=661f9efdcb4f46fe7ab5f2e78a705a2a";
916
//        String url = MainApplication.url + "/zhannew/basic/web/index.php/interface/start_v2?" +
917
//                "ver=1.0&type=" + type + "&timer=" + token + "&user_id=" + MainApplication.userId + "&pile_code="
918
//                + pile_code + "&group_id=" + group_id + "&password=" + MainApplication.userPassword + "&sign=" + Md5Util.md5(s);
919
//        Log.e(TAG, "startHssy: url=" + url);
920
//        OkHttpUtils.get().url(url).build().execute(new StringCallback() {
921
//            @Override
922
//            public void onError(Call call, Exception e) {
923
//
924
//            }
925
//
926
//            @Override
927
//            public void onResponse(String response) {
928
//                Log.e(TAG, "onResponse: startHssy=" + response);
929
//                String code = JsonUtils.getKeyResult(response, "code");
930
//                if (code.equals("200")) {
931
//                    MainApplication.isAppStart = true;
932
//                    ProfileManager.getInstance().setAppStart(getApplicationContext(), MainApplication.isAppStart);
933
//                    startActivity(new Intent(getApplicationContext(), ChargingStatusActivity.class));
934
//                    finish();
935
//                } else {
936
//                    String error_message = JsonUtils.getKeyResult(response, "error_message");
937
//                    ToastUtil.showToast(getApplicationContext(), error_message, Toast.LENGTH_SHORT);
938
//                    new Handler().postDelayed(new Runnable() {
939
//                        public void run() {
940
//                            if (mCamera != null) {
941
//                                scanRestart();
942
//                            }
943
//                        }
944
//                    }, 1500);
945
//                }
946
//            }
947
//        });
948
//    }
949
//
950
//
951
//}

+ 0 - 68
app/src/main/java/com/electric/chargingpile/activity/TLDLoadingActivity.java

@ -113,38 +113,6 @@ public class TLDLoadingActivity extends Activity {
113 113
114 114
            @Override
115 115
            public void onResponse(final String response) {
116
//                AlertDialog.Builder builder = new AlertDialog.Builder(TLDLoadingActivity.this);
117
//                builder.setTitle("提示");
118
//                builder.setMessage(response);
119
//                builder.setCancelable(false);
120
//                builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
121
//                    @Override
122
//                    public void onClick(DialogInterface dialogg, int which) {
123
//                        if (EmptyUtils.isNotEmpty(response)){
124
//                            LogUtils.e("query:"+response);
125
//                            String rtnCode = JsonUtils.getKeyResult(response,"rtnCode");
126
//                            String rtnMsg = JsonUtils.getKeyResult(response,"rtnMsg");
127
//                            if ("01".equals(rtnCode)){
128
//                                String data = JsonUtils.getKeyResult(response,"data");
129
//                                ChargingBean chargingBean = JsonUtils.parseToObjectBean(data,ChargingBean.class);
130
//                                if (chargingBean.getStatus() == 1) {
131
//                                    MainApplication.isAppStart = true;
132
//                                    ProfileManager.getInstance().setAppStart(getApplicationContext(), MainApplication.isAppStart);
133
//                                    Intent intent = new Intent(getApplicationContext(), ChargingStatusActivity.class);
134
//                                    intent.putExtra(ChargingConstants.ORDERID, orderId);
135
//                                    startActivity(intent);
136
//                                }else {
137
//                                    ToastUtil.showToast(getApplicationContext(),"当前终端无响应,请拔枪重试或更换其他充电桩",Toast.LENGTH_SHORT);
138
//                                }
139
//                            }else {
140
//                                ToastUtil.showToast(getApplicationContext(), rtnMsg, Toast.LENGTH_SHORT);
141
//                            }
142
//                            finish();
143
//                        }
144
//                    }
145
//                });
146
//                builder.setNegativeButton("取消", null);
147
//                builder.create().show();
148 116
149 117
                if (EmptyUtils.isNotEmpty(response)) {
150 118
                    LogUtils.e("query:" + response);
@ -171,40 +139,4 @@ public class TLDLoadingActivity extends Activity {
171 139
        });
172 140
    }
173 141
174
175
//    private void startCharging(String pile_code,String group_id,String type,int time){
176
//        long appTime1 = System.currentTimeMillis() / 1000;
177
//        long updatetime = appTime1 - MainMapActivity.cha - 3;
178
//        String token = String.valueOf(updatetime);
179
//        String s = "group_id="+group_id+"&password="+MainApplication.userPassword+"&pile_code="+pile_code+"&timer="+token+"&type="+type+"&user_id="+MainApplication.userId+"&key=661f9efdcb4f46fe7ab5f2e78a705a2a";
180
//        String url = MainApplication.url+"/zhannew/basic/web/index.php/interface/start_v2?" +
181
//                "ver=1.0&type="+type+"&timer="+token+"&user_id="+MainApplication.userId+"&pile_code="
182
//                +pile_code+"&group_id="+group_id+"&password="+MainApplication.userPassword+"&sign="+ Md5Util.md5(s);
183
////        Log.e(TAG, "startHssy: url="+url );
184
//        OkHttpUtils.get().url(url).build().connTimeOut(time*1000).readTimeOut(time*1000).execute(new StringCallback() {
185
//            @Override
186
//            public void onError(Call call, Exception e) {
187
//                ToastUtil.showToast(getApplicationContext(),"网络异常,请检查您的网络连接",Toast.LENGTH_SHORT);
188
//                CrashReport.postCatchedException(e);
189
//            }
190
//
191
//            @Override
192
//            public void onResponse(String response) {
193
//                LogUtils.e(response);
194
//                String code = JsonUtils.getKeyResult(response,"code");
195
//                if (code.equals("200")){
196
//                    MainApplication.isAppStart = true;
197
//                    ProfileManager.getInstance().setAppStart(getApplicationContext(),MainApplication.isAppStart);
198
//                    startActivity(new Intent(getApplicationContext(),ChargingStatusActivity.class));
199
//                    finish();
200
//                }else {
201
//                    String error_message = JsonUtils.getKeyResult(response,"error_message");
202
//                    ToastUtil.showToast(getApplicationContext(), error_message, Toast.LENGTH_SHORT);
203
//                    finish();
204
//                }
205
//            }
206
//        });
207
//    }
208
209
210 142
}

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


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


BIN
app/src/main/res/drawable-mdpi/bg_charging_orange.png


BIN
app/src/main/res/drawable-mdpi/icon_zhan_name_orange.png


BIN
app/src/main/res/drawable-xhdpi/bg_charging_orange.png


BIN
app/src/main/res/drawable-xhdpi/icon_zhan_name_orange.png


BIN
app/src/main/res/drawable-xxhdpi/bg_charging_orange.png


BIN
app/src/main/res/drawable-xxhdpi/icon_zhan_name_orange.png


BIN
app/src/main/res/drawable-xxxhdpi/bg_charging_orange.png


BIN
app/src/main/res/drawable-xxxhdpi/icon_zhan_name_orange.png


+ 10 - 0
app/src/main/res/drawable/bg_tv_stop_green.xml

@ -0,0 +1,10 @@
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
    <!-- 表示shape的四个角的角度。只适用于矩形shape,这里的角度是指圆角的程度 -->
6
    <corners android:radius="5dp" />
7
8
    <!-- 这个标签表示纯色填充,通过android:color即可指定shape中填充的颜色 -->
9
    <solid android:color="#1BB637" />
10
</shape>

+ 10 - 0
app/src/main/res/drawable/bg_tv_stop_orange.xml

@ -0,0 +1,10 @@
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
    <!-- 表示shape的四个角的角度。只适用于矩形shape,这里的角度是指圆角的程度 -->
6
    <corners android:radius="5dp" />
7
8
    <!-- 这个标签表示纯色填充,通过android:color即可指定shape中填充的颜色 -->
9
    <solid android:color="#FF985A" />
10
</shape>

+ 73 - 74
app/src/main/res/layout/activity_charging_status.xml

@ -1,19 +1,19 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:app="http://schemas.android.com/apk/res-auto"
3 4
    xmlns:tools="http://schemas.android.com/tools"
4 5
    android:layout_width="match_parent"
5 6
    android:layout_height="match_parent"
6
    android:orientation="vertical"
7 7
    android:background="@color/white"
8
    xmlns:app="http://schemas.android.com/apk/res-auto"
8
    android:orientation="vertical"
9 9
    tools:context="com.electric.chargingpile.activity.ChargingStatusActivity">
10 10
11 11
    <RelativeLayout
12 12
        android:id="@+id/rl_title"
13 13
        android:layout_width="match_parent"
14 14
        android:layout_height="44dp"
15
        android:layout_alignParentLeft="true"
16 15
        android:layout_alignParentStart="true"
16
        android:layout_alignParentLeft="true"
17 17
        android:layout_alignParentTop="true"
18 18
        android:background="@color/white">
19 19
@ -41,114 +41,112 @@
41 41
            android:layout_width="wrap_content"
42 42
            android:layout_height="match_parent"
43 43
            android:layout_alignParentRight="true"
44
            android:text="充电帮助"
45
            android:textSize="16sp"
46
            android:textColor="@color/lvse"
47 44
            android:gravity="center"
45
            android:paddingLeft="16dp"
48 46
            android:paddingRight="16dp"
49
            android:paddingLeft="16dp"/>
47
            android:text="充电帮助"
48
            android:textColor="@color/lvse"
49
            android:textSize="15sp" />
50 50
51 51
    </RelativeLayout>
52 52
53 53
    <LinearLayout
54 54
        android:id="@+id/ll_charginginfo"
55
        android:layout_height="44dp"
56 55
        android:layout_width="match_parent"
56
        android:layout_height="44dp"
57
        android:layout_below="@+id/rl_circle"
57 58
        android:layout_marginLeft="12dp"
58
        android:layout_marginRight="12dp"
59
        android:orientation="horizontal"
60 59
        android:layout_marginTop="26dp"
61
        android:layout_below="@+id/rl_circle">
60
        android:layout_marginRight="12dp"
61
        android:orientation="horizontal">
62 62
63 63
        <RelativeLayout
64
            android:layout_height="match_parent"
65 64
            android:layout_width="0dp"
65
            android:layout_height="match_parent"
66 66
            android:layout_weight="1">
67 67
68 68
            <TextView
69 69
                android:layout_width="wrap_content"
70 70
                android:layout_height="wrap_content"
71
                android:text="电流(安)"
72
                android:textColor="@color/ui_68"
73
                android:textSize="12sp"
74 71
                android:layout_alignParentTop="true"
75 72
                android:layout_centerHorizontal="true"
76
                android:layout_gravity="center" />
73
                android:layout_gravity="center"
74
                android:text="电流(安)"
75
                android:textColor="@color/ui_68"
76
                android:textSize="12sp" />
77 77
78 78
            <TextView
79 79
                android:id="@+id/tv_dianliu"
80 80
                android:layout_width="wrap_content"
81 81
                android:layout_height="wrap_content"
82
                android:text="--"
83 82
                android:layout_alignParentBottom="true"
84 83
                android:layout_centerHorizontal="true"
84
                android:text="--"
85 85
                android:textColor="@color/ui_65"
86 86
                android:textSize="17sp" />
87 87
88 88
89
90
91 89
        </RelativeLayout>
92 90
93 91
        <View
94 92
            android:layout_width="0.5dp"
95 93
            android:layout_height="match_parent"
96
            android:background="@color/ui_6d"/>
94
            android:background="@color/ui_6d" />
97 95
98 96
        <RelativeLayout
99
            android:layout_height="match_parent"
100 97
            android:layout_width="0dp"
98
            android:layout_height="match_parent"
101 99
            android:layout_weight="1">
102 100
103 101
            <TextView
104 102
                android:layout_width="wrap_content"
105 103
                android:layout_height="wrap_content"
104
                android:layout_alignParentTop="true"
105
                android:layout_centerHorizontal="true"
106 106
                android:text="电压(伏)"
107 107
                android:textColor="@color/ui_68"
108
                android:textSize="12sp"
109
                android:layout_alignParentTop="true"
110
                android:layout_centerHorizontal="true" />
108
                android:textSize="12sp" />
111 109
112 110
            <TextView
113 111
                android:id="@+id/tv_dianya"
114 112
                android:layout_width="wrap_content"
115 113
                android:layout_height="wrap_content"
114
                android:layout_alignParentBottom="true"
115
                android:layout_centerHorizontal="true"
116 116
                android:text="--"
117 117
                android:textColor="@color/ui_65"
118
                android:textSize="17sp"
119
                android:layout_alignParentBottom="true"
120
                android:layout_centerHorizontal="true"/>
118
                android:textSize="17sp" />
121 119
122 120
        </RelativeLayout>
123 121
124 122
        <View
125 123
            android:layout_width="0.5dp"
126 124
            android:layout_height="match_parent"
127
            android:background="@color/ui_6d"/>
125
            android:background="@color/ui_6d" />
128 126
129 127
        <RelativeLayout
130
            android:layout_height="match_parent"
131 128
            android:layout_width="0dp"
129
            android:layout_height="match_parent"
132 130
            android:layout_weight="1">
133 131
134 132
            <TextView
135 133
                android:layout_width="wrap_content"
136 134
                android:layout_height="wrap_content"
135
                android:layout_alignParentTop="true"
136
                android:layout_centerHorizontal="true"
137 137
                android:text="充电进程"
138 138
                android:textColor="@color/ui_68"
139
                android:textSize="12sp"
140
                android:layout_alignParentTop="true"
141
                android:layout_centerHorizontal="true" />
139
                android:textSize="12sp" />
142 140
143 141
            <TextView
144 142
                android:id="@+id/tv_jindu"
145 143
                android:layout_width="wrap_content"
146 144
                android:layout_height="wrap_content"
145
                android:layout_alignParentBottom="true"
146
                android:layout_centerHorizontal="true"
147 147
                android:text="--"
148 148
                android:textColor="@color/ui_65"
149
                android:textSize="17sp"
150
                android:layout_alignParentBottom="true"
151
                android:layout_centerHorizontal="true"/>
149
                android:textSize="17sp" />
152 150
153 151
        </RelativeLayout>
154 152
@ -159,33 +157,33 @@
159 157
        android:layout_width="172dp"
160 158
        android:layout_height="172dp"
161 159
        android:layout_centerHorizontal="true"
160
        android:layout_gravity="center_horizontal"
162 161
        android:layout_marginTop="40dp"
163
        android:background="@drawable/bg_charging"
164
        android:layout_gravity="center_horizontal">
162
        android:background="@drawable/bg_charging">
165 163
166 164
        <me.itangqi.waveloadingview.WaveLoadingView
167 165
            android:id="@+id/waveLoadingView"
168 166
            android:layout_width="match_parent"
169 167
            android:layout_height="match_parent"
170 168
            app:wlv_borderColor="#00ffffff"
171
            app:wlv_wave_background_Color="#00ffffff"
172 169
            app:wlv_borderWidth="1dp"
173
            app:wlv_shapeType="circle"
174 170
            app:wlv_round_rectangle="false"
171
            app:wlv_shapeType="circle"
175 172
            app:wlv_titleCenterStrokeColor="@android:color/holo_blue_dark"
176 173
            app:wlv_titleCenterStrokeWidth="3dp"
177 174
            app:wlv_waveAmplitude="60"
178
            app:wlv_waveColor="#3fffffff"/>
175
            app:wlv_waveColor="#3fffffff"
176
            app:wlv_wave_background_Color="#00ffffff" />
179 177
180 178
181 179
        <!--<com.loonggg.circleprogressbarlibrary.view.CircleProgressBar-->
182
            <!--android:id="@+id/pb"-->
183
            <!--android:layout_width="143dp"-->
184
            <!--android:layout_height="143dp"-->
185
            <!--android:visibility="gone"-->
186
            <!--android:layout_centerInParent="true"-->
187
            <!--loonggg:bgProgressBarColor="#efefef"-->
188
            <!--loonggg:circleStrokeWidth="5dp" />-->
180
        <!--android:id="@+id/pb"-->
181
        <!--android:layout_width="143dp"-->
182
        <!--android:layout_height="143dp"-->
183
        <!--android:visibility="gone"-->
184
        <!--android:layout_centerInParent="true"-->
185
        <!--loonggg:bgProgressBarColor="#efefef"-->
186
        <!--loonggg:circleStrokeWidth="5dp" />-->
189 187
190 188
        <LinearLayout
191 189
            android:layout_width="wrap_content"
@ -221,13 +219,13 @@
221 219
        android:layout_width="wrap_content"
222 220
        android:layout_height="wrap_content"
223 221
        android:layout_gravity="center_horizontal"
224
        android:gravity="center_vertical"
225
        android:textColor="@color/ui_62"
222
        android:layout_marginTop="33dp"
226 223
        android:drawableLeft="@drawable/icon_zhan_name"
227 224
        android:drawablePadding="8dp"
225
        android:gravity="center_vertical"
228 226
        android:text=""
229
        android:textSize="18sp"
230
        android:layout_marginTop="33dp" />
227
        android:textColor="@color/ui_62"
228
        android:textSize="18sp" />
231 229
232 230
    <LinearLayout
233 231
        android:layout_width="match_parent"
@ -243,28 +241,28 @@
243 241
            <TextView
244 242
                android:layout_width="wrap_content"
245 243
                android:layout_height="wrap_content"
244
                android:layout_alignParentTop="true"
245
                android:layout_centerHorizontal="true"
246 246
                android:text="充电时长"
247
                android:textSize="12sp"
248 247
                android:textColor="@color/ui_68"
249
                android:layout_alignParentTop="true"
250
                android:layout_centerHorizontal="true"/>
248
                android:textSize="12sp" />
251 249
252 250
            <TextView
253 251
                android:id="@+id/tv_time"
254 252
                android:layout_width="wrap_content"
255 253
                android:layout_height="wrap_content"
256 254
                android:layout_alignParentBottom="true"
255
                android:layout_centerHorizontal="true"
257 256
                android:text="--"
258
                android:textSize="21sp"
259 257
                android:textColor="@color/ui_62"
260
                android:layout_centerHorizontal="true"/>
258
                android:textSize="21sp" />
261 259
262 260
        </RelativeLayout>
263 261
264 262
        <View
265 263
            android:layout_width="0.5dp"
266 264
            android:layout_height="match_parent"
267
            android:background="@color/ui_6d"/>
265
            android:background="@color/ui_6d" />
268 266
269 267
        <RelativeLayout
270 268
            android:layout_width="0dp"
@ -274,11 +272,11 @@
274 272
            <TextView
275 273
                android:layout_width="wrap_content"
276 274
                android:layout_height="wrap_content"
275
                android:layout_alignParentTop="true"
276
                android:layout_centerHorizontal="true"
277 277
                android:text="充电金额"
278
                android:textSize="12sp"
279 278
                android:textColor="@color/ui_68"
280
                android:layout_alignParentTop="true"
281
                android:layout_centerHorizontal="true" />
279
                android:textSize="12sp" />
282 280
283 281
            <TextView
284 282
                android:id="@+id/tv_cost"
@ -286,17 +284,16 @@
286 284
                android:layout_height="wrap_content"
287 285
                android:layout_alignParentBottom="true"
288 286
                android:layout_centerHorizontal="true"
287
                android:layout_centerVertical="true"
289 288
                android:text="--"
290
                android:textSize="21sp"
291 289
                android:textColor="@color/ui_62"
292
                android:layout_centerVertical="true"/>
290
                android:textSize="21sp" />
293 291
294 292
        </RelativeLayout>
295 293
296 294
    </LinearLayout>
297 295
298 296
299
300 297
    <RelativeLayout
301 298
        android:layout_width="match_parent"
302 299
        android:layout_height="match_parent">
@ -309,7 +306,7 @@
309 306
            android:layout_alignParentRight="true"
310 307
            android:layout_marginTop="21dp"
311 308
            android:layout_marginRight="13dp"
312
            android:visibility="gone"/>
309
            android:visibility="gone" />
313 310
314 311
        <TextView
315 312
            android:id="@+id/tv_activity"
@ -319,22 +316,24 @@
319 316
            android:layout_centerHorizontal="true"
320 317
            android:paddingTop="20dp"
321 318
            android:paddingBottom="15dp"
322
            android:textSize="14sp"
323 319
            android:text=""
324 320
            android:textColor="#ffa900"
325
            android:visibility="visible"/>
321
            android:textSize="14sp"
322
            android:visibility="visible" />
326 323
327 324
        <TextView
328 325
            android:id="@+id/tv_stop"
329
            android:layout_width="165dp"
330
            android:layout_height="39dp"
331
            android:background="@drawable/bg_text_yuanlvline_whitebg"
332
            android:text="结束充电"
326
            android:layout_width="match_parent"
327
            android:layout_height="40dp"
328
            android:layout_alignParentBottom="true"
329
            android:layout_marginLeft="15dp"
330
            android:layout_marginRight="15dp"
331
            android:layout_marginBottom="15dp"
332
            android:background="@drawable/bg_tv_stop_green"
333 333
            android:gravity="center"
334
            android:layout_centerInParent="true"
335
            android:textSize="16sp"
336
            android:textColor="@color/lvse"/>
337
334
            android:text="结束充电"
335
            android:textColor="@color/white"
336
            android:textSize="16sp" />
338 337
    </RelativeLayout>
339 338
340 339
</LinearLayout>

+ 0 - 87
zxing/src/main/java/com/google/zxing/client/android/CaptureActivity.java

@ -1388,91 +1388,4 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
1388 1388
            }
1389 1389
        });
1390 1390
    }
1391
1392
//    private void getChargingPile(final String result){
1393
//        String web_url = url+"/zhannew/basic/web/index.php/interface/info?flag=1&user_id="+user_id+"&url="+result;
1394
//        Log.e(TAG, web_url );
1395
//        OkHttpUtils.get().url(web_url).build().execute(new StringCallback() {
1396
//            @Override
1397
//            public void onError(Call call, Exception e) {
1398
//
1399
//            }
1400
//
1401
//            @Override
1402
//            public void onResponse(String response) {
1403
//                if (loadingDialog.isShowing()){
1404
//                    loadingDialog.dismiss();
1405
//                }
1406
//                Log.e(TAG, "onResponse: getChargingPile11="+response );
1407
//                String code = JsonUtils.getKeyResult(response,"code");
1408
//                if (code.equals("200")){
1409
//                    String group_id = JsonUtils.getKeyResult(response,"group_id");
1410
//                    String eletype = JsonUtils.getKeyResult(response,"eletype");
1411
//                    String type = JsonUtils.getKeyResult(response,"type");
1412
//                    String pile_code = JsonUtils.getKeyResult(response,"pile_code");
1413
//                    if (type.equals("jd")){
1414
//                        startHssy(pile_code,group_id,type);
1415
//                    }else {
1416
//                        Intent intent = new Intent();
1417
//                        intent.setClassName("com.electric.chargingpile", "com.electric.chargingpile.activity.TLDLoadingActivity");
1418
//                        intent.putExtra("type",type);
1419
//                        intent.putExtra("eletype",eletype);
1420
//                        intent.putExtra("chargingCode",pile_code);
1421
//                        intent.putExtra("group_id",group_id);
1422
//                        startActivity(intent);
1423
//                        finish();
1424
//                    }
1425
//
1426
//                }else {
1427
//                    String error_message = JsonUtils.getKeyResult(response,"error_message");
1428
////                    ToastUtils.showShort("");
1429
//                    ToastUtil.showToast(getApplicationContext(),error_message,Toast.LENGTH_SHORT);
1430
//                    new Handler().postDelayed(new Runnable() {
1431
//                        public void run() {
1432
//                            restartPreviewAfterDelay(0L);
1433
//                        }
1434
//                    }, 1500);
1435
//                }
1436
//            }
1437
//        });
1438
//    }
1439
//
1440
//    private void startHssy(String pile_code,String group_id,String type){
1441
//        long appTime1 = System.currentTimeMillis() / 1000;
1442
//        long updatetime = appTime1 - cha - 3;
1443
//        String token = String.valueOf(updatetime);
1444
//        String s = "group_id="+group_id+"&password="+user_password+"&pile_code="+pile_code+"&timer="+token+"&type="+type+"&user_id="+user_id+"&key=661f9efdcb4f46fe7ab5f2e78a705a2a";
1445
//        String web_url = url+"/zhannew/basic/web/index.php/interface/start_v2?" +
1446
//                "ver=1.0&type="+type+"&timer="+token+"&user_id="+user_id+"&pile_code="
1447
//                +pile_code+"&group_id="+group_id+"&password="+user_password+"&sign="+ Md5Util.md5(s);
1448
//        Log.e(TAG, "startHssy: url="+web_url );
1449
//        OkHttpUtils.get().url(web_url).build().execute(new StringCallback() {
1450
//            @Override
1451
//            public void onError(Call call, Exception e) {
1452
//
1453
//            }
1454
//
1455
//            @Override
1456
//            public void onResponse(String response) {
1457
//                Log.e(TAG, "onResponse: startHssy="+response );
1458
//                String code = JsonUtils.getKeyResult(response,"code");
1459
//                if (code.equals("200")){
1460
//                    Intent intent = new Intent();
1461
//                    intent.setClassName("com.electric.chargingpile", "com.electric.chargingpile.activity.ChargingStatusActivity");
1462
//                    startActivity(intent);
1463
//                    finish();
1464
//                }else {
1465
//                    String error_message = JsonUtils.getKeyResult(response,"error_message");
1466
//                    ToastUtil.showToast(getApplicationContext(),error_message,Toast.LENGTH_SHORT);
1467
//                    new Handler().postDelayed(new Runnable() {
1468
//                        public void run() {
1469
//                            restartPreviewAfterDelay(0L);
1470
//                        }
1471
//                    }, 1500);
1472
//                }
1473
//            }
1474
//        });
1475
//    }
1476
1477
1478 1391
}

推荐功能页面开发完成 · d85c709efe - Gogs: Go Git Service
Просмотр исходного кода

推荐功能页面开发完成

huyuguo лет назад: 6
Родитель
Сommit
d85c709efe

+ 56 - 24
app/src/main/java/com/electric/chargingpile/activity/RecommendChargingStationActivity.java

@ -30,6 +30,7 @@ import com.blankj.utilcode.util.LogUtils;
30 30
import com.electric.chargingpile.BuildConfig;
31 31
import com.electric.chargingpile.R;
32 32
import com.electric.chargingpile.application.MainApplication;
33
import com.electric.chargingpile.data.PileData;
33 34
import com.electric.chargingpile.data.RecommendZhan;
34 35
import com.electric.chargingpile.util.BarColorUtil;
35 36
import com.electric.chargingpile.util.JsonUtils;
@ -48,6 +49,7 @@ import java.io.PrintWriter;
48 49
import java.net.Socket;
49 50
import java.net.URISyntaxException;
50 51
import java.util.ArrayList;
52
import java.util.Calendar;
51 53
import java.util.Collections;
52 54
import java.util.Comparator;
53 55
import java.util.HashMap;
@ -417,12 +419,13 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
417 419
            final TextView iv_label_ground;
418 420
            final TextView iv_label_free_park;
419 421
            final TextView payment_method;
420
            final TextView fast_num;
421
            final TextView fast_free;
422
            final TextView fast_free_num;
423
            final TextView slow_num;
424
            final TextView slow_free;
425
            final TextView slow_free_num;
422
            final TextView window_tv_fast_free_label;
423
            final TextView window_tv_fast_free_num;
424
            final TextView window_tv_fast_total_num;
425
            final TextView window_tv_slow_free_num;
426
            final TextView window_tv_slow_free_label;
427
            final TextView window_tv_slow_total_num;
428
            final TextView fenshi_info_textview;
426 429
427 430
            public ViewHolder(View itemView) {
428 431
                super(itemView);
@ -443,13 +446,14 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
443 446
                iv_label_free_park = itemView.findViewById(R.id.iv_label_free_park);
444 447
                payment_method = itemView.findViewById(R.id.payment_method);
445 448
446
                fast_num = itemView.findViewById(R.id.fast_num);
447
                fast_free = itemView.findViewById(R.id.fast_free);
448
                fast_free_num = itemView.findViewById(R.id.fast_free_num);
449
                window_tv_fast_free_label = itemView.findViewById(R.id.window_tv_fast_free_label);
450
                window_tv_fast_free_num = itemView.findViewById(R.id.window_tv_fast_free_num);
451
                window_tv_fast_total_num = itemView.findViewById(R.id.window_tv_fast_total_num);
449 452
450
                slow_num = itemView.findViewById(R.id.slow_num);
451
                slow_free = itemView.findViewById(R.id.slow_free);
452
                slow_free_num = itemView.findViewById(R.id.slow_free_num);
453
                window_tv_slow_free_label = itemView.findViewById(R.id.window_tv_slow_free_label);
454
                window_tv_slow_free_num = itemView.findViewById(R.id.window_tv_slow_free_num);
455
                window_tv_slow_total_num = itemView.findViewById(R.id.window_tv_slow_total_num);
456
                fenshi_info_textview = itemView.findViewById(R.id.fenshi_info_textview);
453 457
454 458
            }
455 459
        }
@ -559,6 +563,7 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
559 563
            holder.iv_label_ground.setText("0".equals(recommendZhan.getPark_location()) ? "地下" : "地上");
560 564
            holder.iv_label_free_park.setVisibility(recommendZhan.getStop_cost().contains("免费") ? View.VISIBLE : View.GONE);
561 565
566
562 567
            if ("1".equals(recommendZhan.getOwn_pay())) {
563 568
                holder.payment_method.setText("可使用本APP扫码支付");
564 569
            } else {
@ -570,21 +575,48 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
570 575
            }
571 576
572 577
            if (recommendZhan.getFast_able_num() == null && recommendZhan.getSlow_able_num() == null) {
573
                holder.fast_free.setVisibility(View.GONE);
574
                holder.fast_free_num.setVisibility(View.GONE);
575
                holder.slow_free.setVisibility(View.GONE);
576
                holder.slow_free_num.setVisibility(View.GONE);
578
                holder.window_tv_fast_free_label.setVisibility(View.GONE);
579
                holder.window_tv_fast_total_num.setVisibility(View.GONE);
580
581
                holder.window_tv_slow_free_label.setVisibility(View.GONE);
582
                holder.window_tv_slow_total_num.setVisibility(View.GONE);
583
584
                holder.window_tv_fast_free_num.setText("".equals(recommendZhan.getFast_num()) ? "0" : recommendZhan.getFast_num());
585
                holder.window_tv_slow_free_num.setText("".equals(recommendZhan.getSlow_num()) ? "0" : recommendZhan.getSlow_num());
586
            } else {
587
                holder.window_tv_fast_free_label.setVisibility(View.VISIBLE);
588
                holder.window_tv_fast_total_num.setVisibility(View.VISIBLE);
589
590
                holder.window_tv_slow_free_label.setVisibility(View.VISIBLE);
591
                holder.window_tv_slow_total_num.setVisibility(View.VISIBLE);
592
593
                holder.window_tv_fast_free_num.setText(recommendZhan.getFast_able_num());
594
                holder.window_tv_slow_free_num.setText(recommendZhan.getSlow_able_num());
595
                holder.window_tv_fast_total_num.setText("".equals(recommendZhan.getFast_num()) ? "0" : "/" + recommendZhan.getFast_num());
596
                holder.window_tv_slow_total_num.setText("".equals(recommendZhan.getSlow_num()) ? "0" : "/" +  recommendZhan.getSlow_num());
597
            }
598
599
600
            if ("1".equals(recommendZhan.getFenshi_is())) {
601
                holder.fenshi_info_textview.setText("");
602
                ArrayList<PileData.FenshiInfoBean> fenshiList = (ArrayList<PileData.FenshiInfoBean>) JsonUtils.parseToObjectList(recommendZhan.getFenshi_info(), PileData.FenshiInfoBean.class);
603
                Calendar calendar = Calendar.getInstance();
604
                int hours = calendar.get(Calendar.HOUR_OF_DAY);
605
                int minutes = calendar.get(Calendar.MINUTE);
606
                int totalMinutes = hours * 60 + minutes;
607
608
                for (PileData.FenshiInfoBean bean : fenshiList) {
609
                    if (bean.getStartTotalMinutes() > totalMinutes) {
610
                        Double service_free = Double.valueOf(bean.getService_free());
611
                        Double charge_free = Double.valueOf(bean.getCharge_free());
612
                        holder.fenshi_info_textview.setText(String.format("%s开始 %.2f元/度", bean.getStart(), service_free + charge_free));
613
                        break;
614
                    }
615
                }
577 616
            } else {
578
                holder.fast_free.setVisibility(View.VISIBLE);
579
                holder.fast_free_num.setVisibility(View.VISIBLE);
580
                holder.slow_free.setVisibility(View.VISIBLE);
581
                holder.slow_free_num.setVisibility(View.VISIBLE);
582
                holder.fast_free_num.setText(recommendZhan.getFast_able_num());
583
                holder.slow_free_num.setText(recommendZhan.getSlow_able_num());
617
                holder.fenshi_info_textview.setText("");
584 618
            }
585 619
586
            holder.fast_num.setText("".equals(recommendZhan.getFast_num()) ? "" : recommendZhan.getFast_num());
587
            holder.slow_num.setText("".equals(recommendZhan.getSlow_num()) ? "0" : recommendZhan.getSlow_num());
588 620
        }
589 621
590 622
        @Override

+ 89 - 61
app/src/main/java/com/electric/chargingpile/activity/SearchActivity.java

@ -12,6 +12,7 @@ import android.os.Handler;
12 12
import androidx.appcompat.app.AlertDialog;
13 13

14 14
import android.text.Editable;
15
import android.text.Html;
15 16
import android.text.TextUtils;
16 17
import android.text.TextWatcher;
17 18
import android.util.Log;
@ -44,14 +45,9 @@ import com.amap.api.services.poisearch.PoiSearch.OnPoiSearchListener;
44 45
import com.electric.chargingpile.R;
45 46
import com.electric.chargingpile.application.MainApplication;
46 47
import com.electric.chargingpile.data.HistoryInfo;
47
import com.electric.chargingpile.data.Zhan;
48 48
import com.electric.chargingpile.manager.ProfileManager;
49 49
import com.electric.chargingpile.util.BarColorUtil;
50 50
import com.electric.chargingpile.util.DBOpenHandler;
51
import com.nostra13.universalimageloader.core.DisplayImageOptions;
52
import com.nostra13.universalimageloader.core.ImageLoader;
53
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
54
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
55 51
import com.umeng.analytics.MobclickAgent;
56 52

57 53
import java.util.ArrayList;
@ -66,10 +62,9 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
66 62
    private ImageView ivClear;
67 63
    private ListView lvContent;
68 64
    private SearchAdapter adapter;
69
    private List<Map<String, String>> list = new ArrayList<Map<String, String>>();
70
    private List<Map<String, String>> history_list = new ArrayList<Map<String, String>>();
71
    private List<Zhan> mList = new ArrayList<Zhan>();
72
    private List<HistoryInfo> hList = new ArrayList<HistoryInfo>();
65
    private List<Map<String, String>> addressList = new ArrayList<Map<String, String>>();
66
    private List<Map<String, String>> addressAllList = new ArrayList<Map<String, String>>();
67
    private List<HistoryInfo> historyInfoList = new ArrayList<HistoryInfo>();
73 68
    private HistoryInfo history;
74 69

75 70
    private Map<String, String> map;
@ -118,16 +113,16 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
118 113
                int[] to = {R.id.search_name, R.id.search_address};
119 114

120 115

121
                hList.clear();
116
                historyInfoList.clear();
122 117
                while (c.moveToNext()) {
123 118
                    history = new HistoryInfo();
124 119
                    history.setIds(c.getString(c.getColumnIndex("keyword")));
125 120
                    history.setJing(c.getString(c.getColumnIndex("jing")));
126 121
                    history.setWei(c.getString(c.getColumnIndex("wei")));
127
                    hList.add(history);
122
                    historyInfoList.add(history);
128 123
                }
129 124

130
                SimpleCursorAdapter adapter = new SimpleCursorAdapter(SearchActivity.this, R.layout.history_item, c, from, to);
125
                SimpleCursorAdapter adapter = new SimpleCursorAdapter(SearchActivity.this, R.layout.history_item, c, from, to, 0);
131 126
                historyList.setAdapter(adapter);
132 127
            }
133 128
        });
@ -153,8 +148,8 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
153 148
                    historyList.setVisibility(View.GONE);
154 149
                    ivClear.setVisibility(View.VISIBLE);
155 150
                } else {
156
                    list.clear();
157
                    mList.clear();
151
                    addressList.clear();
152
                    addressAllList.clear();
158 153
                    historyList.setVisibility(View.VISIBLE);
159 154
                    lvContent.setVisibility(View.GONE);
160 155
                    ivClear.setVisibility(View.GONE);
@ -222,7 +217,7 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
222 217

223 218
            }
224 219
        });
225
        adapter = new SearchAdapter(this, list);
220
        adapter = new SearchAdapter(this, addressList);
226 221
        lvContent.setAdapter(adapter);
227 222

228 223
        // 点击历史记录
@ -230,10 +225,10 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
230 225
            @Override
231 226
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
232 227
                Intent intent = new Intent();
233
                intent.putExtra("zhan_name", hList.get(position).getIds());
234
                intent.putExtra("jing", hList.get(position).getJing());
235
                intent.putExtra("wei", hList.get(position).getWei());
236
                ProfileManager.getInstance().setSearchAddress(getApplicationContext(), hList.get(position).getIds());
228
                intent.putExtra("zhan_name", historyInfoList.get(position).getIds());
229
                intent.putExtra("jing", historyInfoList.get(position).getJing());
230
                intent.putExtra("wei", historyInfoList.get(position).getWei());
231
                ProfileManager.getInstance().setSearchAddress(getApplicationContext(), historyInfoList.get(position).getIds());
237 232
                setResult(101, intent);
238 233
                finish();
239 234

@ -251,10 +246,10 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
251 246
                db.queryOne(etSearch.getText().toString());
252 247
                ContentValues values = new ContentValues();
253 248
                values.put("time", System.currentTimeMillis());
254
                values.put("keyword", list.get(position).get("name"));
255
                values.put("type", list.get(position).get("address"));
256
                values.put("jing", list.get(position).get("jing"));
257
                values.put("wei", list.get(position).get("wei"));
249
                values.put("keyword", addressList.get(position).get("name"));
250
                values.put("type", addressList.get(position).get("address"));
251
                values.put("jing", addressList.get(position).get("jing"));
252
                values.put("wei", addressList.get(position).get("wei"));
258 253
                db.insert(values);
259 254

260 255
                Cursor c = db.query();
@ -267,10 +262,10 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
267 262
                SimpleCursorAdapter historyAdapter = new SimpleCursorAdapter(SearchActivity.this, R.layout.history_item, c, from, to, 0);
268 263
                historyList.setAdapter(historyAdapter);
269 264
                Intent intent = new Intent();
270
                intent.putExtra("zhan_name", list.get(position).get("name"));
271
                intent.putExtra("jing", list.get(position).get("jing"));
272
                intent.putExtra("wei", list.get(position).get("wei"));
273
                ProfileManager.getInstance().setSearchAddress(getApplicationContext(), list.get(position).get("name"));
265
                intent.putExtra("zhan_name", addressList.get(position).get("name"));
266
                intent.putExtra("jing", addressList.get(position).get("jing"));
267
                intent.putExtra("wei", addressList.get(position).get("wei"));
268
                ProfileManager.getInstance().setSearchAddress(getApplicationContext(), addressList.get(position).get("name"));
274 269
                setResult(101, intent);
275 270
                View v = getWindow().peekDecorView();
276 271
                if (v != null) {
@ -300,13 +295,13 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
300 295
        }
301 296

302 297

303
        hList.clear();
298
        historyInfoList.clear();
304 299
        while (c.moveToNext()) {
305 300
            history = new HistoryInfo();
306 301
            history.setIds(c.getString(c.getColumnIndex("keyword")));
307 302
            history.setJing(c.getString(c.getColumnIndex("jing")));
308 303
            history.setWei(c.getString(c.getColumnIndex("wei")));
309
            hList.add(history);
304
            historyInfoList.add(history);
310 305
        }
311 306

312 307
        String[] from = {"keyword", "type"};
@ -367,8 +362,8 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
367 362
            case R.id.iv_search_clear:
368 363
                ivClear.setVisibility(View.GONE);
369 364
                etSearch.setText("");
370
                list.clear();
371
                mList.clear();
365
                addressList.clear();
366
                addressAllList.clear();
372 367
                adapter.notifyDataSetChanged();
373 368
                lvContent.setVisibility(View.GONE);
374 369
                historyList.setVisibility(View.VISIBLE);
@ -397,26 +392,32 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
397 392
                if (result.getQuery().equals(query)) {// 是否是同一条
398 393
                    poiResult = result;
399 394
                    // 取得搜索到的poiitems有多少页
400
                    List<PoiItem> mList = poiResult.getPois();// 取得第一页的poiitem数据,页数从数字0开始
395
                    List<PoiItem> poisList = poiResult.getPois();// 取得第一页的poiitem数据,页数从数字0开始
401 396
                    List<SuggestionCity> suggestionCities = poiResult.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
402 397

403
                    if (mList != null && mList.size() > 0) {
404
                        list.clear();
398
                    if (poisList != null && poisList.size() > 0) {
399
                        addressList.clear();
400
                        addressAllList.clear();
405 401
                        try {
406
                            for (int i = 0; i < mList.size(); i++) {
402
                            for (int i = 0; i < poisList.size(); i++) {
407 403
                                map = new HashMap<String, String>();
408
                                map.put("name", mList.get(i).getTitle());
409
                                Log.e("name", mList.get(i).getTitle());
410
                                map.put("address", mList.get(i).getSnippet());
411
                                Log.e("address", mList.get(i).getSnippet());
412
                                map.put("jing", mList.get(i).getLatLonPoint().getLongitude() + "");
413
                                Log.e("jing", mList.get(i).getLatLonPoint().getLongitude() + "");
414
                                map.put("wei", mList.get(i).getLatLonPoint().getLatitude() + "");
415
                                Log.e("wei", mList.get(i).getLatLonPoint().getLatitude() + "");
404
                                map.put("name", poisList.get(i).getTitle());
405
                                map.put("address", poisList.get(i).getSnippet());
406
                                map.put("jing", poisList.get(i).getLatLonPoint().getLongitude() + "");
407
                                map.put("wei", poisList.get(i).getLatLonPoint().getLatitude() + "");
416 408
                                map.put("url", "");
417
                                list.add(map);
409
                                addressAllList.add(map);
410

411
                            }
412

413
                            for (Map<String, String> address : addressAllList) {
414
                                addressList.add(address);
415
                                if (addressList.size() == 5) {
416
                                    break;
417
                                }
418 418
                            }
419
                            if (list != null && list.size() > 0) {
419

420
                            if (addressList != null && addressList.size() > 0) {
420 421
                                runOnUiThread(new Runnable() {
421 422
                                    @Override
422 423
                                    public void run() {
@ -430,7 +431,8 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
430 431
                        }
431 432
                    } else {
432 433
                        Toast.makeText(SearchActivity.this, "抱歉,未找到结果", Toast.LENGTH_SHORT).show();
433
                        list.clear();
434
                        addressList.clear();
435
                        addressAllList.clear();
434 436
                        adapter.notifyDataSetChanged();
435 437
                    }
436 438
                }
@ -471,27 +473,53 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
471 473

472 474
        @Override
473 475
        public View getView(int position, View convertView, ViewGroup parent) {
474
            ViewHolder viewHolder = null;
475
            if (convertView == null) {
476
                convertView = LayoutInflater.from(context).inflate(R.layout.item_search, null);
477
                viewHolder = new ViewHolder();
478
                viewHolder.name = (TextView) convertView.findViewById(R.id.search_name);
479
                viewHolder.address = (TextView) convertView.findViewById(R.id.search_address);
480
                viewHolder.zhan = (ImageView) convertView.findViewById(R.id.search_zhan);
481
                convertView.setTag(viewHolder);
482
            } else {
483
                viewHolder = (ViewHolder) convertView.getTag();
476
            if (addressList.size() > 0 && position < addressList.size()) {
477
                ViewHolder viewHolder = null;
478
                if (convertView == null) {
479
                    convertView = LayoutInflater.from(context).inflate(R.layout.item_search, null);
480
                    viewHolder = new ViewHolder();
481
                    viewHolder.name = convertView.findViewById(R.id.search_name);
482
                    viewHolder.address = convertView.findViewById(R.id.search_address);
483
                    viewHolder.header_title = convertView.findViewById(R.id.header_title);
484
                    viewHolder.query_all_addresses = convertView.findViewById(R.id.query_all_addresses);
485
                    convertView.setTag(viewHolder);
486
                } else {
487
                    viewHolder = (ViewHolder) convertView.getTag();
488
                }
489

490
                String name = list.get(position).get("name");
491
                String address = list.get(position).get("address");
492
                name = name.replace(keyWord, "<font color=\"#1BB637\">" + keyWord + "</font>");
493
                address = address.replace(keyWord, "<font color=\"#1BB637\">" + keyWord + "</font>");
494
                viewHolder.name.setText(Html.fromHtml(name, Html.FROM_HTML_MODE_LEGACY));
495
                viewHolder.address.setText(Html.fromHtml(address, Html.FROM_HTML_MODE_LEGACY));
496

497
                if (position == 0) {
498
                    viewHolder.header_title.setVisibility(View.VISIBLE);
499
                    viewHolder.header_title.setText(keyWord + "相关目的地");
500
                } else {
501
                    viewHolder.header_title.setVisibility(View.GONE);
502
                }
503

504
                if (position == addressList.size() - 1 && addressAllList.size() > 5) {
505
                    viewHolder.query_all_addresses.setVisibility(View.VISIBLE);
506
                } else {
507
                    viewHolder.query_all_addresses.setVisibility(View.GONE);
508
                }
509
                viewHolder.query_all_addresses.setOnClickListener(new View.OnClickListener() {
510

511
                    @Override
512
                    public void onClick(View v) {
513
                        // TODO by hyg add
514
                    }
515
                });
484 516
            }
485
            viewHolder.name.setText(list.get(position).get("name"));
486
            viewHolder.address.setText(list.get(position).get("address"));
487 517

488
            viewHolder.zhan.setVisibility(View.GONE);
489 518
            return convertView;
490 519
        }
491 520

492 521
        class ViewHolder {
493
            TextView name, address;
494
            ImageView zhan;
522
            TextView name, address, header_title, query_all_addresses;
495 523
        }
496 524
    }
497 525


+ 18 - 0
app/src/main/java/com/electric/chargingpile/data/RecommendZhan.java

@ -54,7 +54,25 @@ public class RecommendZhan {
54 54
    private String belong_attribute;
55 55
    private String park_location;
56 56
    private String stop_cost;
57
    private String fenshi_is;
57 58
59
    public String getFenshi_info() {
60
        return fenshi_info;
61
    }
62
63
    public void setFenshi_info(String fenshi_info) {
64
        this.fenshi_info = fenshi_info;
65
    }
66
67
    private String fenshi_info;
68
69
    public String getFenshi_is() {
70
        return fenshi_is;
71
    }
72
73
    public void setFenshi_is(String fenshi_is) {
74
        this.fenshi_is = fenshi_is;
75
    }
58 76
59 77
    public String getId() {
60 78
        return id;

+ 4 - 0
app/src/main/res/drawable/list_item_divider.xml

@ -0,0 +1,4 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<inset xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:drawable="@color/lineColor"
4
    android:insetLeft="15dp"></inset>

+ 1 - 3
app/src/main/res/layout/activity_search.xml

@ -158,8 +158,6 @@
158 158
        android:layout_weight="9.8"
159 159
        android:background="@color/white"
160 160
        android:cacheColorHint="@color/transparent"
161
        android:divider="#dddddd"
162
        android:dividerHeight="0.5dp"
163 161
        android:fadingEdge="none"
164 162
        android:listSelector="@color/transparent" />
165 163

@ -170,7 +168,7 @@
170 168
        android:layout_weight="9.8"
171 169
        android:background="@color/white"
172 170
        android:cacheColorHint="@color/transparent"
173
        android:divider="#dddddd"
171
        android:divider="@drawable/list_item_divider"
174 172
        android:dividerHeight="0.5dp"
175 173
        android:fadingEdge="none"
176 174
        android:listSelector="@color/transparent" />

+ 83 - 53
app/src/main/res/layout/item_search.xml

@ -1,67 +1,97 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:tools="http://schemas.android.com/tools"
3 4
    android:layout_width="match_parent"
4 5
    android:layout_height="wrap_content"
5 6
    android:background="@color/white"
6 7
    android:orientation="vertical">
7 8

8
    <RelativeLayout
9
        android:id="@+id/search_real"
10
        android:layout_width="wrap_content"
11
        android:layout_height="wrap_content">
12

13
        <ImageView
14
            android:id="@+id/search_image"
15
            android:layout_width="wrap_content"
16
            android:layout_height="wrap_content"
17
            android:layout_centerVertical="true"
18
            android:layout_marginLeft="16dp"
19
            android:contentDescription="@null"
20
            android:paddingTop="20dp"
21
            android:paddingRight="14dp"
22
            android:paddingBottom="20dp"
23
            android:src="@drawable/icon_search1117" />
24

25
        <ImageView
26
            android:id="@+id/search_zhan"
27
            android:layout_width="60dp"
28
            android:layout_height="60dp"
29
            android:layout_centerVertical="true"
30
            android:layout_margin="10dp"
31
            android:contentDescription="@null"
32
            android:src="@drawable/image_default"
33
            android:visibility="gone" />
34
    </RelativeLayout>
9
    <TextView
10
        android:id="@+id/header_title"
11
        android:layout_width="match_parent"
12
        android:layout_height="wrap_content"
13
        android:background="#F2F2F2"
14
        android:ellipsize="end"
15
        android:maxLines="2"
16
        android:paddingLeft="15dp"
17
        android:paddingTop="4dp"
18
        android:paddingRight="15dp"
19
        android:paddingBottom="4dp"
20
        android:textColor="#a2a2a2"
21
        android:textSize="12sp"
22
        android:visibility="gone"
23
        tools:text="朝阳相关目的地"
24
        tools:visibility="visible" />
35 25

36 26
    <LinearLayout
37
        android:layout_width="fill_parent"
27
        android:layout_width="match_parent"
38 28
        android:layout_height="wrap_content"
39
        android:layout_centerVertical="true"
40
        android:layout_toRightOf="@id/search_real"
41
        android:gravity="center_vertical"
42
        android:orientation="vertical"
43
        android:paddingTop="10dp"
44
        android:paddingRight="10dp"
45
        android:paddingBottom="10dp">
29
        android:orientation="horizontal">
46 30

47
        <TextView
48
            android:id="@+id/search_name"
49
            android:layout_width="fill_parent"
50
            android:layout_height="wrap_content"
51
            android:ellipsize="end"
52
            android:singleLine="true"
53
            android:textColor="@color/title_row"
54
            android:textSize="15sp" />
31
        <LinearLayout
32
            android:layout_width="wrap_content"
33
            android:layout_height="match_parent"
34
            android:gravity="center_vertical">
55 35

56
        <TextView
57
            android:id="@+id/search_address"
58
            android:layout_width="fill_parent"
36
            <ImageView
37
                android:id="@+id/search_image"
38
                android:layout_width="wrap_content"
39
                android:layout_height="wrap_content"
40
                android:layout_centerVertical="true"
41
                android:layout_marginLeft="15dp"
42
                android:layout_marginTop="10dp"
43
                android:layout_marginRight="10dp"
44
                android:layout_marginBottom="10dp"
45
                android:contentDescription="@null"
46
                android:src="@drawable/icon_search1117" />
47
        </LinearLayout>
48

49
        <LinearLayout
50
            android:layout_width="match_parent"
59 51
            android:layout_height="wrap_content"
60
            android:layout_marginTop="2dp"
61
            android:ellipsize="end"
62
            android:maxLines="2"
63
            android:textColor="@color/hintColor"
64
            android:textSize="12sp" />
52
            android:orientation="vertical"
53
            android:paddingTop="10dp"
54
            android:paddingRight="15dp"
55
            android:paddingBottom="8dp">
56

57
            <TextView
58
                android:id="@+id/search_name"
59
                android:layout_width="fill_parent"
60
                android:layout_height="wrap_content"
61
                android:ellipsize="end"
62
                android:singleLine="true"
63
                android:textColor="#151515"
64
                android:textSize="15sp"
65
                tools:text="sdfdsfdsfdsfdsasdasdasdasdasdasdasdsadasdasdasdasf" />
66

67
            <TextView
68
                android:id="@+id/search_address"
69
                android:layout_width="fill_parent"
70
                android:layout_height="wrap_content"
71
                android:layout_marginTop="2dp"
72
                android:ellipsize="end"
73
                android:maxLines="2"
74
                android:textColor="#999999"
75
                android:textSize="12sp"
76
                tools:text="sdfdsfdsfdsfds" />
77
        </LinearLayout>
65 78
    </LinearLayout>
66 79

67
</RelativeLayout>
80
    <View
81
        android:layout_width="match_parent"
82
        android:layout_height="0.5dp"
83
        android:layout_marginLeft="12dp"
84
        android:background="#DDDDDD" />
85

86
    <TextView
87
        android:id="@+id/query_all_addresses"
88
        android:layout_width="match_parent"
89
        android:layout_height="wrap_content"
90
        android:gravity="center_horizontal"
91
        android:textSize="12sp"
92
        android:textColor="#888888"
93
        android:paddingTop="10dp"
94
        android:paddingBottom="20dp"
95
        android:text="@string/query_all_addresses" />
96

97
</LinearLayout>

+ 147 - 109
app/src/main/res/layout/recommend_charging_station_item.xml

@ -45,20 +45,6 @@
45 45
            app:layout_constraintLeft_toRightOf="@+id/zhan_name"
46 46
            app:layout_constraintTop_toTopOf="parent"
47 47
            tools:visibility="visible" />
48
49
        <Button
50
            android:id="@+id/recommend_nav"
51
            android:layout_width="50dp"
52
            android:layout_height="24dp"
53
            android:background="@drawable/recommend_btn_normal"
54
            android:text="导航"
55
            android:textColor="#83d287"
56
            android:textSize="13sp"
57
            app:layout_constraintBottom_toBottomOf="parent"
58
            app:layout_constraintRight_toRightOf="parent"
59
            app:layout_constraintTop_toTopOf="parent" />
60
61
62 48
    </androidx.constraintlayout.widget.ConstraintLayout>
63 49
64 50
    <!-- 评分、距离 -->
@ -98,6 +84,40 @@
98 84
            android:textColor="#888888"
99 85
            android:textSize="12sp"
100 86
            tools:text="4.65km" />
87
88
        <LinearLayout
89
            android:id="@+id/zongjia_container"
90
            android:layout_width="0dp"
91
            android:layout_height="wrap_content"
92
            android:layout_weight="1"
93
            android:gravity="right|bottom"
94
            android:paddingRight="15dp"
95
            tools:background="#00ff00">
96
97
            <TextView
98
                android:layout_width="wrap_content"
99
                android:layout_height="wrap_content"
100
                android:text="¥"
101
                android:textColor="#E02020"
102
                android:textSize="12dp" />
103
104
            <TextView
105
                android:id="@+id/zongjia"
106
                android:layout_width="wrap_content"
107
                android:layout_height="wrap_content"
108
                android:textColor="#E02020"
109
                android:textSize="20dp"
110
                android:textStyle="bold"
111
                tools:text="1.69" />
112
113
            <TextView
114
                android:layout_width="wrap_content"
115
                android:layout_height="wrap_content"
116
                android:text="元/度"
117
                android:textColor="#E02020"
118
                android:textSize="12sp" />
119
120
        </LinearLayout>
101 121
    </LinearLayout>
102 122
103 123
    <!-- 充电成功次数、评论次数 -->
@ -131,6 +151,16 @@
131 151
            android:textColor="#202020"
132 152
            android:textSize="14sp"
133 153
            tools:text="9次评论" />
154
155
        <TextView
156
            android:id="@+id/fenshi_info_textview"
157
            android:layout_width="match_parent"
158
            android:layout_height="match_parent"
159
            android:gravity="center_vertical|right"
160
            android:paddingRight="15dp"
161
            android:textColor="#222222"
162
            android:textSize="10sp"
163
            tools:text="18:00开始 1.45元/度" />
134 164
    </LinearLayout>
135 165
136 166
    <!-- 公共、地下、免费停车属性  价格 -->
@ -179,52 +209,38 @@
179 209
                android:textColor="#828282"
180 210
                android:textSize="11dp" />
181 211
        </LinearLayout>
182
183
        <LinearLayout
184
            android:id="@+id/zongjia_container"
185
            android:layout_width="0dp"
186
            android:layout_height="wrap_content"
187
            android:layout_weight="1"
188
            android:gravity="right|bottom"
189
            android:paddingRight="15dp"
190
            tools:background="#00ff00">
191
192
            <TextView
193
                android:layout_width="wrap_content"
194
                android:layout_height="wrap_content"
195
                android:text="¥"
196
                android:textColor="#555557"
197
                android:textSize="12dp" />
198
199
            <TextView
200
                android:id="@+id/zongjia"
201
                android:layout_width="wrap_content"
202
                android:layout_height="wrap_content"
203
                android:textColor="#555557"
204
                android:textSize="20dp"
205
                tools:text="1.69" />
206
207
            <TextView
208
                android:layout_width="wrap_content"
209
                android:layout_height="wrap_content"
210
                android:text="元/度"
211
                android:textColor="#555557"
212
                android:textSize="12sp" />
213
214
        </LinearLayout>
215 212
    </LinearLayout>
216 213
217
    <!-- 支付方式 -->
218
    <TextView
219
        android:id="@+id/payment_method"
214
    <LinearLayout
220 215
        android:layout_width="match_parent"
221 216
        android:layout_height="wrap_content"
222 217
        android:layout_marginLeft="15dp"
223
        android:layout_marginTop="20dp"
224 218
        android:layout_marginRight="15dp"
225
        android:textColor="#222222"
226
        android:textSize="14sp"
227
        tools:text="可使用本APP扫码支付" />
219
        android:orientation="horizontal">
220
        <!-- 支付方式 -->
221
        <TextView
222
            android:id="@+id/payment_method"
223
            android:layout_width="0dp"
224
            android:layout_height="wrap_content"
225
            android:layout_marginTop="20dp"
226
            android:layout_weight="1"
227
            android:ellipsize="end"
228
            android:lines="1"
229
            android:paddingRight="5dp"
230
            android:textColor="#222222"
231
            android:textSize="14sp"
232
            tools:text="可使用本APP扫码支付" />
233
234
        <Button
235
            android:id="@+id/recommend_nav"
236
            android:layout_width="50dp"
237
            android:layout_height="24dp"
238
            android:layout_marginTop="20dp"
239
            android:background="@drawable/recommend_btn_normal"
240
            android:text="导航"
241
            android:textColor="#83d287"
242
            android:textSize="13sp" />
243
    </LinearLayout>
228 244
229 245
    <View
230 246
        android:layout_width="match_parent"
@ -237,48 +253,58 @@
237 253
        android:layout_width="match_parent"
238 254
        android:layout_height="48dp"
239 255
        android:gravity="center_vertical">
240
241 256
        <LinearLayout
257
242 258
            android:layout_width="0dp"
243
            android:layout_height="match_parent"
259
            android:layout_height="wrap_content"
260
            android:layout_centerInParent="true"
244 261
            android:layout_weight="1"
245
            android:gravity="centerhorizontal">
246
247
            <TextView
248
                android:layout_width="wrap_content"
249
                android:layout_height="wrap_content"
250
                android:text="快充"
251
                android:textColor="#b2b2b2"
252
                android:textSize="12sp" />
262
            android:gravity="center_horizontalhorizontal"
263
            android:orientation="horizontal">
253 264
254
            <TextView
255
                android:id="@+id/fast_num"
265
            <ImageView
256 266
                android:layout_width="wrap_content"
257 267
                android:layout_height="wrap_content"
258
                android:layout_marginLeft="10dp"
259
                android:textColor="#555556"
260
                android:textSize="20sp"
261
                tools:text="5" />
268
                android:layout_gravity="center_vertical"
269
                android:paddingRight="10dp"
270
                android:src="@drawable/fast_icon" />
262 271
263 272
            <TextView
264
                android:id="@+id/fast_free"
273
                android:id="@+id/window_tv_fast_free_label"
265 274
                android:layout_width="wrap_content"
266 275
                android:layout_height="wrap_content"
267
                android:layout_marginLeft="34dp"
268
                android:text="闲"
269
                android:textColor="#b2b2b2"
270
                android:textSize="12sp" />
276
                android:layout_gravity="center_vertical"
277
                android:text="闲"
278
                android:textColor="@color/ui_62"
279
                android:textSize="14sp" />
271 280
272
            <TextView
273
                android:id="@+id/fast_free_num"
281
            <LinearLayout
274 282
                android:layout_width="wrap_content"
275 283
                android:layout_height="wrap_content"
276
                android:layout_marginLeft="10dp"
277
                android:textColor="#555556"
278
                android:textSize="20sp"
279
                tools:text="5" />
280
281
284
                android:layout_gravity="center_vertical"
285
                android:orientation="horizontal">
286
287
                <TextView
288
                    android:id="@+id/window_tv_fast_free_num"
289
                    android:layout_width="wrap_content"
290
                    android:layout_height="wrap_content"
291
                    android:layout_gravity="bottom"
292
                    android:paddingLeft="5dp"
293
                    android:textColor="@color/ui_62"
294
                    android:textSize="18sp"
295
                    android:textStyle="bold"
296
                    tools:text="13" />
297
298
                <TextView
299
                    android:id="@+id/window_tv_fast_total_num"
300
                    android:layout_width="wrap_content"
301
                    android:layout_height="wrap_content"
302
                    android:layout_gravity="bottom"
303
                    android:paddingLeft="1dp"
304
                    android:textColor="@color/ui_68"
305
                    android:textSize="12sp"
306
                    tools:text="/15" />
307
            </LinearLayout>
282 308
        </LinearLayout>
283 309
284 310
        <View
@ -288,43 +314,55 @@
288 314
289 315
        <LinearLayout
290 316
            android:layout_width="0dp"
291
            android:layout_height="match_parent"
317
            android:layout_height="wrap_content"
318
            android:layout_centerInParent="true"
292 319
            android:layout_weight="1"
293
            android:gravity="centerhorizontal">
320
            android:gravity="center_horizontalhorizontal"
321
            android:orientation="horizontal">
294 322
295
            <TextView
323
            <ImageView
296 324
                android:layout_width="wrap_content"
297 325
                android:layout_height="wrap_content"
298
                android:text="慢充"
299
                android:textColor="#b2b2b2"
300
                android:textSize="12sp" />
326
                android:layout_gravity="center_vertical"
327
                android:paddingRight="10dp"
328
                android:src="@drawable/slow_icon" />
301 329
302 330
            <TextView
303
                android:id="@+id/slow_num"
331
                android:id="@+id/window_tv_slow_free_label"
304 332
                android:layout_width="wrap_content"
305 333
                android:layout_height="wrap_content"
306
                android:layout_marginLeft="10dp"
307
                android:textColor="#555556"
308
                android:textSize="20sp"
309
                tools:text="5" />
334
                android:layout_gravity="center_vertical"
335
                android:text="闲"
336
                android:textColor="@color/ui_62"
337
                android:textSize="14sp" />
310 338
311
            <TextView
312
                android:id="@+id/slow_free"
313
                android:layout_width="wrap_content"
314
                android:layout_height="wrap_content"
315
                android:layout_marginLeft="34dp"
316
                android:text="空闲"
317
                android:textColor="#b2b2b2"
318
                android:textSize="12sp" />
319
320
            <TextView
321
                android:id="@+id/slow_free_num"
339
            <LinearLayout
322 340
                android:layout_width="wrap_content"
323 341
                android:layout_height="wrap_content"
324
                android:layout_marginLeft="10dp"
325
                android:textColor="#555556"
326
                android:textSize="20sp"
327
                tools:text="5" />
342
                android:layout_gravity="center_vertical"
343
                android:orientation="horizontal">
344
345
                <TextView
346
                    android:id="@+id/window_tv_slow_free_num"
347
                    android:layout_width="wrap_content"
348
                    android:layout_height="wrap_content"
349
                    android:layout_gravity="bottom"
350
                    android:paddingLeft="5dp"
351
                    android:textColor="@color/ui_62"
352
                    android:textSize="18sp"
353
                    android:textStyle="bold"
354
                    tools:text="13" />
355
356
                <TextView
357
                    android:id="@+id/window_tv_slow_total_num"
358
                    android:layout_width="wrap_content"
359
                    android:layout_height="wrap_content"
360
                    android:layout_gravity="bottom"
361
                    android:paddingLeft="1dp"
362
                    android:textColor="@color/ui_68"
363
                    android:textSize="12sp"
364
                    tools:text="/15" />
365
            </LinearLayout>
328 366
        </LinearLayout>
329 367
    </LinearLayout>
330 368

+ 2 - 2
app/src/main/res/values/strings.xml

@ -205,6 +205,6 @@
205 205
    <string name="refresh_load_succeed">Loading succeeded</string>
206 206
    <string name="refresh_load_succeed_nomore">That\'s All!</string>
207 207
    <string name="refresh_load_fail">Loading failed</string>
208
    <string name="personal_shar_info_content">快来分享吧\n
209
小主大家都很期待你的精彩内容哦</string>
208
    <string name="personal_shar_info_content">快来分享吧\n小主大家都很期待你的精彩内容哦</string>
209
    <string name="query_all_addresses"><u>查看全部目的地</u></string>
210 210
</resources>