Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
ShenghuoquanBusiness
Commits
3d37545f
Commit
3d37545f
authored
May 30, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 身份证相册选择上传+OCR逻辑
parent
24c50cd2
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
317 additions
and
4 deletions
+317
-4
Constant.kt
.../com/yidian/shenghuoquan/newscontent/constant/Constant.kt
+17
-0
GetIDCardOCRBean.kt
...henghuoquan/newscontent/http/httpbean/GetIDCardOCRBean.kt
+1
-1
LifeAccountIDCardAuthFragment.kt
...quan/newscontent/ui/auth/LifeAccountIDCardAuthFragment.kt
+235
-3
BitmapUtil.kt
...a/com/yidian/shenghuoquan/newscontent/utils/BitmapUtil.kt
+54
-0
LifeAccountAuthIdentityInfoEditView.kt
...newscontent/widget/LifeAccountAuthIdentityInfoEditView.kt
+10
-0
No files found.
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/constant/Constant.kt
View file @
3d37545f
...
...
@@ -6,6 +6,9 @@ package com.yidian.shenghuoquan.newscontent.constant
* description: 常量
*/
object
Constant
{
const
val
LIFE_ACCOUNT_AUTH_TAG
=
"LifeAccountAuth"
// 商户类型
const
val
ITEM_INDIVIDUAL_BUSINESSES
=
"个体工商户"
const
val
ITEM_COMMON_ENTERPRISE
=
"普通企业"
...
...
@@ -13,4 +16,18 @@ object Constant {
// 身份证、营业执照上传方式
const
val
ITEM_TAKE_PHOTO
=
"拍照"
const
val
ITEM_OPEN_ALBUM
=
"相册"
// 调用系统相机、打开系统相册 requestCode
const
val
REQUEST_CODE_OPEN_ALBUM
=
101
const
val
REQUEST_CODE_OPEN_CAMERA
=
102
// 身份证人像面、身份证国徽面、营业执照待上传临时存储path,营业执照相机拍照临时存储path
const
val
FILE_PATH_ID_CARD_PORTRAIT_FACE
=
"/ocr/id_card/portrait_face.jpg"
const
val
FILE_PATH_ID_CARD_NATIONAL_EMBLEM_FACE
=
"/ocr/id_card/national_emblem_face.jpg"
const
val
FILE_PATH_BUSINESS_LICENSE_CAMERA
=
"/ocr/business_license_camera.jpg"
const
val
FILE_PATH_BUSINESS_LICENSE
=
"/ocr/business_license.jpg"
// 上传身份证人像面、身份证国徽面标识
const
val
OPCODE_ID_CARD_PORTRAIT_FACE
=
0
const
val
OPCODE_ID_CARD_NATIONAL_EMBLEM_FACE
=
1
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/httpbean/GetIDCardOCRBean.kt
View file @
3d37545f
...
...
@@ -36,7 +36,7 @@ class GetIDCardOCRBean(val request: Request, val response: Response) {
)
data class
Legality
(
val
Edited
:
Int
,
val
Edited
:
Double
,
val
ID_Photo
:
Double
,
val
ID_Photo_Threshold
:
Double
,
val
Photocopy
:
Int
,
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/auth/LifeAccountIDCardAuthFragment.kt
View file @
3d37545f
This diff is collapsed.
Click to expand it.
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/BitmapUtil.kt
0 → 100644
View file @
3d37545f
package
com.yidian.shenghuoquan.newscontent.utils
import
android.content.Context
import
android.graphics.Bitmap
import
android.graphics.BitmapFactory
import
android.net.Uri
import
android.view.View
import
java.io.FileOutputStream
/**
* author: yinjiacheng
* date: 5/30/21 2:02 PM
* description: Bitmap相关操作
*/
object
BitmapUtil
{
/**
* 从Uri生成Bitmap
* @param container bitmap容器
*/
fun
generateBitmapFromUri
(
context
:
Context
?,
uri
:
Uri
?,
container
:
View
):
Bitmap
?
{
if
(
uri
==
null
)
return
null
val
parcelFileDescriptor
=
context
?.
contentResolver
?.
openFileDescriptor
(
uri
,
"r"
)
val
options
=
BitmapFactory
.
Options
()
options
.
inJustDecodeBounds
=
true
BitmapFactory
.
decodeFileDescriptor
(
parcelFileDescriptor
?.
fileDescriptor
,
null
,
options
)
// 尺寸压缩
val
sourceWidth
=
options
.
outWidth
val
sourceHeight
=
options
.
outHeight
var
inSampleSize
=
1
if
(
sourceWidth
>
container
.
width
||
sourceHeight
>
container
.
height
)
{
val
halfWidth
=
sourceWidth
/
2
val
halfHeight
=
sourceHeight
/
2
// 压缩后的尺寸与所需的尺寸进行比较
while
(
halfWidth
/
inSampleSize
>=
container
.
width
&&
halfHeight
/
inSampleSize
>=
container
.
height
)
{
inSampleSize
*=
2
}
}
options
.
inSampleSize
=
inSampleSize
options
.
inJustDecodeBounds
=
false
val
bitmap
=
BitmapFactory
.
decodeFileDescriptor
(
parcelFileDescriptor
?.
fileDescriptor
,
null
,
options
)
parcelFileDescriptor
?.
close
()
return
bitmap
}
/**
* Bitmap to File
* @param destPath 目标文件路径
*/
fun
generateFileFromBitmap
(
bitmap
:
Bitmap
?,
destPath
:
String
)
{
bitmap
?.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
15
,
FileOutputStream
(
destPath
))
}
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/widget/LifeAccountAuthIdentityInfoEditView.kt
View file @
3d37545f
...
...
@@ -60,6 +60,16 @@ class LifeAccountAuthIdentityInfoEditView @JvmOverloads constructor(
}
}
/**
* 填写传入的文字
*/
fun
fillEditContent
(
content
:
String
?)
{
if
(!
TextUtils
.
isEmpty
(
content
))
{
viewBinding
.
etContent
.
setText
(
content
)
viewBinding
.
ivClear
.
visibility
=
View
.
VISIBLE
}
}
override
fun
onClick
(
v
:
View
?)
{
if
(
v
?.
id
==
R
.
id
.
iv_clear
)
{
// 清除输入框中的内容
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment