身份证拍照框2.0
This commit is contained in:
parent
4650884846
commit
be767e7d46
@ -12,6 +12,7 @@
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/keeplibrary" />
|
||||
<option value="$PROJECT_DIR$/mylibrary" />
|
||||
<option value="$PROJECT_DIR$/ocr_ui" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
|
@ -435,7 +435,7 @@ interface Api {
|
||||
*根据手机号查询司机
|
||||
* */
|
||||
@GET(BASE_URL + "driver/captain/selectDriverList")
|
||||
fun selectDriverList(@Query("phone") phone: String): Observable<CommonResponseBean<MutableList<DriverBean>>>
|
||||
fun selectDriverList(@Query("phone") phone: String,@Query("pageNum") pageNum: Int,@Query("pageSize") pageSize: Int): Observable<CommonResponseBean<MutableList<DriverBean>>>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,10 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.oss;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
@ -22,11 +26,13 @@ import com.alibaba.sdk.android.oss.model.PutObjectRequest;
|
||||
import com.alibaba.sdk.android.oss.model.PutObjectResult;
|
||||
import com.arpa.hndahesudintocctmsdriver.base.App;
|
||||
import com.arpa.mylibrary.utils.LoadingUtils;
|
||||
import com.arpa.mylibrary.utils.TimeUtil;
|
||||
import com.lxj.xpopup.impl.LoadingPopupView;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
@ -110,7 +116,10 @@ public class OssServiceUtil {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
File file = new File(localFile);
|
||||
|
||||
|
||||
if (!file.exists()) {
|
||||
return;
|
||||
}
|
||||
@ -382,4 +391,29 @@ public class OssServiceUtil {
|
||||
public interface PicsResultCallback {
|
||||
void onOssSuccess(List<String> success, List<String> failure);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the corresponding path to a file from the given content:// URI
|
||||
* @param selectedVideoUri The content:// URI to find the file path from
|
||||
* @param contentResolver The content resolver to use to perform the query.
|
||||
* @return the file path as a string
|
||||
*/
|
||||
public String getFilePathFromContentUri(Uri selectedVideoUri,
|
||||
ContentResolver contentResolver) {
|
||||
String filePath;
|
||||
String[] filePathColumn = {MediaStore.MediaColumns.DATA};
|
||||
|
||||
Cursor cursor = contentResolver.query(selectedVideoUri, filePathColumn, null, null, null);
|
||||
// 也可用下面的方法拿到cursor
|
||||
// Cursor cursor = this.context.managedQuery(selectedVideoUri, filePathColumn, null, null, null);
|
||||
|
||||
cursor.moveToFirst();
|
||||
|
||||
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
|
||||
filePath = cursor.getString(columnIndex);
|
||||
cursor.close();
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ class HomeActivity : BaseActivity<ActivityHomeBinding>(), OnTabSelectListener,
|
||||
|
||||
private val mNormalRes = mutableListOf(
|
||||
R.drawable.tab_home_normal,
|
||||
R.drawable.tab_message_normal,
|
||||
R.drawable.tab_waybill_normal,
|
||||
R.drawable.tab_mine_normal
|
||||
)
|
||||
|
@ -1,12 +1,17 @@
|
||||
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.alibaba.idst.nui.DateUtil.DEFAULT_FORMAT_DATE
|
||||
import com.arpa.hndahesudintocctmsdriver.R
|
||||
import com.arpa.hndahesudintocctmsdriver.base.AppConfig
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.OcrPersonBean
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.UpPersonInfoBean
|
||||
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
|
||||
@ -22,8 +27,18 @@ 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.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
|
||||
|
||||
@ -69,7 +84,11 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
}
|
||||
|
||||
if (!tvEnd.text.toString().contains("长期")) {
|
||||
if (TimeUtil.compareDate(tvEnd.text.toString(), SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()))) {
|
||||
if (TimeUtil.compareDate(
|
||||
tvEnd.text.toString(),
|
||||
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
|
||||
)
|
||||
) {
|
||||
ToastUtils.showToast(mContext, "身份证已过期,请及时更换最新证件")
|
||||
}
|
||||
}
|
||||
@ -80,7 +99,7 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
|
||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
||||
super.onSuccess(t)
|
||||
BaseSPUtils.put(mContext,AppConfig.USER_CARID,perInfoBean.idcardNo)
|
||||
BaseSPUtils.put(mContext, AppConfig.USER_CARID, perInfoBean.idcardNo)
|
||||
ActivityUtils.startActivity(mContext, AuthDriverActivity::class.java)
|
||||
// finish()
|
||||
}
|
||||
@ -105,35 +124,17 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
}
|
||||
|
||||
ivFront.setOnClickListener {
|
||||
if (perInfoBean.idcardFrontUrl.isNullOrBlank()){
|
||||
OcrUtils.getInstance()
|
||||
.ocrPerson(mContext, this@AuthPersonActivity) { picPath, result ->
|
||||
if (result?.data?.face == null) {
|
||||
ToastUtils.showToast(mContext, "请选择正确证件照片")
|
||||
return@ocrPerson
|
||||
}
|
||||
if (perInfoBean.idcardFrontUrl.isNullOrBlank()) {
|
||||
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.locPic, 12, ivFront)
|
||||
tvFrontSeeBig.visibility = View.VISIBLE
|
||||
perInfoBean.idcardFrontUrl = picPath.picPath
|
||||
result?.data?.face?.data.let {
|
||||
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{
|
||||
XPopup.Builder(mContext)
|
||||
.dismissOnTouchOutside(true)
|
||||
.asCustom(PopNorBottomPic2(
|
||||
mContext,
|
||||
) {
|
||||
dealPic(it, true)
|
||||
})
|
||||
.show()
|
||||
} else {
|
||||
CommonPopUtils.getInstance().showOnePic(
|
||||
mContext,
|
||||
ivFront, perInfoBean.idcardFrontUrl
|
||||
@ -143,44 +144,16 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
}
|
||||
|
||||
ivBack.setOnClickListener {
|
||||
if (perInfoBean.idcardBackUrl.isNullOrBlank()){
|
||||
OcrUtils.getInstance()
|
||||
.ocrPerson(mContext, this@AuthPersonActivity) { picPath, result ->
|
||||
|
||||
if (result?.data?.back == null) {
|
||||
ToastUtils.showToast(mContext, "请选择正确证件照片")
|
||||
return@ocrPerson
|
||||
}
|
||||
|
||||
perInfoBean.idcardBackUrl = picPath.picPath
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.locPic, 12, ivBack)
|
||||
tvBackSeeBig.visibility = View.VISIBLE
|
||||
result?.data?.back?.let {
|
||||
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 = "长期"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
if (perInfoBean.idcardBackUrl.isNullOrBlank()) {
|
||||
XPopup.Builder(mContext)
|
||||
.dismissOnTouchOutside(true)
|
||||
.asCustom(PopNorBottomPic2(
|
||||
mContext,
|
||||
) {
|
||||
dealPic(it, false)
|
||||
})
|
||||
.show()
|
||||
} else {
|
||||
CommonPopUtils.getInstance().showOnePic(
|
||||
mContext,
|
||||
ivBack, perInfoBean.idcardBackUrl
|
||||
@ -188,6 +161,20 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tvFrontSeeBig.setOnClickListener {
|
||||
CommonPopUtils.getInstance().showOnePic(
|
||||
mContext,
|
||||
ivFront, perInfoBean.idcardFrontUrl
|
||||
)
|
||||
}
|
||||
|
||||
tvBackSeeBig.setOnClickListener {
|
||||
CommonPopUtils.getInstance().showOnePic(
|
||||
mContext,
|
||||
ivBack, perInfoBean.idcardBackUrl
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,4 +221,132 @@ class AuthPersonActivity : 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@AuthPersonActivity
|
||||
) { picPath, result ->
|
||||
dealOcrResult(picPath, result, true)
|
||||
}
|
||||
} else {
|
||||
OcrUtils.getInstance().onlyOcrPerson(
|
||||
mContext,
|
||||
getSaveFile(application).absolutePath,
|
||||
this@AuthPersonActivity
|
||||
) { picPath, result ->
|
||||
dealOcrResult(picPath, result, false)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getSaveFile(context: Context): File {
|
||||
return File(context.filesDir, "pic1.jpg")
|
||||
}
|
||||
|
||||
private fun dealPic(isPhoto: Boolean, isFront: Boolean) {
|
||||
if (isPhoto) {
|
||||
val intent = Intent(this@AuthPersonActivity, 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)
|
||||
.setMaxSelectNum(1)
|
||||
.isMaxSelectEnabledMask(true)
|
||||
.isGif(false)
|
||||
selectionModel.forResult(object : OnResultCallbackListener<LocalMedia> {
|
||||
override fun onResult(result: ArrayList<LocalMedia>) {
|
||||
OcrUtils.getInstance().onlyOcrPerson(
|
||||
mContext,
|
||||
result[0].availablePath,
|
||||
this@AuthPersonActivity
|
||||
) { 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 {
|
||||
tvFrontSeeBig.visibility = View.VISIBLE
|
||||
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 ""
|
||||
}
|
||||
}
|
||||
binding.tvBackSeeBig.visibility = View.VISIBLE
|
||||
if (it.data.validPeriod?.contains("长期") == true) {
|
||||
val split = it.data.validPeriod.split("长期")
|
||||
binding.run {
|
||||
tvStart.text =
|
||||
TimeUtil.changeDateFormat(split[0])
|
||||
tvEnd.text = "长期"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -47,12 +47,16 @@ class EditBankCardActivity : BaseActivity<ActivityAuthBankcardBinding>() {
|
||||
subMit()
|
||||
}
|
||||
ivFront.setOnClickListener {
|
||||
if (!perInfoBean.driverBankcardPhotoUrl.isNullOrEmpty())
|
||||
if (!perInfoBean.driverBankcardPhotoUrl.isNullOrEmpty()){
|
||||
CommonPopUtils.getInstance().seeBigPic(
|
||||
mContext,
|
||||
binding.ivFront,
|
||||
perInfoBean.driverBankcardPhotoUrl
|
||||
)
|
||||
}else{
|
||||
selBankPic()
|
||||
}
|
||||
|
||||
}
|
||||
tvChangeFront.setOnClickListener {
|
||||
selBankPic()
|
||||
@ -119,6 +123,7 @@ class EditBankCardActivity : BaseActivity<ActivityAuthBankcardBinding>() {
|
||||
binding.let {
|
||||
it.etId.setText(cardNumber)
|
||||
it.tvBankName.setText(bankName)
|
||||
it.tvChangeFront.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,12 +71,22 @@ class EditDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
|
||||
|
||||
ivFront.setOnClickListener {
|
||||
|
||||
seeBigPic(binding.ivFront, driverInfoBean.licensePhotoFaceUrl)
|
||||
if (driverInfoBean.licensePhotoFaceUrl.isNullOrEmpty()){
|
||||
selFrontPic()
|
||||
}else{
|
||||
seeBigPic(binding.ivFront, driverInfoBean.licensePhotoFaceUrl)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ivBack.setOnClickListener {
|
||||
|
||||
seeBigPic(binding.ivBack, driverInfoBean.licensePhotoBackUrl)
|
||||
if (driverInfoBean.licensePhotoBackUrl.isNullOrEmpty()){
|
||||
selBackPic()
|
||||
}else{
|
||||
seeBigPic(binding.ivBack, driverInfoBean.licensePhotoBackUrl)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tvChangeFront.setOnClickListener {
|
||||
@ -219,6 +229,7 @@ class EditDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
|
||||
issueAuthority //发证机关
|
||||
}
|
||||
binding.run {
|
||||
tvChangeFront.visibility = View.VISIBLE
|
||||
etName.setText(it.name)
|
||||
etId.setText(it.licenseNumber)
|
||||
tvCarType.text = it.approvedType
|
||||
@ -248,6 +259,7 @@ class EditDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.locPic, 12, binding.ivBack)
|
||||
driverInfoBean.licensePhotoBackUrl = picPath.picPath
|
||||
binding.tvChangeBack.visibility = View.VISIBLE
|
||||
it?.run {
|
||||
backLicName = it.name
|
||||
driverInfoBean.licenseRecordNumber = recordNumber
|
||||
|
@ -218,18 +218,40 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
}
|
||||
|
||||
ivFront.setOnClickListener {
|
||||
CommonPopUtils.getInstance().showOnePic(
|
||||
mContext,
|
||||
ivFront, perInfoBean.idcardFrontUrl
|
||||
)
|
||||
|
||||
if (perInfoBean.idcardFrontUrl.isNullOrEmpty()) {
|
||||
XPopup.Builder(mContext)
|
||||
.dismissOnTouchOutside(true)
|
||||
.asCustom(PopNorBottomPic2(
|
||||
mContext,
|
||||
) {
|
||||
dealPic(it, true)
|
||||
})
|
||||
.show()
|
||||
} else {
|
||||
CommonPopUtils.getInstance().showOnePic(
|
||||
mContext,
|
||||
ivFront, perInfoBean.idcardFrontUrl
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
ivBack.setOnClickListener {
|
||||
CommonPopUtils.getInstance().showOnePic(
|
||||
mContext,
|
||||
ivBack, perInfoBean.idcardBackUrl
|
||||
)
|
||||
if (perInfoBean.idcardBackUrl.isNullOrEmpty()) {
|
||||
XPopup.Builder(mContext)
|
||||
.dismissOnTouchOutside(true)
|
||||
.asCustom(PopNorBottomPic2(
|
||||
mContext,
|
||||
) {
|
||||
dealPic(it, false)
|
||||
})
|
||||
.show()
|
||||
} else {
|
||||
CommonPopUtils.getInstance().showOnePic(
|
||||
mContext,
|
||||
ivBack, perInfoBean.idcardBackUrl
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -245,7 +267,7 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
// 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){
|
||||
if (contentType == CameraActivity.CONTENT_TYPE_ID_CARD_FRONT) {
|
||||
OcrUtils.getInstance().onlyOcrPerson(
|
||||
mContext,
|
||||
getSaveFile(application).absolutePath,
|
||||
@ -253,7 +275,7 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
) { picPath, result ->
|
||||
dealOcrResult(picPath, result, true)
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
OcrUtils.getInstance().onlyOcrPerson(
|
||||
mContext,
|
||||
getSaveFile(application).absolutePath,
|
||||
@ -333,7 +355,7 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
)
|
||||
intent.putExtra(
|
||||
CameraActivity.KEY_CONTENT_TYPE,
|
||||
if(isFront) CameraActivity.CONTENT_TYPE_ID_CARD_FRONT else CameraActivity.CONTENT_TYPE_ID_CARD_BACK
|
||||
if (isFront) CameraActivity.CONTENT_TYPE_ID_CARD_FRONT else CameraActivity.CONTENT_TYPE_ID_CARD_BACK
|
||||
)
|
||||
startActivityForResult(intent, 102)
|
||||
|
||||
@ -345,6 +367,7 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
.setImageEngine(GlideEngine.createGlideEngine())
|
||||
.setCompressEngine(ImageFileCompressEngine())
|
||||
.isPreviewImage(true)
|
||||
.setMaxSelectNum(1)
|
||||
.isMaxSelectEnabledMask(true)
|
||||
.isGif(false)
|
||||
selectionModel.forResult(object : OnResultCallbackListener<LocalMedia> {
|
||||
@ -381,6 +404,7 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
}
|
||||
}
|
||||
binding.run {
|
||||
tvFrontSeeBig.visibility = View.VISIBLE
|
||||
etName.setText(it?.name)
|
||||
etId.setText(it?.idNumber)
|
||||
}
|
||||
@ -402,6 +426,7 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
) else ""
|
||||
}
|
||||
}
|
||||
binding.tvBackSeeBig.visibility = View.VISIBLE
|
||||
if (it.data.validPeriod?.contains("长期") == true) {
|
||||
val split = it.data.validPeriod.split("长期")
|
||||
binding.run {
|
||||
|
@ -54,12 +54,22 @@ class EditQualificationActivity : BaseActivity<ActivityAuthQualificationBinding>
|
||||
}
|
||||
|
||||
ivFront.setOnClickListener {
|
||||
if (!upQuaInfo.qualificationCertificatePhotoUrl.isNullOrEmpty())
|
||||
if (!upQuaInfo.qualificationCertificatePhotoUrl.isNullOrEmpty()) {
|
||||
CommonPopUtils.getInstance().seeBigPic(
|
||||
mContext,
|
||||
binding.ivFront,
|
||||
upQuaInfo.qualificationCertificatePhotoUrl
|
||||
)
|
||||
} else {
|
||||
OcrUtils.getInstance()
|
||||
.noOcrUpPic(mContext, this@EditQualificationActivity) { picPath, _ ->
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.locPic, 12, ivFront)
|
||||
upQuaInfo.qualificationCertificatePhotoUrl = picPath.picPath
|
||||
binding.tvChangeFront.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tvChangeFront.setOnClickListener {
|
||||
@ -68,6 +78,7 @@ class EditQualificationActivity : BaseActivity<ActivityAuthQualificationBinding>
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.locPic, 12, ivFront)
|
||||
upQuaInfo.qualificationCertificatePhotoUrl = picPath.picPath
|
||||
binding.tvChangeFront.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class EditRoadActivity : BaseActivity<ActivityAuthRoadBinding>() {
|
||||
}
|
||||
binding.run {
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, data.licenseFaceUrl, 12, ivFront)
|
||||
.loadRoundImage(mContext, data.roadLicensePhotoUrl, 12, ivFront)
|
||||
|
||||
etID.setText(data.roadLicense)
|
||||
tvDate.text = data.roadLicenseValidity
|
||||
@ -93,7 +93,7 @@ class EditRoadActivity : BaseActivity<ActivityAuthRoadBinding>() {
|
||||
roadLicense = binding.etID.text.trim().toString()
|
||||
roadLicenseValidity = binding.tvDate.text.toString()
|
||||
|
||||
if (upRoad.roadLicense.isNullOrEmpty() || upRoad.roadLicenseValidity.isNullOrEmpty() || upRoad.roadLicensePhotoUrl.isNullOrEmpty()) {
|
||||
if (upRoad.roadLicensePhotoUrl.isNullOrEmpty()) {
|
||||
showToast("请完善信息")
|
||||
return
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ class InviteDriverActivity : BaseActivity<ActivityInviteDriverBinding>(), Refres
|
||||
if (phone.isNullOrEmpty()) {
|
||||
return
|
||||
}
|
||||
DataManager.getInstance().selectDriverList(phone).subscribeOn(Schedulers.io())
|
||||
DataManager.getInstance().selectDriverList(phone, mRefreshPage,mRefreshCount).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<MutableList<DriverBean>>() {
|
||||
override fun onSuccess(t: CommonResponseBean<MutableList<DriverBean>>) {
|
||||
|
@ -340,6 +340,7 @@ class MineFragment : BaseFragment<FragmentMineBinding>(), View.OnClickListener,
|
||||
val userInfo = SPUtils.instance.getUserInfo(mContext)
|
||||
if (userInfo?.isCarCaptain == "1") {//是否是车队长(0=否,1=是,9=未选择)
|
||||
binding.llNotic.visibility = View.GONE
|
||||
binding.rlCars.visibility = View.GONE
|
||||
} else {
|
||||
|
||||
//司机车辆显示
|
||||
|
@ -17,9 +17,14 @@ 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.luck.picture.lib.config.PictureMimeType
|
||||
import com.luck.picture.lib.utils.DateUtils
|
||||
import com.lxj.xpopup.XPopup
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import top.zibin.luban.Luban
|
||||
import top.zibin.luban.OnNewCompressListener
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* @ClassName OcrUtils
|
||||
@ -85,7 +90,7 @@ class OcrUtils private constructor() {
|
||||
LoadingUtils.instance.showLoading(activity)
|
||||
//上传oss得到图片地址
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(result[0].realPath, null)
|
||||
asyncPutImage(result[0].availablePath, null)
|
||||
setResultCallBack { data, oldPath ->
|
||||
DataManager.getInstance().recognizeIdcard(oldPath)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
@ -131,39 +136,64 @@ class OcrUtils private constructor() {
|
||||
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>
|
||||
) {
|
||||
//压缩
|
||||
Luban.with(context).load(picPath).ignoreBy(30).setRenameListener { filePath ->
|
||||
val indexOf = filePath.lastIndexOf(".")
|
||||
val postfix = if (indexOf != -1) filePath.substring(indexOf) else ".jpg"
|
||||
DateUtils.getCreateFileName("CMP_") + postfix
|
||||
}.filter { path ->
|
||||
if (PictureMimeType.isUrlHasImage(path) && !PictureMimeType.isHasHttp(path)) {
|
||||
true
|
||||
} else !PictureMimeType.isUrlHasGif(path)
|
||||
}.setCompressListener(object : OnNewCompressListener {
|
||||
override fun onStart() {}
|
||||
override fun onSuccess(source: String, compressFile: File) {
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(compressFile.absolutePath, 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) {
|
||||
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, "图片识别失败,请重新上传")
|
||||
ToastUtils.showToast(mContext, "图片识别失败,请重新上传")
|
||||
// } else {
|
||||
// ToastUtils.showToast(mContext, t.msg)
|
||||
// }
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(source: String, e: Throwable) {
|
||||
LoadingUtils.instance.dissLoading()
|
||||
// call?.onCallback(source, null)
|
||||
}
|
||||
}).launch()
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +205,7 @@ class OcrUtils private constructor() {
|
||||
LoadingUtils.instance.showLoading(activity)
|
||||
//上传oss得到图片地址
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(result[0].realPath, null)
|
||||
asyncPutImage(result[0].availablePath, null)
|
||||
setResultCallBack { data, oldPath ->
|
||||
DataManager.getInstance().recognizeDrivingLicense(oldPath)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
@ -233,7 +263,7 @@ class OcrUtils private constructor() {
|
||||
LoadingUtils.instance.showLoading(activity)
|
||||
//上传oss得到图片地址
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(result[0].realPath, null)
|
||||
asyncPutImage(result[0].availablePath, null)
|
||||
setResultCallBack { data, oldPath ->
|
||||
DataManager.getInstance().recognizeVehicleLicense(oldPath)//行驶证识别
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
@ -290,7 +320,7 @@ class OcrUtils private constructor() {
|
||||
PopsUtils.getInstance().showSimSelPic(context) { result ->
|
||||
//上传oss得到图片地址
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(result[0].realPath, activity)
|
||||
asyncPutImage(result[0].availablePath, activity)
|
||||
setResultCallBack { data, oldPath ->
|
||||
DataManager.getInstance().recognizeBankCard(oldPath)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
@ -346,7 +376,7 @@ class OcrUtils private constructor() {
|
||||
PopsUtils.getInstance().showSimSelPic(context) { result ->
|
||||
//上传oss得到图片地址
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(result[0].realPath, activity)
|
||||
asyncPutImage(result[0].availablePath, activity)
|
||||
setResultCallBack { data, oldPath ->
|
||||
DataManager.getInstance().recognizeBusinessLicense(oldPath)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
@ -447,7 +477,7 @@ class OcrUtils private constructor() {
|
||||
PopsUtils.getInstance().showSimSelPic(context) {
|
||||
var data = it[0]
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(data.realPath, activity)
|
||||
asyncPutImage(data.availablePath, activity)
|
||||
setResultCallBack { data, oldPath ->
|
||||
activity.runOnUiThread {
|
||||
listener.onSuccResult(
|
||||
|
@ -433,6 +433,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"
|
||||
|
@ -62,6 +62,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"
|
||||
|
@ -26,15 +26,18 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/tvName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_12"
|
||||
android:text="王师傅"
|
||||
android:lines="1"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/tvStatu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -47,7 +50,7 @@
|
||||
android:text="待加入"
|
||||
android:textColor="@color/main_red"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:visibility="gone" />
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -57,6 +57,7 @@ class PopNorBottomPic(
|
||||
// 单独拍照
|
||||
val cameraModel: PictureSelectionCameraModel = PictureSelector.create(context)
|
||||
.openCamera(SelectMimeType.TYPE_IMAGE)
|
||||
.setCompressEngine(ImageFileCompressEngine())
|
||||
// .setCameraInterceptListener(getCustomCameraEvent())//自定义相机
|
||||
// .setRecordAudioInterceptListener(MainActivity.MeOnRecordAudioInterceptListener())//录音回调事件
|
||||
// .setCropEngine(ImageFileCropEngine())//裁剪
|
||||
|
@ -22,7 +22,7 @@ class ImageFileCompressEngine : CompressFileEngine {
|
||||
source: ArrayList<Uri>?,
|
||||
call: OnKeyValueResultCallbackListener?
|
||||
) {
|
||||
Luban.with(context).load(source).ignoreBy(100).setRenameListener { filePath ->
|
||||
Luban.with(context).load(source).ignoreBy(30).setRenameListener { filePath ->
|
||||
val indexOf = filePath.lastIndexOf(".")
|
||||
val postfix = if (indexOf != -1) filePath.substring(indexOf) else ".jpg"
|
||||
DateUtils.getCreateFileName("CMP_") + postfix
|
||||
|
Loading…
Reference in New Issue
Block a user