身份证拍照框1.0
This commit is contained in:
parent
8d3abcea63
commit
4650884846
@ -151,6 +151,8 @@ dependencies {
|
||||
implementation project(path: ':mylibrary')
|
||||
implementation project(path: ':keeplibrary')
|
||||
|
||||
// implementation files('libs/ocrsdk.aar')
|
||||
|
||||
//高德地图
|
||||
// implementation 'com.amap.api:3dmap:9.8.3'
|
||||
|
||||
|
@ -321,11 +321,6 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.waybill.activity.WaybillUpPicActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<!-- 运单相关end -->
|
||||
|
||||
<!-- 我的相关start -->
|
||||
|
@ -0,0 +1,75 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.mypop
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.Button
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.account.authperson.EditPersonActivity
|
||||
import com.arpa.mylibrary.R
|
||||
import com.arpa.mylibrary.callback.OnPicResultListener
|
||||
import com.arpa.mylibrary.callback.OnPicTypeistener
|
||||
import com.arpa.mylibrary.weight.GlideEngine
|
||||
import com.arpa.mylibrary.weight.ImageFileCompressEngine
|
||||
import com.luck.picture.lib.basic.PictureSelectionCameraModel
|
||||
import com.luck.picture.lib.basic.PictureSelectionModel
|
||||
import com.luck.picture.lib.basic.PictureSelector
|
||||
import com.luck.picture.lib.config.SelectMimeType
|
||||
import com.luck.picture.lib.entity.LocalMedia
|
||||
import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
||||
import com.lxj.xpopup.core.BottomPopupView
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* @ClassName PopBottomPic
|
||||
* @Author john
|
||||
* @Date 2024/1/31 11:11
|
||||
* @Description TODO
|
||||
*/
|
||||
class PopNorBottomPic2(
|
||||
context: Context,
|
||||
onPicTypeistener: OnPicTypeistener
|
||||
) : BottomPopupView(context) {
|
||||
|
||||
|
||||
private var listener: OnPicTypeistener
|
||||
|
||||
init {
|
||||
this.listener = onPicTypeistener
|
||||
}
|
||||
|
||||
|
||||
override fun getImplLayoutId() = R.layout.choice_norcar_img
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
var paizhao = findViewById<Button>(R.id.btn_paizhao)
|
||||
var xiangce = findViewById<Button>(R.id.btnXiangce)
|
||||
var btnQuxiao = findViewById<Button>(R.id.btn_quxiao)
|
||||
|
||||
paizhao.setOnClickListener {
|
||||
if (listener != null)
|
||||
listener.onResult(true)
|
||||
// 单独拍照
|
||||
dismiss()
|
||||
|
||||
}
|
||||
|
||||
xiangce.setOnClickListener {
|
||||
if (listener != null)
|
||||
listener.onResult(false)
|
||||
// 进入相册
|
||||
dismiss()
|
||||
}
|
||||
|
||||
btnQuxiao.setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun openCam() {
|
||||
PictureSelector.create(context)
|
||||
.openCamera(SelectMimeType.TYPE_IMAGE)
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -104,7 +104,9 @@ abstract class RxHttpCallBack<T> {
|
||||
// mContext.startActivity(intent);
|
||||
ToastUtils.showToast(mContext, "您的账号再异地登录,请重新登录")
|
||||
} else {
|
||||
ToastUtils.showToast(mContext, t.msg)
|
||||
if (t.msg!="禁止频繁上传"){
|
||||
ToastUtils.showToast(mContext, t.msg)
|
||||
}
|
||||
}
|
||||
|
||||
// if (t.getMessage().getMsg_code() == 100 && SPUtils.hasUserInfo(mContext)) {
|
||||
|
@ -43,18 +43,16 @@ class HomeActivity : BaseActivity<ActivityHomeBinding>(), OnTabSelectListener,
|
||||
|
||||
private val mSelectRes = mutableListOf(
|
||||
R.drawable.tab_home_press,
|
||||
R.drawable.tab_message_press,
|
||||
R.drawable.tab_waybill_press,
|
||||
R.drawable.tab_mine_press
|
||||
)
|
||||
private var mTitles = arrayOf("首页", "消息", "运单", "我的")
|
||||
private var mTitles = arrayOf("首页", "运单", "我的")
|
||||
private var mTabEntities = arrayListOf<CustomTabEntity>(
|
||||
TabBean(mTitles[0], mSelectRes[0], mNormalRes[0]),
|
||||
TabBean(mTitles[1], mSelectRes[1], mNormalRes[1]),
|
||||
TabBean(mTitles[2], mSelectRes[2], mNormalRes[2]),
|
||||
TabBean(mTitles[3], mSelectRes[3], mNormalRes[3])
|
||||
)
|
||||
private var mFragments = arrayListOf<Fragment>(HomeFragment(), MessageFragment(), WaybillFragment(), MineFragment())
|
||||
private var mFragments = arrayListOf<Fragment>(HomeFragment(), WaybillFragment(), MineFragment())
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
|
||||
|
@ -152,8 +152,8 @@ class AuthDrivingActivity : BaseActivity<ActivityAuthDrivingBinding>() {
|
||||
engineNo = it.engineNumber
|
||||
vinCode = it.vinCode
|
||||
model = it.model
|
||||
licenseRegisterDate = it.registrationDate
|
||||
licenseIssueDate = it.issueDate
|
||||
licenseRegisterDate = TimeUtil.changeDateNoneFormat(it.registrationDate,"yyyy-MM-dd")
|
||||
licenseIssueDate = TimeUtil.changeDateNoneFormat(it.issueDate,"yyyy-MM-dd")
|
||||
address = it.address
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ class AuthQualificationActivity : BaseActivity<ActivityAuthQualificationBinding>
|
||||
// qualificationCertificateNo = binding.etId.text.toString()
|
||||
qualificationCertificateEffectiveEnd = binding.tvDate.text.toString()
|
||||
|
||||
if (qualificationCertificateEffectiveEnd.isNullOrEmpty()||upQuaInfo.qualificationCertificatePhotoUrl.isNullOrEmpty()) {
|
||||
if (upQuaInfo.qualificationCertificatePhotoUrl.isNullOrEmpty()) {
|
||||
showToast("请完善信息")
|
||||
return@run
|
||||
}
|
||||
|
@ -174,6 +174,7 @@ class AuthTrailerActivity : BaseActivity<ActivityAuthTrailerBinding>() {
|
||||
}
|
||||
binding.run {
|
||||
etHdzzz.setText(upDrivingInfoBean.approvedLoad)
|
||||
tvInfo.text = it.overallDimension
|
||||
}
|
||||
|
||||
//车长
|
||||
|
@ -197,8 +197,8 @@ class EditDrivingActivity : BaseActivity<ActivityAuthDrivingBinding>() {
|
||||
engineNo = it.engineNumber
|
||||
vinCode = it.vinCode
|
||||
model = it.model
|
||||
licenseRegisterDate = it.registrationDate
|
||||
licenseIssueDate = it.issueDate
|
||||
licenseRegisterDate = TimeUtil.changeDateNoneFormat(it.registrationDate,"yyyy-MM-dd")
|
||||
licenseIssueDate = TimeUtil.changeDateNoneFormat(it.issueDate,"yyyy-MM-dd")
|
||||
address = it.address
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,16 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.ui.account.authperson
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.arpa.glex.bean.UserDetail
|
||||
import com.arpa.hndahesudintocctmsdriver.R
|
||||
import com.arpa.hndahesudintocctmsdriver.base.AppConfig
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.OcrPersonBean
|
||||
import com.arpa.hndahesudintocctmsdriver.callback.PicPath
|
||||
import com.arpa.hndahesudintocctmsdriver.databinding.ActivityAuthPersonBinding
|
||||
import com.arpa.hndahesudintocctmsdriver.mypop.PopNorBottomPic2
|
||||
import com.arpa.hndahesudintocctmsdriver.net.BaseObserver
|
||||
import com.arpa.hndahesudintocctmsdriver.net.DataManager
|
||||
import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack
|
||||
@ -20,8 +25,19 @@ import com.arpa.mylibrary.utils.ImageLoader
|
||||
import com.arpa.mylibrary.utils.PickerUtils
|
||||
import com.arpa.mylibrary.utils.TimeUtil
|
||||
import com.arpa.mylibrary.utils.ToastUtils
|
||||
import com.arpa.mylibrary.weight.GlideEngine
|
||||
import com.arpa.mylibrary.weight.ImageFileCompressEngine
|
||||
import com.baidu.ocr.ui.camera.CameraActivity
|
||||
import com.baidu.ocr.ui.camera.CameraNativeHelper
|
||||
import com.luck.picture.lib.basic.PictureSelectionModel
|
||||
import com.luck.picture.lib.basic.PictureSelector
|
||||
import com.luck.picture.lib.config.SelectMimeType
|
||||
import com.luck.picture.lib.entity.LocalMedia
|
||||
import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
||||
import com.lxj.xpopup.XPopup
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
||||
@ -42,6 +58,7 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
setResult(RESULT_OK)
|
||||
finish()
|
||||
}
|
||||
|
||||
var isOnlyShow =
|
||||
intent.extras?.getBoolean(AppConfig.IS_ONLY_SHOW, false) == true
|
||||
binding.run {
|
||||
@ -113,72 +130,91 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
}
|
||||
|
||||
tvFrontSeeBig.setOnClickListener {
|
||||
OcrUtils.getInstance()
|
||||
.ocrPerson(
|
||||
XPopup.Builder(mContext)
|
||||
.dismissOnTouchOutside(true)
|
||||
.asCustom(PopNorBottomPic2(
|
||||
mContext,
|
||||
perInfoBean.idcardFrontUrl,
|
||||
this@EditPersonActivity
|
||||
) { picPath, result ->
|
||||
if (result?.data?.face == null) {
|
||||
ToastUtils.showToast(mContext, "请选择正确证件照片")
|
||||
return@ocrPerson
|
||||
}
|
||||
result?.data?.face?.data.let {
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.locPic, 12, ivFront)
|
||||
perInfoBean.idcardFrontUrl = picPath.picPath
|
||||
it?.run {
|
||||
perInfoBean.run {
|
||||
idcardNo = idNumber
|
||||
idcardName = name
|
||||
idcardAddress = address
|
||||
idcardEthnicity = ethnicity
|
||||
idcardSex = if (sex == "男") "0" else "1"
|
||||
}
|
||||
}
|
||||
binding.run {
|
||||
etName.setText(it?.name)
|
||||
etId.setText(it?.idNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
) {
|
||||
dealPic(it, true)
|
||||
})
|
||||
.show()
|
||||
|
||||
// OcrUtils.getInstance()
|
||||
// .ocrPerson(
|
||||
// mContext,
|
||||
// perInfoBean.idcardFrontUrl,
|
||||
// this@EditPersonActivity
|
||||
// ) { picPath, result ->
|
||||
// if (result?.data?.face == null) {
|
||||
// ToastUtils.showToast(mContext, "请选择正确证件照片")
|
||||
// return@ocrPerson
|
||||
// }
|
||||
// result?.data?.face?.data.let {
|
||||
// ImageLoader.getInstance()
|
||||
// .loadRoundImage(mContext, picPath.locPic, 12, ivFront)
|
||||
// perInfoBean.idcardFrontUrl = picPath.picPath
|
||||
// it?.run {
|
||||
// perInfoBean.run {
|
||||
// idcardNo = idNumber
|
||||
// idcardName = name
|
||||
// idcardAddress = address
|
||||
// idcardEthnicity = ethnicity
|
||||
// idcardSex = if (sex == "男") "0" else "1"
|
||||
// }
|
||||
// }
|
||||
// binding.run {
|
||||
// etName.setText(it?.name)
|
||||
// etId.setText(it?.idNumber)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
tvBackSeeBig.setOnClickListener {
|
||||
OcrUtils.getInstance()
|
||||
.ocrPerson(mContext, this@EditPersonActivity) { picPath, result ->
|
||||
if (result?.data?.back == null) {
|
||||
ToastUtils.showToast(mContext, "请选择正确证件照片")
|
||||
return@ocrPerson
|
||||
}
|
||||
XPopup.Builder(mContext)
|
||||
.dismissOnTouchOutside(true)
|
||||
.asCustom(PopNorBottomPic2(
|
||||
mContext,
|
||||
) {
|
||||
dealPic(it, false)
|
||||
})
|
||||
.show()
|
||||
|
||||
result?.data?.back?.let {
|
||||
perInfoBean.idcardBackUrl = picPath.picPath
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.locPic, 12, ivBack)
|
||||
|
||||
if (it.data.validPeriod?.contains("-") == true) {
|
||||
val split = it.data.validPeriod.split("-")
|
||||
binding.run {
|
||||
tvStart.text =
|
||||
TimeUtil.changeDateFormat(split[0])
|
||||
tvEnd.text =
|
||||
if (split.size == 2) TimeUtil.changeDateFormat(
|
||||
split[1]
|
||||
) else ""
|
||||
}
|
||||
}
|
||||
|
||||
if (it.data.validPeriod?.contains("长期") == true) {
|
||||
val split = it.data.validPeriod.split("长期")
|
||||
binding.run {
|
||||
tvStart.text =
|
||||
TimeUtil.changeDateFormat(split[0])
|
||||
tvEnd.text = "长期"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// OcrUtils.getInstance()
|
||||
// .ocrPerson(mContext, this@EditPersonActivity) { picPath, result ->
|
||||
// if (result?.data?.back == null) {
|
||||
// ToastUtils.showToast(mContext, "请选择正确证件照片")
|
||||
// return@ocrPerson
|
||||
// }
|
||||
//
|
||||
// result?.data?.back?.let {
|
||||
// perInfoBean.idcardBackUrl = picPath.picPath
|
||||
// ImageLoader.getInstance()
|
||||
// .loadRoundImage(mContext, picPath.locPic, 12, ivBack)
|
||||
//
|
||||
// if (it.data.validPeriod?.contains("-") == true) {
|
||||
// val split = it.data.validPeriod.split("-")
|
||||
// binding.run {
|
||||
// tvStart.text =
|
||||
// TimeUtil.changeDateFormat(split[0])
|
||||
// tvEnd.text =
|
||||
// if (split.size == 2) TimeUtil.changeDateFormat(
|
||||
// split[1]
|
||||
// ) else ""
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (it.data.validPeriod?.contains("长期") == true) {
|
||||
// val split = it.data.validPeriod.split("长期")
|
||||
// binding.run {
|
||||
// tvStart.text =
|
||||
// TimeUtil.changeDateFormat(split[0])
|
||||
// tvEnd.text = "长期"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
ivFront.setOnClickListener {
|
||||
@ -201,6 +237,42 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||
if (data != null) {
|
||||
// binding.ivBack.setImageBitmap(BitmapFactory.decodeFile(getSaveFile(application).absolutePath));
|
||||
// ImageLoader.getInstance()
|
||||
// .loadRoundImage(mContext, getSaveFile(application).absolutePath, 12, binding.ivBack)
|
||||
val contentType = data.getStringExtra(CameraActivity.KEY_CONTENT_TYPE)
|
||||
if (contentType == CameraActivity.CONTENT_TYPE_ID_CARD_FRONT){
|
||||
OcrUtils.getInstance().onlyOcrPerson(
|
||||
mContext,
|
||||
getSaveFile(application).absolutePath,
|
||||
this@EditPersonActivity
|
||||
) { picPath, result ->
|
||||
dealOcrResult(picPath, result, true)
|
||||
}
|
||||
}else{
|
||||
OcrUtils.getInstance().onlyOcrPerson(
|
||||
mContext,
|
||||
getSaveFile(application).absolutePath,
|
||||
this@EditPersonActivity
|
||||
) { picPath, result ->
|
||||
dealOcrResult(picPath, result, false)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() { // 释放本地质量控制模型
|
||||
// 释放本地质量控制模型
|
||||
CameraNativeHelper.release()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
DataManager.getInstance().getUserDetail()
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
@ -247,4 +319,99 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
setResult(RESULT_OK)
|
||||
finish()
|
||||
}
|
||||
|
||||
fun getSaveFile(context: Context): File {
|
||||
return File(context.filesDir, "pic1.jpg")
|
||||
}
|
||||
|
||||
private fun dealPic(isPhoto: Boolean, isFront: Boolean) {
|
||||
if (isPhoto) {
|
||||
val intent = Intent(this@EditPersonActivity, CameraActivity::class.java)
|
||||
intent.putExtra(
|
||||
CameraActivity.KEY_OUTPUT_FILE_PATH,
|
||||
getSaveFile(application).absolutePath
|
||||
)
|
||||
intent.putExtra(
|
||||
CameraActivity.KEY_CONTENT_TYPE,
|
||||
if(isFront) CameraActivity.CONTENT_TYPE_ID_CARD_FRONT else CameraActivity.CONTENT_TYPE_ID_CARD_BACK
|
||||
)
|
||||
startActivityForResult(intent, 102)
|
||||
|
||||
} else {
|
||||
// 进入相册
|
||||
val selectionModel: PictureSelectionModel = PictureSelector.create(mContext)
|
||||
.openGallery(SelectMimeType.TYPE_IMAGE)
|
||||
.isDisplayCamera(false)//关闭拍照
|
||||
.setImageEngine(GlideEngine.createGlideEngine())
|
||||
.setCompressEngine(ImageFileCompressEngine())
|
||||
.isPreviewImage(true)
|
||||
.isMaxSelectEnabledMask(true)
|
||||
.isGif(false)
|
||||
selectionModel.forResult(object : OnResultCallbackListener<LocalMedia> {
|
||||
override fun onResult(result: ArrayList<LocalMedia>) {
|
||||
OcrUtils.getInstance().onlyOcrPerson(
|
||||
mContext,
|
||||
result[0].availablePath,
|
||||
this@EditPersonActivity
|
||||
) { picPath, result ->
|
||||
dealOcrResult(picPath, result, isFront)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancel() {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun dealOcrResult(picPath: PicPath, ocrPersonBean: OcrPersonBean?, isFront: Boolean) {
|
||||
if (isFront) {
|
||||
ocrPersonBean?.data?.face?.data.let {
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.picPath, 12, binding.ivFront)
|
||||
perInfoBean.idcardFrontUrl = picPath.picPath
|
||||
it?.run {
|
||||
perInfoBean.run {
|
||||
idcardNo = idNumber
|
||||
idcardName = name
|
||||
idcardAddress = address
|
||||
idcardEthnicity = ethnicity
|
||||
idcardSex = if (sex == "男") "0" else "1"
|
||||
}
|
||||
}
|
||||
binding.run {
|
||||
etName.setText(it?.name)
|
||||
etId.setText(it?.idNumber)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ocrPersonBean?.data?.back?.let {
|
||||
perInfoBean.idcardBackUrl = picPath.picPath
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.picPath, 12, binding.ivBack)
|
||||
|
||||
if (it.data.validPeriod?.contains("-") == true) {
|
||||
val split = it.data.validPeriod.split("-")
|
||||
binding.run {
|
||||
tvStart.text =
|
||||
TimeUtil.changeDateFormat(split[0])
|
||||
tvEnd.text =
|
||||
if (split.size == 2) TimeUtil.changeDateFormat(
|
||||
split[1]
|
||||
) else ""
|
||||
}
|
||||
}
|
||||
if (it.data.validPeriod?.contains("长期") == true) {
|
||||
val split = it.data.validPeriod.split("长期")
|
||||
binding.run {
|
||||
tvStart.text =
|
||||
TimeUtil.changeDateFormat(split[0])
|
||||
tvEnd.text = "长期"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -113,10 +113,10 @@ class EditQualificationActivity : BaseActivity<ActivityAuthQualificationBinding>
|
||||
qualificationCertificateEffectiveEnd = binding.tvDate.text.toString()
|
||||
|
||||
|
||||
if (qualificationCertificateEffectiveEnd.isNullOrEmpty()) {
|
||||
showToast("请完善信息")
|
||||
return@run
|
||||
}
|
||||
// if (qualificationCertificateEffectiveEnd.isNullOrEmpty()) {
|
||||
// showToast("请完善信息")
|
||||
// return@run
|
||||
// }
|
||||
|
||||
DataManager.getInstance().reUpDriverQualificationCertificate(upQuaInfo)
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
@ -221,6 +221,7 @@ class EditTrailerActivity : BaseActivity<ActivityAuthTrailerBinding>() {
|
||||
}
|
||||
binding.run {
|
||||
etHdzzz.setText(upDrivingInfoBean.approvedLoad)
|
||||
tvInfo.text = it.overallDimension
|
||||
}
|
||||
|
||||
//车长
|
||||
|
@ -140,7 +140,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
tvMar.isSelected = true
|
||||
|
||||
ivMyWaybill.setOnClickListener {
|
||||
EventBus.getDefault().post(GoWaybillEvent(2))
|
||||
EventBus.getDefault().post(GoWaybillEvent(1))
|
||||
// if (::mListener.isInitialized)
|
||||
// mListener(2)
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ class MineFragment : BaseFragment<FragmentMineBinding>(), View.OnClickListener,
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(16.0f),
|
||||
ConvertUtils.dp2px(8.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
@ -189,9 +189,14 @@ class MineFragment : BaseFragment<FragmentMineBinding>(), View.OnClickListener,
|
||||
}
|
||||
|
||||
tvAddCar.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext, AuthDrivingActivity::class.java,Bundle().apply {
|
||||
putBoolean(AppConfig.IS_GO_MINE,true)
|
||||
})
|
||||
|
||||
ActivityUtils.startActivity(mContext, CarsManActivity::class.java)
|
||||
// ActivityUtils.startActivity(
|
||||
// mContext,
|
||||
// AuthDrivingActivity::class.java,
|
||||
// Bundle().apply {
|
||||
// putBoolean(AppConfig.IS_GO_MINE, true)
|
||||
// })
|
||||
}
|
||||
|
||||
// llNotic.setOnClickListener {
|
||||
@ -265,7 +270,7 @@ class MineFragment : BaseFragment<FragmentMineBinding>(), View.OnClickListener,
|
||||
}
|
||||
|
||||
2 -> {
|
||||
BaseUtils.callPhone(activity as AppCompatActivity?,"拨打电话","13783631930")
|
||||
BaseUtils.callPhone(activity as AppCompatActivity?, "拨打电话", "13783631930")
|
||||
// ToastUtils.showToast(mContext, plats[pos].title)
|
||||
}
|
||||
|
||||
@ -350,8 +355,6 @@ class MineFragment : BaseFragment<FragmentMineBinding>(), View.OnClickListener,
|
||||
} else {
|
||||
carAdapter?.submitList(t.data)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.ui.mine.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.arpa.hndahesudintocctmsdriver.R
|
||||
import com.arpa.hndahesudintocctmsdriver.base.WebActivity
|
||||
@ -20,13 +21,14 @@ class RulesActivity : BaseActivity<ActivityRulesBinding>() {
|
||||
binding.run {
|
||||
rlOne.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext,WebActivity::class.java,Bundle().apply {
|
||||
putString("url","www.baidu.com")
|
||||
putString("title","百度")
|
||||
putString("url","http://agreement.dahehuoyun.com/#/user")
|
||||
putString("title","用户服务协议")
|
||||
})
|
||||
}
|
||||
rlTwo.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext,WebActivity::class.java,Bundle().apply {
|
||||
putString("url","www.baidu.com")
|
||||
putString("title","隐私协议")
|
||||
putString("url","http://agreement.dahehuoyun.com/huawei/#/private")
|
||||
})
|
||||
}
|
||||
rlThree.setOnClickListener {
|
||||
|
@ -57,7 +57,7 @@ class AllWaybillFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCa
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(8.0f),
|
||||
ConvertUtils.dp2px(16.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
|
@ -52,7 +52,7 @@ class CancelWaybillFragment : BaseFragment<FragmentWaybillListBinding>(), Refres
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(8.0f),
|
||||
ConvertUtils.dp2px(16.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
|
@ -55,7 +55,7 @@ class WaitAppraiseFragment : BaseFragment<FragmentWaybillListBinding>(), Refresh
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(8.0f),
|
||||
ConvertUtils.dp2px(16.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
|
@ -55,7 +55,7 @@ class WaitLoadFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCall
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(8.0f),
|
||||
ConvertUtils.dp2px(16.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
|
@ -55,7 +55,7 @@ class WaitSignFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCall
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(8.0f),
|
||||
ConvertUtils.dp2px(16.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
|
@ -55,7 +55,7 @@ class WaitUnLoadFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCa
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(8.0f),
|
||||
ConvertUtils.dp2px(16.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
|
@ -12,10 +12,12 @@ import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack
|
||||
import com.arpa.hndahesudintocctmsdriver.oss.OssServiceUtil
|
||||
import com.arpa.mylibrary.base.SingletonNoPHolder
|
||||
import com.arpa.mylibrary.net.CommonResponseBean
|
||||
import com.arpa.mylibrary.pop.PopNorBottomPic
|
||||
import com.arpa.mylibrary.utils.LoadingUtils
|
||||
import com.arpa.mylibrary.utils.PopsUtils
|
||||
import com.arpa.mylibrary.utils.RegexpUtils
|
||||
import com.arpa.mylibrary.utils.ToastUtils
|
||||
import com.lxj.xpopup.XPopup
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
|
||||
@ -118,6 +120,53 @@ class OcrUtils private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传oss并ocr识别
|
||||
* @param context Context
|
||||
* @param picPath String
|
||||
* @param activity AppCompatActivity
|
||||
* @param listener OnOcrPicResultListener
|
||||
*/
|
||||
fun onlyOcrPerson(context: Context,picPath: String, activity: AppCompatActivity, listener: OnOcrPicResultListener){
|
||||
//上传oss得到图片地址
|
||||
LoadingUtils.instance.showLoading(activity)
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(picPath, null)
|
||||
setResultCallBack { data, oldPath ->
|
||||
DataManager.getInstance().recognizeIdcard(oldPath)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(context, object : RxHttpCallBack<OcrPersonBean>() {
|
||||
override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
|
||||
super.onSuccess(t)
|
||||
LoadingUtils.instance.dissLoading()
|
||||
t.data?.let {
|
||||
listener.onSuccResult(
|
||||
PicPath(picPath, oldPath), it
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCodeError(
|
||||
mContext: Context?,
|
||||
t: CommonResponseBean<OcrPersonBean>
|
||||
) {
|
||||
// super.onCodeError(mContext, t)
|
||||
LoadingUtils.instance.dissLoading()
|
||||
if (t.code == 500) {
|
||||
// if (t.msg.contains("code: 400, The image type does not match the API operation")) {
|
||||
ToastUtils.showToast(mContext, "图片识别失败,请重新上传")
|
||||
// } else {
|
||||
// ToastUtils.showToast(mContext, t.msg)
|
||||
// }
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 驾驶证ocr识别
|
||||
* */
|
||||
|
BIN
app/src/main/res/drawable-xxhdpi/icon_wallert.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_wallert.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -81,6 +81,7 @@
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
@ -34,6 +34,13 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_20"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cdPerson"
|
||||
|
@ -100,6 +100,7 @@
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/right_gray" />
|
||||
|
@ -63,7 +63,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="货物运输协议"
|
||||
android:text="隐私协议"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
@ -92,6 +92,7 @@
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:visibility="gone"
|
||||
android:id="@+id/rlThree"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
|
@ -168,6 +168,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="我的钱包"
|
||||
android:drawableLeft="@drawable/icon_wallert"
|
||||
android:drawablePadding="@dimen/dp_6"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:textStyle="bold"></TextView>
|
||||
@ -280,7 +282,7 @@
|
||||
<RelativeLayout
|
||||
android:id="@+id/rlCars"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/lltwo"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
@ -305,7 +307,7 @@
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="添加车辆"
|
||||
android:text="车辆列表"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignBottom="@+id/tvToolsTitle"
|
||||
android:layout_alignTop="@+id/tvToolsTitle"
|
||||
|
@ -48,7 +48,7 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
|
||||
|
||||
|
||||
api project(path: ':ocr_ui')
|
||||
api rootProject.ext.dependencies["gson"]
|
||||
api rootProject.ext.dependencies["glide"]
|
||||
annotationProcessor rootProject.ext.dependencies["glide-compiler"]
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.arpa.mylibrary.callback
|
||||
|
||||
import com.luck.picture.lib.entity.LocalMedia
|
||||
|
||||
/**
|
||||
* @ClassName OnPicResultListener
|
||||
* @Author john
|
||||
* @Date 2024/2/6 14:48
|
||||
* @Description 是否选择拍照 ,true为拍照 false为相册
|
||||
*/
|
||||
fun interface OnPicTypeistener {
|
||||
fun onResult(isPhoto: Boolean)
|
||||
}
|
@ -23,3 +23,4 @@ rootProject.name = "GLDriver"
|
||||
include ':app'
|
||||
include ':mylibrary'
|
||||
include ':keeplibrary'
|
||||
include ':ocr_ui'
|
||||
|
Loading…
Reference in New Issue
Block a user