e签宝
This commit is contained in:
parent
f3a422ac5e
commit
df6d087704
@ -152,7 +152,7 @@ dependencies {
|
||||
// implementation 'com.amap.api:navi-3dmap:9.8.3_3dmap9.8.3'
|
||||
|
||||
//易签宝
|
||||
implementation files('libs/EsignSDK.aar')
|
||||
// implementation files('libs/EsignSDK.aar')
|
||||
// implementation(name: 'EsignSDK', ext: 'aar')
|
||||
|
||||
|
||||
|
@ -286,6 +286,12 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.waybill.activity.WaybillAppraiseActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.waybill.activity.WaybillUpPicActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
@ -382,6 +388,27 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".ui.esingn.H5Activity"
|
||||
android:screenOrientation="portrait"
|
||||
android:launchMode="singleTask">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="demo"
|
||||
android:path="/signBack"
|
||||
android:scheme="esign" />
|
||||
<data
|
||||
android:host="demo"
|
||||
android:path="/realBack"
|
||||
android:scheme="esign" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- 我的相关end -->
|
||||
|
||||
<!-- 导航相关end -->
|
||||
|
@ -12,7 +12,6 @@ import com.dahe.gldriver.net.Api
|
||||
import com.dahe.gldriver.oss.OssServiceUtil
|
||||
import com.dahe.gldriver.push.PushHelper
|
||||
import com.dahe.mylibrary.CommonBaseLibrary
|
||||
import com.esign.esignsdk.EsignSdk
|
||||
import com.github.gzuliyujiang.dialog.DialogConfig
|
||||
import com.github.gzuliyujiang.dialog.DialogStyle
|
||||
import com.tencent.bugly.crashreport.CrashReport
|
||||
@ -47,7 +46,7 @@ class App : Application() {
|
||||
OssServiceUtil.getInstance().init();
|
||||
|
||||
//E签宝
|
||||
EsignSdk.getInstance().init(AppConfig.E_KEY, AppConfig.E_LICENSE)
|
||||
// EsignSdk.getInstance().init(AppConfig.E_KEY, AppConfig.E_LICENSE)
|
||||
initUmeng()
|
||||
|
||||
// var pendingIntent: PendingIntent = getActivity(
|
||||
|
@ -86,3 +86,17 @@ data class QueDetail(
|
||||
val classroomId: String,
|
||||
val contentData: String
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* 已签宝
|
||||
* @property authFlowId String
|
||||
* @property authShortUrl String
|
||||
* @property authUrl String
|
||||
* @constructor
|
||||
*/
|
||||
data class FaceBean(
|
||||
val authFlowId: String,
|
||||
val authShortUrl: String,
|
||||
val authUrl: String
|
||||
)
|
||||
|
9
app/src/main/java/com/dahe/gldriver/event/FaceEvent.kt
Normal file
9
app/src/main/java/com/dahe/gldriver/event/FaceEvent.kt
Normal file
@ -0,0 +1,9 @@
|
||||
package com.dahe.gldriver.event
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/10/20 14:43
|
||||
* @description:
|
||||
*/
|
||||
class FaceEvent(var message: String)
|
@ -9,6 +9,7 @@ import com.dahe.gldriver.bean.CarBean
|
||||
import com.dahe.gldriver.bean.CarDetail
|
||||
import com.dahe.gldriver.bean.DiCarColor
|
||||
import com.dahe.gldriver.bean.DriverBean
|
||||
import com.dahe.gldriver.bean.FaceBean
|
||||
import com.dahe.gldriver.bean.InviteRecord
|
||||
import com.dahe.gldriver.bean.OcrPersonBean
|
||||
import com.dahe.gldriver.bean.OrderChild
|
||||
@ -511,6 +512,13 @@ interface Api {
|
||||
@GET(BASE_URL + "driver/app/info/safeClassroomList")
|
||||
fun safeClassroomList(): Observable<CommonResponseBean<MutableList<QuestionBean>>>
|
||||
|
||||
/**
|
||||
* 获取易签宝实名认证
|
||||
* @return Observable<CommonResponseBean<QuestionBean>>
|
||||
*/
|
||||
@GET(BASE_URL+"driver/driver/getESignPsnAuthUrl")
|
||||
fun getESignPsnAuthUrl():Observable<CommonResponseBean<FaceBean>>
|
||||
|
||||
companion object {
|
||||
// String BASE_URL = "https://tmstest.dahehuoyun.com/";
|
||||
const val BASE_URL = BuildConfig.BASE_URL
|
||||
|
@ -3,10 +3,20 @@ package com.dahe.gldriver.ui.account.authperson
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.base.AppConfig
|
||||
import com.dahe.gldriver.bean.FaceBean
|
||||
import com.dahe.gldriver.databinding.ActivityAuthFaceBinding
|
||||
import com.dahe.gldriver.ui.account.AuthSuccActivity
|
||||
import com.dahe.gldriver.event.FaceEvent
|
||||
import com.dahe.gldriver.net.BaseObserver
|
||||
import com.dahe.gldriver.net.DataManager
|
||||
import com.dahe.gldriver.net.RxHttpCallBack
|
||||
import com.dahe.gldriver.ui.esingn.H5Activity
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
|
||||
/**
|
||||
* @ClassName AuthFaceActivity
|
||||
@ -17,19 +27,67 @@ import com.dahe.mylibrary.utils.ActivityUtils
|
||||
class AuthFaceActivity : BaseActivity<ActivityAuthFaceBinding>() {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("实名认证",true)
|
||||
var isSupp = intent.extras?.getBoolean(AppConfig.IS_SUPPLEMENT,false)
|
||||
setTitleBar("实名认证", true)
|
||||
var isSupp = intent.extras?.getBoolean(AppConfig.IS_SUPPLEMENT, false)
|
||||
binding.btnOk.setOnClickListener {
|
||||
if (isSupp == true){
|
||||
finish()
|
||||
}else{
|
||||
ActivityUtils.startActivity(mContext,AuthSuccActivity::class.java)
|
||||
finish()
|
||||
}
|
||||
|
||||
DataManager.getInstance().getESignPsnAuthUrl()
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<FaceBean>() {
|
||||
override fun onSuccess(t: CommonResponseBean<FaceBean>) {
|
||||
super.onSuccess(t)
|
||||
t.data.toString()
|
||||
// val intent: Intent = Intent(
|
||||
// this,
|
||||
// H5Activity::class.java
|
||||
// )
|
||||
// intent.putExtra("url", bb.getData() as String)
|
||||
// intent.putExtra("view_file", false)
|
||||
// startActivity(intent)
|
||||
|
||||
ActivityUtils.startActivity(mContext,
|
||||
H5Activity::class.java, Bundle().apply {
|
||||
putString("url", t.data.authUrl)
|
||||
putBoolean("view_file", false)
|
||||
})
|
||||
|
||||
// ActivityUtils.startActivity(mContext, WebSignActivity::class.java, Bundle().apply {
|
||||
// putString("title", "实名认证")
|
||||
// putString("url", t.data.authUrl)
|
||||
// })
|
||||
}
|
||||
}))
|
||||
|
||||
// if (isSupp == true){
|
||||
// finish()
|
||||
// }else{
|
||||
// ActivityUtils.startActivity(mContext,AuthSuccActivity::class.java)
|
||||
// finish()
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
fun eventStatu(event: FaceEvent) {
|
||||
if (event != null && event.message == "刷脸成功") {
|
||||
setResult(RESULT_OK)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
485
app/src/main/java/com/dahe/gldriver/ui/esingn/H5Activity.java
Normal file
485
app/src/main/java/com/dahe/gldriver/ui/esingn/H5Activity.java
Normal file
@ -0,0 +1,485 @@
|
||||
package com.dahe.gldriver.ui.esingn;
|
||||
|
||||
import static android.webkit.WebSettings.LOAD_NO_CACHE;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.webkit.ConsoleMessage;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
import android.webkit.JsPromptResult;
|
||||
import android.webkit.JsResult;
|
||||
import android.webkit.PermissionRequest;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebResourceError;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.dahe.gldriver.R;
|
||||
import com.dahe.gldriver.event.FaceEvent;
|
||||
import com.dahe.mylibrary.utils.StatusBar;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import pub.devrel.easypermissions.EasyPermissions;
|
||||
import qiu.niorgai.StatusBarCompat;
|
||||
|
||||
/**
|
||||
* @author xingtian on 2019/3/25
|
||||
*/
|
||||
public class H5Activity extends AppCompatActivity {
|
||||
|
||||
public static final int REQUEST_PERMISSION_STORAGE = 0x00;
|
||||
public static final int REQUEST_PERMISSION_CAMERA = 0x01;
|
||||
|
||||
public final static String SCHEMA_REAL = "esign://demo/realBack";
|
||||
|
||||
public final static String SCHEMA_SIGN = "esign://demo/signBack";
|
||||
|
||||
private WebView mWebView;
|
||||
|
||||
String curUrl = null;
|
||||
boolean viewFile = false;
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
ValueCallback<Uri> uploadMessage;
|
||||
private ValueCallback<Uri[]> uploadMessageAboveL;
|
||||
private final static int FILE_CHOOSER_RESULT_CODE = 10000;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.setContentView(R.layout.activity_h5);
|
||||
StatusBarCompat.setStatusBarColor(this, ContextCompat.getColor(this, R.color.white), 0);
|
||||
StatusBar.changeToLightStatusBar(this); //黑色 下边白色
|
||||
|
||||
mWebView = findViewById(R.id.webview);
|
||||
// ImageView back = findViewById(R.id.back);
|
||||
// TextView close = findViewById(R.id.close);
|
||||
WebSettings webSetting = mWebView.getSettings();
|
||||
|
||||
// back.setOnClickListener(v -> {
|
||||
// if (mWebView.canGoBack()) {
|
||||
// mWebView.goBack();
|
||||
// } else {
|
||||
// finish();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// close.setOnClickListener(v -> {
|
||||
// if (mWebView.canGoBack()) {
|
||||
// mWebView.goBack();
|
||||
// } else {
|
||||
// finish();
|
||||
// }
|
||||
// });
|
||||
|
||||
webSetting.setJavaScriptEnabled(true);
|
||||
webSetting.setDomStorageEnabled(true);
|
||||
// webSetting.setAppCacheMaxSize(1024 * 1024 * 8);
|
||||
webSetting.setUseWideViewPort(true);
|
||||
webSetting.setLoadWithOverviewMode(true);
|
||||
webSetting.setAllowFileAccess(true);
|
||||
// webSetting.setAppCacheEnabled(true);
|
||||
String appCachePath = getApplication().getCacheDir().getAbsolutePath();
|
||||
// webSetting.setAppCachePath(appCachePath);
|
||||
webSetting.setDatabaseEnabled(true);
|
||||
webSetting.setCacheMode(LOAD_NO_CACHE);
|
||||
webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
WebView.setWebContentsDebuggingEnabled(true);
|
||||
}
|
||||
|
||||
CookieSyncManager.createInstance(this);
|
||||
CookieManager cookieManager = CookieManager.getInstance();
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
cookieManager.setAcceptThirdPartyCookies(mWebView, true);
|
||||
}
|
||||
cookieManager.setAcceptCookie(true);
|
||||
|
||||
|
||||
mWebView.setWebViewClient(new MyWebViewClient());
|
||||
mWebView.setWebChromeClient(new H5FaceWebChromeClient(this));
|
||||
|
||||
WBH5FaceVerifySDK.getInstance().setWebViewSettings(mWebView, getApplicationContext());
|
||||
|
||||
processExtraData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mWebView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mWebView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mWebView.stopLoading();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
try {
|
||||
if (mWebView != null) {
|
||||
mWebView.removeAllViews();
|
||||
mWebView.destroy();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
processExtraData();
|
||||
}
|
||||
|
||||
private void processExtraData() {
|
||||
|
||||
Intent intent = getIntent();
|
||||
Uri uri = intent.getData();
|
||||
Log.e("test", "===" + uri);
|
||||
if (uri != null) {
|
||||
// 芝麻认证刷脸结束返回获取后续操作页面地址
|
||||
// String callbackUrl = uri.getQueryParameter("callback");
|
||||
|
||||
String callbackUrl = uri.getQueryParameter("realnameUrl");
|
||||
if (!TextUtils.isEmpty(callbackUrl)) {
|
||||
try {
|
||||
mWebView.loadUrl(URLDecoder.decode(callbackUrl, "utf-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
String url = intent.getStringExtra("url");
|
||||
viewFile = intent.getBooleanExtra("view_file", false);
|
||||
if (url.startsWith("alipay")) {
|
||||
|
||||
try {
|
||||
Intent intent2 = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
startActivity(intent2);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (curUrl == null) {
|
||||
curUrl = url;
|
||||
}
|
||||
mWebView.loadUrl(url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class MyWebViewClient extends WebViewClient {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (url == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Uri uri = Uri.parse(url);
|
||||
Log.e("test", "要加载的地址:" + uri.getScheme() + " " + url + " ");
|
||||
if (uri.getScheme().equals("http") || uri.getScheme().equals("https")) {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
} else if (uri.getScheme().equals("js") || uri.getScheme().equals("jsbridge")) {
|
||||
|
||||
// js://signCallback?signResult=true 签署结果
|
||||
if (uri.getAuthority().equals("signCallback")) {
|
||||
if (viewFile) {
|
||||
view.loadUrl(curUrl);
|
||||
return true;
|
||||
} else {
|
||||
if (url.contains("signResult")) {
|
||||
boolean signResult = uri.getBooleanQueryParameter("signResult", false);
|
||||
Toast.makeText(H5Activity.this, "签署结果: " + " signResult = " + signResult, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
String tsignCode = uri.getQueryParameter("tsignCode");
|
||||
if ("0".equals(tsignCode)) {
|
||||
tsignCode = "签署成功";
|
||||
} else {
|
||||
tsignCode = "签署失败";
|
||||
}
|
||||
Toast.makeText(H5Activity.this, "签署结果: " + tsignCode, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
//js://tsignRealBack?esignAppScheme=esign://app/callback&serviceId=854677892133554052&verifycode=4a52e2af0d0abfb7b285c4f05b5af133&status=true&passed=true
|
||||
//实名结果
|
||||
if (uri.getAuthority().equals("tsignRealBack")) {
|
||||
//实名结果字段
|
||||
if (uri.getQueryParameter("verifycode") != null) {
|
||||
String realVerifyCode = uri.getQueryParameter("verifycode");
|
||||
}
|
||||
// 实名认证结束 返回按钮/倒计时返回/暂不认证
|
||||
boolean status = uri.getBooleanQueryParameter("status", false);
|
||||
if (status) {
|
||||
//认证成功返回
|
||||
new Handler().postDelayed(() -> {
|
||||
FaceEvent he = new FaceEvent("刷脸成功");
|
||||
EventBus.getDefault().post(he);
|
||||
finish();
|
||||
}, 800);
|
||||
Toast.makeText(H5Activity.this, "认证成功", Toast.LENGTH_LONG).show();
|
||||
// finish();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (url.startsWith(SCHEMA_REAL)) {
|
||||
//esign://app/realBack&serviceId=854677892133554052&verifycode=4a52e2af0d0abfb7b285c4f05b5af133&status=true&passed=true
|
||||
|
||||
//实名结果
|
||||
if (uri.getQueryParameter("verifycode") != null) {
|
||||
String realVerifyCode = uri.getQueryParameter("verifycode");
|
||||
}
|
||||
// 实名认证结束 返回按钮/倒计时返回/暂不认证
|
||||
boolean status = uri.getBooleanQueryParameter("status", false);
|
||||
if (status) {
|
||||
//认证成功返回
|
||||
new Handler().postDelayed(() -> {
|
||||
FaceEvent he = new FaceEvent("刷脸成功");
|
||||
EventBus.getDefault().post(he);
|
||||
finish();
|
||||
}, 800);
|
||||
Toast.makeText(H5Activity.this, "认证成功", Toast.LENGTH_LONG).show();
|
||||
// finish();
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (url.startsWith(SCHEMA_SIGN)) {
|
||||
// js://signCallback?signResult=true 签署结果
|
||||
if (url.contains("signResult")) {
|
||||
boolean signResult = uri.getBooleanQueryParameter("signResult", false);
|
||||
Toast.makeText(H5Activity.this, "签署结果: " + " signResult = " + signResult, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
String tsignCode = uri.getQueryParameter("tsignCode");
|
||||
if ("0".equals(tsignCode)) {
|
||||
//延时1.5秒跳转运单详情页面
|
||||
// new Handler().postDelayed(() -> {
|
||||
// FaceEvent he = new FaceEvent("刷脸成功");
|
||||
// EventBus.getDefault().post(he);
|
||||
// finish();
|
||||
// }, 800);
|
||||
tsignCode = "签署成功";
|
||||
} else {
|
||||
tsignCode = "签署失败";
|
||||
}
|
||||
Toast.makeText(H5Activity.this, "签署结果: " + tsignCode, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
// finish();
|
||||
return true;
|
||||
} else if (uri.getScheme().equals("alipays")) {
|
||||
// 跳转到支付宝刷脸
|
||||
// alipays://platformapi/startapp?appId=20000067&pd=NO&url=https%3A%2F%2Fzmcustprod.zmxy.com.cn%2Fcertify%2Fbegin.htm%3Ftoken%3DZM201811133000000050500431389414
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
startActivity(intent);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
|
||||
super.onReceivedError(view, request, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||
// super.onReceivedSslError(view, handler, error);
|
||||
handler.proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||
super.onPageStarted(view, url, favicon);
|
||||
time = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
super.onPageFinished(view, url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadResource(WebView view, String url) {
|
||||
super.onLoadResource(view, url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class H5FaceWebChromeClient extends WebChromeClient {
|
||||
private Activity activity;
|
||||
|
||||
public H5FaceWebChromeClient(Activity mActivity) {
|
||||
this.activity = mActivity;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onReceivedTitle(WebView view, String title) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
|
||||
return super.onJsPrompt(view, url, message, defaultValue, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
|
||||
return super.onJsConfirm(view, url, message, result);
|
||||
}
|
||||
|
||||
@TargetApi(8)
|
||||
@Override
|
||||
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
|
||||
return super.onConsoleMessage(consoleMessage);
|
||||
}
|
||||
|
||||
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
|
||||
if (WBH5FaceVerifySDK.getInstance().recordVideoForApiBelow21(uploadMsg, acceptType, activity)) {
|
||||
return;
|
||||
}
|
||||
uploadMessage = uploadMsg;
|
||||
}
|
||||
|
||||
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
|
||||
if (WBH5FaceVerifySDK.getInstance().recordVideoForApiBelow21(uploadMsg, acceptType, activity)) {
|
||||
return;
|
||||
}
|
||||
uploadMessage = uploadMessage;
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
@Override
|
||||
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
|
||||
if (WBH5FaceVerifySDK.getInstance().recordVideoForApi21(webView, filePathCallback, activity, fileChooserParams)) {
|
||||
return true;
|
||||
}
|
||||
uploadMessageAboveL = filePathCallback;
|
||||
recordVideo(H5Activity.this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPermissionRequest(PermissionRequest request) {
|
||||
request.grant(request.getResources());
|
||||
request.getOrigin();
|
||||
}
|
||||
}
|
||||
|
||||
public void recordVideo(Activity activity) {
|
||||
if (EasyPermissions.hasPermissions(activity, Manifest.permission.CAMERA)) {
|
||||
try {
|
||||
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
intent.putExtra("android.intent.extras.CAMERA_FACING", 1); // 调用前置摄像头
|
||||
activity.startActivityForResult(intent, FILE_CHOOSER_RESULT_CODE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
EasyPermissions.requestPermissions(activity, "请同意使用相机功能", REQUEST_PERMISSION_CAMERA, Manifest.permission.CAMERA);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if (mWebView.canGoBack()) {
|
||||
mWebView.goBack();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (WBH5FaceVerifySDK.getInstance().receiveH5FaceVerifyResult(requestCode, resultCode, data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (requestCode == FILE_CHOOSER_RESULT_CODE) {
|
||||
if (null == uploadMessage && null == uploadMessageAboveL) {
|
||||
return;
|
||||
}
|
||||
Uri result = data == null || resultCode != RESULT_OK ? null : data.getData();
|
||||
if (uploadMessageAboveL != null) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
uploadMessageAboveL.onReceiveValue(new Uri[]{result});
|
||||
uploadMessageAboveL = null;
|
||||
} else {
|
||||
uploadMessageAboveL.onReceiveValue(new Uri[]{});
|
||||
uploadMessageAboveL = null;
|
||||
}
|
||||
} else if (uploadMessage != null) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
uploadMessage.onReceiveValue(result);
|
||||
uploadMessage = null;
|
||||
} else {
|
||||
uploadMessage.onReceiveValue(Uri.EMPTY);
|
||||
uploadMessage = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
WBH5FaceVerifySDK.getInstance().recordVideo(this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,236 @@
|
||||
package com.dahe.gldriver.ui.esingn;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
import static com.dahe.gldriver.ui.esingn.H5Activity.REQUEST_PERMISSION_CAMERA;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import pub.devrel.easypermissions.EasyPermissions;
|
||||
|
||||
public class WBH5FaceVerifySDK {
|
||||
//没有网络连接
|
||||
private static final String NETWORK_NONE = "NETWORK_NONE";
|
||||
//wifi连接
|
||||
private static final String NETWORK_WIFI = "NETWORK_WIFI";
|
||||
//手机网络数据连接类型
|
||||
private static final String NETWORK_2G = "NETWORK_2G";
|
||||
private static final String NETWORK_3G = "NETWORK_3G";
|
||||
private static final String NETWORK_4G = "NETWORK_4G";
|
||||
private static final String NETWORK_MOBILE = "NETWORK_MOBILE";
|
||||
private static final int VIDEO_REQUEST = 0x0001;
|
||||
private ValueCallback<Uri> mUploadMessage;
|
||||
private ValueCallback<Uri[]> mUploadCallbackAboveL;
|
||||
private static WBH5FaceVerifySDK instance;
|
||||
|
||||
/**
|
||||
* 获取当前网络连接类型
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
private static String getNetWorkState(Context context) {
|
||||
//获取系统的网络服务
|
||||
ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
//如果当前没有网络
|
||||
if (null == connManager) {
|
||||
return NETWORK_NONE;
|
||||
}
|
||||
|
||||
//获取当前网络类型,如果为空,返回无网络
|
||||
NetworkInfo activeNetInfo = connManager.getActiveNetworkInfo();
|
||||
if (activeNetInfo == null || !activeNetInfo.isAvailable()) {
|
||||
return NETWORK_NONE;
|
||||
}
|
||||
|
||||
// 判断是不是连接的是不是wifi
|
||||
NetworkInfo wifiInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||
if (null != wifiInfo) {
|
||||
NetworkInfo.State state = wifiInfo.getState();
|
||||
if (null != state) {
|
||||
if (state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING) {
|
||||
return NETWORK_WIFI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果不是wifi,则判断当前连接的是运营商的哪种网络2g、3g、4g等
|
||||
NetworkInfo networkInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
||||
|
||||
if (null != networkInfo) {
|
||||
NetworkInfo.State state = networkInfo.getState();
|
||||
String strSubTypeName = networkInfo.getSubtypeName();
|
||||
if (null != state) {
|
||||
if (state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING) {
|
||||
switch (activeNetInfo.getSubtype()) {
|
||||
//如果是2g类型
|
||||
case TelephonyManager.NETWORK_TYPE_GPRS: // 联通2g
|
||||
case TelephonyManager.NETWORK_TYPE_CDMA: // 电信2g
|
||||
case TelephonyManager.NETWORK_TYPE_EDGE: // 移动2g
|
||||
case TelephonyManager.NETWORK_TYPE_1xRTT:
|
||||
case TelephonyManager.NETWORK_TYPE_IDEN:
|
||||
return NETWORK_2G;
|
||||
//如果是3g类型
|
||||
case TelephonyManager.NETWORK_TYPE_EVDO_A: // 电信3g
|
||||
case TelephonyManager.NETWORK_TYPE_UMTS:
|
||||
case TelephonyManager.NETWORK_TYPE_EVDO_0:
|
||||
case TelephonyManager.NETWORK_TYPE_HSDPA:
|
||||
case TelephonyManager.NETWORK_TYPE_HSUPA:
|
||||
case TelephonyManager.NETWORK_TYPE_HSPA:
|
||||
case TelephonyManager.NETWORK_TYPE_EVDO_B:
|
||||
case TelephonyManager.NETWORK_TYPE_EHRPD:
|
||||
case TelephonyManager.NETWORK_TYPE_HSPAP:
|
||||
return NETWORK_3G;
|
||||
//如果是4g类型
|
||||
case TelephonyManager.NETWORK_TYPE_LTE:
|
||||
return NETWORK_4G;
|
||||
default:
|
||||
//中国移动 联通 电信 三种3G制式
|
||||
if (strSubTypeName.equalsIgnoreCase("TD-SCDMA") || strSubTypeName.equalsIgnoreCase("WCDMA") || strSubTypeName.equalsIgnoreCase("CDMA2000")) {
|
||||
return NETWORK_3G;
|
||||
} else {
|
||||
return NETWORK_MOBILE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NETWORK_NONE;
|
||||
}
|
||||
|
||||
public static synchronized WBH5FaceVerifySDK getInstance() {
|
||||
if (null == instance) {
|
||||
instance = new WBH5FaceVerifySDK();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private WBH5FaceVerifySDK() {
|
||||
}
|
||||
|
||||
public void setWebViewSettings(WebView mWebView, Context context) {
|
||||
if (null == mWebView) {
|
||||
return;
|
||||
}
|
||||
if (null == mWebView) {
|
||||
return;
|
||||
}
|
||||
|
||||
WebSettings webSetting = mWebView.getSettings();
|
||||
webSetting.setJavaScriptEnabled(true);
|
||||
webSetting.setTextZoom(100);
|
||||
webSetting.setAllowFileAccess(true);
|
||||
webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
|
||||
webSetting.setSupportZoom(true);
|
||||
webSetting.setBuiltInZoomControls(true);
|
||||
webSetting.setUseWideViewPort(true);
|
||||
webSetting.setSupportMultipleWindows(false);
|
||||
webSetting.setLoadWithOverviewMode(true);
|
||||
// webSetting.setAppCacheEnabled(true);
|
||||
webSetting.setDatabaseEnabled(true);
|
||||
webSetting.setDomStorageEnabled(true);
|
||||
webSetting.setGeolocationEnabled(true);
|
||||
// webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
|
||||
// webSetting.setAppCachePath(context.getDir("appcache", 0).getPath());
|
||||
webSetting.setDatabasePath(context.getDir("databases", 0).getPath());
|
||||
webSetting.setGeolocationDatabasePath(context.getDir("geolocation", 0).getPath());
|
||||
webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
|
||||
webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
webSetting.setAllowUniversalAccessFromFileURLs(true);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
mWebView.removeJavascriptInterface("searchBoxJavaBridge_");
|
||||
}
|
||||
|
||||
String ua = webSetting.getUserAgentString();
|
||||
try {
|
||||
webSetting.setUserAgentString(ua + ";webank/h5face;webank/1.0" + ";netType:" +
|
||||
getNetWorkState(context) + ";appVersion:" +
|
||||
context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode +
|
||||
";packageName:" + context.getPackageName());
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
webSetting.setUserAgentString(ua + ";webank/h5face;webank/1.0");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean receiveH5FaceVerifyResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == VIDEO_REQUEST) { //根据请求码判断返回的是否是h5刷脸结果
|
||||
if (null == mUploadMessage && null == mUploadCallbackAboveL) {
|
||||
return true;
|
||||
}
|
||||
Uri result = data == null || resultCode != RESULT_OK ? null : data.getData();
|
||||
Uri[] uris = result == null ? null : new Uri[]{result};
|
||||
if (mUploadCallbackAboveL != null) {
|
||||
mUploadCallbackAboveL.onReceiveValue(uris);
|
||||
setmUploadCallbackAboveL(null);
|
||||
} else {
|
||||
mUploadMessage.onReceiveValue(result);
|
||||
setmUploadMessage(null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean recordVideoForApiBelow21(ValueCallback<Uri> uploadMsg, String acceptType, Activity activity) {
|
||||
if ("video/webank".equals(acceptType)) {
|
||||
setmUploadMessage(uploadMsg);
|
||||
recordVideo(activity);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
public boolean recordVideoForApi21(WebView webView, ValueCallback<Uri[]> filePathCallback, Activity activity, WebChromeClient.FileChooserParams fileChooserParams) {
|
||||
if ("video/webank".equals(fileChooserParams.getAcceptTypes()[0])||webView.getUrl().startsWith("https://miniprogram-kyc.tencentcloudapi.com")||webView.getUrl().startsWith("https://ida.webank.com")) { //是h5刷脸
|
||||
setmUploadCallbackAboveL(filePathCallback);
|
||||
recordVideo(activity);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用系统前置摄像头进行视频录制
|
||||
*/
|
||||
public void recordVideo(Activity activity) {
|
||||
if (EasyPermissions.hasPermissions(activity, Manifest.permission.CAMERA)) {
|
||||
try {
|
||||
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
intent.putExtra("android.intent.extras.CAMERA_FACING", 1); // 调用前置摄像头
|
||||
activity.startActivityForResult(intent, VIDEO_REQUEST);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
EasyPermissions.requestPermissions(activity, "请同意使用相机功能", REQUEST_PERMISSION_CAMERA, Manifest.permission.CAMERA);
|
||||
}
|
||||
}
|
||||
|
||||
private void setmUploadMessage(ValueCallback<Uri> uploadMessage) {
|
||||
mUploadMessage = uploadMessage;
|
||||
}
|
||||
|
||||
private void setmUploadCallbackAboveL(ValueCallback<Uri[]> uploadCallbackAboveL) {
|
||||
mUploadCallbackAboveL = uploadCallbackAboveL;
|
||||
}
|
||||
}
|
@ -140,10 +140,10 @@ class PersonInfoActivity : BaseActivity<ActivityPersonInfoBinding>(), View.OnCli
|
||||
EditQualificationActivity::class.java, 1
|
||||
)
|
||||
|
||||
4 -> ActivityUtils.startActivity(
|
||||
mContext,
|
||||
4 -> ActivityUtils.startActivityForResult(
|
||||
this@PersonInfoActivity,
|
||||
AuthFaceActivity::class.java,
|
||||
Bundle().apply { putBoolean(AppConfig.IS_SUPPLEMENT, true) })
|
||||
Bundle().apply { putBoolean(AppConfig.IS_SUPPLEMENT, true) },1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,289 @@
|
||||
package com.dahe.gldriver.ui.waybill.activity
|
||||
|
||||
import android.Manifest
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.Toast
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.amap.api.maps.AMap
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.adapter.WaybillNodeAdapter
|
||||
import com.dahe.gldriver.base.AppConfig
|
||||
import com.dahe.gldriver.bean.OrderDetailBean
|
||||
import com.dahe.gldriver.databinding.ActivityWaybillUnloadBinding
|
||||
import com.dahe.gldriver.net.BaseObserver
|
||||
import com.dahe.gldriver.net.DataManager
|
||||
import com.dahe.gldriver.net.RxHttpCallBack
|
||||
import com.dahe.gldriver.utils.GDLocationUtils
|
||||
import com.dahe.gldriver.utils.LocationUtils
|
||||
import com.dahe.gldriver.utils.NaviUtils
|
||||
import com.dahe.gldriver.utils.OrderUtils
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import com.dahe.mylibrary.utils.BaseUtils
|
||||
import com.dahe.mylibrary.utils.ConvertUtils
|
||||
import com.dahe.mylibrary.utils.LoadingUtils
|
||||
import com.dahe.mylibrary.utils.ToastUtils
|
||||
import com.permissionx.guolindev.PermissionX
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
|
||||
/**
|
||||
* @ClassName WaybillLoadActivity
|
||||
* @Author john
|
||||
* @Date 2024/1/29 16:52
|
||||
* @Description 运单详情-待评价-查看
|
||||
*/
|
||||
class WaybillAppraiseActivity : BaseActivity<ActivityWaybillUnloadBinding>() {
|
||||
|
||||
lateinit var aMap: AMap
|
||||
|
||||
|
||||
var orderId: String = ""
|
||||
var waybillId: String = ""
|
||||
lateinit var orderBean: OrderDetailBean
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
orderId = intent.extras?.getString(AppConfig.ORDER_ID, "").toString()
|
||||
setStatusHeightParams(binding.rlTop)
|
||||
setTitleBar("运单详情", true, true, "查看单据") {
|
||||
ActivityUtils.startActivity(
|
||||
mContext,
|
||||
SeeDocActivity::class.java,
|
||||
Bundle().apply { putString(AppConfig.ORDER_ID, orderId) })
|
||||
}
|
||||
|
||||
initRecy()
|
||||
getLocation()
|
||||
binding.run {
|
||||
mapView.onCreate(savedInstanceState)
|
||||
aMap = mapView.map.apply {
|
||||
uiSettings.run { isZoomControlsEnabled = false }
|
||||
}
|
||||
btnRight.text = "去评价"
|
||||
llGoStart.setOnClickListener {
|
||||
if (!::loadPos.isInitialized) {
|
||||
showToast("请等待定位成功")
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
NaviUtils.getInstance().goNextPoint(mContext, loadPos, loadAddress)
|
||||
}
|
||||
|
||||
llRoutes.setOnClickListener {
|
||||
|
||||
if (!::unLoadPos.isInitialized || !::loadPos.isInitialized) {
|
||||
showToast("缺少起始点定位信息,请返回重试")
|
||||
return@setOnClickListener
|
||||
}
|
||||
NaviUtils.getInstance()
|
||||
.getRoute(mContext, loadPos, unLoadPos, loadAddress, unLoadAddress)
|
||||
}
|
||||
|
||||
|
||||
btnRight.setOnClickListener {
|
||||
//去评价
|
||||
ActivityUtils.startActivity(
|
||||
mContext,
|
||||
WaybillRateActivity::class.java,
|
||||
Bundle().apply {
|
||||
putString(AppConfig.ORDER_ID, orderId)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
|
||||
DataManager.getInstance().orderDetail(orderId)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<OrderDetailBean>() {
|
||||
override fun onSuccess(t: CommonResponseBean<OrderDetailBean>) {
|
||||
super.onSuccess(t)
|
||||
orderBean = t.data
|
||||
val load = orderBean.orderChildList.first { it.type == "1" }
|
||||
val unLoad = orderBean.orderChildList.last { it.type == "2" }
|
||||
var distance = ""
|
||||
loadPos = LatLng(load.latitude.toDouble(), load.longitude.toDouble())
|
||||
unLoadPos = LatLng(unLoad.latitude.toDouble(), unLoad.longitude.toDouble())
|
||||
loadAddress = load.address
|
||||
unLoadAddress = unLoad.address
|
||||
|
||||
LocationUtils.getInstance()
|
||||
.searchRouteResult(mContext, loadPos, unLoadPos, aMap)
|
||||
if (::gdLatLng.isInitialized) {
|
||||
distance = LocationUtils.getInstance().getDistance(
|
||||
gdLatLng,
|
||||
loadPos
|
||||
) + "km"
|
||||
}
|
||||
var goods =
|
||||
t.data.goodsList.map { """${it.goodName},${it.goodItemGrossWeight}吨,${if (it.goodCube.isNullOrEmpty()) "" else it.goodCube + "方"}""" }
|
||||
.reduce { acc, s ->
|
||||
"""${acc}
|
||||
|${s}""".trimMargin()
|
||||
}
|
||||
binding.run {
|
||||
tvWaybillNum.text = """运单号:${orderBean.orderNum}"""
|
||||
tvWaybillStatu.text =
|
||||
OrderUtils.getInstance().getOrderStatu(orderBean.orderStatus)
|
||||
tvTime.text = orderBean.receiverDeadline
|
||||
tvComName.text = orderBean.realCompanyName//货主
|
||||
|
||||
tvCarNum.text = orderBean.waybillInfo.vehicleNum
|
||||
tvCarLen.text =
|
||||
"""${orderBean.waybillInfo.carLong}mm/${orderBean.waybillInfo.approvedLoad}"""
|
||||
tvCarType.text = orderBean.vehicleType//车辆类型
|
||||
|
||||
if (!distance.isNullOrEmpty()) tvLoadDis.text = distance
|
||||
tvUnloadDis.text = orderBean.distance + "km"
|
||||
|
||||
|
||||
tvType.text = if (orderBean.orderType == "0") "一装一卸" else "一装多卸"
|
||||
|
||||
tvCom.text = orderBean?.receiverBusinessName//收货方
|
||||
tvFreight.text = orderBean?.driverFreight.toString()
|
||||
|
||||
tvCarInfo.text = """${t.data.vehicleLength} ${t.data.vehicleType}"""
|
||||
tvGoods.text = goods
|
||||
|
||||
tvReceTime.text = orderBean.waybillInfo.receivingOrderTime
|
||||
tvLoadTime.text = orderBean.waybillInfo.loadTime
|
||||
tvUnloadTime.text = orderBean.waybillInfo.unloadTime
|
||||
|
||||
if (!t.data.requirement.isNullOrEmpty()) tvRemark.text = t.data.requirement
|
||||
|
||||
btnLeft.setOnClickListener {
|
||||
if (orderBean.phone.isNullOrEmpty()) {
|
||||
ToastUtils.showToast(mContext, "未获取到手机号码")
|
||||
return@setOnClickListener
|
||||
}
|
||||
PermissionX.init(this@WaybillAppraiseActivity)
|
||||
.permissions(Manifest.permission.CALL_PHONE)
|
||||
.request { allGranted, grantedList, deniedList ->
|
||||
if (allGranted) {
|
||||
BaseUtils.callPhone(
|
||||
this@WaybillAppraiseActivity,
|
||||
orderBean.phone
|
||||
)
|
||||
} else {
|
||||
Toast.makeText(
|
||||
mContext,
|
||||
"开启权限失败,请在应用设置-权限中打开电话权限",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
btnHzPhone.setOnClickListener {
|
||||
if (orderBean.shipperContactPhone.isNullOrEmpty()) {
|
||||
ToastUtils.showToast(mContext, "未获取到手机号码")
|
||||
return@setOnClickListener
|
||||
}
|
||||
PermissionX.init(this@WaybillAppraiseActivity)
|
||||
.permissions(Manifest.permission.CALL_PHONE)
|
||||
.request { allGranted, _, _ ->
|
||||
if (allGranted) {
|
||||
BaseUtils.callPhone(
|
||||
this@WaybillAppraiseActivity,
|
||||
orderBean.shipperContactPhone
|
||||
)
|
||||
} else {
|
||||
Toast.makeText(
|
||||
mContext,
|
||||
"开启权限失败,请在应用设置-权限中打开电话权限",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
adapter?.submitList(t.data.orderChildList)
|
||||
// initXml(t.data)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
var adapter: WaybillNodeAdapter? = null
|
||||
private fun initRecy() {
|
||||
adapter = binding.recycler.run {
|
||||
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
||||
setHasFixedSize(true)
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(16.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
adapter = WaybillNodeAdapter()
|
||||
adapter as WaybillNodeAdapter
|
||||
}.apply {
|
||||
setOnItemClickListener { _, _, position ->
|
||||
ActivityUtils.startActivity(
|
||||
mContext,
|
||||
WaybillLoadActivity::class.java,
|
||||
Bundle().apply { putString(AppConfig.ORDER_ID, items[position].orderId) })
|
||||
}
|
||||
addOnItemChildClickListener(R.id.btnOk) { adapter, view, position ->
|
||||
ActivityUtils.startActivity(mContext, WaybillDetailActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
binding.mapView.onResume();
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
binding.mapView.onPause();
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
binding.mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
lateinit var gdLatLng: LatLng
|
||||
lateinit var loadPos: LatLng
|
||||
lateinit var unLoadPos: LatLng
|
||||
lateinit var loadAddress: String
|
||||
lateinit var unLoadAddress: String
|
||||
fun getLocation() {
|
||||
GDLocationUtils.instance.getLocation(mContext) {
|
||||
//errCode等于0代表定位成功,其他的为定位失败,具体的可以参照官网定位错误码说明
|
||||
runOnUiThread {
|
||||
LoadingUtils.instance.dissLoading()
|
||||
if (it.getErrorCode() == 0) {
|
||||
it.getLongitude()//经 度
|
||||
it.getLatitude()//纬 度
|
||||
gdLatLng = LatLng(it.latitude, it.longitude)
|
||||
if (::loadPos.isInitialized) {
|
||||
var distance = LocationUtils.getInstance().getDistance(
|
||||
gdLatLng,
|
||||
loadPos
|
||||
) + "km"
|
||||
binding.tvLoadDis.text = distance
|
||||
}
|
||||
|
||||
} else {
|
||||
showToast("定位失败,请检查定位权限是否开启")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -149,6 +149,11 @@ class WaybillUnlLoadActivity : BaseActivity<ActivityWaybillUnloadBinding>() {
|
||||
|
||||
tvCarInfo.text = """${t.data.vehicleLength} ${t.data.vehicleType}"""
|
||||
tvGoods.text = goods
|
||||
|
||||
tvReceTime.text = orderBean.waybillInfo.receivingOrderTime
|
||||
tvLoadTime.text = orderBean.waybillInfo.loadTime
|
||||
tvUnloadTime.text = orderBean.waybillInfo.unloadTime
|
||||
|
||||
if (!t.data.requirement.isNullOrEmpty()) tvRemark.text = t.data.requirement
|
||||
|
||||
btnLeft.setOnClickListener {
|
||||
|
@ -17,6 +17,7 @@ import com.dahe.gldriver.net.BaseObserver
|
||||
import com.dahe.gldriver.net.DataManager
|
||||
import com.dahe.gldriver.net.RxHttpCallBack
|
||||
import com.dahe.gldriver.ui.waybill.activity.SeeDocActivity
|
||||
import com.dahe.gldriver.ui.waybill.activity.WaybillAppraiseActivity
|
||||
import com.dahe.gldriver.ui.waybill.activity.WaybillRateActivity
|
||||
import com.dahe.gldriver.ui.waybill.activity.WaybillUnlLoadActivity
|
||||
import com.dahe.gldriver.utils.OrderUtils
|
||||
@ -67,11 +68,11 @@ class WaitAppraiseFragment : BaseFragment<FragmentWaybillListBinding>(), Refresh
|
||||
(adapter as WaybillListAdapter).isStateViewEnable = true
|
||||
adapter as WaybillListAdapter
|
||||
}.apply {
|
||||
// setOnItemClickListener{_,_,position->
|
||||
// val orderBean = items[position]
|
||||
// ActivityUtils.startActivity(mContext,
|
||||
// WaybillUnlLoadActivity::class.java,Bundle().apply { putString(AppConfig.ORDER_ID,orderBean.orderId) })
|
||||
// }
|
||||
setOnItemClickListener{_,_,position->
|
||||
val orderBean = items[position]
|
||||
ActivityUtils.startActivity(mContext,
|
||||
WaybillAppraiseActivity::class.java,Bundle().apply { putString(AppConfig.ORDER_ID,orderBean.orderId) })
|
||||
}
|
||||
addOnItemChildClickListener(R.id.btnOk) { _, _, position ->
|
||||
val orderBean = items[position]
|
||||
ActivityUtils.startActivity(mContext,WaybillRateActivity::class.java, Bundle().apply {
|
||||
|
12
app/src/main/res/layout/activity_h5.xml
Normal file
12
app/src/main/res/layout/activity_h5.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
@ -491,6 +491,102 @@
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="@dimen/dp_8">
|
||||
|
||||
<RelativeLayout
|
||||
android:paddingBottom="@dimen/dp_16"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingTop="@dimen/dp_16">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/dp_16"
|
||||
android:text="运单信息"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_17"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReceTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_46"
|
||||
android:paddingLeft="@dimen/dp_16"
|
||||
android:text="接单时间"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_15" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReceTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/tvReceTitle"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:paddingRight="@dimen/dp_16"
|
||||
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_15" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLoadTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tvReceTitle"
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:paddingLeft="@dimen/dp_16"
|
||||
android:text="装货时间"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_15" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLoadTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/tvLoadTitle"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:paddingRight="@dimen/dp_16"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_15" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUnloadTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tvLoadTitle"
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:paddingLeft="@dimen/dp_16"
|
||||
android:text="卸货时间"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_15" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUnloadTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/tvUnloadTitle"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:paddingRight="@dimen/dp_16"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_15" />
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
|
Loading…
Reference in New Issue
Block a user