Sfoglia il codice sorgente

remove Useless progress dependence

1145873331@qq.com 6 anni fa
parent
commit
b1035e9511
48 ha cambiato i file con 137 aggiunte e 3411 eliminazioni
  1. 8 19
      XRefreshView/build.gradle
  2. 1 22
      app/bugly/BuglyUploadLog.txt
  3. 9 22
      app/build.gradle
  4. 0 29
      app/src/main/java/com/electric/chargingpile/activity/AlterOneActivity.java
  5. 1 172
      app/src/main/java/com/electric/chargingpile/activity/ClaimSurveyTwoActivity.java
  6. 0 31
      app/src/main/java/com/electric/chargingpile/activity/NewZhanDetailsActivity.java
  7. 3 1
      app/src/main/java/com/electric/chargingpile/activity/RefundActivity.java
  8. 0 163
      app/src/main/java/com/electric/chargingpile/activity/ZhanDetailsNew.java
  9. 114 114
      app/src/main/java/com/electric/chargingpile/dbhelper/AllCitySqliteOpenHelper.java
  10. 0 11
      app/src/main/java/com/electric/chargingpile/manager/ScrollViewListener.java
  11. 0 209
      app/src/main/java/com/electric/chargingpile/util/ActivityStackManager.java
  12. 0 28
      app/src/main/java/com/electric/chargingpile/util/CheckNetWork.java
  13. 0 9
      app/src/main/java/com/electric/chargingpile/util/CoordinateTransformation.java
  14. 0 74
      app/src/main/java/com/electric/chargingpile/util/DensityUtils.java
  15. 0 5
      app/src/main/java/com/electric/chargingpile/util/DialogCreate.java
  16. 0 43
      app/src/main/java/com/electric/chargingpile/util/HttpUpImage.java
  17. 0 59
      app/src/main/java/com/electric/chargingpile/util/HttpUtils.java
  18. 0 85
      app/src/main/java/com/electric/chargingpile/util/HttpUtilss.java
  19. 0 10
      app/src/main/java/com/electric/chargingpile/util/ImageBucket.java
  20. 0 95
      app/src/main/java/com/electric/chargingpile/util/MyOrientationListener.java
  21. 0 131
      app/src/main/java/com/electric/chargingpile/util/NetRequest.java
  22. 0 8
      app/src/main/java/com/electric/chargingpile/util/NetStyle.java
  23. 0 21
      app/src/main/java/com/electric/chargingpile/util/NoScrollGridView.java
  24. 0 33
      app/src/main/java/com/electric/chargingpile/util/PackageUtil.java
  25. 0 69
      app/src/main/java/com/electric/chargingpile/util/PiPei.java
  26. 0 25
      app/src/main/java/com/electric/chargingpile/util/Replace.java
  27. 0 40
      app/src/main/java/com/electric/chargingpile/util/ScreenUtil.java
  28. 0 38
      app/src/main/java/com/electric/chargingpile/util/SignUtils.java
  29. 0 109
      app/src/main/java/com/electric/chargingpile/util/SpUtils.java
  30. 0 61
      app/src/main/java/com/electric/chargingpile/util/Tools.java
  31. 0 231
      app/src/main/java/com/electric/chargingpile/view/ActionSheetDialog.java
  32. 0 38
      app/src/main/java/com/electric/chargingpile/view/BaifenbiView.java
  33. 0 70
      app/src/main/java/com/electric/chargingpile/view/BubbleDetails.java
  34. 0 347
      app/src/main/java/com/electric/chargingpile/view/CopyOfREditText.java
  35. 0 231
      app/src/main/java/com/electric/chargingpile/view/CustomImageView.java
  36. 0 97
      app/src/main/java/com/electric/chargingpile/view/RefundDialog.java
  37. 0 25
      app/src/main/java/com/electric/chargingpile/view/SaundProgressIndicator.java
  38. 0 36
      app/src/main/java/com/electric/chargingpile/view/SearchDialog.java
  39. 0 268
      app/src/main/java/com/electric/chargingpile/view/WaterWaveView.java
  40. 0 37
      app/src/main/res/layout/baifenbi.xml
  41. 0 108
      app/src/main/res/layout/bubble_details_view.xml
  42. 0 64
      app/src/main/res/layout/dialog_search.xml
  43. 0 50
      app/src/main/res/layout/view_actionsheet.xml
  44. 0 40
      app/src/main/res/layout/view_time_pager.xml
  45. 0 6
      app/src/main/res/layout/yuanjiao.xml
  46. 0 19
      app/src/main/res/layout/zoom_controls_layout.xml
  47. 0 6
      app/src/main/res/values/attr.xml
  48. 1 2
      settings.gradle

+ 8 - 19
XRefreshView/build.gradle

@ -1,12 +1,13 @@
1 1
apply plugin: 'com.android.library'
2 2
3 3
android {
4
    compileSdkVersion 23
5
    buildToolsVersion '25.0.0'
4
    compileSdkVersion 26
5
    buildToolsVersion '28.0.3'
6
6 7
    resourcePrefix "XRefreshView"
7 8
    defaultConfig {
8
        minSdkVersion 10
9
        targetSdkVersion 23
9
        minSdkVersion 14
10
        targetSdkVersion 26
10 11
        versionCode 1
11 12
        versionName "1.0.1"
12 13
    }
@ -21,19 +22,7 @@ android {
21 22
    }
22 23
}
23 24
dependencies {
24
//    compile 'com.android.support:recyclerview-v7:23.3.0'
25
    compile 'com.android.support:recyclerview-v7:23.0.1'
26
    compile 'com.android.support:support-v4:23.0.1'
27
28
}
25
    compile 'com.android.support:recyclerview-v7:26.1.0'
26
    compile 'com.android.support:support-v4:26.1.0'
29 27
30
//for upload jar
31
buildscript {
32
    repositories {
33
        jcenter()
34
    }
35
    dependencies {
36
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
37
    }
38
}
39
apply from: 'gradle-jcenter-push.gradle'
28
}

+ 1 - 22
app/bugly/BuglyUploadLog.txt

@ -1,26 +1,5 @@
1 1
file=C:\Development Projects\Android_project\android_chargingpile\app\build\outputs\mapping\anzhi\debug\mapping.txt
2
sha1=193028feef990ee8b94d5d382eb229b1fda71241
3
appId=900010422
4
appChannel=anzhi
5
appPackage=com.electric.chargingpile
6
appVersion=3.2.1
7
8
file=C:\Development Projects\Android_project\android_chargingpile\app\build\outputs\mapping\anzhi\debug\mapping.txt
9
sha1=ddf1583852d1f90c2e0505c203a0fd665221b477
10
appId=900010422
11
appChannel=anzhi
12
appPackage=com.electric.chargingpile
13
appVersion=3.2.1
14
15
file=C:\Development Projects\Android_project\android_chargingpile\app\build\outputs\mapping\anzhi\debug\mapping.txt
16
sha1=3db22ee78ad3f2135a2b616dbcaf50920ae8c820
17
appId=900010422
18
appChannel=anzhi
19
appPackage=com.electric.chargingpile
20
appVersion=3.2.1
21
22
file=C:\Development Projects\Android_project\android_chargingpile\app\build\outputs\mapping\anzhi\debug\mapping.txt
23
sha1=e42e3780171cd84d117516c642887701399f45d2
2
sha1=9809f8c0086ec5b9ae373c105f99266926d10da4
24 3
appId=900010422
25 4
appChannel=anzhi
26 5
appPackage=com.electric.chargingpile

+ 9 - 22
app/build.gradle

@ -229,51 +229,40 @@ MobSDK {
229 229
230 230
dependencies {
231 231
    compile files('libs/mframework.jar')
232
//    compile files('libs/ShareSDK-Core-2.5.9.jar')
233
//    compile files('libs/ShareSDK-QQ-2.5.9.jar')
234
//    compile files('libs/ShareSDK-QZone-2.5.9.jar')
235
//    compile files('libs/ShareSDK-ShortMessage-2.5.9.jar')
236
//    compile files('libs/ShareSDK-SinaWeibo-2.5.9.jar')
237
//    compile files('libs/ShareSDK-Wechat-2.5.9.jar')
238
//    compile files('libs/ShareSDK-Wechat-Core-2.5.9.jar')
239
//    compile files('libs/ShareSDK-Wechat-Moments-2.5.9.jar')
232
    //    compile files('libs/ShareSDK-Core-2.5.9.jar')
233
    //    compile files('libs/ShareSDK-QQ-2.5.9.jar')
234
    //    compile files('libs/ShareSDK-QZone-2.5.9.jar')
235
    //    compile files('libs/ShareSDK-ShortMessage-2.5.9.jar')
236
    //    compile files('libs/ShareSDK-SinaWeibo-2.5.9.jar')
237
    //    compile files('libs/ShareSDK-Wechat-2.5.9.jar')
238
    //    compile files('libs/ShareSDK-Wechat-Core-2.5.9.jar')
239
    //    compile files('libs/ShareSDK-Wechat-Moments-2.5.9.jar')
240 240
    compile files('libs/xUtils-2.6.14.jar')
241
242 241
    compile files('libs/picasso-2.5.2.jar')
243 242
    compile files('libs/httpmime-4.3.5.jar')
244 243
    compile files('libs/badgeview.jar')
245 244
    compile project(':autolayout')
246
247 245
    compile files('libs/universal-image-loader-1.9.1.jar')
248 246
    compile files('libs/eventbus-2.4.0.jar')
249
250 247
    //noinspection GradleCompatible
251
252 248
    //    compile 'com.facebook.fresco:fresco:0.9.0+'
253
254 249
    //    compile 'com.facebook.fresco:drawee:0.9.0+'
255 250
    compile files('libs/bugly_1.2.9_release.jar')
256
257 251
    //noinspection GradleCompatible
258 252
    compile files('libs/jg_filter_sdk_1.1.jar')
259
260 253
    //    compile files('libs/Xg_sdk_v2.42_20160111_1539.jar')
261 254
    compile files('libs/wup-1.0.0.E-SNAPSHOT.jar')
262 255
    compile files('libs/pinyin4j-2.5.0.jar')
263 256
    compile files('libs/pinyin4android1.0.jar')
264
265 257
    compile files('libs/Msc.jar')
266
267 258
    compile files('libs/libammsdk.jar')
268 259
    compile files('libs/alipaySdk-20160427.jar')
269 260
    compile 'com.google.zxing:core:+'
270 261
    compile 'com.google.zxing:android-core:+'
271
272 262
    compile project(':library')
273 263
    compile files('libs/ZBarDecoder.jar')
274 264
    compile files('libs/jpush-android_v3.0.6.jar')
275 265
    compile files('libs/jcore-android_v1.1.3.jar')
276
277 266
    compile 'com.blankj:utilcode:1.9.8'
278 267
    compile project(':xrichtextt')
279 268
    compile 'com.android.support:multidex:1.0.1'
@ -307,15 +296,13 @@ dependencies {
307 296
    compile 'com.alibaba:fastjson:1.1.64.android'
308 297
    compile 'pub.devrel:easypermissions:0.2.0'
309 298
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.3'
310
311 299
    compile 'com.github.promeg:tinypinyin:1.0.0'
312 300
    compile 'org.greenrobot:eventbus:3.0.0'
313
314 301
    //    compile 'com.github.vilyever:AndroidSocketClient:3.0.3'
315 302
    compile files('libs/AMap3DMap_6.5.0_AMapNavi_6.4.0_AMapSearch_6.5.0_AMapLocation_4.2.0_20181009.jar')
316 303
    compile 'com.qmuiteam:qmui:1.2.0'
317 304
    compile 'org.zackratos:ultimatebar:1.1.1'
318 305
    compile project(':XRefreshView')
319 306
    compile 'com.github.Aspsine:IRecyclerView:0.0.7'
320
307
    compile project(':ijkplayer-java')
321 308
}

+ 0 - 29
app/src/main/java/com/electric/chargingpile/activity/AlterOneActivity.java

@ -682,35 +682,6 @@ public class AlterOneActivity extends Activity implements View.OnClickListener ,
682 682

683 683

684 684
    public void photo() {
685
//		Intent openCameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
686
//		startActivityForResult(openCameraIntent, TAKE_PICTURE);
687
//        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
688
//        File file = new File(Environment.getExternalStorageDirectory() + "/myimage/", String.valueOf(System
689
//                .currentTimeMillis()) + ".jpg");
690
//        camePath = file.getPath();
691
//        Uri imageUri = Uri.fromFile(file);
692
//        intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
693
//        startActivityForResult(intent, TAKE_PICTURE);
694
//        if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)
695
//                != PackageManager.PERMISSION_GRANTED) {
696
//            ActivityCompat.requestPermissions(this,
697
//                    new String[]{"1111"}, 2);
698
//        } else {
699

700
//        if (Build.VERSION.SDK_INT >= 23) {
701
//            boolean cameraPermissionEnabled = PermissionUtils.cheackPermission(AlterOneActivity.this, Manifest.permission.CAMERA);
702
//            boolean wPermissionEnabled = PermissionUtils.cheackPermission(AlterOneActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
703
//            boolean rPermissionEnabled = PermissionUtils.cheackPermission(AlterOneActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE);
704
//            if (!cameraPermissionEnabled || !wPermissionEnabled || !rPermissionEnabled) {
705
//                PermissionUtils.requestPermissionsWrapper(AlterOneActivity.this, new String[]{Manifest.permission.CAMERA
706
//                                , Manifest.permission.WRITE_EXTERNAL_STORAGE
707
//                                , Manifest.permission.READ_EXTERNAL_STORAGE},
708
//                        REQUEST_CAMERA_PERMISSION_CODE);
709
//
710
//                return;
711
//            }
712
//        } else {
713

714 685

715 686
        if (hasSdcard()) {
716 687
            int currentapiVersion = Build.VERSION.SDK_INT;

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

@ -2367,178 +2367,7 @@ public class ClaimSurveyTwoActivity extends Activity implements View.OnClickList
2367 2367
            super.handleMessage(msg);
2368 2368
        }
2369 2369
    };
2370
2371
2372
//    private void submitShareTwo() {
2373
//
2374
//        if (!NetUtil.CheckNetwork(this)) {
2375
//            Toast.makeText(this, "请检查网络", Toast.LENGTH_SHORT).show();
2376
//            return;
2377
//        }
2378
//
2379
////        http://123.56.88.79/zhan/index.php?m=content&c=index&a=add2&catid=9&zhan_name=&city=北京&district=&zhan_address=&user_id=&poi_jing=&poi_wei=&zhan_type=&audit=&total_num=&fast_num=&slow_num=&suit_car=&work_open=&belong_attribute=0&work_close=&company_name=&charge_cost=&charge_cost_way=&other_cost=&stop_cost=&pic=&holiday_open=&holiday_close=&open_object&stop_cost_way&person_name=&telephone=&imem=&sf_cost=&zy_num=
2380
////        Request request = new Request.Builder().url("http://123.56.88.79/zhan/index.php?m=content&c=index&a=add2&catid=9&zhan_name=&city=北京&district=&zhan_address=&user_id=&poi_jing=&poi_wei=&zhan_type=&audit=&total_num=&fast_num=&slow_num=&suit_car=&work_open=&belong_attribute=0&work_close=&company_name=&charge_cost=&charge_cost_way=&other_cost=&stop_cost=&pic=&holiday_open=&holiday_close=&open_object&stop_cost_way&person_name=&telephone=&imem=").build();
2381
////        Toast.makeText(this, "提交:poi_jing:"+llposition.longitude+",poi_wei:"+llposition.latitude+",city:"+city
2382
////                        +",district:"+location+",zhan_address:"+et_share_address.getText().toString()+",totalNum:"+
2383
////                        et_totalNum.getText().toString()+",cost:"+cost ,Toast.LENGTH_SHORT).show();
2384
//
2385
//        TelephonyManager telephonyManager=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
2386
//        String imem=telephonyManager.getDeviceId();
2387
//        Request request = new Request.Builder().url("http://123.56.88.79/zhan/index.php?" +
2388
//                "m=content&c=index&a=add2&catid=9&zhan_name="+zhanName.getText().toString()+"&city="+city+"&district="+city+"&" +
2389
//                "zhan_address="+et_share_address.getText().toString()+"&user_id="+ MainApplication.userPhone+"&poi_jing="+llposition.longitude+"&" +
2390
//                "poi_wei="+llposition.latitude+"&zhan_type="+zhuangType.getText().toString()+"&audit=&total_num=&" +
2391
//                "fast_num="+fastNum.getText().toString()+"&slow_num="+slowNum.getText().toString()+"&suit_car=&work_open=&belong_attribute=0&work_close=&company_name=&charge_cost=&" +
2392
//                "charge_cost_way="+costWay.getText().toString()+"&other_cost="+serviceCost.getText().toString()+"&stop_cost="+parkCost.getText().toString()+"&pic=&holiday_open=&holiday_close=&open_object&stop_cost_way&" +
2393
//                "person_name=&telephone=&imem="+imem+"&sf_cost=&zy_num=").build();
2394
//        Response response = null;
2395
//        try{
2396
//            response = OkHttpUtil.execute(request);
2397
//            if (response.code() == 200) {
2398
//                String json = "";
2399
//                try {
2400
//                    json = response.body().string();
2401
//                    Message msg = new Message();
2402
//                    msg.obj = json;
2403
//                    msg.what=2;
2404
//                    handler.sendMessage(msg);
2405
//                }catch (Exception e){
2406
//                    e.printStackTrace();
2407
//                    Message msg = new Message();
2408
//                    msg.what=3;
2409
//                    handler.sendMessage(msg);
2410
//                }
2411
//            }
2412
//        }catch (Exception e){
2413
//            e.printStackTrace();
2414
//            Message msg = new Message();
2415
//            msg.what=3;
2416
//            handler.sendMessage(msg);
2417
//        }
2418
//
2419
//
2420
//
2421
////        String name = etName.getText().toString().trim();
2422
////        String address = etAddress.getText().toString().trim();
2423
////        String phone = etPhone.getText().toString().trim();
2424
////        String num = etNum.getText().toString().trim();
2425
////        String remark = etRemark.getText().toString().trim();
2426
////        Request request = new Request.Builder().url("http://123.56.88.79/zhan/index.php?" +
2427
//////                "m=content&c=index&a=add2&catid=9&zhan_name=&city="+city+"&district=&" +
2428
//////                "zhan_address="+share_address+"&user_id="+ MainApplication.userPhone+"&poi_jing="+poi_jing+"&" +
2429
//////                "poi_wei="+poi_wei+"&zhan_type=&audit=&total_num=&" +
2430
//////                "fast_num="+et_fast_num.getText().toString()+"&slow_num="+et_slow_num.getText().toString()+"&suit_car=&work_open="+open_time.getText().toString()+"&belong_attribute=0&work_close="+close_time.getText().toString()+"&company_name=&charge_cost=&" +
2431
//////                "charge_cost_way="+et_style.getText().toString()+"&other_cost=&stop_cost=&pic=&holiday_open="+holiday_open.getText().toString()+"&holiday_close="+holiday_close.getText().toString()+"&open_object&stop_cost_way&" +
2432
//////                "person_name=&telephone="+et_phone.getText().toString()+"&imem="+imem+"&sf_cost=&zy_num=").build();
2433
//        TelephonyManager telephonyManager=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
2434
//        String imem=telephonyManager.getDeviceId();
2435
//        final Map<String, String> map = new HashMap<String, String>();
2436
//        // map.put("action", "add_zhan");
2437
//        map.put("user_id", MainApplication.userPhone);
2438
//        map.put("city", city);
2439
//        map.put("district", city);
2440
//        map.put("zhan_address", zhan_address);
2441
//        map.put("telephone", et_phone.getText().toString());
2442
//        map.put("poi_jing", poi_jing+"");
2443
//        map.put("poi_wei", poi_wei+"");
2444
//        map.put("audit", "2");
2445
//        map.put("photo", "");
2446
//        map.put("suit_car",suit_car);
2447
//        map.put("comment", et_remark.getText().toString());
2448
//        map.put("imem",imem);
2449
//        map.put("charge_cost_way",et_style.getText().toString());
2450
//        map.put("work_close",close_time.getText().toString());
2451
//        map.put("holiday_close",holiday_close.getText().toString());
2452
//        map.put("holiday_open",holiday_open.getText().toString());
2453
//        map.put("slow_num",et_slow_num.getText().toString());
2454
//        map.put("fast_num",et_fast_num.getText().toString());
2455
//        map.put("work_open",open_time.getText().toString());
2456
//        map.put("sf_cost",sf_cost);
2457
//
2458
//
2459
////        if (type2.equals("公有")) {
2460
//        map.put("type", "1");
2461
////        } else if (type2.equals("私有")) {
2462
////            map.put("type", "2");
2463
////        } else {
2464
////            map.put("type", "");
2465
////        }
2466
//
2467
//        System.out.println(map.toString());
2468
//        new Thread() {
2469
//            public void run() {
2470
//                post = HttpUpImage.post("http://123.56.88.79/zhan/index.php?m=content&c=index&a=add2&catid=9", srcPath, map);
2471
//                if (post != null) {
2472
//                    JSONObject jsonObject;
2473
//                    try {
2474
//                        for (String line : post) {
2475
//                            jsonObject = new JSONObject(line);
2476
//                            String add_zhan = jsonObject.getString("add_zhan");
2477
//                            handler.sendMessage(handler
2478
//                                    .obtainMessage(1, add_zhan));
2479
//                        }
2480
//                    } catch (JSONException e) {
2481
//                        // TODO Auto-generated catch block
2482
//                        e.printStackTrace();
2483
//                    }
2484
//                } else {
2485
//                    handler.sendEmptyMessage(2);
2486
//                }
2487
//            }
2488
//
2489
//            ;
2490
//        }.start();
2491
2492
2493
//    }
2494
2495
//    @Override
2496
//    public void onActivityResult(final int requestCode, int resultCode,
2497
//                                 final Intent data) {
2498
//        super.onActivityResult(requestCode, resultCode, data);
2499
//        // Log.e("data", data.toString() + "  resultCode ==" + resultCode);
2500
//        if (resultCode != Activity.RESULT_OK)
2501
//            return;
2502
//
2503
//        switch (requestCode) {
2504
//            // 如果是直接从相册获取
2505
//            case 1:
2506
//                if (data != null) {
2507
//                    startPhotoZoom(data.getData());
2508
//                    Toast.makeText(mContext, "拖动正方形角可调整剪切大小",
2509
//                            android.widget.Toast.LENGTH_SHORT).show();
2510
//                }
2511
//                break;
2512
//            // 如果是调用相机拍照时
2513
//            case 2:
2514
//                File temp = new File(Environment.getExternalStorageDirectory()
2515
//                        + "/androidapp.jpg");
2516
//                startPhotoZoom(Uri.fromFile(temp));
2517
//                break;
2518
//            // 取得裁剪后的图片
2519
//            case 3:
2520
//                if (data != null) {
2521
//                    setPicToView(data);
2522
//                }
2523
//                break;
2524
//            default:
2525
//                break;
2526
//        }
2527
//        ;
2528
//    }
2529
//
2530
//    public static final String removeBOM(String data) {
2531
//        if (TextUtils.isEmpty(data)) {
2532
//            return data;
2533
//        }
2534
//
2535
//        if (data.startsWith("\ufeff")) {
2536
//            Log.i("------------%%","json处理");
2537
//            return data.substring(1);
2538
//        } else {
2539
//            return data;
2540
//        }
2541
//    }
2370
 
2542 2371
2543 2372
    @Override
2544 2373
    protected void onPause() {

+ 0 - 31
app/src/main/java/com/electric/chargingpile/activity/NewZhanDetailsActivity.java

@ -8,13 +8,10 @@ import android.content.pm.PackageManager;
8 8
import android.graphics.drawable.BitmapDrawable;
9 9
import android.os.AsyncTask;
10 10
import android.os.Bundle;
11
import android.os.Environment;
12 11
import android.os.Handler;
13 12
import android.os.Message;
14
import android.support.v4.app.FragmentActivity;
15 13
import android.support.v4.view.ViewPager;
16 14
import android.support.v7.app.AppCompatActivity;
17
import android.util.Log;
18 15
import android.view.Gravity;
19 16
import android.view.KeyEvent;
20 17
import android.view.LayoutInflater;
@ -44,7 +41,6 @@ import com.electric.chargingpile.data.CommentsBean;
44 41
import com.electric.chargingpile.data.MyOtto;
45 42
import com.electric.chargingpile.data.Province;
46 43
import com.electric.chargingpile.data.RankinglistRefreshEvent;
47
import com.electric.chargingpile.data.SigninData;
48 44
import com.electric.chargingpile.data.Zhan;
49 45
import com.electric.chargingpile.fragment.CommentFragment;
50 46
import com.electric.chargingpile.fragment.DetailsFragment;
@ -62,8 +58,6 @@ import com.electric.chargingpile.util.ToastUtil;
62 58
import com.electric.chargingpile.view.CustomProgressDialog;
63 59
import com.electric.chargingpile.view.CustomScrollView;
64 60
import com.electric.chargingpile.view.SlideShowView;
65
import com.google.gson.Gson;
66
import com.google.gson.reflect.TypeToken;
67 61
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
68 62
import com.squareup.okhttp.Request;
69 63
import com.squareup.okhttp.Response;
@ -78,7 +72,6 @@ import org.json.JSONObject;
78 72
79 73
import java.io.BufferedReader;
80 74
import java.io.BufferedWriter;
81
import java.io.File;
82 75
import java.io.IOException;
83 76
import java.io.InputStreamReader;
84 77
import java.io.OutputStreamWriter;
@ -95,7 +88,6 @@ import java.util.regex.Pattern;
95 88
import cn.sharesdk.framework.Platform;
96 89
import cn.sharesdk.framework.PlatformActionListener;
97 90
import cn.sharesdk.framework.ShareSDK;
98
import cn.sharesdk.onekeyshare.OnekeyShare;
99 91
import cn.sharesdk.tencent.qq.QQ;
100 92
import cn.sharesdk.wechat.friends.Wechat;
101 93
import cn.sharesdk.wechat.moments.WechatMoments;
@ -480,29 +472,6 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
480 472
    }
481 473
482 474
483
//    // 获取课程的详情的接口线程
484
//    public void getDetailThread(final String s) {
485
//        Runnable run = new Runnable() {
486
//            @Override
487
//            public void run() {
488
//                Map<String,Object> map = new HashMap<String,Object>();
489
//                map.put("staCode", );
490
//
491
//                String dd="{\"encrypt\":"+"\""+NOENCRYPT+"\""+",\"requestMsg\":"+ JsonUtils.mapToJson(map)+",\"sign\":"+"\""+NetRequest.getRequestSign(map, NOENCRYPT, ENCRYPTMD5)+"\""+"}";
492
//
493
//                String s= NetRequest.sendPostSta(postSta_url, dd, JsonUtils.getKeyResult(NetRequest.sendPost(token_url, "client_id=" + client_id + "&client_secret=" + client_secret + "&grant_type=" + grant_type), "access_token"));
494
//                System.err.println(s);
495
//                String json = JsonUtils.getKeyResult(s,"resultValue");
496
//                Log.e("error", s);
497
//                Message msg = handler.obtainMessage();
498
//                msg.what =111;
499
//                msg.obj= json;
500
//                handler.sendMessage(msg);
501
//            }
502
//        };
503
//        new Thread(run).start();
504
//    }
505
506 475
    private void initView() {
507 476
        tv_xiangqing = (TextView) findViewById(R.id.tv_xiangqing);
508 477
        tv_xiangqing.setOnClickListener(this);

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

@ -72,7 +72,7 @@ public class RefundActivity extends AppCompatActivity implements View.OnClickLis
72 72
        tv_give_money = (TextView) findViewById(R.id.tv_give_money);
73 73
        tv_refund = (TextView) findViewById(R.id.tv_refund);
74 74
        tvList = (TextView) findViewById(R.id.tv_refund_list);
75
        webView = findViewById(R.id.webView);
75
        webView =(WebView) findViewById(R.id.webView);
76 76
        webView.setVisibility(View.GONE);
77 77
        webView.loadUrl("http://evcharge.cc/pc/res/lib/refund.html");
78 78
@ -92,12 +92,14 @@ public class RefundActivity extends AppCompatActivity implements View.OnClickLis
92 92
            webView.setVisibility(View.VISIBLE);
93 93
        }
94 94
95
        @Override
95 96
        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error){
96 97
            //handler.cancel(); // Android默认的处理方式
97 98
            handler.proceed();  // 接受所有网站的证书
98 99
            //handleMessage(Message msg); // 进行其他处理
99 100
        }
100 101
102
        @Override
101 103
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
102 104
//            Log.e(TAG, "onPage1 :"+url );
103 105
//            //  重写此方法表明点击网页里面的链接还是在当前的webview里跳转,不跳到浏览器那边

+ 0 - 163
app/src/main/java/com/electric/chargingpile/activity/ZhanDetailsNew.java

@ -873,28 +873,6 @@ public class ZhanDetailsNew extends Activity implements OnClickListener {
873 873
//                oks.show(getActivity());
874 874
                break;
875 875
            case R.id.rl_alter:
876
//                new ActionSheetDialog(ZhanDetailsNew.this)
877
//                        .builder()
878
//                        .setCancelable(false)
879
//                        .setCanceledOnTouchOutside(false)
880
//                        .addSheetItem("描述错误", ActionSheetDialog.SheetItemColor.Green,
881
//                                new ActionSheetDialog.OnSheetItemClickListener() {
882
//                                    @Override
883
//                                    public void onClick(int which) {
884
//                                        Intent intent = new Intent(getApplication(),AlterOneActivity.class);
885
//                                        intent.putExtra("zhan",zhan);
886
//                                        startActivity(intent);
887
//                                    }
888
//                                })
889
//                        .addSheetItem("位置错误", ActionSheetDialog.SheetItemColor.Green,
890
//                                new ActionSheetDialog.OnSheetItemClickListener() {
891
//                                    @Override
892
//                                    public void onClick(int which) {
893
//                                        Intent intent = new Intent(getApplication(),AlterTwoActivity.class);
894
//                                        intent.putExtra("zhan",zhan);
895
//                                        startActivity(intent);
896
//                                    }
897
//                                }).show();
898 876
                LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
899 877
                popupWindowView = inflater.inflate(R.layout.popupwindow_alter, null);
900 878
                popupWindow = new PopupWindow(popupWindowView,
@ -1127,146 +1105,5 @@ public class ZhanDetailsNew extends Activity implements OnClickListener {
1127 1105
                submitHotZhan(url);
1128 1106
            }
1129 1107
        }).start();
1130
//        Log.i("@@@@++++", "热点站已统计");
1131
//        Request request = new Request.Builder().url("http://123.57.6.131/zhan/index.php?m=content&c=index&a=detail&catid=9&zhan_id="+zhan_id+"&user_id="+MainApplication.userPhone).build();
1132
//        Response response = null;
1133
//        try {
1134
//            response = OkHttpUtil.execute(request);
1135
//            if (response.code() == 200) {
1136
//                String json = "";
1137
//                try {
1138
//                    json = response.body().string();
1139
//                    Message msg = new Message();
1140
//                    msg.obj = json;
1141
//                    msg.what = 6;
1142
//                    handler.sendMessage(msg);
1143
//                    Log.i("@@@@", "热点站已统计");
1144
//                } catch (Exception e) {
1145
//                    e.printStackTrace();
1146
//                    Message msg = new Message();
1147
//                    msg.what = 3;
1148
//                    handler.sendMessage(msg);
1149
//                }
1150
//            }
1151
//        } catch (Exception e) {
1152
//            e.printStackTrace();
1153
//            Message msg = new Message();
1154
//            msg.what = 3;
1155
//            handler.sendMessage(msg);
1156
//        }
1157 1108
    }
1158
1159
1160
1161
//    public void startNavi(LatLng pt1, LatLng pt2) {
1162
//        NaviPara para = new NaviPara();
1163
//        para.startPoint = pt1;
1164
//        para.startName = "从这里开始";
1165
//        para.endPoint = pt2;
1166
//        para.endName = "到这里结束";
1167
//
1168
//        try {
1169
//            BaiduMapNavigation.openBaiduMapNavi(para, this);
1170
//        } catch (BaiduMapAppNotSupportNaviException e) {
1171
//            e.printStackTrace();
1172
//            BaiduMapNavigation.openWebBaiduMapNavi(para, this);
1173
//        }
1174
//    }
1175
1176
//    @Override
1177
//    protected void onPause() {
1178
//        super.onPause();
1179
//        requestManager.removeOnRequestFinishedListener(this);
1180
//        MobclickAgent.onPause(this);
1181
//    }
1182
//
1183
//    @Override
1184
//    protected void onResume() {
1185
//        super.onResume();
1186
//        requestManager.addOnRequestFinishedListener(this);
1187
//        MobclickAgent.onResume(this);
1188
//    }
1189
1190
//    private void getZhuangList() {
1191
//        if (!NetUtil.CheckNetwork(this)) {
1192
//            Toast.makeText(this, "请检查网络", Toast.LENGTH_SHORT).show();
1193
//            return;
1194
//        }
1195
//        RequestDataProvider.getZhuanglistMap.put("action", "get_zhuang_list");
1196
//        RequestDataProvider.getZhuanglistMap.put("zhan_id", zhan.getId() + "");
1197
//        requestManager
1198
//                .netServiceMethod(PoCRequestManager.CHARGING_WORE_TYPE_GET_ZHUANGLIST);
1199
//    }
1200
//
1201
//    @Override
1202
//    public void onRequestFinished(int resultCode, Bundle payload) {
1203
//        int flag = payload.getInt(PoCService.INTENT_EXTRA_WORKER_TYPE);
1204
//        switch (flag) {
1205
//            case PoCRequestManager.CHARGING_WORE_TYPE_GET_ZHUANGLIST:
1206
////			if (resultCode == -1) {
1207
////				Toast.makeText(this, "获取详情信息失败", Toast.LENGTH_SHORT).show();
1208
////				return;
1209
////			}
1210
//                Gson g = new Gson();
1211
//                Type type = new TypeToken<List<Zhuang>>() {
1212
//                }.getType();
1213
//                List<Zhuang> l = g.fromJson(payload.getString("zhuanglist"), type);
1214
//                list.clear();
1215
//                if (l != null && l.size() > 0) {
1216
//                    list.addAll(l);
1217
//                    setDetail();
1218
//                }
1219
//                break;
1220
//
1221
//            default:
1222
//                break;
1223
//        }
1224
//    }
1225
//
1226
//    private void setDetail() {
1227
//        List<Map<String, String>> mapList = Util.getMapList(list);
1228
//        hao.setText(Util.hao);
1229
//        time.setText(Util.fenzhong + "分钟后");
1230
//        for (int i = 0; i < mapList.size(); i++) {
1231
//            BaifenbiView b = new BaifenbiView(this);
1232
//            b.getName().setText(mapList.get(i).get("name"));
1233
//            if ("100%".equals(mapList.get(i).get("bai"))) {
1234
//                b.getBaifen().setText("空闲");
1235
//            } else {
1236
//                b.getBaifen().setText(mapList.get(i).get("bai"));
1237
//            }
1238
//            int a = Integer.valueOf(mapList.get(i).get("bai")
1239
//                    .substring(0, mapList.get(i).get("bai").length() - 1));
1240
//            b.getContent().setHeight(DensityUtil.dptopx(this, a));
1241
//            if (a == 100) {
1242
//                b.getContent().setBackgroundResource(R.drawable.radius_bkg_one);
1243
//            } else if (a >= 80) {
1244
//                b.getContent().setBackgroundResource(R.drawable.radius_bkg_two);
1245
//            } else if (a >= 50) {
1246
//                b.getContent().setBackgroundResource(
1247
//                        R.drawable.radius_bkg_three);
1248
//            } else {
1249
//                b.getContent()
1250
//                        .setBackgroundResource(R.drawable.radius_bkg_four);
1251
//            }
1252
//            llDetail.addView(b);
1253
//        }
1254
//    }
1255
//
1256
//    public void startNavi(LatLng pt1, LatLng pt2) {
1257
//        NaviPara para = new NaviPara();
1258
//        para.startPoint = pt1;
1259
//        para.startName = "从这里开始";
1260
//        para.endPoint = pt2;
1261
//        para.endName = "到这里结束";
1262
//
1263
//        try {
1264
//            BaiduMapNavigation.openBaiduMapNavi(para, this);
1265
//        } catch (BaiduMapAppNotSupportNaviException e) {
1266
//            e.printStackTrace();
1267
//            BaiduMapNavigation.openWebBaiduMapNavi(para, this);
1268
//        }
1269
//    }
1270
1271
1272 1109
}

+ 114 - 114
app/src/main/java/com/electric/chargingpile/dbhelper/AllCitySqliteOpenHelper.java

@ -1,114 +1,114 @@
1
package com.electric.chargingpile.dbhelper;
2
3
import android.content.Context;
4
import android.database.sqlite.SQLiteDatabase;
5
import android.database.sqlite.SQLiteDatabase.CursorFactory;
6
import android.database.sqlite.SQLiteException;
7
import android.database.sqlite.SQLiteOpenHelper;
8
9
import java.io.File;
10
import java.io.FileOutputStream;
11
import java.io.IOException;
12
import java.io.InputStream;
13
import java.io.OutputStream;
14
15
public class AllCitySqliteOpenHelper extends SQLiteOpenHelper {
16
17
	// 数据库文件目标存放路径为系统默认位置,com.droid 是你的包名
18
	private static String DB_PATH = "/data/data/com.electric.chargingpile/databases/";
19
	private static String DB_NAME = "meituan_cities.db";
20
	private Context mContext;
21
	private static String ASSETS_NAME = "meituan_cities.db";
22
	private static final int DB_VERSION = 3;
23
	
24
	public AllCitySqliteOpenHelper(Context context, String name, CursorFactory factory,
25
								   int version) {
26
		// 必须通过super调用父类当中的构造函数
27
		super(context, name, null, version);
28
		this.mContext = context;
29
	}
30
31
	public AllCitySqliteOpenHelper(Context context, String name, int version) {
32
		this(context, name, null, version);
33
	}
34
35
	public AllCitySqliteOpenHelper(Context context, String name) {
36
		this(context, name, DB_VERSION);
37
	}
38
39
	public AllCitySqliteOpenHelper(Context context) {
40
		this(context, DB_PATH + DB_NAME);
41
	}
42
43
	public void createDataBase() throws IOException {
44
		boolean dbExist = checkDataBase();
45
		if (dbExist) {
46
			// 数据库已存在,do nothing.
47
		} else {
48
			// 创建数据库
49
			try {
50
				File dir = new File(DB_PATH);
51
				if (!dir.exists()) {
52
					dir.mkdirs();
53
				}
54
				File dbf = new File(DB_PATH + DB_NAME);
55
				if (dbf.exists()) {
56
					dbf.delete();
57
				}
58
				//通过openOrCreateDatabase方法将assets目录下的数据库,创建到系统默认的地方
59
				SQLiteDatabase.openOrCreateDatabase(dbf, null);
60
				// 复制asseets中的db文件到DB_PATH下
61
				copyDataBase();
62
			} catch (IOException e) {
63
				throw new Error("数据库创建失败");
64
			}
65
		}
66
	}
67
68
	// 检查数据库是否有效
69
	private boolean checkDataBase() {
70
		SQLiteDatabase checkDB = null;
71
		String myPath = DB_PATH + DB_NAME;
72
		try {
73
			checkDB = SQLiteDatabase.openDatabase(myPath, null,
74
					SQLiteDatabase.OPEN_READONLY);
75
		} catch (SQLiteException e) {
76
			// database does't exist yet.
77
		}
78
		if (checkDB != null) {
79
			checkDB.close();
80
		}
81
		return checkDB != null ? true : false;
82
	}
83
	
84
	//将assets目录下的城市的数据复制到所创建的数据库下
85
	private void copyDataBase() throws IOException {
86
		// Open your local db as the input stream
87
		InputStream myInput = mContext.getAssets().open(ASSETS_NAME);
88
		// Path to the just created empty db
89
		String outFileName = DB_PATH + DB_NAME;
90
		// Open the empty db as the output stream
91
		OutputStream myOutput = new FileOutputStream(outFileName);
92
		// transfer bytes from the inputfile to the outputfile
93
		byte[] buffer = new byte[1024];
94
		int length;
95
		while ((length = myInput.read(buffer)) > 0) {
96
			myOutput.write(buffer, 0, length);
97
		}
98
		// Close the streams
99
		myOutput.flush();
100
		myOutput.close();
101
		myInput.close();
102
	}
103
	
104
	@Override
105
	public void onCreate(SQLiteDatabase db) {
106
		
107
	}
108
109
	@Override
110
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
111
112
	}
113
114
}
1
//package com.electric.chargingpile.dbhelper;
2
//
3
//import android.content.Context;
4
//import android.database.sqlite.SQLiteDatabase;
5
//import android.database.sqlite.SQLiteDatabase.CursorFactory;
6
//import android.database.sqlite.SQLiteException;
7
//import android.database.sqlite.SQLiteOpenHelper;
8
//
9
//import java.io.File;
10
//import java.io.FileOutputStream;
11
//import java.io.IOException;
12
//import java.io.InputStream;
13
//import java.io.OutputStream;
14
//
15
//public class AllCitySqliteOpenHelper extends SQLiteOpenHelper {
16
//
17
//	// 数据库文件目标存放路径为系统默认位置,com.droid 是你的包名
18
//	private static String DB_PATH = "/data/data/com.electric.chargingpile/databases/";
19
//	private static String DB_NAME = "meituan_cities.db";
20
//	private Context mContext;
21
//	private static String ASSETS_NAME = "meituan_cities.db";
22
//	private static final int DB_VERSION = 3;
23
//
24
//	public AllCitySqliteOpenHelper(Context context, String name, CursorFactory factory,
25
//								   int version) {
26
//		// 必须通过super调用父类当中的构造函数
27
//		super(context, name, null, version);
28
//		this.mContext = context;
29
//	}
30
//
31
//	public AllCitySqliteOpenHelper(Context context, String name, int version) {
32
//		this(context, name, null, version);
33
//	}
34
//
35
//	public AllCitySqliteOpenHelper(Context context, String name) {
36
//		this(context, name, DB_VERSION);
37
//	}
38
//
39
//	public AllCitySqliteOpenHelper(Context context) {
40
//		this(context, DB_PATH + DB_NAME);
41
//	}
42
//
43
//	public void createDataBase() throws IOException {
44
//		boolean dbExist = checkDataBase();
45
//		if (dbExist) {
46
//			// 数据库已存在,do nothing.
47
//		} else {
48
//			// 创建数据库
49
//			try {
50
//				File dir = new File(DB_PATH);
51
//				if (!dir.exists()) {
52
//					dir.mkdirs();
53
//				}
54
//				File dbf = new File(DB_PATH + DB_NAME);
55
//				if (dbf.exists()) {
56
//					dbf.delete();
57
//				}
58
//				//通过openOrCreateDatabase方法将assets目录下的数据库,创建到系统默认的地方
59
//				SQLiteDatabase.openOrCreateDatabase(dbf, null);
60
//				// 复制asseets中的db文件到DB_PATH下
61
//				copyDataBase();
62
//			} catch (IOException e) {
63
//				throw new Error("数据库创建失败");
64
//			}
65
//		}
66
//	}
67
//
68
//	// 检查数据库是否有效
69
//	private boolean checkDataBase() {
70
//		SQLiteDatabase checkDB = null;
71
//		String myPath = DB_PATH + DB_NAME;
72
//		try {
73
//			checkDB = SQLiteDatabase.openDatabase(myPath, null,
74
//					SQLiteDatabase.OPEN_READONLY);
75
//		} catch (SQLiteException e) {
76
//			// database does't exist yet.
77
//		}
78
//		if (checkDB != null) {
79
//			checkDB.close();
80
//		}
81
//		return checkDB != null ? true : false;
82
//	}
83
//
84
//	//将assets目录下的城市的数据复制到所创建的数据库下
85
//	private void copyDataBase() throws IOException {
86
//		// Open your local db as the input stream
87
//		InputStream myInput = mContext.getAssets().open(ASSETS_NAME);
88
//		// Path to the just created empty db
89
//		String outFileName = DB_PATH + DB_NAME;
90
//		// Open the empty db as the output stream
91
//		OutputStream myOutput = new FileOutputStream(outFileName);
92
//		// transfer bytes from the inputfile to the outputfile
93
//		byte[] buffer = new byte[1024];
94
//		int length;
95
//		while ((length = myInput.read(buffer)) > 0) {
96
//			myOutput.write(buffer, 0, length);
97
//		}
98
//		// Close the streams
99
//		myOutput.flush();
100
//		myOutput.close();
101
//		myInput.close();
102
//	}
103
//
104
//	@Override
105
//	public void onCreate(SQLiteDatabase db) {
106
//
107
//	}
108
//
109
//	@Override
110
//	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
111
//
112
//	}
113
//
114
//}

+ 0 - 11
app/src/main/java/com/electric/chargingpile/manager/ScrollViewListener.java

@ -1,11 +0,0 @@
1
package com.electric.chargingpile.manager;
2
3
import com.electric.chargingpile.view.ObservableScrollView;
4
5
/**
6
 * Created by Demon on 16/11/21.
7
 */
8
9
public interface ScrollViewListener {
10
    void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy);
11
}

+ 0 - 209
app/src/main/java/com/electric/chargingpile/util/ActivityStackManager.java

@ -1,209 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
import android.app.Activity;
4
5
import java.util.Iterator;
6
import java.util.Stack;
7
8
/**
9
 * date:      ljy 2017.11.13
10
 * description: Activity 栈管理器,可用于退出单个activity、退出全部activity等
11
 */
12
public class ActivityStackManager {
13
14
    private Stack<Activity> mActivityStack;
15
16
    /**
17
     * 单例模式
18
     */
19
    public static ActivityStackManager getInstance() {
20
        return ActivityStackManager.SingletonHolder.instance;
21
    }
22
23
    private static class SingletonHolder {
24
        private static final ActivityStackManager instance = new ActivityStackManager();
25
    }
26
27
    private ActivityStackManager() {
28
    }
29
30
    /**
31
     * 把一个activity压入栈中
32
     *
33
     * @param activity
34
     */
35
    public void pushOneActivity(Activity activity) {
36
        if (activity == null) {
37
            return;
38
        }
39
        if (mActivityStack == null) {
40
            mActivityStack = new Stack<>();
41
        }
42
        mActivityStack.push(activity);
43
    }
44
45
    /**
46
     * 把栈顶的activity弹出
47
     *
48
     * @param activity
49
     */
50
    public void popOneActivity(Activity activity) {
51
        if (activity == null || CollectionUtil.isEmpty(mActivityStack)) {
52
            return;
53
        }
54
55
        mActivityStack.pop();
56
    }
57
58
    /**
59
     * 获取栈顶的activity,先进后出原则
60
     *
61
     * @return
62
     */
63
    public Activity currentActivity() {
64
        Activity activity = null;
65
        if (!CollectionUtil.isEmpty(mActivityStack)) {
66
            activity = mActivityStack.peek();
67
        }
68
        return activity;
69
    }
70
71
    /**
72
     * 获取栈底(第一个压住栈)的activity,先进后出原则
73
     *
74
     * @return
75
     */
76
    public Activity firstActivity() {
77
        Activity activity = null;
78
        if (!CollectionUtil.isEmpty(mActivityStack)) {
79
            activity = mActivityStack.firstElement();
80
        }
81
        return activity;
82
    }
83
84
    /**
85
     * 获取应用 activity的数量
86
     *
87
     * @return
88
     */
89
    public int getStackSize() {
90
        if (mActivityStack != null) {
91
            return mActivityStack.size();
92
        }
93
        return 0;
94
    }
95
96
    /**
97
     * 退出activity
98
     * @param activity
99
     */
100
    public void exitActivity(Activity activity) {
101
        activity.finish();
102
        mActivityStack.remove(activity);
103
    }
104
105
    /**
106
     * 退出类型为cls的Activity
107
     * @param cls
108
     */
109
    public void exitActivity(Class cls) {
110
        if (CollectionUtil.isEmpty(mActivityStack)) {
111
            return;
112
        }
113
114
        Iterator<Activity> iterator = mActivityStack.iterator();
115
        while (iterator.hasNext()) {
116
            Activity activity = iterator.next();
117
            if (activity == null) {
118
                continue;
119
            }
120
            if (activity.getClass().equals(cls)) {
121
                exitActivity(activity);
122
            }
123
        }
124
    }
125
126
    /**
127
     * 退出类型为cls且第一个进栈的Activity
128
     * @param cls
129
     */
130
    public void exitActivityByFirstIn(Class cls) {
131
        if (CollectionUtil.isEmpty(mActivityStack)) {
132
            return;
133
        }
134
135
        Iterator<Activity> iterator = mActivityStack.iterator();
136
        while (iterator.hasNext()) {
137
            Activity activity = iterator.next();
138
            if (activity == null) {
139
                continue;
140
            }
141
            if (activity.getClass().equals(cls)) {
142
                exitActivity(activity);
143
                break;
144
            }
145
        }
146
    }
147
148
    /**
149
     * 退出类型为cls且第后一个进栈的Activity
150
     * @param cls
151
     */
152
    public void exitActivityByLastIn(Class cls) {
153
        if (CollectionUtil.isEmpty(mActivityStack)) {
154
            return;
155
        }
156
157
        int size = mActivityStack.size();
158
        for (int i = size - 1; i >= 0; i--) {
159
            Activity activity = mActivityStack.get(i);
160
            if (activity == null) {
161
                continue;
162
            }
163
            if (activity.getClass().equals(cls)) {
164
                activity.finish();
165
                mActivityStack.removeElementAt(mActivityStack.lastIndexOf(activity));
166
                break;
167
            }
168
        }
169
    }
170
171
    /**
172
     * 退出除cls类型以外的所有Activity
173
     *
174
     * @param cls 页面activity的类型
175
     */
176
    public void exitAllActivityExceptCurrent(Class cls) {
177
        Activity activity;
178
        while (true) {
179
            activity = firstActivity();
180
            if (activity == null) {
181
                break;
182
            }
183
            if (activity.getClass().equals(cls)) {
184
                if (getStackSize() <= 1) {
185
                    break;
186
                } else continue;
187
            }
188
            exitActivity(activity);
189
        }
190
    }
191
192
    /**
193
     * 退出应用程序
194
     */
195
    public void exitApplication() {
196
        while (true) {
197
            Activity activity = firstActivity();
198
            if (activity == null) {
199
                break;
200
            }
201
            exitActivity(activity);
202
        }
203
    }
204
205
206
207
208
209
}

+ 0 - 28
app/src/main/java/com/electric/chargingpile/util/CheckNetWork.java

@ -1,28 +0,0 @@
1
package com.electric.chargingpile.util;
2

3
import android.content.Context;
4
import android.net.ConnectivityManager;
5
import android.net.NetworkInfo;
6

7
public class CheckNetWork {
8

9
	public static boolean checkNetConnection(Context context) {
10

11
		try {
12
			ConnectivityManager connectivity = (ConnectivityManager) context
13
					.getSystemService(Context.CONNECTIVITY_SERVICE);
14
			if (connectivity != null) {
15
				NetworkInfo info = connectivity.getActiveNetworkInfo();
16
				if (info != null && info.isConnected()) {
17
					if (info.getState() == NetworkInfo.State.CONNECTED) {
18
						return true;
19
					}
20
				}
21
			}
22
		} catch (Exception e) {
23
			return false;
24
		}
25
		return false;
26
	}
27

28
}

+ 0 - 9
app/src/main/java/com/electric/chargingpile/util/CoordinateTransformation.java

@ -1,9 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
/**
4
 * Created by demon on 2017/8/3.
5
 */
6
7
public class CoordinateTransformation {
8
9
}

+ 0 - 74
app/src/main/java/com/electric/chargingpile/util/DensityUtils.java

@ -1,74 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
4
import android.content.Context;
5
import android.util.TypedValue;
6
/**
7
 * Created by Demon on 15/11/8.
8
 */
9
/**
10
 * 常用单位转换的辅助类
11
 *
12
 *
13
 *
14
 */
15
public class DensityUtils
16
{
17
    private DensityUtils()
18
    {
19
        /* cannot be instantiated */
20
        throw new UnsupportedOperationException("cannot be instantiated");
21
    }
22
23
    /**
24
     * dp转px
25
     *
26
     * @param context
27
     * @param val
28
     * @return
29
     */
30
    public static int dp2px(Context context, float dpVal)
31
    {
32
        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
33
                dpVal, context.getResources().getDisplayMetrics());
34
    }
35
36
    /**
37
     * sp转px
38
     *
39
     * @param context
40
     * @param val
41
     * @return
42
     */
43
    public static int sp2px(Context context, float spVal)
44
    {
45
        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
46
                spVal, context.getResources().getDisplayMetrics());
47
    }
48
49
    /**
50
     * px转dp
51
     *
52
     * @param context
53
     * @param pxVal
54
     * @return
55
     */
56
    public static float px2dp(Context context, float pxVal)
57
    {
58
        final float scale = context.getResources().getDisplayMetrics().density;
59
        return (pxVal / scale);
60
    }
61
62
    /**
63
     * px转sp
64
     *
65
     * @param fontScale
66
     * @param pxVal
67
     * @return
68
     */
69
    public static float px2sp(Context context, float pxVal)
70
    {
71
        return (pxVal / context.getResources().getDisplayMetrics().scaledDensity);
72
    }
73
74
}

+ 0 - 5
app/src/main/java/com/electric/chargingpile/util/DialogCreate.java

@ -1,5 +0,0 @@
1
package com.electric.chargingpile.util;
2

3
public class DialogCreate {
4

5
}

+ 0 - 43
app/src/main/java/com/electric/chargingpile/util/HttpUpImage.java

@ -1,43 +0,0 @@
1
package com.electric.chargingpile.util;
2

3
import java.io.File;
4
import java.io.IOException;
5
import java.util.List;
6
import java.util.Map;
7

8
public class HttpUpImage {
9
	public static List<String> post(String url, String path,
10
			Map<String, String> params) {
11
		String charset = "UTF-8";
12
		File uploadFile1 = new File(path);
13
		try {
14
			MultipartUtility multipart = new MultipartUtility(url, charset);
15
			multipart.addHeaderField("User-Agent", "CodeJava");
16
			multipart.addHeaderField("Test-Header", "Header-Value");
17
			multipart.addFormField("description", "Cool Pictures");
18
			multipart.addFormField("keywords", "Java,upload,Spring");
19
			if (params != null) {
20
				for (String key : params.keySet()) {
21
					String value = params.get(key);
22
					multipart.addFormField(key, value);
23
				}
24
			}
25
			if(uploadFile1.exists()){
26
				multipart.addFilePart("file", uploadFile1);
27
				}else{
28
				}
29
			
30
			List<String> response = multipart.finish();
31
			System.out.println("SERVER REPLIED:");
32
			for (String line : response) {
33
				System.out.println(line);
34
				
35
			}
36
			return response;
37

38
		} catch (IOException ex) {
39
			System.err.println(ex);
40
		}
41
		return null;
42
	}
43
}

+ 0 - 59
app/src/main/java/com/electric/chargingpile/util/HttpUtils.java

@ -1,59 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
/**
4
 * Created by Demon on 15/9/24.
5
 */
6
import java.io.IOException;
7
import java.io.InputStream;
8
import java.net.HttpURLConnection;
9
import java.net.MalformedURLException;
10
import java.net.URL;
11
12
import android.graphics.Bitmap;
13
import android.graphics.BitmapFactory;
14
15
/**
16
 * http工具类 http可以使用HttpURLConnection或HttpClient
17
 *
18
 * @author Administrator
19
 * @date 2014.05.10
20
 * @version V1.0
21
 */
22
public class HttpUtils {
23
24
    /**
25
     * 获取网络图片
26
     *
27
     * @param urlString
28
     *            如:http://f.hiphotos.baidu.com/image/w%3D2048/sign=3
29
     *            b06d28fc91349547e1eef6462769358
30
     *            /d000baa1cd11728b22c9e62ccafcc3cec2fd2cd3.jpg
31
     * @return
32
     * @date 2014.05.10
33
     */
34
    public static Bitmap getNetWorkBitmap(String urlString) {
35
        URL imgUrl = null;
36
        Bitmap bitmap = null;
37
        try {
38
            imgUrl = new URL(urlString);
39
            // 使用HttpURLConnection打开连接
40
            HttpURLConnection urlConn = (HttpURLConnection) imgUrl
41
                    .openConnection();
42
            urlConn.setDoInput(true);
43
            urlConn.connect();
44
            // 将得到的数据转化成InputStream
45
            InputStream is = urlConn.getInputStream();
46
            // 将InputStream转换成Bitmap
47
            bitmap = BitmapFactory.decodeStream(is);
48
            is.close();
49
        } catch (MalformedURLException e) {
50
            // TODO Auto-generated catch block
51
            System.out.println("[getNetWorkBitmap->]MalformedURLException");
52
            e.printStackTrace();
53
        } catch (IOException e) {
54
            System.out.println("[getNetWorkBitmap->]IOException");
55
            e.printStackTrace();
56
        }
57
        return bitmap;
58
    }
59
}

+ 0 - 85
app/src/main/java/com/electric/chargingpile/util/HttpUtilss.java

@ -1,85 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
import java.io.ByteArrayOutputStream;
4
import java.io.IOException;
5
import java.io.InputStream;
6
import java.net.HttpURLConnection;
7
import java.net.URL;
8
9
/**
10
 * Created by Demon on 15/11/26.
11
 */
12
public class HttpUtilss {
13
    private final static String URL_PATH = "http://www.android.com/images/about/about-nexus-family.png"; //访问网络图片的路径
14
15
    public HttpUtilss() {
16
        // TODO Auto-generated constructor stub
17
    }
18
19
    /**
20
     * 从网络中获取图片信息,以流的形式返回
21
     * @return
22
     * @throws IOException
23
     */
24
    public static InputStream getImageViewInputStream() throws IOException{
25
26
        InputStream inputStream = null;
27
        URL url = new URL(URL_PATH);
28
        if(url != null){
29
            HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
30
            httpURLConnection.setConnectTimeout(3000); //设置连接超时的时间
31
            httpURLConnection.setRequestMethod("GET");
32
            httpURLConnection.setDoInput(true);
33
            //设置响应的代码
34
            int response_code = httpURLConnection.getResponseCode();
35
            if(response_code == 200){
36
                inputStream = httpURLConnection.getInputStream();
37
            }
38
        }
39
40
        return inputStream;
41
    }
42
43
    public static byte[] getImageViewArray(){
44
        byte[] data = null;
45
        InputStream inputStream = null;
46
47
        //不需要关闭输出流,直接 写入到内存中
48
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
49
        try {
50
            URL url = new URL("URL_PATH");
51
            if(url != null){
52
                HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
53
                httpURLConnection.setConnectTimeout(3000); //设置连接超时的时间
54
                httpURLConnection.setRequestMethod("GET");
55
                httpURLConnection.setDoInput(true);
56
                //设置响应的代码
57
                int response_code = httpURLConnection.getResponseCode();
58
59
                int len = 0;
60
                byte[] b_data = new byte[1024];
61
                if(response_code == 200){
62
                    inputStream = httpURLConnection.getInputStream();
63
                    while((len = inputStream.read(b_data)) != -1) {
64
                        outputStream.write(b_data, 0, len);
65
                    }
66
                    data = outputStream.toByteArray();
67
                }
68
            }
69
        } catch (Exception e) {
70
            // TODO: handle exception
71
        }finally{
72
            if(inputStream != null){
73
                try {
74
                    inputStream.close();
75
                } catch (IOException e) {
76
                    // TODO Auto-generated catch block
77
                    e.printStackTrace();
78
                }
79
            }
80
        }
81
82
        return data;
83
84
    }
85
}

+ 0 - 10
app/src/main/java/com/electric/chargingpile/util/ImageBucket.java

@ -1,10 +0,0 @@
1
package com.electric.chargingpile.util;
2

3
import java.util.List;
4

5
public class ImageBucket {
6
	public int count = 0;
7
	public String bucketName;
8
	public List<ImageItem> imageList;
9

10
}

+ 0 - 95
app/src/main/java/com/electric/chargingpile/util/MyOrientationListener.java

@ -1,95 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
import android.content.Context;
4
import android.hardware.Sensor;
5
import android.hardware.SensorEvent;
6
import android.hardware.SensorEventListener;
7
import android.hardware.SensorManager;
8
9
10
import com.electric.chargingpile.R;
11
12
/**
13
 * Created by Demon on 15/5/29.
14
 */
15
public class MyOrientationListener implements SensorEventListener
16
{
17
18
    private Context context;
19
    private SensorManager sensorManager;
20
    private Sensor sensor;
21
22
    private float lastX ;
23
24
    private OnOrientationListener onOrientationListener ;
25
26
    public MyOrientationListener(Context context)
27
    {
28
        this.context = context;
29
    }
30
31
32
33
    // 开始
34
    public void start()
35
    {
36
        // 获得传感器管理器
37
        sensorManager = (SensorManager) context
38
                .getSystemService(Context.SENSOR_SERVICE);
39
        if (sensorManager != null)
40
        {
41
            // 获得方向传感器
42
            sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
43
        }
44
        // 注册
45
        if (sensor != null)
46
        {//SensorManager.SENSOR_DELAY_UI
47
            sensorManager.registerListener(this, sensor,
48
                    SensorManager.SENSOR_DELAY_UI);
49
        }
50
51
    }
52
53
    // 停止检测
54
    public void stop()
55
    {
56
        sensorManager.unregisterListener(this);
57
    }
58
59
    @Override
60
    public void onAccuracyChanged(Sensor sensor, int accuracy)
61
    {
62
63
    }
64
65
    @Override
66
    public void onSensorChanged(SensorEvent event)
67
    {
68
        // 接受方向感应器的类型
69
        if (event.sensor.getType() == Sensor.TYPE_ORIENTATION)
70
        {
71
            // 这里我们可以得到数据,然后根据需要来处理
72
            float x = event.values[SensorManager.DATA_X];
73
74
            if( Math.abs(x- lastX) > 1.0 )
75
            {
76
                onOrientationListener.onOrientationChanged(x);
77
            }
78
//            Log.e("DATA_X", x+"");
79
            lastX = x ;
80
81
        }
82
    }
83
84
    public void setOnOrientationListener(OnOrientationListener onOrientationListener)
85
    {
86
        this.onOrientationListener = onOrientationListener ;
87
    }
88
89
90
    public interface OnOrientationListener
91
    {
92
        void onOrientationChanged(float x);
93
    }
94
95
}

+ 0 - 131
app/src/main/java/com/electric/chargingpile/util/NetRequest.java

@ -1,131 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
/**
4
 * Created by Demon on 15/11/6.
5
 */
6
7
8
        import java.io.BufferedReader;
9
        import java.io.IOException;
10
        import java.io.InputStreamReader;
11
        import java.io.PrintWriter;
12
        import java.net.URL;
13
        import java.net.URLConnection;
14
        import java.util.Map;
15
16
public class NetRequest {
17
18
    public static String sendPost(String url, String param) {
19
        PrintWriter out = null;
20
        BufferedReader in = null;
21
        String result = "";
22
        try {
23
            URL realUrl = new URL(url);
24
            // 打开和URL之间的连接
25
            URLConnection conn = realUrl.openConnection();
26
            // 设置通用的请求属性
27
            conn.setRequestProperty("accept", "*/*");
28
            conn.setRequestProperty("connection", "Keep-Alive");
29
            conn.setRequestProperty("user-agent",
30
                    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
31
            // 发送POST请求必须设置如下两行
32
            conn.setDoOutput(true);
33
            conn.setDoInput(true);
34
            // 获取URLConnection对象对应的输出流
35
            out = new PrintWriter(conn.getOutputStream());
36
            // 发送请求参数
37
            out.print(param);
38
            // flush输出流的缓冲
39
            out.flush();
40
            // 定义BufferedReader输入流来读取URL的响应
41
            in = new BufferedReader(
42
                    new InputStreamReader(conn.getInputStream()));
43
            String line;
44
            while ((line = in.readLine()) != null) {
45
                result += line;
46
            }
47
        } catch (Exception e) {
48
            System.out.println("发送 POST 请求出现异常!"+e);
49
            e.printStackTrace();
50
        }
51
        //使用finally块来关闭输出流、输入流
52
        finally{
53
            try{
54
                if(out!=null){
55
                    out.close();
56
                }
57
                if(in!=null){
58
                    in.close();
59
                }
60
            }
61
            catch(IOException ex){
62
                ex.printStackTrace();
63
            }
64
        }
65
        return result;
66
    }
67
68
    public static String sendPostSta(String url, String param,String token) {
69
        PrintWriter out = null;
70
        BufferedReader in = null;
71
        String result = "";
72
        try {
73
            URL realUrl = new URL(url);
74
            // 打开和URL之间的连接
75
            URLConnection conn = realUrl.openConnection();
76
            // 设置通用的请求属性
77
//			 conn.setRequestProperty("Authorization",token);
78
            conn.setRequestProperty("Authorization",  "Bearer "+token);
79
80
//			 conn.setRequestProperty("Bearer",  "Bearer");
81
            conn.setRequestProperty("Content-Type" ,"application/json; charset=utf-8");
82
            conn.setRequestProperty("accept", "*/*");
83
            conn.setRequestProperty("connection", "Keep-Alive");
84
            conn.setRequestProperty("user-agent",
85
                    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
86
            // 发送POST请求必须设置如下两行
87
            conn.setDoOutput(true);
88
            conn.setDoInput(true);
89
            // 获取URLConnection对象对应的输出流
90
            out = new PrintWriter(conn.getOutputStream());
91
            // 发送请求参数
92
            out.print(param);
93
94
            System.err.println(token);
95
            System.err.println(param);
96
            // flush输出流的缓冲
97
            out.flush();
98
            // 定义BufferedReader输入流来读取URL的响应
99
            in = new BufferedReader(
100
                    new InputStreamReader(conn.getInputStream()));
101
            String line;
102
            while ((line = in.readLine()) != null) {
103
                result += line;
104
            }
105
        } catch (Exception e) {
106
            System.out.println("发送 POST 请求出现异常!"+e);
107
            e.printStackTrace();
108
        }
109
        //使用finally块来关闭输出流、输入流
110
        finally{
111
            try{
112
                if(out!=null){
113
                    out.close();
114
                }
115
                if(in!=null){
116
                    in.close();
117
                }
118
            }
119
            catch(IOException ex){
120
                ex.printStackTrace();
121
            }
122
        }
123
        return result;
124
    }
125
126
    public static String getRequestSign(Map<String,Object> map,String aCveopDHgZnMnaYx1TFCV49R2lhJlB5e){
127
        System.err.println(Md5Util.MD5("requestMsg="+JsonUtils.mapToJson(map)+"aCveopDHgZnMnaYx1TFCV49R2lhJlB5e").toLowerCase().equals("d0e963298f2fec59dafe798fcc75724f"));
128
        return Md5Util.MD5("requestMsg="+JsonUtils.mapToJson(map)+aCveopDHgZnMnaYx1TFCV49R2lhJlB5e).toLowerCase();
129
    }
130
}
131

+ 0 - 8
app/src/main/java/com/electric/chargingpile/util/NetStyle.java

@ -1,8 +0,0 @@
1
package com.electric.chargingpile.util;
2

3
class NetStyle {
4
    static String NetStyle = "";
5
    final static String NETSTYLE_ERROR = "error";
6
    final static String NETSTYLE_NORMAL = "normal";
7
    final static String NETSTYLE_CMWAP = "cmwap";
8
}

+ 0 - 21
app/src/main/java/com/electric/chargingpile/util/NoScrollGridView.java

@ -1,21 +0,0 @@
1
package com.electric.chargingpile.util;
2

3
import android.content.Context;
4
import android.util.AttributeSet;
5
import android.widget.GridView;
6

7
public class NoScrollGridView extends GridView {
8
	public NoScrollGridView(Context context) {
9
		super(context);
10
	}
11

12
	public NoScrollGridView(Context context, AttributeSet attrs) {
13
		super(context, attrs);
14
	}
15

16
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
17
		int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
18
				MeasureSpec.AT_MOST);
19
		super.onMeasure(widthMeasureSpec, expandSpec);
20
	}
21
}

+ 0 - 33
app/src/main/java/com/electric/chargingpile/util/PackageUtil.java

@ -1,33 +0,0 @@
1
package com.electric.chargingpile.util;
2

3
import android.content.Context;
4
import android.content.pm.PackageInfo;
5
import android.content.pm.PackageManager;
6
import android.content.pm.PackageManager.NameNotFoundException;
7

8
public class PackageUtil {
9

10
	public static String getVersionName(Context context) {
11
		PackageManager pm = context.getPackageManager();
12
		try {
13
			PackageInfo pi = pm.getPackageInfo(context.getPackageName(),
14
					PackageManager.GET_CONFIGURATIONS);
15
			return pi.versionName;
16
		} catch (NameNotFoundException e) {
17
			e.printStackTrace();
18
		}
19
		return "";
20
	}
21

22
	public static int getVersionCode(Context context) {
23
		PackageManager pm = context.getPackageManager();
24
		try {
25
			PackageInfo pi = pm.getPackageInfo(context.getPackageName(),
26
					PackageManager.GET_CONFIGURATIONS);
27
			return pi.versionCode;
28
		} catch (NameNotFoundException e) {
29
			e.printStackTrace();
30
		}
31
		return 0;
32
	}
33
}

+ 0 - 69
app/src/main/java/com/electric/chargingpile/util/PiPei.java

@ -1,69 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
4
import java.io.IOException;
5
import java.util.ArrayList;
6
import java.util.List;
7
8
import com.electric.chargingpile.data.TeLaiDian;
9
import com.electric.chargingpile.data.Zhan;
10
import com.squareup.okhttp.Request;
11
import com.squareup.okhttp.Response;
12
13
public class PiPei {
14
    public static List<Zhan> listZhan = new ArrayList<Zhan>();
15
16
    public static void main(String[] args) {
17
        Zhan zhan = new Zhan();
18
        zhan.setSupplier("特来电");
19
        zhan.setTid("1101050004");
20
        listZhan.add(zhan);
21
        String re = getToken();
22
23
        List<TeLaiDian> list = JsonUtils.parseToObjectList(re, TeLaiDian.class);
24
        System.err.println(list.size());
25
        for (int i = 0; i < listZhan.size(); i++) {
26
            if (listZhan.get(i).getSupplier().equals("特来电")) {
27
                for (int j = 0; j < list.size(); j++) {
28
                    if (listZhan.get(i).getTid().equals(list.get(j).getStaCode())) {
29
                        listZhan.get(i).setAcableNum(list.get(j).getAcableNum());
30
                        listZhan.get(i).setDcableNum(list.get(j).getDcableNum());
31
                        listZhan.get(i).setDcNum(list.get(j).getDcNum());
32
                        listZhan.get(i).setAcNum(list.get(j).getAcNum());
33
                    }
34
                }
35
36
            }
37
        }
38
39
        for (int i = 0; i < listZhan.size(); i++) {
40
            System.err.println(listZhan.get(i).getAcableNum());
41
            System.err.println(listZhan.get(i).getDcNum());
42
            System.err.println(listZhan.get(i).getAcNum());
43
            System.err.println(listZhan.get(i).getDcableNum());
44
        }
45
46
    }
47
48
    private static String getToken() {
49
        String json = "";
50
        String sendurl = "http://123.57.6.131/zhannew/trd.txt";//
51
        Request request = new Request.Builder().url(sendurl).build();
52
        Response response = null;
53
        try {
54
            response = OkHttpUtil.execute(request);
55
            if (response.code() == 200) {
56
57
                try {
58
                    json = response.body().string();
59
                    System.err.println(json);
60
                } catch (IOException e) {
61
                    e.printStackTrace();
62
                }
63
            }
64
        } catch (Exception e) {
65
            e.printStackTrace();
66
        }
67
        return json;
68
    }
69
}

+ 0 - 25
app/src/main/java/com/electric/chargingpile/util/Replace.java

@ -1,25 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
/**
4
 * Created by Demon on 15/8/16.
5
 */
6
public final class Replace {
7
    static String replaceurl ="";
8
    public static String replace( String url){
9
10
//        url = url.replaceAll("&", "%26");
11
        url = url.replaceAll(" ", "%20");
12
        url = url.replaceAll("\\+", " ");
13
//        url = url.replaceAll("/", "%2F");
14
////        url = url.replaceAll("?", "%3F");
15
        url = url.replaceAll("%", "%25");
16
//        url = url.replaceAll("#", "%23");
17
//        url = url.replaceAll("&", "%26");
18
        url = url.replaceAll("=", "%3D");
19
20
21
        replaceurl =url;
22
23
        return replaceurl;
24
    }
25
}

+ 0 - 40
app/src/main/java/com/electric/chargingpile/util/ScreenUtil.java

@ -1,40 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
import android.app.Activity;
4
import android.content.Context;
5
import android.util.DisplayMetrics;
6
7
/**
8
 * Created by demon on 2017/7/19.
9
 */
10
11
public class ScreenUtil {
12
    /**
13
     * 获取屏幕内容高度
14
     * @param activity
15
     * @return
16
     */
17
    public static int getScreenHeight(Activity activity) {
18
        DisplayMetrics dm = new DisplayMetrics();
19
        activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
20
        int result = 0;
21
        int resourceId = activity.getResources()
22
                .getIdentifier("status_bar_height", "dimen", "android");
23
        if (resourceId > 0) {
24
            result = activity.getResources().getDimensionPixelSize(resourceId);
25
        }
26
        int screenHeight = dm.heightPixels - result;
27
        return screenHeight;
28
    }
29
30
    /**
31
     * dp转px
32
     * @param context
33
     * @param dipValue
34
     * @return
35
     */
36
    public static int dip2px(Context context, float dipValue) {
37
        final float scale = context.getResources().getDisplayMetrics().density;
38
        return (int) (dipValue * scale + 0.5f);
39
    }
40
}

+ 0 - 38
app/src/main/java/com/electric/chargingpile/util/SignUtils.java

@ -1,38 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
import java.security.KeyFactory;
4
import java.security.PrivateKey;
5
import java.security.spec.PKCS8EncodedKeySpec;
6
7
public class SignUtils {
8
9
    private static final String ALGORITHM = "RSA";
10
11
    private static final String SIGN_ALGORITHMS = "SHA1WithRSA";
12
13
    private static final String DEFAULT_CHARSET = "UTF-8";
14
15
    public static String sign(String content, String privateKey) {
16
        try {
17
            PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(
18
                    Base64.decode(privateKey));
19
            KeyFactory keyf = KeyFactory.getInstance(ALGORITHM);
20
            PrivateKey priKey = keyf.generatePrivate(priPKCS8);
21
22
            java.security.Signature signature = java.security.Signature
23
                    .getInstance(SIGN_ALGORITHMS);
24
25
            signature.initSign(priKey);
26
            signature.update(content.getBytes(DEFAULT_CHARSET));
27
28
            byte[] signed = signature.sign();
29
30
            return Base64.encode(signed);
31
        } catch (Exception e) {
32
            e.printStackTrace();
33
        }
34
35
        return null;
36
    }
37
38
}

+ 0 - 109
app/src/main/java/com/electric/chargingpile/util/SpUtils.java

@ -1,109 +0,0 @@
1
package com.electric.chargingpile.util;
2
3
import android.app.ActivityManager;
4
import android.content.Context;
5
import android.content.SharedPreferences;
6
import android.util.Base64;
7
8
import android.widget.TextView;
9
10
import java.io.*;
11
import java.util.ArrayList;
12
import java.util.List;
13
14
/**
15
 * @author cao_zhi_qing
16
 * @version Revision: 1.0 Date: 2015/1/2
17
 */
18
public class SpUtils {
19
    /**
20
     * 把对象保存到以String形式保存到sp中
21
     * @param context 上下文
22
     * @param t 泛型参数
23
     * @param spName sp文件名
24
     * @param keyName 字段名
25
     * @param
26
     */
27
    public static <T> void saveObj2SP(Context context, T t, String spName, String keyName) {
28
29
        SharedPreferences preferences = context.getSharedPreferences(spName, Context.MODE_PRIVATE);
30
        ByteArrayOutputStream bos;
31
        ObjectOutputStream oos = null;
32
        try {
33
            bos = new ByteArrayOutputStream();
34
            oos = new ObjectOutputStream(bos);
35
            oos.writeObject(t);
36
            byte[] bytes = bos.toByteArray();
37
// String ObjStr = new String(bytes,0,bytes.length);
38
            String ObjStr = Base64.encodeToString(bytes, Base64.DEFAULT);
39
            SharedPreferences.Editor editor = preferences.edit();
40
            editor.putString(keyName, ObjStr);
41
            editor.commit();
42
        } catch (IOException e) {
43
            e.printStackTrace();
44
        } finally {
45
//关闭流
46
            if (oos != null) {
47
                try {
48
                    oos.flush();
49
                    oos.close();
50
                } catch (IOException e) {
51
                    e.printStackTrace();
52
                }
53
54
            }
55
56
        }
57
58
    }
59
60
    /**
61
     * sp文件名 和 字段名相同
62
     * @param context
63
     * @param t
64
     * @param spName
65
     * @param <T>
66
     */
67
    public static <T> void saveObj2SP(Context context, T t, String spName) {
68
        saveObj2SP(context, t, spName, spName);
69
    }
70
71
72
    /**
73
     *从sp中读取对象
74
     * @param context
75
     * @param spName sp文件名
76
     * @param keyNme 字段名
77
     * @param <T>    泛型参数
78
     * @return
79
     */
80
    public static <T extends Object> T getObjFromSp(Context context, String spName, String keyNme) {
81
        SharedPreferences preferences = context.getSharedPreferences(spName, Context.MODE_PRIVATE);
82
        byte[] bytes = Base64.decode(preferences.getString(keyNme, ""), Base64.DEFAULT);
83
        ByteArrayInputStream bis;
84
        ObjectInputStream ois = null;
85
        T obj = null;
86
        try {
87
            bis = new ByteArrayInputStream(bytes);
88
            ois = new ObjectInputStream(bis);
89
            obj = (T) ois.readObject();
90
        } catch (IOException e) {
91
            e.printStackTrace();
92
        } catch (ClassNotFoundException e) {
93
            e.printStackTrace();
94
        } finally {
95
            if (ois != null) {
96
                try {
97
                    ois.close();
98
                } catch (IOException e) {
99
                    e.printStackTrace();
100
                }
101
            }
102
        }
103
        return obj;
104
    }
105
106
    public static <T extends Object> T getObjFromSp(Context context, String spName){
107
        return  getObjFromSp(context,spName,spName);
108
    }
109
}

+ 0 - 61
app/src/main/java/com/electric/chargingpile/util/Tools.java

@ -1,61 +0,0 @@
1
package com.electric.chargingpile.util;
2

3
import android.app.Activity;
4
import android.content.SharedPreferences;
5
import android.view.View;
6
import android.view.ViewGroup;
7
import android.view.ViewParent;
8
import android.widget.FrameLayout;
9
import android.widget.ImageView;
10
import android.widget.ImageView.ScaleType;
11

12
public class Tools 
13
{
14
	/**
15
	 * @author lianglin
16
	 * @param act The Activity which invoke this function
17
	 * @param viewId The view of the activity
18
	 * @param imageId The guide image
19
	 * @param preferenceName The sharePreference which save the flag whether first login in
20
	 * */
21
	public static void setGuidImage(Activity act,int viewId, int imageId, String preferenceName)
22
	{
23
		@SuppressWarnings("static-access")
24
		SharedPreferences preferences = act.getSharedPreferences(preferenceName,act.MODE_PRIVATE);
25
		final SharedPreferences.Editor editor = preferences.edit();
26
		final String key = act.getClass().getName()+"_firstLogin";
27
		if(!preferences.contains(key))
28
		{
29
			editor.putBoolean(key, true);
30
			editor.commit();
31
		}
32
		
33
		//判断是否首次登陆
34
		if(!preferences.getBoolean(key, true))
35
			return;
36
		
37
		View view = act.getWindow().getDecorView().findViewById(viewId);
38
		ViewParent viewParent = view.getParent();
39
		if(viewParent instanceof FrameLayout)
40
		{
41
            final FrameLayout frameLayout = (FrameLayout)viewParent;
42
            final ImageView guideImage = new ImageView(act.getApplication());
43
            FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
44
            guideImage.setLayoutParams(params);
45
            guideImage.setScaleType(ScaleType.FIT_XY);
46
                guideImage.setImageResource(imageId);
47
                guideImage.setOnClickListener(new View.OnClickListener() 
48
                {
49
                    @Override
50
                    public void onClick(View v)
51
                    {
52
                        frameLayout.removeView(guideImage);
53
                        editor.putBoolean(key, false);
54
                        editor.commit();
55
                    }
56
                });
57
                frameLayout.addView(guideImage);//添加引导图片
58
                
59
        }
60
	}
61
}

+ 0 - 231
app/src/main/java/com/electric/chargingpile/view/ActionSheetDialog.java

@ -1,231 +0,0 @@
1
package com.electric.chargingpile.view;
2

3
import java.util.ArrayList;
4
import java.util.List;
5

6
import com.electric.chargingpile.R;
7

8
import android.app.Dialog;
9
import android.content.Context;
10
import android.graphics.Color;
11
import android.view.Display;
12
import android.view.Gravity;
13
import android.view.LayoutInflater;
14
import android.view.View;
15
import android.view.View.OnClickListener;
16
import android.view.Window;
17
import android.view.WindowManager;
18
import android.widget.LinearLayout;
19
import android.widget.LinearLayout.LayoutParams;
20
import android.widget.ScrollView;
21
import android.widget.TextView;
22

23
public class ActionSheetDialog {
24
	private Context context;
25
	private Dialog dialog;
26
	private TextView txt_title;
27
	private TextView txt_cancel;
28
	private LinearLayout lLayout_content;
29
	private ScrollView sLayout_content;
30
	private boolean showTitle = false;
31
	private List<SheetItem> sheetItemList;
32
	private Display display;
33

34
	public ActionSheetDialog(Context context) {
35
		this.context = context;
36
		WindowManager windowManager = (WindowManager) context
37
				.getSystemService(Context.WINDOW_SERVICE);
38
		display = windowManager.getDefaultDisplay();
39
	}
40

41
	public ActionSheetDialog builder() {
42
		// ��ȡDialog����
43
		View view = LayoutInflater.from(context).inflate(
44
				R.layout.view_actionsheet, null);
45

46
		// ����Dialog��С���Ϊ��Ļ���
47
		view.setMinimumWidth(display.getWidth());
48

49
		// ��ȡ�Զ���Dialog�����еĿؼ�
50
		sLayout_content = (ScrollView) view.findViewById(R.id.sLayout_content);
51
		lLayout_content = (LinearLayout) view
52
				.findViewById(R.id.lLayout_content);
53
		txt_title = (TextView) view.findViewById(R.id.txt_title);
54
		txt_cancel = (TextView) view.findViewById(R.id.txt_cancel);
55
		txt_cancel.setOnClickListener(new OnClickListener() {
56
			@Override
57
			public void onClick(View v) {
58
				dialog.dismiss();
59
			}
60
		});
61

62
		// ����Dialog���ֺͲ���
63
		dialog = new Dialog(context, R.style.ActionSheetDialogStyle);
64
		dialog.setContentView(view);
65
		Window dialogWindow = dialog.getWindow();
66
		dialogWindow.setGravity(Gravity.LEFT | Gravity.BOTTOM);
67
		WindowManager.LayoutParams lp = dialogWindow.getAttributes();
68
		lp.x = 0;
69
		lp.y = 0;
70
		dialogWindow.setAttributes(lp);
71

72
		return this;
73
	}
74

75
	public ActionSheetDialog setTitle(String title) {
76
		showTitle = true;
77
		txt_title.setVisibility(View.VISIBLE);
78
		txt_title.setText(title);
79
		return this;
80
	}
81

82
	public ActionSheetDialog setCancelable(boolean cancel) {
83
		dialog.setCancelable(cancel);
84
		return this;
85
	}
86

87
	public ActionSheetDialog setCanceledOnTouchOutside(boolean cancel) {
88
		dialog.setCanceledOnTouchOutside(cancel);
89
		return this;
90
	}
91

92
	/**
93
	 * 
94
	 * @param strItem
95
	 *            ��Ŀ����
96
	 * @param color
97
	 *            ��Ŀ������ɫ������null��Ĭ����ɫ
98
	 * @param listener
99
	 * @return
100
	 */
101
	public ActionSheetDialog addSheetItem(String strItem, SheetItemColor color,
102
			OnSheetItemClickListener listener) {
103
		if (sheetItemList == null) {
104
			sheetItemList = new ArrayList<SheetItem>();
105
		}
106
		sheetItemList.add(new SheetItem(strItem, color, listener));
107
		return this;
108
	}
109

110
	/** ������Ŀ���� */
111
	private void setSheetItems() {
112
		if (sheetItemList == null || sheetItemList.size() <= 0) {
113
			return;
114
		}
115

116
		int size = sheetItemList.size();
117

118
		// TODO �߶ȿ��ƣ�����ѽ���취
119
		// �����Ŀ�����ʱ����Ƹ߶�
120
		if (size >= 7) {
121
			LayoutParams params = (LayoutParams) sLayout_content
122
					.getLayoutParams();
123
			params.height = display.getHeight() / 2;
124
			sLayout_content.setLayoutParams(params);
125
		}
126

127
		// ѭ�������Ŀ
128
		for (int i = 1; i <= size; i++) {
129
			final int index = i;
130
			SheetItem sheetItem = sheetItemList.get(i - 1);
131
			String strItem = sheetItem.name;
132
			SheetItemColor color = sheetItem.color;
133
			final OnSheetItemClickListener listener = (OnSheetItemClickListener) sheetItem.itemClickListener;
134

135
			TextView textView = new TextView(context);
136
			textView.setText(strItem);
137
			textView.setTextSize(18);
138
			textView.setGravity(Gravity.CENTER);
139

140
			// ����ͼƬ
141
			if (size == 1) {
142
				if (showTitle) {
143
					textView.setBackgroundResource(R.drawable.actionsheet_bottom_selector);
144
				} else {
145
					textView.setBackgroundResource(R.drawable.actionsheet_single_selector);
146
				}
147
			} else {
148
				if (showTitle) {
149
					if (i >= 1 && i < size) {
150
						textView.setBackgroundResource(R.drawable.actionsheet_middle_selector);
151
					} else {
152
						textView.setBackgroundResource(R.drawable.actionsheet_bottom_selector);
153
					}
154
				} else {
155
					if (i == 1) {
156
						textView.setBackgroundResource(R.drawable.actionsheet_top_selector);
157
					} else if (i < size) {
158
						textView.setBackgroundResource(R.drawable.actionsheet_middle_selector);
159
					} else {
160
						textView.setBackgroundResource(R.drawable.actionsheet_bottom_selector);
161
					}
162
				}
163
			}
164

165
			// ������ɫ
166
			if (color == null) {
167
				textView.setTextColor(Color.parseColor(SheetItemColor.Green
168
						.getName()));
169
			} else {
170
				textView.setTextColor(Color.parseColor(color.getName()));
171
			}
172

173
			// �߶�
174
			float scale = context.getResources().getDisplayMetrics().density;
175
			int height = (int) (45 * scale + 0.5f);
176
			textView.setLayoutParams(new LayoutParams(
177
					LayoutParams.MATCH_PARENT, height));
178

179
			// ����¼�
180
			textView.setOnClickListener(new OnClickListener() {
181
				@Override
182
				public void onClick(View v) {
183
					listener.onClick(index);
184
					dialog.dismiss();
185
				}
186
			});
187

188
			lLayout_content.addView(textView);
189
		}
190
	}
191

192
	public void show() {
193
		setSheetItems();
194
		dialog.show();
195
	}
196

197
	public interface OnSheetItemClickListener {
198
		void onClick(int which);
199
	}
200

201
	public class SheetItem {
202
		String name;
203
		OnSheetItemClickListener itemClickListener;
204
		SheetItemColor color;
205

206
		public SheetItem(String name, SheetItemColor color,
207
				OnSheetItemClickListener itemClickListener) {
208
			this.name = name;
209
			this.color = color;
210
			this.itemClickListener = itemClickListener;
211
		}
212
	}
213

214
	public enum SheetItemColor {
215
		Blue("#037BFF"), Red("#FD4A2E"),Green("#1CB43F");
216

217
		private String name;
218

219
		private SheetItemColor(String name) {
220
			this.name = name;
221
		}
222

223
		public String getName() {
224
			return name;
225
		}
226

227
		public void setName(String name) {
228
			this.name = name;
229
		}
230
	}
231
}

+ 0 - 38
app/src/main/java/com/electric/chargingpile/view/BaifenbiView.java

@ -1,38 +0,0 @@
1
package com.electric.chargingpile.view;
2

3
import com.electric.chargingpile.R;
4

5
import android.content.Context;
6
import android.view.LayoutInflater;
7
import android.view.View;
8
import android.widget.RelativeLayout;
9
import android.widget.TextView;
10

11
public class BaifenbiView extends RelativeLayout {
12
	private TextView name;
13
	private TextView content;
14
	private TextView baifen;
15

16
	public BaifenbiView(Context context) {
17
		super(context);
18
		LayoutInflater from = LayoutInflater.from(context);
19
		View view = from.inflate(R.layout.baifenbi, null);
20
		name = (TextView) view.findViewById(R.id.zhuang_name);
21
		content = (TextView) view.findViewById(R.id.zhuang_content);
22
		baifen = (TextView) view.findViewById(R.id.zhuang_baifen);
23
		addView(view);
24
	}
25

26
	public TextView getName() {
27
		return name;
28
	}
29

30
	public TextView getContent() {
31
		return content;
32
	}
33

34
	public TextView getBaifen() {
35
		return baifen;
36
	}
37

38
}

+ 0 - 70
app/src/main/java/com/electric/chargingpile/view/BubbleDetails.java

@ -1,70 +0,0 @@
1
package com.electric.chargingpile.view;
2

3
import com.electric.chargingpile.R;
4

5
import android.content.Context;
6
import android.view.LayoutInflater;
7
import android.view.View;
8
import android.widget.LinearLayout;
9
import android.widget.TextView;
10

11
public class BubbleDetails extends LinearLayout {
12
	private TextView distance;
13
	private TextView name;
14
	private TextView address;
15
	private TextView yuyue;
16
	private TextView daohang;
17

18
	public TextView getDistance() {
19
		return distance;
20
	}
21

22
	public void setDistance(TextView distance) {
23
		this.distance = distance;
24
	}
25

26
	public TextView getName() {
27
		return name;
28
	}
29

30
	public void setName(TextView name) {
31
		this.name = name;
32
	}
33

34
	public TextView getAddress() {
35
		return address;
36
	}
37

38
	public void setAddress(TextView address) {
39
		this.address = address;
40
	}
41

42
	public TextView getYuyue() {
43
		return yuyue;
44
	}
45

46
	public void setYuyue(TextView yuyue) {
47
		this.yuyue = yuyue;
48
	}
49

50
	public BubbleDetails(Context context) {
51
		super(context);
52
		LayoutInflater from = LayoutInflater.from(context);
53
		View view = from.inflate(R.layout.bubble_details_view, null);
54
		distance = (TextView) view.findViewById(R.id.detail_distance);
55
		name = (TextView) view.findViewById(R.id.detail_name);
56
		address = (TextView) view.findViewById(R.id.detail_address);
57
		yuyue = (TextView) view.findViewById(R.id.detail_yue);
58
		daohang = (TextView) view.findViewById(R.id.detail_daohang);
59
		addView(view);
60
	}
61

62
	public TextView getDaohang() {
63
		return daohang;
64
	}
65

66
	public void setDaohang(TextView daohang) {
67
		this.daohang = daohang;
68
	}
69

70
}

+ 0 - 347
app/src/main/java/com/electric/chargingpile/view/CopyOfREditText.java

@ -1,347 +0,0 @@
1
package com.electric.chargingpile.view;
2

3
import java.util.ArrayList;
4
import java.util.List;
5

6
import android.content.Context;
7
import android.content.res.TypedArray;
8
import android.graphics.Color;
9
import android.text.Editable;
10
import android.text.Spannable;
11
import android.text.TextUtils;
12
import android.text.TextWatcher;
13
import android.text.style.BackgroundColorSpan;
14
import android.text.style.ForegroundColorSpan;
15
import android.util.AttributeSet;
16
import android.view.KeyEvent;
17
import android.view.View;
18
import android.widget.EditText;
19

20
import com.electric.chargingpile.R;
21
import com.electric.chargingpile.data.RObject;
22

23

24
/**
25
 * ��΢����������ؼ�
26
 * 
27
 * @author Ruffian
28
 * @date 2016��10��10��
29
 * 
30
 */
31
public class CopyOfREditText extends EditText {
32

33
	// Ĭ��,�����ı�������ɫ
34
	private static final int FOREGROUND_COLOR = Color.parseColor("#FF8C00");
35
	// Ĭ��,���ⱳ��������ɫ
36
	private static final int BACKGROUND_COLOR = Color.parseColor("#FFDEAD");
37

38
	/**
39
	 * �����߿���������
40
	 */
41
	private int mForegroundColor = FOREGROUND_COLOR;// �����ı�������ɫ
42
	private int mBackgroundColor = BACKGROUND_COLOR;// ���ⱳ��������ɫ
43
	private List<RObject> mRObjectsList = new ArrayList<RObject>();// object����
44

45
	public CopyOfREditText(Context context) {
46
		this(context, null);
47
	}
48

49
	public CopyOfREditText(Context context, AttributeSet attrs) {
50
		super(context, attrs);
51

52
		TypedArray a = context.obtainStyledAttributes(attrs,
53
				R.styleable.REditText);
54
		mBackgroundColor = a
55
				.getColor(R.styleable.REditText_object_background_color,
56
						BACKGROUND_COLOR);
57
		mForegroundColor = a
58
				.getColor(R.styleable.REditText_object_foreground_color,
59
						getResources().getColor(R.color.blue));
60
		a.recycle();
61

62
		// ��ʼ������
63
		initView();
64
	}
65

66
	/**
67
	 * ��������λ��,����괦�ڻ��������м����ƶ���굽�������λ��
68
	 */
69
	@Override
70
	protected void onSelectionChanged(int selStart, int selEnd) {
71
		super.onSelectionChanged(selStart, selEnd);
72
		if (mRObjectsList == null || mRObjectsList.size() == 0) {
73
			return;
74
		}
75

76
		int startPosition = 0;
77
		int endPosition = 0;
78
		String objectText = "";
79
		for (int i = 0; i < mRObjectsList.size(); i++) {
80
			objectText = mRObjectsList.get(i).getObjectText();// �ı�
81
			startPosition = getText().toString().indexOf(objectText);// ��ȡ�ı���ʼ�±�
82
			endPosition = startPosition + objectText.length();
83
			if (startPosition != -1 && selStart > startPosition
84
					&& selStart <= endPosition) {// ����괦�ڻ��������м����ƶ���굽�������λ��
85
				setSelection(endPosition);
86
			}
87
		}
88

89
	}
90

91
	/**
92
	 * ��ʼ���ؼ�,һЩ����
93
	 */
94
	private void initView() {
95

96
		/**
97
		 * ��������ݱ仯����<br/>
98
		 * 1.���������ݲ����仯��ʱ��ʵʱ����UI
99
		 */
100
		this.addTextChangedListener(new TextWatcher() {
101
			@Override
102
			public void beforeTextChanged(CharSequence s, int start, int count,
103
					int after) {
104
			}
105

106
			@Override
107
			public void onTextChanged(CharSequence s, int start, int before,
108
					int count) {
109
			}
110

111
			@Override
112
			public void afterTextChanged(Editable s) {
113
				// ���ָı�ˢ��UI
114
				refreshEditTextUI(s.toString());
115
			}
116
		});
117

118
		/**
119
		 * ����ɾ���� <br/>
120
		 * 1.����ڻ������,��������������ɾ�� <br/>
121
		 * 2.�������ͨ���ֺ���,ɾ��һ���ַ�
122
		 */
123
		this.setOnKeyListener(new OnKeyListener() {
124
			@Override
125
			public boolean onKey(View v, int keyCode, KeyEvent event) {
126

127
				if (keyCode == KeyEvent.KEYCODE_DEL
128
						&& event.getAction() == KeyEvent.ACTION_DOWN) {
129

130
					int selectionStart = getSelectionStart();
131
					int selectionEnd = getSelectionEnd();
132

133
					/**
134
					 * ��������ʼ�ͽ�������ͬһλ��,ɾ���ı�
135
					 */
136
					if (selectionStart != selectionEnd) {
137
						// ��ѯ�ı��Ƿ�����Ŀ�����,�����Ƴ��б�����
138
						String tagetText = getText().toString().substring(
139
								selectionStart, selectionEnd);
140
						for (int i = 0; i < mRObjectsList.size(); i++) {
141
							RObject object = mRObjectsList.get(i);
142
							if (tagetText.equals(object.getObjectText())) {
143
								mRObjectsList.remove(object);
144
							}
145
						}
146
						return false;
147
					}
148

149
					int lastPos = 0;
150
					Editable editable = getText();
151
					// �����жϹ���λ��
152
					for (int i = 0; i < mRObjectsList.size(); i++) {
153

154
						String objectText = mRObjectsList.get(i)
155
								.getObjectText();
156

157
						lastPos = getText().toString().indexOf(objectText,
158
								lastPos);
159
						if (lastPos != -1) {
160
							if (selectionStart != 0
161
									&& selectionStart >= lastPos
162
									&& selectionStart <= (lastPos + objectText
163
											.length())) {
164
								// ѡ�л���
165
								setSelection(lastPos,
166
										lastPos + objectText.length());
167
								// ���ñ���ɫ
168
								editable.setSpan(new BackgroundColorSpan(
169
										mBackgroundColor), lastPos, lastPos
170
										+ objectText.length(),
171
										Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
172
								return true;
173
							}
174
						}
175
						lastPos += objectText.length();
176
					}
177
				}
178

179
				// if (keyCode == KeyEvent.KEYCODE_DEL
180
				// && event.getAction() == KeyEvent.ACTION_DOWN) { //
181
				// ��Ϊɾ���������ǰ��¶���ʱִ��
182
				//
183
				// int selectionStart = getSelectionStart();// ��ǰ���λ��
184
				// int selectionEnd = getSelectionEnd();// �������
185
				//
186
				// Log.w("tag", "--selectionStart:" + selectionStart
187
				// + "---selectionEnd:" + selectionEnd);
188
				//
189
				// /**
190
				// * ��������ʼ�ͽ�������ͬһλ��,ɾ���ı�
191
				// */
192
				// if (selectionStart != selectionEnd) {
193
				// // ��ѯ�ı��Ƿ�����Ŀ�����,�����Ƴ��б�����
194
				// String tagetText = getText().toString().substring(
195
				// selectionStart, selectionEnd);
196
				// for (int i = 0; i < mRObjectsList.size(); i++) {
197
				// RObject object = mRObjectsList.get(i);
198
				// if (tagetText.equals(object.getObjectText())) {
199
				// mRObjectsList.remove(object);
200
				// }
201
				// }
202
				// return false;
203
				// }
204
				//
205
				// int startPosition = 0;
206
				// int endPosition = 0;
207
				// for (int i = 0; i < mRObjectsList.size(); i++) {
208
				//
209
				// String objectText = mRObjectsList.get(i)
210
				// .getObjectText();
211
				// startPosition = getText().toString()
212
				// .indexOf(objectText);
213
				// endPosition = startPosition + objectText.length();
214
				//
215
				// if (startPosition != -1
216
				// && selectionStart == endPosition) {
217
				//
218
				// Log.w("tag", "--����--" + startPosition + "---"
219
				// + endPosition);
220
				// // ѡ�л���
221
				// setSelection(startPosition, endPosition);
222
				// // ���ñ���ɫ
223
				// Editable editable = getText();
224
				// editable.setSpan(new BackgroundColorSpan(
225
				// mBackgroundColor), startPosition,
226
				// endPosition,
227
				// Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
228
				// return true;
229
				//
230
				// }
231
				// }
232
				//
233
				// }
234

235
				return false;
236
			}
237
		});
238

239
	}
240

241
	/**
242
	 * EditText�����޸�֮��ˢ��UI
243
	 * 
244
	 * @param content���������
245
	 */
246
	private void refreshEditTextUI(String content) {
247

248
		/**
249
		 * ���ݱ仯ʱ����<br/>
250
		 * 1.����ƥ�����л������� <br/>
251
		 * 2.���û�������������ɫ
252
		 */
253

254
		if (mRObjectsList.size() == 0)
255
			return;
256

257
		if (TextUtils.isEmpty(content)) {
258
			mRObjectsList.clear();
259
			return;
260
		}
261

262
		/**
263
		 * ��������span
264
		 */
265
		Editable editable = getText();
266
		int findPosition = 0;
267
		for (int i = 0; i < mRObjectsList.size(); i++) {
268
			final RObject object = mRObjectsList.get(i);
269
			String objectText = object.getObjectText();// �ı�
270
			findPosition = content.indexOf(objectText);// ��ȡ�ı���ʼ�±�
271

272
			if (findPosition != -1) {// ���û�������ǰ��ɫ����
273

274
				ForegroundColorSpan colorSpan = new ForegroundColorSpan(
275
						getResources().getColor(R.color.blue));
276
				editable.setSpan(colorSpan, findPosition, findPosition
277
						+ objectText.length(),
278
						Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
279

280
			}
281
		}
282

283
	}
284

285
	/**
286
	 * ����/���û���
287
	 * 
288
	 * @param object�������
289
	 */
290
	public void setObject(RObject object) {
291

292
		if (object == null)
293
			return;
294

295
		String objectRule = object.getObjectRule();
296
		String objectText = object.getObjectText();
297
		if (TextUtils.isEmpty(objectText) || TextUtils.isEmpty(objectRule))
298
			return;
299

300
		// ƴ���ַ�# %s #,������
301
		objectText = objectRule + objectText + objectRule;
302
		object.setObjectText(objectText);
303

304
		/**
305
		 * ��ӻ���<br/>
306
		 * 1.������������ӵ����ݼ�����<br/>
307
		 * 2.������������ӵ�EditText��չʾ
308
		 */
309

310
		/**
311
		 * 1.��ӻ������ݵ����ݼ���
312
		 */
313
		mRObjectsList.add(object);
314

315
		/**
316
		 * 2.������������ӵ�EditText��չʾ
317
		 */
318
		int selectionStart = getSelectionStart();// ����
319
		Editable editable = getText();// ԭ������
320

321
		if (selectionStart >= 0) {
322
			editable.insert(selectionStart, objectText);// �ڹ��λ�ò�������
323
			editable.insert(getSelectionStart(), " ");// ����������ո�,������Ҫ
324
			setSelection(getSelectionStart());// �ƶ���굽��ӵ����ݺ���
325
		}
326

327
	}
328

329
	/**
330
	 * ��ȡobject�б�����
331
	 */
332
	public List<RObject> getObjects() {
333
		List<RObject> objectsList = new ArrayList<RObject>();
334
		// ���ڱ���ʱ���ı����������ƥ���ַ�#,�˴�ȥ��,��ԭ����
335
		if (mRObjectsList != null && mRObjectsList.size() > 0) {
336
			for (int i = 0; i < mRObjectsList.size(); i++) {
337
				RObject object = mRObjectsList.get(i);
338
				String objectText = object.getObjectText();
339
				String objectRule = object.getObjectRule();
340
				object.setObjectText(objectText.replace(objectRule, ""));// ��ƥ������ַ��滻
341
				objectsList.add(object);
342
			}
343
		}
344
		return objectsList;
345
	}
346

347
}

+ 0 - 231
app/src/main/java/com/electric/chargingpile/view/CustomImageView.java

@ -1,231 +0,0 @@
1
package com.electric.chargingpile.view;
2
3
/**
4
 * Created by Demon on 15/8/11.
5
 */
6
7
import com.electric.chargingpile.R;
8
9
import android.content.Context;
10
import android.content.res.TypedArray;
11
import android.graphics.Bitmap;
12
import android.graphics.BitmapFactory;
13
import android.graphics.Canvas;
14
import android.graphics.Paint;
15
import android.graphics.PorterDuff;
16
import android.graphics.PorterDuffXfermode;
17
import android.graphics.RectF;
18
import android.graphics.Bitmap.Config;
19
import android.graphics.drawable.BitmapDrawable;
20
import android.graphics.drawable.Drawable;
21
import android.util.AttributeSet;
22
import android.util.Log;
23
import android.util.TypedValue;
24
import android.view.View;
25
import android.view.View.MeasureSpec;
26
27
/**
28
 * 自定义View,实现圆角,圆形等效果
29
 *
30
 * @author zhy
31
 *
32
 */
33
public class CustomImageView extends View
34
{
35
36
    /**
37
     * TYPE_CIRCLE / TYPE_ROUND
38
     */
39
    private int type;
40
    private static final int TYPE_CIRCLE = 0;
41
    private static final int TYPE_ROUND = 1;
42
43
    /**
44
     * 图片
45
     */
46
    private Bitmap mSrc;
47
48
    /**
49
     * 圆角的大小
50
     */
51
    private int mRadius;
52
53
    /**
54
     * 控件的宽度
55
     */
56
    private int mWidth;
57
    /**
58
     * 控件的高度
59
     */
60
    private int mHeight;
61
62
    public CustomImageView(Context context, AttributeSet attrs)
63
    {
64
        this(context, attrs, 0);
65
    }
66
67
    public CustomImageView(Context context)
68
    {
69
        this(context, null);
70
    }
71
72
    /**
73
     * 初始化一些自定义的参数
74
     *
75
     * @param context
76
     * @param attrs
77
     * @param defStyle
78
     */
79
    public CustomImageView(Context context, AttributeSet attrs, int defStyle)
80
    {
81
        super(context, attrs, defStyle);
82
83
        TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CustomImageView, defStyle, 0);
84
85
        int n = a.getIndexCount();
86
        for (int i = 0; i < n; i++)
87
        {
88
            int attr = a.getIndex(i);
89
            switch (attr)
90
            {
91
                case R.styleable.CustomImageView_src:
92
                    mSrc = BitmapFactory.decodeResource(getResources(), a.getResourceId(attr, 0));
93
                    break;
94
                case R.styleable.CustomImageView_type:
95
                    type = a.getInt(attr, 0);// 默认为Circle
96
                    break;
97
                case R.styleable.CustomImageView_borderRadius:
98
                    type = a.getDimensionPixelSize(attr, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10f,
99
                            getResources().getDisplayMetrics()));// 默认为10DP
100
                    break;
101
            }
102
        }
103
        a.recycle();
104
    }
105
106
    /**
107
     * 计算控件的高度和宽度
108
     */
109
    @Override
110
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
111
    {
112
        // super.onMeasure(widthMeasureSpec, heightMeasureSpec);
113
114
        /**
115
         * 设置宽度
116
         */
117
        int specMode = MeasureSpec.getMode(widthMeasureSpec);
118
        int specSize = MeasureSpec.getSize(widthMeasureSpec);
119
120
        if (specMode == MeasureSpec.EXACTLY)// match_parent , accurate
121
        {
122
            mWidth = specSize;
123
        } else
124
        {
125
            // 由图片决定的宽
126
            int desireByImg = getPaddingLeft() + getPaddingRight() + mSrc.getWidth();
127
            if (specMode == MeasureSpec.AT_MOST)// wrap_content
128
            {
129
                mWidth = Math.min(desireByImg, specSize);
130
            }
131
        }
132
133
        /***
134
         * 设置高度
135
         */
136
137
        specMode = MeasureSpec.getMode(heightMeasureSpec);
138
        specSize = MeasureSpec.getSize(heightMeasureSpec);
139
        if (specMode == MeasureSpec.EXACTLY)// match_parent , accurate
140
        {
141
            mHeight = specSize;
142
        } else
143
        {
144
            int desire = getPaddingTop() + getPaddingBottom() + mSrc.getHeight();
145
            if (specMode == MeasureSpec.AT_MOST)// wrap_content
146
            {
147
                mHeight = Math.min(desire, specSize);
148
            }
149
        }
150
        setMeasuredDimension(mWidth, mHeight);
151
152
    }
153
154
    /**
155
     * 绘制
156
     */
157
    @Override
158
    protected void onDraw(Canvas canvas)
159
    {
160
161
        switch (type)
162
        {
163
            // 如果是TYPE_CIRCLE绘制圆形
164
            case TYPE_CIRCLE:
165
166
                int min = Math.min(mWidth, mHeight);
167
                /**
168
                 * 长度如果不一致,按小的值进行压缩
169
                 */
170
                mSrc = Bitmap.createScaledBitmap(mSrc, min, min, false);
171
172
                canvas.drawBitmap(createCircleImage(mSrc, min), 0, 0, null);
173
                break;
174
            case TYPE_ROUND:
175
                canvas.drawBitmap(createRoundConerImage(mSrc), 0, 0, null);
176
                break;
177
178
        }
179
180
    }
181
182
    /**
183
     * 根据原图和变长绘制圆形图片
184
     *
185
     * @param source
186
     * @param min
187
     * @return
188
     */
189
    private Bitmap createCircleImage(Bitmap source, int min)
190
    {
191
        final Paint paint = new Paint();
192
        paint.setAntiAlias(true);
193
        Bitmap target = Bitmap.createBitmap(min, min, Config.ARGB_8888);
194
        /**
195
         * 产生一个同样大小的画布
196
         */
197
        Canvas canvas = new Canvas(target);
198
        /**
199
         * 首先绘制圆形
200
         */
201
        canvas.drawCircle(min / 2, min / 2, min / 2, paint);
202
        /**
203
         * 使用SRC_IN,参考上面的说明
204
         */
205
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
206
        /**
207
         * 绘制图片
208
         */
209
        canvas.drawBitmap(source, 0, 0, paint);
210
        return target;
211
    }
212
213
    /**
214
     * 根据原图添加圆角
215
     *
216
     * @param source
217
     * @return
218
     */
219
    private Bitmap createRoundConerImage(Bitmap source)
220
    {
221
        final Paint paint = new Paint();
222
        paint.setAntiAlias(true);
223
        Bitmap target = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
224
        Canvas canvas = new Canvas(target);
225
        RectF rect = new RectF(0, 0, source.getWidth(), source.getHeight());
226
        canvas.drawRoundRect(rect, 50f, 50f, paint);
227
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
228
        canvas.drawBitmap(source, 0, 0, paint);
229
        return target;
230
    }
231
}

+ 0 - 97
app/src/main/java/com/electric/chargingpile/view/RefundDialog.java

@ -1,97 +0,0 @@
1
package com.electric.chargingpile.view;
2
3
import android.app.Activity;
4
import android.content.Context;
5
import android.view.Display;
6
import android.view.LayoutInflater;
7
import android.view.View;
8
import android.view.WindowManager;
9
import android.view.inputmethod.InputMethodManager;
10
import android.widget.EditText;
11
import android.widget.FrameLayout;
12
import android.widget.LinearLayout;
13
import android.widget.TextView;
14
15
import com.electric.chargingpile.R;
16
17
/**
18
 * Created by demon on 2018/3/14.
19
 */
20
21
public class RefundDialog {
22
    private Context context;
23
    private Activity activity;
24
    private android.app.Dialog dialog;
25
    private Display display;
26
    private TextView dialog_cancel,dialog_sure;
27
    private FrameLayout dialog_bg;
28
    private EditText dialog_et;
29
30
31
    public RefundDialog(Context context,Activity activity) {
32
        this.context = context;
33
        this.activity = activity;
34
        WindowManager windowManager = (WindowManager) context
35
                .getSystemService(Context.WINDOW_SERVICE);
36
        display = windowManager.getDefaultDisplay();
37
    }
38
39
    public RefundDialog builder() {
40
        // 获取Dialog布局
41
        View view = LayoutInflater.from(context).inflate(
42
                R.layout.layout_refund_dialog, null);
43
44
        // 获取自定义Dialog布局中的控件
45
        dialog_bg = (FrameLayout) view.findViewById(R.id.dialog_bg);
46
        dialog_cancel = (TextView) view.findViewById(R.id.dialog_tv_cancel);
47
        dialog_sure = (TextView) view.findViewById(R.id.dialog_tv_sure);
48
        dialog_et = (EditText) view.findViewById(R.id.dialog_et_account);
49
50
        // 定义Dialog布局和参数
51
        dialog = new android.app.Dialog(context, R.style.AlertDialogStyle);
52
        dialog.setContentView(view);
53
54
        // 调整dialog背景大小
55
        dialog_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
56
                .getWidth() * 0.85), LinearLayout.LayoutParams.WRAP_CONTENT));
57
58
        return this;
59
    }
60
61
    public RefundDialog setCancelable(boolean cancel) {
62
        dialog.setCancelable(cancel);
63
        dialog.setCanceledOnTouchOutside(cancel);
64
        return this;
65
    }
66
67
    public void show() {
68
        dialog_cancel.setOnClickListener(new View.OnClickListener() {
69
            @Override
70
            public void onClick(View v) {
71
                try {
72
                    hideInput();
73
                    dialog.dismiss();
74
                } catch (Exception e) {
75
                    e.printStackTrace();
76
                }
77
            }
78
        });
79
80
        dialog.show();
81
//        showInput(dialog_et);
82
83
    }
84
85
    public void hideInput() {
86
        View view = activity.getWindow().peekDecorView();
87
        if (view != null) {
88
            InputMethodManager inputmanger = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
89
            inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
90
        }
91
    }
92
93
    public void showInput(View view){
94
        InputMethodManager inputmanger = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
95
        inputmanger.showSoftInput(view, 0);
96
    }
97
}

+ 0 - 25
app/src/main/java/com/electric/chargingpile/view/SaundProgressIndicator.java

@ -1,25 +0,0 @@
1
package com.electric.chargingpile.view;
2
3
/**
4
 * Created by demon on 2017/5/18.
5
 */
6
7
import android.content.Context;
8
import android.util.AttributeSet;
9
import android.widget.TextView;
10
11
public class SaundProgressIndicator extends TextView {
12
13
    public SaundProgressIndicator(Context context) {
14
        this(context, null);
15
    }
16
17
    public SaundProgressIndicator(Context context, AttributeSet attrs) {
18
        this(context, attrs, 0);
19
    }
20
21
    public SaundProgressIndicator(Context context, AttributeSet attrs,
22
                                  int defStyle) {
23
        super(context, attrs, defStyle);
24
    }
25
}

+ 0 - 36
app/src/main/java/com/electric/chargingpile/view/SearchDialog.java

@ -1,36 +0,0 @@
1
package com.electric.chargingpile.view;
2

3
import com.electric.chargingpile.R;
4

5
import android.app.Dialog;
6
import android.content.Context;
7
import android.os.Bundle;
8
import android.widget.TextView;
9

10
public class SearchDialog extends Dialog {
11
	private TextView zhan, search;
12
	Context context;
13

14
	public SearchDialog(Context context) {
15
		super(context);
16
		this.context = context;
17
	}
18

19
	@Override
20
	protected void onCreate(Bundle savedInstanceState) {
21
		super.onCreate(savedInstanceState);
22
		this.setContentView(R.layout.dialog_search);
23

24
		zhan = (TextView) findViewById(R.id.dialog_search_zhan);
25
		search = (TextView) findViewById(R.id.dialog_search_address);
26
	}
27

28
	public TextView getZhan() {
29
		return zhan;
30
	}
31

32
	public TextView getSearch() {
33
		return search;
34
	}
35

36
}

+ 0 - 268
app/src/main/java/com/electric/chargingpile/view/WaterWaveView.java

@ -1,268 +0,0 @@
1
package com.electric.chargingpile.view;
2
3
import android.content.Context;
4
import android.graphics.Canvas;
5
import android.graphics.Color;
6
import android.graphics.Paint;
7
import android.graphics.Path;
8
import android.graphics.Rect;
9
import android.graphics.RectF;
10
import android.os.SystemClock;
11
import android.util.AttributeSet;
12
import android.view.View;
13
14
/**
15
 * Created by demon on 2017/6/2.
16
 */
17
18
public class WaterWaveView extends View {
19
    //边框宽度
20
    private int STROKE_WIDTH;
21
    //组件的宽,高
22
    private int width, height;
23
    /**
24
     * 进度条最大值和当前进度值
25
     */
26
    private float max, progress;
27
28
    /**
29
     * 绘制波浪的画笔
30
     */
31
    private Paint progressPaint;
32
33
    //波纹振幅与半径之比。(建议设置:<0.1)
34
    private static final float A = 0.05f;
35
    //绘制文字的画笔
36
    private Paint textPaint;
37
    //绘制边框的画笔
38
    private Paint circlePaint;
39
40
    /**
41
     * 圆弧圆心位置
42
     */
43
    private int centerX, centerY;
44
45
    //内圆所在的矩形
46
    private RectF circleRectF;
47
48
    public WaterWaveView(Context context) {
49
        super(context);
50
        init();
51
    }
52
53
    public WaterWaveView(Context context, AttributeSet attrs) {
54
        super(context, attrs);
55
        init();
56
    }
57
58
    public WaterWaveView(Context context, AttributeSet attrs, int defStyleAttr) {
59
        super(context, attrs, defStyleAttr);
60
        init();
61
    }
62
63
    //初始化
64
    private void init() {
65
        progressPaint = new Paint();
66
        progressPaint.setColor(Color.parseColor("#77cccc88"));
67
        progressPaint.setAntiAlias(true);
68
69
        textPaint = new Paint();
70
        textPaint.setColor(Color.WHITE);
71
        textPaint.setAntiAlias(true);
72
73
        circlePaint = new Paint();
74
        circlePaint.setStyle(Paint.Style.STROKE);
75
        circlePaint.setAntiAlias(true);
76
        circlePaint.setColor(Color.parseColor("#33333333"));
77
78
        autoRefresh();
79
    }
80
81
    @Override
82
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
83
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
84
85
        if (width == 0 || height == 0) {
86
            width = getWidth();
87
            height = getHeight();
88
89
            //计算圆弧半径和圆心点
90
            int circleRadius = Math.min(width, height) >> 1;
91
            STROKE_WIDTH = circleRadius / 10;
92
            circlePaint.setStrokeWidth(STROKE_WIDTH);
93
94
            centerX = width / 2;
95
            centerY = height / 2;
96
97
            VALID_RADIUS = circleRadius - STROKE_WIDTH;
98
            RADIANS_PER_X = (float) (Math.PI / VALID_RADIUS);
99
            circleRectF = new RectF(centerX - VALID_RADIUS, centerY - VALID_RADIUS,
100
                    centerX + VALID_RADIUS, centerY + VALID_RADIUS);
101
        }
102
    }
103
104
    private Rect textBounds = new Rect();
105
106
    //x方向偏移量
107
    private int xOffset;
108
109
    @Override
110
    protected void onDraw(Canvas canvas) {
111
        super.onDraw(canvas);
112
113
        //绘制圆形边框
114
        canvas.drawCircle(centerX, centerY, VALID_RADIUS + (STROKE_WIDTH >> 1), circlePaint);
115
        //绘制水波曲线
116
        canvas.drawPath(getWavePath(xOffset), progressPaint);
117
118
        //绘制文字
119
        textPaint.setTextSize(VALID_RADIUS >> 1);
120
        String text1 = String.valueOf(progress);
121
        //测量文字长度
122
        float w1 = textPaint.measureText(text1);
123
        //测量文字高度
124
        textPaint.getTextBounds("8", 0, 1, textBounds);
125
        float h1 = textBounds.height();
126
        float extraW = textPaint.measureText("8") / 3;
127
        canvas.drawText(text1, centerX - w1 / 2 - extraW, centerY + h1 / 2, textPaint);
128
129
        textPaint.setTextSize(VALID_RADIUS / 6);
130
        textPaint.getTextBounds("M", 0, 1, textBounds);
131
        float h2 = textBounds.height();
132
        canvas.drawText("M", centerX + w1 / 2 - extraW + 5, centerY - (h1 / 2 - h2), textPaint);
133
134
        String text3 = "共" + String.valueOf(max) + "M";
135
        float w3 = textPaint.measureText(text3, 0, text3.length());
136
        textPaint.getTextBounds("M", 0, 1, textBounds);
137
        float h3 = textBounds.height();
138
        canvas.drawText(text3, centerX - w3 / 2, centerY + (VALID_RADIUS >> 1) + h3 / 2, textPaint);
139
140
        String text4 = "流量剩余";
141
        float w4 = textPaint.measureText(text4, 0, text4.length());
142
        textPaint.getTextBounds(text4, 0, text4.length(), textBounds);
143
        float h4 = textBounds.height();
144
        canvas.drawText(text4, centerX - w4 / 2, centerY - (VALID_RADIUS >> 1) + h4 / 2, textPaint);
145
146
    }
147
148
    //绘制水波的路径
149
    private Path wavePath;
150
    //每一个像素对应的弧度数
151
    private float RADIANS_PER_X;
152
    //去除边框后的半径(即内圆半径)
153
    private int VALID_RADIUS;
154
155
    /**
156
     * 获取水波曲线(包含圆弧部分)的Path.
157
     *
158
     * @param xOffset x方向像素偏移量.
159
     */
160
    private Path getWavePath(int xOffset) {
161
        if (wavePath == null) {
162
            wavePath = new Path();
163
        } else {
164
            wavePath.reset();
165
        }
166
167
        float[] startPoint = new float[2];  //波浪线起点
168
        float[] endPoint = new float[2];  //波浪线终点
169
170
        for (int i = 0; i <= VALID_RADIUS * 2; i += 2) {
171
            float x = centerX - VALID_RADIUS + i;
172
            float y = (float) (centerY + VALID_RADIUS * (1.0f + A) * 2 * (0.5f - progress / max)
173
                    + VALID_RADIUS * A * Math.sin((xOffset + i) * RADIANS_PER_X));
174
175
            //只计算内圆内部的点,边框上的忽略
176
            if (calDistance(x, y, centerX, centerY) > VALID_RADIUS) {
177
                if (x < centerX) {
178
                    continue;  //左边框,继续循环
179
                } else {
180
                    break; //右边框,结束循环
181
                }
182
            }
183
184
            //第1个点
185
            if (wavePath.isEmpty()) {
186
                startPoint[0] = x;
187
                startPoint[1] = y;
188
                wavePath.moveTo(x, y);
189
            } else {
190
                wavePath.lineTo(x, y);
191
            }
192
193
            endPoint[0] = x;
194
            endPoint[1] = y;
195
        }
196
197
        if (wavePath.isEmpty()) {
198
            if (progress / max >= 0.5f) {
199
                //满格
200
                wavePath.moveTo(centerX, centerY - VALID_RADIUS);
201
                wavePath.addCircle(centerX, centerY, VALID_RADIUS, Path.Direction.CW);
202
            } else {
203
                //空格
204
                return wavePath;
205
            }
206
        } else {
207
            //添加圆弧部分
208
            float startDegree = calDegreeByPosition(startPoint[0], startPoint[1]);  //0~180
209
            float endDegree = calDegreeByPosition(endPoint[0], endPoint[1]); //180~360
210
            wavePath.arcTo(circleRectF, endDegree - 360, startDegree - (endDegree - 360));
211
        }
212
213
        return wavePath;
214
    }
215
216
    private float calDistance(float x1, float y1, float x2, float y2) {
217
        return (float) Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
218
    }
219
220
    //根据当前位置,计算出进度条已经转过的角度。
221
    private float calDegreeByPosition(float currentX, float currentY) {
222
        float a1 = (float) (Math.atan(1.0f * (centerX - currentX) / (currentY - centerY)) / Math.PI * 180);
223
        if (currentY < centerY) {
224
            a1 += 180;
225
        } else if (currentY > centerY && currentX > centerX) {
226
            a1 += 360;
227
        }
228
229
        return a1 + 90;
230
    }
231
232
    public void setMax(int max) {
233
        this.max = max;
234
        invalidate();
235
    }
236
237
    //直接设置进度值(同步)
238
    public void setProgressSync(float progress) {
239
        this.progress = progress;
240
        invalidate();
241
    }
242
243
    /**
244
     * 自动刷新页面,创造水波效果。组件销毁后该线城将自动停止。
245
     */
246
    private void autoRefresh() {
247
        new Thread(new Runnable() {
248
            @Override
249
            public void run() {
250
                while (!detached) {
251
                    xOffset += (VALID_RADIUS >> 4);
252
                    SystemClock.sleep(100);
253
                    postInvalidate();
254
                }
255
            }
256
        }).start();
257
    }
258
259
    //标记View是否已经销毁
260
    private boolean detached = false;
261
262
    @Override
263
    protected void onDetachedFromWindow() {
264
        super.onDetachedFromWindow();
265
266
        detached = true;
267
    }
268
}

+ 0 - 37
app/src/main/res/layout/baifenbi.xml

@ -1,37 +0,0 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="wrap_content"
4
    android:layout_height="wrap_content"
5
    android:padding="10dp" >
6

7
    <TextView
8
        android:id="@+id/zhuang_name"
9
        android:layout_width="wrap_content"
10
        android:layout_height="wrap_content"
11
        android:layout_alignParentBottom="true"
12
        android:layout_centerHorizontal="true"
13
        android:text="1号"
14
        android:textColor="@color/white"
15
        android:textSize="12sp" />
16

17
    <TextView
18
        android:id="@+id/zhuang_content"
19
        android:layout_width="20dp"
20
        android:layout_height="wrap_content"
21
        android:layout_above="@id/zhuang_name"
22
        android:layout_centerHorizontal="true"
23
        android:layout_marginBottom="10dp"
24
        android:background="@drawable/radius_bkg_one" />
25

26
    <TextView
27
        android:id="@+id/zhuang_baifen"
28
        android:layout_width="wrap_content"
29
        android:layout_height="wrap_content"
30
        android:layout_above="@id/zhuang_content"
31
        android:layout_centerHorizontal="true"
32
        android:layout_marginBottom="10dp"
33
        android:text="100%"
34
        android:textColor="@color/white"
35
        android:textSize="12sp" />
36

37
</RelativeLayout>

+ 0 - 108
app/src/main/res/layout/bubble_details_view.xml

@ -1,108 +0,0 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="wrap_content"
4
    android:layout_height="wrap_content"
5
    android:background="@drawable/login_edit_normal" >
6

7
    <TextView
8
        android:id="@+id/detail_name"
9
        android:layout_width="wrap_content"
10
        android:layout_height="wrap_content"
11
        android:layout_marginLeft="10dp"
12
        android:layout_marginTop="5dp"
13
        android:ellipsize="end"
14
        android:maxLines="2"
15
        android:text="国贸充电站"
16
        android:textSize="15sp" />
17

18
    <LinearLayout
19
        android:id="@+id/linear"
20
        android:layout_width="wrap_content"
21
        android:layout_height="wrap_content"
22
        android:layout_below="@id/detail_name"
23
        android:layout_marginTop="3dp"
24
        android:orientation="horizontal" >
25

26
        <TextView
27
            android:id="@+id/detail_address"
28
            android:layout_width="0dp"
29
            android:layout_weight="1"
30
            android:layout_height="wrap_content"
31
            android:layout_gravity="center_vertical"
32
            android:layout_marginLeft="10dp"
33
            android:drawableLeft="@drawable/icon_address"
34
            android:drawablePadding="2dp"
35
            android:ellipsize="end"
36
            android:maxLines="2"
37
            android:text="大望路20号万达广场"
38
            android:textColor="#dbdbdb"
39
            android:textSize="12sp" />
40

41
        <View
42
            android:layout_width="1dp"
43
            android:layout_height="14dp"
44
            android:layout_gravity="center_vertical"
45
            android:layout_marginLeft="5dp"
46
            android:layout_marginRight="5dp"
47
            android:background="#dbdbdb" />
48

49
        <TextView
50
            android:id="@+id/detail_distance"
51
            android:layout_width="wrap_content"
52
            android:layout_height="wrap_content"
53
            android:layout_gravity="center_vertical"
54

55
            android:drawablePadding="2dp"
56
            android:text="3.5km"
57
            android:textColor="#dbdbdb"
58
            android:textSize="12sp" />
59
    </LinearLayout>
60

61
    <View
62
        android:id="@+id/view_line"
63
        android:layout_width="fill_parent"
64
        android:layout_height="1dp"
65
        android:layout_below="@id/linear"
66
        android:layout_marginTop="2dp"
67
        android:background="#dbdbdb" />
68

69
    <LinearLayout
70
        android:layout_width="fill_parent"
71
        android:layout_height="wrap_content"
72
        android:layout_below="@id/view_line"
73
        android:gravity="center_vertical"
74
        android:orientation="horizontal" >
75

76
        <TextView
77
            android:id="@+id/detail_daohang"
78
            android:layout_width="fill_parent"
79
            android:layout_height="wrap_content"
80
            android:layout_weight="1"
81
            android:gravity="center"
82
            android:paddingBottom="5dp"
83
            android:paddingLeft="30dp"
84
            android:paddingRight="30dp"
85
            android:paddingTop="5dp"
86
            android:text="导航"
87
            android:textColor="@color/bkg_button_green" />
88

89
        <View
90
            android:layout_width="1dp"
91
            android:layout_height="15dp"
92
            android:background="#dbdbdb" />
93

94
        <TextView
95
            android:id="@+id/detail_yue"
96
            android:layout_width="fill_parent"
97
            android:layout_height="wrap_content"
98
            android:layout_weight="1"
99
            android:gravity="center"
100
            android:paddingBottom="5dp"
101
            android:paddingLeft="30dp"
102
            android:paddingRight="30dp"
103
            android:paddingTop="5dp"
104
            android:text="详情"
105
            android:textColor="@color/bkg_button_green" />
106
    </LinearLayout>
107

108
</RelativeLayout>

+ 0 - 64
app/src/main/res/layout/dialog_search.xml

@ -1,64 +0,0 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="730px"
4
    android:layout_height="300px"
5
    android:layout_gravity="center"
6
    android:background="@drawable/login_edit_normal"
7
    android:orientation="vertical" >
8

9

10
    <TextView
11
        android:layout_width="wrap_content"
12
        android:layout_height="0dp"
13
        android:layout_weight="1"
14
        android:background="@color/white"
15
        android:padding="10dp"
16
        android:layout_gravity="center"
17
        android:text="请选择您要搜索的类型"
18
        android:textSize="20sp" />
19

20
    <View
21
        android:layout_width="wrap_content"
22
        android:layout_height="1dp"
23
        android:background="@color/bkg_line"/>
24

25

26
    <LinearLayout
27
        android:layout_width="fill_parent"
28
        android:layout_height="0dp"
29
        android:layout_weight="0.9"
30
        android:layout_marginTop="1dp"
31
        android:orientation="horizontal" >
32

33
        <Button
34
            android:id="@+id/dialog_search_zhan"
35
            android:layout_width="wrap_content"
36
            android:layout_height="wrap_content"
37
            android:layout_weight="1"
38
            android:background="@drawable/bkg_press_white_grey"
39
             android:textColor="@color/bkg_button_green"
40
            android:text="搜站名"
41
            android:gravity="center"
42
            android:textSize="15sp"
43
            />
44

45
        <!-- 搜地址按钮 -->
46
        <View
47
            android:layout_width="1dp"
48
            android:layout_height="wrap_content"
49
            android:background="@color/bkg_line"/>
50

51
        <Button
52
            android:id="@+id/dialog_search_address"
53
            android:layout_width="wrap_content"
54
            android:layout_height="wrap_content"
55
            android:layout_weight="1"
56
            android:gravity="center"
57
            android:background="@drawable/bkg_press_white_grey"
58
            android:textColor="@color/bkg_button_green"
59
            android:text="搜地址"
60
            android:textSize="15sp" />
61

62
    </LinearLayout>
63

64
</LinearLayout>

+ 0 - 50
app/src/main/res/layout/view_actionsheet.xml

@ -1,50 +0,0 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    android:layout_height="wrap_content"
5
    android:orientation="vertical"
6
    android:padding="8dp" >
7

8
    <TextView
9
        android:id="@+id/txt_title"
10
        android:layout_width="match_parent"
11
        android:layout_height="wrap_content"
12
        android:background="@drawable/actionsheet_top_normal"
13
        android:gravity="center"
14
        android:minHeight="45dp"
15
        android:paddingTop="10dp"
16
        android:paddingBottom="10dp"
17
        android:paddingLeft="15dp"
18
        android:paddingRight="15dp"
19
        android:textColor="@color/actionsheet_gray"
20
        android:textSize="13sp"
21
        android:visibility="gone" />
22

23
    <ScrollView
24
        android:id="@+id/sLayout_content"
25
        android:layout_width="match_parent"
26
        android:layout_height="wrap_content"
27
        android:fadingEdge="none"
28
         >
29

30
        <LinearLayout
31
            android:id="@+id/lLayout_content"
32
            android:layout_width="match_parent"
33
            android:layout_height="wrap_content"
34
            android:orientation="vertical" >
35
        </LinearLayout>
36
    </ScrollView>
37

38
    <TextView
39
        android:id="@+id/txt_cancel"
40
        android:layout_width="match_parent"
41
        android:layout_height="45dp"
42
        android:layout_marginTop="8dp"
43
        android:background="@drawable/actionsheet_single_selector"
44
        android:gravity="center"
45
        android:text="取消"
46
        android:textColor="@color/actionsheet_green"
47
        android:textSize="18sp"
48
        android:textStyle="bold" />
49

50
</LinearLayout>

+ 0 - 40
app/src/main/res/layout/view_time_pager.xml

@ -1,40 +0,0 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    android:layout_height="match_parent"
5
    android:orientation="vertical" >
6

7
    <RadioGroup
8
        android:id="@+id/rg_time"
9
        android:layout_width="fill_parent"
10
        android:layout_height="wrap_content"
11
        android:orientation="horizontal" >
12

13
        <RadioButton
14
            android:id="@+id/rb_time_one"
15
            style="@style/appointent_time_item_style"
16
            android:layout_weight="1.0"
17
            android:checked="true"
18
            android:text="09:00-15:00" />
19

20
        <RadioButton
21
            android:id="@+id/rb_time_two"
22
            style="@style/appointent_time_item_style"
23
            android:layout_weight="1.0"
24
            android:text="15:30-23:00" />
25
    </RadioGroup>
26

27
    <GridView
28
        android:id="@+id/gv_time"
29
        android:layout_width="fill_parent"
30
        android:layout_height="wrap_content"
31
        android:layout_below="@id/rg_time"
32
        android:background="@color/transparent"
33
        android:gravity="center"
34
        android:horizontalSpacing="5dp"
35
        android:numColumns="4"
36
        android:padding="10dp"
37
        android:stretchMode="columnWidth"
38
        android:verticalSpacing="5dp" />
39

40
</RelativeLayout>

+ 0 - 6
app/src/main/res/layout/yuanjiao.xml

@ -1,6 +0,0 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:orientation="vertical" android:layout_width="match_parent"
4
    android:layout_height="match_parent">
5
6
</LinearLayout>

+ 0 - 19
app/src/main/res/layout/zoom_controls_layout.xml

@ -1,19 +0,0 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_alignWithParentIfMissing="true"
4
    android:layout_width="wrap_content"
5
    android:layout_height="wrap_content" >
6

7
    <Button
8
        android:id="@+id/zoomin"
9
        android:layout_width="wrap_content"
10
        android:layout_height="wrap_content"
11
        android:background="@drawable/zoomin_seletor" />
12

13
    <Button
14
        android:id="@+id/zoomout"
15
        android:layout_width="wrap_content"
16
        android:layout_height="wrap_content"
17
        android:layout_below="@+id/zoomin"
18
        android:background="@drawable/zoomout_seletor" />
19
</RelativeLayout>

+ 0 - 6
app/src/main/res/values/attr.xml

@ -62,12 +62,6 @@
62 62
        <attr name="border_color" format="color" />
63 63
    </declare-styleable>
64 64

65

66
    <declare-styleable name="CustomImageView">
67
        <attr name="borderRadius" />
68
        <attr name="type" />
69
        <attr name="src" />
70
    </declare-styleable>
71 65
    <declare-styleable name="RoundAngleImageView">
72 66
        <attr name="roundWidth" format="dimension" />
73 67
        <attr name="roundHeight" format="dimension" />

+ 1 - 2
settings.gradle

@ -1,3 +1,2 @@
1
include ':app', ':autolayout', ':xrichtextt', ':zxing', ':XRefreshView'
2
include ':library'
1
include ':app', ':autolayout', ':xrichtextt', ':zxing', ':XRefreshView',':ijkplayer-java',':library'
3 2
project(':xrichtextt').projectDir = new File('xrichtext')