1157
                //当分享按钮被点击时,会调用此处代码。在这里处理分享的业务逻辑。
1158
                ChargingShareBean chargingShareBean = new ChargingShareBean();
1159
                chargingShareBean.setIcon(shareThumbnail);
1160
                chargingShareBean.setTitle(shareTitle);
1161
                chargingShareBean.setUrl(shareUrl);
1162
                chargingShareBean.setText("");
1163
                showSimpleBottomSheetGrid(chargingShareBean);
1164
            }
1165
1166
            /**
1167
             * 当点击“请先登录”按钮唤起登录时,会调用此处代码。
1168
             * 用户登录后,需要将CreditsActivity.IS_WAKEUP_LOGIN变量设置为true。
1169
             * @param webView 用于登录成功后返回到当前的webview刷新登录状态。
1170
             * @param currentUrl 当前页面的url
1171
             */
1172
            public void onLoginClick(WebView webView, final String currentUrl) {
1173
                //当未登录的用户点击去登录时,会调用此处代码。
1174
                //用户登录后,需要将CreditsActivity.IS_WAKEUP_LOGIN变量设置为true。
1175
                //为了用户登录后能回到未登录前的页面(currentUrl)。
1176
                //当用户登录成功后,需要重新请求一次服务端,带上currentUrl。
1177
                //用该方法中的webview变量加载请求链接。
1178
                //服务端收到请求后在生成免登录url时,将currentUrl放入redirect参数,通知客户端302跳转到新生成的免登录URL。
1179
                new AlertDialog.Builder(webView.getContext()).setTitle("跳转登录").setMessage("跳转到登录页面?")
1180
                        .setPositiveButton("是", new DialogInterface.OnClickListener() {
1181
                            @Override
1182
                            public void onClick(DialogInterface dialog, int which) {
1183
                                MainApplication.current_url = currentUrl;
1184
                                startActivity(new Intent(getContext(), LoginActivity.class));
1185
                            }
1186
                        })
1187
                        .setNegativeButton("否", null)
1188
                        .show();
1189
            }
1190
1191
            /**
1192
             * 当点击“复制”按钮时,触发该方法,回调获取到券码code
1193
             * @param webView webview对象。
1194
             * @param code 复制的券码
1195
             */
1196
            public void onCopyCode(WebView webView, String code) {
1197
                //当未登录的用户点击去登录时,会调用此处代码。
1198
                new AlertDialog.Builder(webView.getContext())
1199
                        .setTitle("复制券码")
1200
                        .setMessage("已复制,券码为:" + code)
1201
                        .setPositiveButton("是", null)
1202
                        .setNegativeButton("否", null)
1203
                        .show();
1204
            }
1205
1206
            /**
1207
             * 积分商城返回首页刷新积分时,触发该方法。
1208
             */
1209
            public void onLocalRefresh(WebView mWebView, String credits) {
1210
                //String credits为积分商城返回的最新积分,不保证准确。
1211
                //触发更新本地积分,这里建议用ajax向自己服务器请求积分值,比较准确。
1212
            }
1213
        };
1214
    }
1215
1216
    private void skipShopDetail(String url) {
1217
        long appTime11 = System.currentTimeMillis() / 1000;
1218
        long updatetime1 = appTime11 - MainMapActivity.cha - 5;
1219
        String token1 = String.valueOf(updatetime1);
1220
        String encode_token = null;
1221
        try {
1222
            encode_token = DES3.encode(token1);
1223
        } catch (Exception e) {
1224
            e.printStackTrace();
1225
        }
1226
        String replace = URLEncoder.encode(encode_token);
1227
//                    startActivity(new Intent(getContext(), ShopActivity.class));
1228
        Intent intent11 = new Intent();
1229
        intent11.setClass(getContext(), CreditActivity.class);
1230
        intent11.putExtra("navColor", "#fcfcfc");    //配置导航条的背景颜色,请用#ffffff长格式。
1231
        intent11.putExtra("titleColor", "#222222");    //配置导航条标题的颜色,请用#ffffff长格式。
1232
        MainApplication.goods_type = "details";
1233
//            MainApplication.current_url = getIntent().getStringExtra("shareUrl");
1234
//                MainApplication.current_url = "http://www.duiba.com.cn/mobile/appItemDetail?appItemId=453087";
1235
        if (!MainApplication.isLogin()) {
1236
            intent11.putExtra("url", "http://cdz.evcharge.cc/zhannew/basic/web/index.php/duiba/active?token=" + replace + "&url=" + url);    //配置自动登陆地址,每次需服务端动态生成。
1237
        } else {
1238
            intent11.putExtra("url", "http://cdz.evcharge.cc/zhannew/basic/web/index.php/duiba/active?user_id=" + MainApplication.userId + "&token=" + replace + "&url=" + url);    //配置自动登陆地址,每次需服务端动态生成。
1239
        }
1240
        startActivity(intent11);
1241
        if (getActivity()!=null){
1242
            getActivity().overridePendingTransition(0, 0);
1243
        }
1244
1245
        CreditActivity.creditsListener = new CreditActivity.CreditsListener() {
1246
            /**
1247
             * 当点击分享按钮被点击
1248
             * @param shareUrl 分享的地址
1249
             * @param shareThumbnail 分享的缩略图
1250
             * @param shareTitle 分享的标题
1251
             * @param shareSubtitle 分享的副标题
1252
             */
1253
            public void onShareClick(WebView webView, String shareUrl, String shareThumbnail, String shareTitle, String shareSubtitle) {
1254
                //当分享按钮被点击时,会调用此处代码。在这里处理分享的业务逻辑。
1255
                ChargingShareBean chargingShareBean = new ChargingShareBean();
1256
                chargingShareBean.setIcon(shareThumbnail);
1257
                chargingShareBean.setTitle(shareTitle);
1258
                chargingShareBean.setUrl(shareUrl);
1259
                chargingShareBean.setText("");
1260
1261
1262
                showSimpleBottomSheetGrid(chargingShareBean);
1263
            }
1264
1265
            /**
1266
             * 当点击“请先登录”按钮唤起登录时,会调用此处代码。
1267
             * 用户登录后,需要将CreditsActivity.IS_WAKEUP_LOGIN变量设置为true。
1268
             * @param webView 用于登录成功后返回到当前的webview刷新登录状态。
1269
             * @param currentUrl 当前页面的url
1270
             */
1271
            public void onLoginClick(WebView webView, final String currentUrl) {
1272
                //当未登录的用户点击去登录时,会调用此处代码。
1273
                //用户登录后,需要将CreditsActivity.IS_WAKEUP_LOGIN变量设置为true。
1274
                //为了用户登录后能回到未登录前的页面(currentUrl)。
1275
                //当用户登录成功后,需要重新请求一次服务端,带上currentUrl。
1276
                //用该方法中的webview变量加载请求链接。
1277
                //服务端收到请求后在生成免登录url时,将currentUrl放入redirect参数,通知客户端302跳转到新生成的免登录URL。
1278
                new AlertDialog.Builder(webView.getContext())
1279
                        .setTitle("跳转登录")
1280
                        .setMessage("跳转到登录页面?")
1281
                        .setPositiveButton("是", new DialogInterface.OnClickListener() {
1282
                            @Override
1283
                            public void onClick(DialogInterface dialog, int which) {
1284
                                MainApplication.h5_url = currentUrl;
1285
                                startActivity(new Intent(getContext(), LoginActivity.class));
1286
1287
                            }
1288
                        })
1289
                        .setNegativeButton("否", null)
1290
                        .show();
1291
            }
1292
1293
            /**
1294
             * 当点击“复制”按钮时,触发该方法,回调获取到券码code
1295
             * @param webView webview对象。
1296
             * @param code 复制的券码
1297
             */
1298
            public void onCopyCode(WebView webView, String code) {
1299
                //当未登录的用户点击去登录时,会调用此处代码。
1300
                new AlertDialog.Builder(webView.getContext())
1301
                        .setTitle("复制券码")
1302
                        .setMessage("已复制,券码为:" + code)
1303
                        .setPositiveButton("是", null)
1304
                        .setNegativeButton("否", null)
1305
                        .show();
1306
            }
1307
1308
            /**
1309
             * 积分商城返回首页刷新积分时,触发该方法。
1310
             */
1311
            public void onLocalRefresh(WebView mWebView, String credits) {
1312
                //String credits为积分商城返回的最新积分,不保证准确。
1313
                //触发更新本地积分,这里建议用ajax向自己服务器请求积分值,比较准确。
1314
            }
1315
        };
1316
    }
1317
1318
    public boolean onKeyDown(int keyCode, KeyEvent event, OnKeyDownListener keyDownListener) {
1319
        WebBackForwardList mWebBackForwardList = webView.copyBackForwardList();
1320
        Log.e("tag", "mWebBackForwardList.getSize() " + mWebBackForwardList.getSize());
1321
        if (webView.canGoBack()) {
1322
            webView.goBack();
1323
            iv_webBack.setVisibility(View.VISIBLE);
1324
            return true;
1325
        } else {
1326
            if (keyDownListener!=null){
1327
               return keyDownListener.onKeyDown(keyCode,event);
1328
            }else{
1329
                return false;
1330
            }
1331
        }
1332
    }
1333
1334
    @Override
1335
    public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
1336
        mHandler.post(new Runnable() {
1337
            @Override
1338
            public void run() {
1339
                ToastUtil.showToast(getContext(), "分享成功", Toast.LENGTH_SHORT);
1340
            }
1341
        });
1342
        ToastUtil.showToast(getContext(), "分享成功", Toast.LENGTH_SHORT);
1343
        getShareIntegral();
1344
    }
1345
1346
    @Override
1347
    public void onError(Platform platform, int i, Throwable throwable) {
1348
        mHandler.post(new Runnable() {
1349
            @Override
1350
            public void run() {
1351
                ToastUtil.showToast(getContext(), "分享失败", Toast.LENGTH_SHORT);
1352
            }
1353
        });
1354
1355
    }
1356
1357
    @Override
1358
    public void onCancel(Platform platform, int i) {
1359
        mHandler.post(new Runnable() {
1360
            @Override
1361
            public void run() {
1362
                ToastUtil.showToast(getContext(), "分享已取消", Toast.LENGTH_SHORT);
1363
            }
1364
1365
        });
1366
    }
1367
1368
1369
    @Override
1370
    public void onClick(View v) {
1371
        switch (v.getId()) {
1372
            case R.id.tv_webview_share:
1373
                if (tv_webShare.getText().toString().equals("分享")) {
1374
                    if (null != shareIcon && null != shareUrl && null != shareTitle && null != shareContext) {
1375
                        btnToShare();
1376
                    }
1377
                } else if (tv_webShare.getText().toString().equals("我的反馈")) {
1378
                    if (MainApplication.isLogin()) {
1379
                        Intent i = new Intent(getContext(), MyFeedbackActivity.class);
1380
                        startActivity(i);
1381
                    } else {
1382
                        startActivity(new Intent(getContext(), LoginActivity.class));
1383
                        ToastUtil.showToast(getContext(), "请先登录", Toast.LENGTH_SHORT);
1384
                        index = "100";
1385
                    }
1386
1387
                } else {
1388
                    mHandler.post(new Runnable() {
1389
                        @TargetApi(Build.VERSION_CODES.KITKAT)
1390
                        @Override
1391
                        public void run() {
1392
                            webView.evaluateJavascript("window.myglobal.resetrctext()", new ValueCallback<String>() {
1393
                                @Override
1394
                                public void onReceiveValue(String arg0) {
1395
1396
                                }
1397
                            });
1398
                        }
1399
                    });
1400
                }
1401
                break;
1402
            case R.id.iv_webview_back:
1403
                WebBackForwardList mWebBackForwardList = webView.copyBackForwardList();
1404
                Log.e("tag", "mWebBackForwardList.getSize() " + mWebBackForwardList.getSize());
1405
                if (webView.canGoBack()) {
1406
                    showsharebtn("no");
1407
                    webView.goBack();
1408
                    iv_webClose.setVisibility(View.VISIBLE);
1409
                } else {
1410
                    if (getActivity() == null){
1411
                        return;
1412
                    }
1413
                    getActivity().finish();
1414
                }
1415
                break;
1416
            case R.id.iv_webview_close:
1417
                if (getActivity() == null){
1418
                    return;
1419
                }
1420
                getActivity().finish();
1421
                break;
1422
        }
1423
    }
1424
1425
    @Override
1426
    public void onRequestPermissionsResult(int requestCode,
1427
                                           @NonNull String[] permissions,
1428
                                           @NonNull int[] grantResults) {
1429
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
1430
1431
        // EasyPermissions handles the request result.
1432
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
1433
    }
1434
1435
    @Override
1436
    public void onPermissionsGranted(int requestCode, List<String> perms) {
1437
1438
    }
1439
1440
    @Override
1441
    public void onPermissionsDenied(int requestCode, List<String> perms) {
1442
        if (requestCode == RC_ALBUM_PERM) {
1443
            mOpenFileWebChromeClient.mFilePathCallback = null;
1444
            mOpenFileWebChromeClient.mFilePathCallbacks = null;
1445
        }
1446
    }
1447
1448
    private boolean hasCallPhonePermission() {
1449
        if (getContext()==null) return false;
1450
        return EasyPermissions.hasPermissions(getContext(), Manifest.permission.CALL_PHONE);
1451
    }
1452
1453
    public class OpenFileWebChromeClient extends WebChromeClient {
1454
        public static final int REQUEST_FILE_PICKER = 1;
1455
        public ValueCallback<Uri> mFilePathCallback;
1456
        public ValueCallback<Uri[]> mFilePathCallbacks;
1457
1458
1459
        public OpenFileWebChromeClient() {
1460
            super();
1461
        }
1462
1463
        @Override
1464
        public void onReceivedTitle(WebView view, String title) {
1465
            super.onReceivedTitle(view, title);
1466
            Log.d("ANDROID_LAB", "TITLE=" + title);
1467
            tv_webTitle.setText(title);
1468
        }
1469
1470
        @Override
1471
        public void onProgressChanged(WebView view, int newProgress) {
1472
            super.onProgressChanged(view, newProgress);
1473
            pb_webBar.setProgress(newProgress);
1474
        }
1475
1476
        @Override
1477
        public void onGeolocationPermissionsShowPrompt(String origin,
1478
                                                       GeolocationPermissions.Callback callback) {
1479
            callback.invoke(origin, true, false);
1480
            super.onGeolocationPermissionsShowPrompt(origin, callback);
1481
        }
1482
1483
        // Android < 3.0 调用这个方法
1484
        public void openFileChooser(ValueCallback<Uri> filePathCallback) {
1485
            mFilePathCallback = filePathCallback;
1486
            permissionTask();
1487
        }
1488
1489
        // 3.0 + 调用这个方法
1490
        public void openFileChooser(ValueCallback filePathCallback, String acceptType) {
1491
            mFilePathCallback = filePathCallback;
1492
            permissionTask();
1493
        }
1494
1495
        // / js上传文件的<input type="file" name="fileField" id="fileField" />事件捕获
1496
        // Android > 4.1.1 调用这个方法
1497
        public void openFileChooser(ValueCallback<Uri> filePathCallback, String acceptType, String capture) {
1498
            mFilePathCallback = filePathCallback;
1499
            permissionTask();
1500
        }
1501
1502
        @Override
1503
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
1504
            mFilePathCallbacks = filePathCallback;
1505
            permissionTask();
1506
            return true;
1507
        }
1508
    }
1509
1510
    @AfterPermissionGranted(RC_ALBUM_PERM)
1511
    public void permissionTask() {
1512
        if (isPermissionOK()) {
1513
            openImageChooserActivity();
1514
        } else {
1515
            EasyPermissions.requestPermissions(
1516
                    this, "充电桩想要获取您的图片读取权限,是否允许?",
1517
                    RC_ALBUM_PERM,
1518
                    Manifest.permission.CAMERA,
1519
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
1520
                    Manifest.permission.READ_EXTERNAL_STORAGE);
1521
        }
1522
    }
1523
1524
    private boolean isPermissionOK() {
1525
        if (getContext()==null){
1526
            return false;
1527
        }
1528
1529
        return EasyPermissions.hasPermissions(getContext(),
1530
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
1531
                Manifest.permission.READ_EXTERNAL_STORAGE,
1532
                Manifest.permission.CAMERA
1533
        );
1534
    }
1535
1536
    private void openImageChooserActivity() {
1537
        if (getContext()==null){
1538
            return;
1539
        }
1540
        new MaterialDialog.Builder(getContext()).items(R.array.photo).positiveText("取消")
1541
                .onPositive(new MaterialDialog.SingleButtonCallback() {
1542
                    @Override
1543
                    public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
1544
                        if (mOpenFileWebChromeClient.mFilePathCallbacks != null) {
1545
                            mOpenFileWebChromeClient.mFilePathCallbacks.onReceiveValue(null);
1546
                            mOpenFileWebChromeClient.mFilePathCallbacks = null;
1547
                        }
1548
1549
                        if (mOpenFileWebChromeClient.mFilePathCallback != null) {
1550
                            mOpenFileWebChromeClient.mFilePathCallback.onReceiveValue(null);
1551
                            mOpenFileWebChromeClient.mFilePathCallback = null;
1552
                        }
1553
                        dialog.dismiss();
1554
                    }
1555
                }).cancelable(false)
1556
                .canceledOnTouchOutside(false).itemsCallback(new MaterialDialog.ListCallback() {
1557
            @Override
1558
            public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
1559
                if (position == 0) {
1560
                    takeCamera();
1561
                } else if (position == 1) {
1562
                    takePhoto();
1563
                }
1564
            }
1565
        }).show();
1566
    }
1567
1568
    // 选择图片
1569
    private void takePhoto() {
1570
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
1571
        intent.addCategory(Intent.CATEGORY_OPENABLE);
1572
        intent.setType("image/*");
1573
        startActivityForResult(Intent.createChooser(intent, "Image Choose"), FILE_CHOOSER_RESULT_CODE);
1574
    }
1575
1576
    // 拍照
1577
    private void takeCamera() {
1578
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
1579
        if (ImageUitl.hasSdcard()) {
1580
            String fileName = "android" + System.currentTimeMillis() / 1000 + ".jpg";
1581
            cameraFilePath = ImageUitl.getPath(PhotoUtils.CACHE_DIR) + "/" + fileName;
1582
            File imageFile = ImageUitl.getFile(cameraFilePath);
1583
            Uri uri =PhotoUtils.parseUri(imageFile);
1584
            intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
1585
            try {
1586
                startActivityForResult(intent, FILE_CAMERA_RESULT_CODE);
1587
            } catch (Exception e) {
1588
                e.printStackTrace();
1589
            }
1590
1591
        }
1592
    }
1593
1594
    public class MyWebViewClient extends WebViewClient {
1595
        @Override
1596
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
1597
            super.onPageStarted(view, url, favicon);
1598
            Log.e(TAG, "onPageStarted: " + url);
1599
            pb_webBar.setVisibility(View.VISIBLE);
1600
        }
1601
1602
        @Override
1603
        public void onPageFinished(WebView view, String url) {
1604
            super.onPageFinished(view, url);
1605
            Log.e(TAG, "onPageFinished: " + url);
1606
            currentUrl = url;
1607
            pb_webBar.setVisibility(View.GONE);
1608
1609
        }
1610
1611
        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
1612
            //handler.cancel(); // Android默认的处理方式
1613
            handler.proceed();  // 接受所有网站的证书
1614
            //handleMessage(Message msg); // 进行其他处理
1615
        }
1616
1617
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
1618
            Log.e(TAG, "onPage1 :" + url);
1619
            //  重写此方法表明点击网页里面的链接还是在当前的webview里跳转,不跳到浏览器那边
1620
//                view.loadUrl(url);
1621
            if (url.startsWith("http://cdz.evcharge.cc/zhannew/basic/web/index.php/drive/wxpay?")) {
1622
                try {
1623
                    Intent intent = new Intent();
1624
                    intent.setAction(Intent.ACTION_VIEW);
1625
                    intent.setData(Uri.parse(url));
1626
                    startActivity(intent);
1627
                } catch (ActivityNotFoundException e) {
1628
                }
1629
            } else if (url.startsWith("tel:")) {
1630
                Intent intent = new Intent(Intent.ACTION_VIEW,
1631
                        Uri.parse(url));
1632
                startActivity(intent);
1633
                return true;
1634
            }else if (url.contains("app://com.d1ev.app.ev01")){
1635
                try {
1636
                    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
1637
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
1638
                    startActivity(intent);
1639
                    mIsDownload = false;
1640
                } catch (Exception e) {
1641
                    //通过直接处理抛出的ActivityNotFound异常来确保程序不会崩溃
1642
                    e.printStackTrace();
1643
                }
1644
                return true;
1645
1646
            }else {
1647
                Log.e(TAG, "shouldOverrideUrlLoading: 1");
1648
                view.loadUrl(url);
1649
            }
1650
            return false;
1651
        }
1652
    }
1653
1654
    @Override
1655
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
1656
        super.onActivityResult(requestCode, resultCode, data);
1657
        if (null == mOpenFileWebChromeClient.mFilePathCallback && null == mOpenFileWebChromeClient.mFilePathCallbacks)
1658
            return;
1659
        if (resultCode != RESULT_OK) {
1660
            if (mOpenFileWebChromeClient.mFilePathCallbacks != null) {
1661
                mOpenFileWebChromeClient.mFilePathCallbacks.onReceiveValue(null);
1662
                mOpenFileWebChromeClient.mFilePathCallbacks = null;
1663
            }
1664
1665
            if (mOpenFileWebChromeClient.mFilePathCallback != null) {
1666
                mOpenFileWebChromeClient.mFilePathCallback.onReceiveValue(null);
1667
                mOpenFileWebChromeClient.mFilePathCallback = null;
1668
            }
1669
            return;
1670
        }
1671
1672
        Uri result = null;
1673
        if (requestCode == FILE_CAMERA_RESULT_CODE) {
1674
            if (null != data && null != data.getData()) {
1675
                result = data.getData();
1676
            }
1677
            if (result == null && ImageUitl.hasFile(cameraFilePath)) {
1678
                result = PhotoUtils.parseUri(new File(cameraFilePath));
1679
            }
1680
1681
            if (mOpenFileWebChromeClient.mFilePathCallbacks != null) {
1682
                mOpenFileWebChromeClient.mFilePathCallbacks.onReceiveValue(new Uri[]{result});
1683
                mOpenFileWebChromeClient.mFilePathCallbacks = null;
1684
            } else if (mOpenFileWebChromeClient.mFilePathCallback != null) {
1685
                mOpenFileWebChromeClient.mFilePathCallback.onReceiveValue(result);
1686
                mOpenFileWebChromeClient.mFilePathCallback = null;
1687
            }
1688
        } else if (requestCode == FILE_CHOOSER_RESULT_CODE) {
1689
            if (data != null) {
1690
                result = data.getData();
1691
            }
1692
            if (mOpenFileWebChromeClient.mFilePathCallbacks != null) {
1693
                onActivityResultCallbacks(data);
1694
            } else if (mOpenFileWebChromeClient.mFilePathCallback != null) {
1695
                mOpenFileWebChromeClient.mFilePathCallback.onReceiveValue(result);
1696
                mOpenFileWebChromeClient.mFilePathCallback = null;
1697
            }
1698
        }
1699
    }
1700
1701
    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
1702
    private void onActivityResultCallbacks(Intent intent) {
1703
        Uri[] results = null;
1704
        if (intent != null) {
1705
            String dataString = intent.getDataString();
1706
            ClipData clipData = intent.getClipData();
1707
            if (clipData != null) {
1708
                results = new Uri[clipData.getItemCount()];
1709
                for (int i = 0; i < clipData.getItemCount(); i++) {
1710
                    ClipData.Item item = clipData.getItemAt(i);
1711
                    results[i] = item.getUri();
1712
                }
1713
            }
1714
            if (dataString != null) {
1715
                results = new Uri[]{Uri.parse(dataString)};
1716
            }
1717
            mOpenFileWebChromeClient.mFilePathCallbacks.onReceiveValue(results);
1718
            mOpenFileWebChromeClient.mFilePathCallbacks = null;
1719
        }
1720
    }
1721
1722
    private void getShareIntegral() {
1723
        String url = MainApplication.url + "/zhannew/basic/web/index.php/member/insert-task?userid=" + MainApplication.userId;
1724
        OkHttpUtils.get().url(url).build().execute(new StringCallback() {
1725
            @Override
1726
            public void onError(Call call, Exception e) {
1727
1728
            }
1729
1730
            @Override
1731
            public void onResponse(String response) {
1732
                Log.e(TAG, "onResponse: getShareIntegral=" + response);
1733
                String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
1734
                if ("01".equals(rtnCode)) {
1735
                    String plusScore = JsonUtils.getKeyResult(response, "plusScore");
1736
                    if (!plusScore.equals("")) {
1737
                        tv_point.setText(plusScore);
1738
                        rl_point.setVisibility(View.VISIBLE);
1739
                        rl_point.startAnimation(animation);
1740
                        new Handler().postDelayed(new Runnable() {
1741
                            public void run() {
1742
                                rl_point.setVisibility(View.GONE);
1743
                            }
1744
                        }, 1500);
1745
                    }
1746
1747
                } else {
1748
                    ToastUtil.showToast(getContext(), "分享成功", Toast.LENGTH_SHORT);
1749
                }
1750
            }
1751
        });
1752
    }
1753
1754
1755
    @Override
1756
    public void onDestroy() {
1757
        super.onDestroy();
1758
        list.clear();
1759
        mHandler.removeCallbacksAndMessages(null);
1760
    }
1761
1762
    /**
1763
     * 获取车主认证信息
1764
     */
1765
    private void getCarOwnerCertificateList() {
1766
        long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
1767
        String token = null;
1768
        try {
1769
            token = DES3.encode(String.valueOf(tokenTime));
1770
            token = URLEncoder.encode(token, "UTF-8");
1771
        } catch (Exception e) {
1772
            e.printStackTrace();
1773
        }
1774
1775
        String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&order=1" + "&token=" + token;
1776
        OkHttpUtils.get().url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
1777
            @Override
1778
            public void onError(Call call, Exception e) {
1779
                e.printStackTrace();
1780
                mHandler.post(new Runnable() {
1781
                    @TargetApi(Build.VERSION_CODES.KITKAT)
1782
                    @Override
1783
                    public void run() {
1784
                        loadDialog.dismiss();
1785
                    }
1786
                });
1787
1788
                Toast.makeText(getContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
1789
            }
1790
1791
            @Override
1792
            public void onResponse(String response) {
1793
                mHandler.post(new Runnable() {
1794
                    @TargetApi(Build.VERSION_CODES.KITKAT)
1795
                    @Override
1796
                    public void run() {
1797
                        loadDialog.dismiss();
1798
                    }
1799
                });
1800
                String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
1801
                if ("01".equals(rtnCode)) {
1802
                    String data = JsonUtils.getKeyResult(response, "data");
1803
                    List<CarOwnerCertificateBean> list =new ArrayList<>();
1804
                    try{
1805
                        list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
1806
                    }catch (JSONException e){
1807
1808
                    }
1809
                    if (list.size() == 0) {
1810
                        startActivity(new Intent(getContext(), CarOwnerCertificateActivity.class));
1811
                    } else {
1812
                        Intent intent = new Intent(getContext(), CarOwnerCertificateListActivity.class);
1813
                        intent.putExtra("data", data);
1814
                        startActivity(intent);
1815
                    }
1816
                } else {
1817
                    String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
1818
                    Toast.makeText(getContext(), rtnMsg, Toast.LENGTH_SHORT).show();
1819
                }
1820
            }
1821
        });
1822
    }
1823
    public interface OnKeyDownListener {
1824
        boolean onKeyDown(int keyCode, KeyEvent event);
1825
    }
1826
}

+ 11 - 0
app/src/main/res/layout/activity_chat.xml

8
    tools:context=".activity.ChatActivity">
8
    tools:context=".activity.ChatActivity">
9
9
10
    <RelativeLayout
10
    <RelativeLayout
11
        android:visibility="gone"
11
        android:id="@+id/act_bar"
12
        android:id="@+id/act_bar"
12
        android:layout_width="match_parent"
13
        android:layout_width="match_parent"
13
        android:layout_height="44dp"
14
        android:layout_height="44dp"
82
    </RelativeLayout>
83
    </RelativeLayout>
83
84
84
    <androidx.viewpager.widget.ViewPager
85
    <androidx.viewpager.widget.ViewPager
86
        android:visibility="gone"
87
85
        android:id="@+id/chat_view_pager"
88
        android:id="@+id/chat_view_pager"
86
        android:layout_width="match_parent"
89
        android:layout_width="match_parent"
87
        android:layout_height="match_parent"
90
        android:layout_height="match_parent"
88
        android:layout_above="@+id/ll_tab"
91
        android:layout_above="@+id/ll_tab"
89
        android:layout_below="@+id/act_bar"
92
        android:layout_below="@+id/act_bar"
90
        android:background="@color/ui_f4" />
93
        android:background="@color/ui_f4" />
94
95
    <FrameLayout
96
        android:id="@+id/frameLayout"
97
        android:layout_above="@+id/ll_tab"
98
        android:background="@color/ui_f4"
99
        android:layout_width="match_parent"
100
        android:layout_height="match_parent"/>
101
91
    <ImageView
102
    <ImageView
92
        android:layout_alignParentBottom="true"
103
        android:layout_alignParentBottom="true"
93
        android:background="@drawable/bg_tab"
104
        android:background="@drawable/bg_tab"

+ 0 - 45
app/src/main/res/layout/activity_user_center.xml

673
                            android:src="@drawable/icon_more2_0" />
673
                            android:src="@drawable/icon_more2_0" />
674
                    </RelativeLayout>
674
                    </RelativeLayout>
675
675
676
677
                    <RelativeLayout
678
                        android:id="@+id/rl_myaq"
679
                        android:layout_width="fill_parent"
680
                        android:layout_height="44dp"
681
                        >
682
683
                        <TextView
684
                            android:layout_width="wrap_content"
685
                            android:layout_height="match_parent"
686
                            android:layout_marginLeft="15dp"
687
                            android:drawableLeft="@drawable/icon_aq"
688
                            android:drawablePadding="15dp"
689
                            android:gravity="center_vertical"
690
                            android:text="我的问答"
691
                            android:textColor="@color/ui_62"
692
                            android:textSize="15sp" />
693
694
                        <TextView
695
                            android:id="@+id/tv_qaNum"
696
                            android:layout_width="wrap_content"
697
                            android:layout_height="wrap_content"
698
                            android:background="@drawable/bg_smallred"
699
                            android:layout_toLeftOf="@+id/i"
700
                            android:layout_marginRight="15dp"
701
                            android:text=""
702
                            android:layout_centerVertical="true"
703
                            android:gravity="center"
704
                            android:textSize="10sp"
705
                            android:textColor="@color/white"
706
                            android:visibility="gone" />
707
708
709
                        <ImageView
710
                            android:id="@+id/i"
711
                            android:layout_width="wrap_content"
712
                            android:layout_height="match_parent"
713
                            android:layout_alignParentEnd="true"
714
                            android:layout_alignParentRight="true"
715
                            android:layout_centerVertical="true"
716
                            android:paddingRight="15dp"
717
                            android:src="@drawable/icon_more2_0" />
718
                    </RelativeLayout>
719
720
721
                    <RelativeLayout
676
                    <RelativeLayout
722
                        android:id="@+id/rl_sirenzhuang"
677
                        android:id="@+id/rl_sirenzhuang"
723
                        android:layout_width="fill_parent"
678
                        android:layout_width="fill_parent"

+ 152 - 0
app/src/main/res/layout/fragment_web.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:app="http://schemas.android.com/apk/res-auto"
4
    xmlns:tools="http://schemas.android.com/tools"
5
    android:layout_width="match_parent"
6
    android:layout_height="match_parent"
7
    android:orientation="vertical"
8
    tools:context="com.electric.chargingpile.activity.MyWebViewActivity">
9
10
    <RelativeLayout
11
        android:id="@+id/rl_title"
12
        android:layout_width="fill_parent"
13
        android:layout_height="44dp"
14
        android:background="@color/white"
15
        android:layout_alignParentTop="true">
16
17
        <TextView
18
            android:id="@+id/tv_webview_title"
19
            android:layout_width="wrap_content"
20
            android:layout_height="wrap_content"
21
            android:layout_centerInParent="true"
22
            android:text=""
23
            android:singleLine="true"
24
            android:maxEms="8"
25
            android:ellipsize="end"
26
            android:textColor="@color/ui_62"
27
            android:textSize="18sp"/>
28
29
        <TextView
30
            android:id="@+id/tv_webview_share"
31
            android:layout_width="wrap_content"
32
            android:layout_height="match_parent"
33
            android:layout_alignParentEnd="true"
34
            android:layout_alignParentRight="true"
35
            android:layout_alignParentTop="true"
36
            android:contentDescription="@null"
37
            android:gravity="center"
38
            android:paddingRight="15dp"
39
            android:paddingLeft="15dp"
40
            android:text=""
41
            android:textColor="@color/lvse"
42
            android:textSize="17sp"
43
            android:visibility="gone" />
44
45
        <ImageView
46
            android:id="@+id/iv_message"
47
            android:layout_width="7dp"
48
            android:layout_height="7dp"
49
            android:layout_alignParentRight="true"
50
            android:src="@drawable/icon_myfeedback_message"
51
            android:layout_marginRight="5dp"
52
            android:layout_marginTop="10dp"
53
            android:visibility="gone"/>
54
55
        <ImageView
56
            android:id="@+id/iv_webview_back"
57
            android:layout_width="wrap_content"
58
            android:layout_height="match_parent"
59
            android:layout_alignParentLeft="true"
60
            android:layout_centerVertical="true"
61
            android:contentDescription="@null"
62
            android:paddingLeft="15dp"
63
            android:paddingRight="15dp"
64
            android:src="@drawable/icon_lvback1119" />
65
66
        <ImageView
67
            android:id="@+id/iv_webview_close"
68
            android:layout_width="wrap_content"
69
            android:layout_height="match_parent"
70
            android:layout_toRightOf="@+id/iv_webview_back"
71
            android:contentDescription="@null"
72
            android:paddingBottom="4dp"
73
            android:paddingLeft="15dp"
74
            android:paddingRight="16dp"
75
            android:paddingTop="4dp"
76
            android:visibility="gone"
77
            android:src="@drawable/icon_close1210" />
78
79
        <ProgressBar
80
            android:id="@+id/pb_webview_bar"
81
            style="?android:attr/progressBarStyleHorizontal"
82
            android:layout_width="match_parent"
83
            android:layout_height="2dp"
84
            android:progressDrawable="@drawable/progress_color_horizontal"
85
            android:layout_alignParentBottom="true"/>
86
    </RelativeLayout>
87
88
    <WebView
89
        android:layout_width="match_parent"
90
        android:layout_height="match_parent"
91
        android:id="@+id/webView"
92
        android:layout_below="@+id/rl_title"/>
93
94
    <RelativeLayout
95
        android:id="@+id/rl_point"
96
        android:layout_width="80dp"
97
        android:layout_height="80dp"
98
        android:layout_marginBottom="50dp"
99
        android:layout_centerHorizontal="true"
100
        android:layout_alignParentBottom="true"
101
        android:visibility="gone"
102
        android:background="@drawable/icon_point_bg">
103
104
        <LinearLayout
105
            android:layout_width="wrap_content"
106
            android:layout_height="wrap_content"
107
            android:orientation="vertical"
108
            android:layout_centerInParent="true">
109
110
            <LinearLayout
111
                android:layout_width="wrap_content"
112
                android:layout_height="wrap_content"
113
                android:layout_gravity="center_horizontal">
114
115
                <TextView
116
                    android:layout_width="wrap_content"
117
                    android:layout_height="wrap_content"
118
                    android:text="+"
119
                    android:textSize="16sp"
120
                    android:textColor="@color/white"/>
121
122
                <TextView
123
                    android:id="@+id/tv_point"
124
                    android:layout_width="wrap_content"
125
                    android:layout_height="wrap_content"
126
                    android:text="20"
127
                    android:textSize="19sp"
128
                    android:layout_marginLeft="2dp"
129
                    android:textColor="@color/white"/>
130
131
132
            </LinearLayout>
133
134
            <TextView
135
                android:layout_width="wrap_content"
136
                android:layout_height="wrap_content"
137
                android:layout_gravity="center_horizontal"
138
                android:text="充电币"
139
                android:textSize="13sp"
140
                android:textColor="@color/white"
141
                android:layout_marginTop="2dp"/>
142
143
144
        </LinearLayout>
145
146
147
148
    </RelativeLayout>
149
150
151
152
</RelativeLayout>

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

18
    <string name="updated_at">上次更新于%1$s前</string>
18
    <string name="updated_at">上次更新于%1$s前</string>
19
    <string name="updated_just_now">刚刚更新</string>
19
    <string name="updated_just_now">刚刚更新</string>
20
    <string name="time_error">时间有问题</string>
20
    <string name="time_error">时间有问题</string>
21
    <string name="string_tab_qa">问答</string>
21
    <string name="string_tab_qa">活动</string>
22
22
23
23
24
    <string name="main_name">主界面</string>
24
    <string name="main_name">主界面</string>

cdzApp - Gogs: Go Git Service

充电桩app代码

hy 446b8d515b 修改首页tab样式 %!s(int64=4) %!d(string=hace) años
..
libs 5b57ae0a9e 删除无用so,添加高德sdk的so %!s(int64=4) %!d(string=hace) años
src 446b8d515b 修改首页tab样式 %!s(int64=4) %!d(string=hace) años
.DS_Store 63b52c4d3c 代码提交 %!s(int64=5) %!d(string=hace) años
build.gradle 5b57ae0a9e 删除无用so,添加高德sdk的so %!s(int64=4) %!d(string=hace) años
gradle.properties 2ccff5dbe6 配置优化 %!s(int64=6) %!d(string=hace) años
proguard-rules.pro e1ca1e4e50 配置信息更改 %!s(int64=6) %!d(string=hace) años