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
1e1bbb4f
Commit
1e1bbb4f
authored
May 20, 2021
by
宋永孟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 调通idcard功能
parent
2c656752
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
100 additions
and
10 deletions
+100
-10
build.gradle
Components/newscontent/build.gradle
+1
-2
AndroidManifest.xml
Components/newscontent/src/main/AndroidManifest.xml
+4
-0
IDCardResultActivity.kt
...henghuoquan/newscontent/ui/idcard/IDCardResultActivity.kt
+25
-0
IDCardTestActivity.kt
.../shenghuoquan/newscontent/ui/idcard/IDCardTestActivity.kt
+39
-0
AccountUtil.kt
.../com/yidian/shenghuoquan/newscontent/utils/AccountUtil.kt
+7
-7
activity_idcard_result.xml
...ewscontent/src/main/res/layout/activity_idcard_result.xml
+23
-0
build.gradle
app/build.gradle
+1
-1
No files found.
Components/newscontent/build.gradle
View file @
1e1bbb4f
...
@@ -62,8 +62,7 @@ android {
...
@@ -62,8 +62,7 @@ android {
}
}
dependencies
{
dependencies
{
compile
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
rootProject
.
ext
.
dependencies
.
other
.
each
{
rootProject
.
ext
.
dependencies
.
other
.
each
{
implementation
project
(
it
)
implementation
project
(
it
)
...
...
Components/newscontent/src/main/AndroidManifest.xml
View file @
1e1bbb4f
...
@@ -80,6 +80,10 @@
...
@@ -80,6 +80,10 @@
android:name=
".ui.idcard.IDCardTestActivity"
android:name=
".ui.idcard.IDCardTestActivity"
android:theme=
"@style/Transparent"
/>
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.idcard.IDCardResultActivity"
android:theme=
"@style/Transparent"
/>
<activity
<activity
android:name=
".ui.ProtocolActivity"
android:name=
".ui.ProtocolActivity"
android:theme=
"@style/Transparent"
/>
android:theme=
"@style/Transparent"
/>
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/idcard/IDCardResultActivity.kt
0 → 100644
View file @
1e1bbb4f
package
com.yidian.shenghuoquan.newscontent.ui.idcard
import
android.os.Bundle
import
com.yidian.common.base.BaseActivity
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityIdcardResultBinding
/**
* Author: sym
* Date: 2021/5/20 6:51 PM
* Describe:
*/
class
IDCardResultActivity
:
BaseActivity
<
ActivityIdcardResultBinding
>()
{
override
fun
createViewBinding
():
ActivityIdcardResultBinding
{
return
ActivityIdcardResultBinding
.
inflate
(
layoutInflater
)
}
override
fun
getXPageName
():
String
{
return
""
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
}
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/idcard/IDCardTestActivity.kt
View file @
1e1bbb4f
package
com.yidian.shenghuoquan.newscontent.ui.idcard
package
com.yidian.shenghuoquan.newscontent.ui.idcard
import
android.Manifest
import
android.app.Activity
import
android.content.Intent
import
android.content.Intent
import
android.content.pm.PackageManager
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.widget.Toast
import
android.widget.Toast
import
com.megvii.demo.activity.IDCardDetectActivity
import
com.megvii.demo.activity.IDCardDetectActivity
...
@@ -36,6 +40,9 @@ class IDCardTestActivity : BaseActivity<ActivityIdcardBinding>() {
...
@@ -36,6 +40,9 @@ class IDCardTestActivity : BaseActivity<ActivityIdcardBinding>() {
//2、请求授权信息
//2、请求授权信息
startGetLicense
()
startGetLicense
()
}
}
requestCameraPerm
()
}
}
private
fun
startGetLicense
()
{
private
fun
startGetLicense
()
{
...
@@ -84,6 +91,11 @@ class IDCardTestActivity : BaseActivity<ActivityIdcardBinding>() {
...
@@ -84,6 +91,11 @@ class IDCardTestActivity : BaseActivity<ActivityIdcardBinding>() {
}
}
}
}
override
fun
onRequestPermissionsResult
(
requestCode
:
Int
,
permissions
:
Array
<
out
String
>,
grantResults
:
IntArray
)
{
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
)
//@TODO 权限通过后的回调
}
private
fun
initConfig
()
{
private
fun
initConfig
()
{
if
(
viewBind
.
rbV
.
isChecked
)
{
if
(
viewBind
.
rbV
.
isChecked
)
{
...
@@ -99,4 +111,31 @@ class IDCardTestActivity : BaseActivity<ActivityIdcardBinding>() {
...
@@ -99,4 +111,31 @@ class IDCardTestActivity : BaseActivity<ActivityIdcardBinding>() {
}
}
private
fun
requestCameraPerm
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
if
(
checkSelfPermission
(
Manifest
.
permission
.
CAMERA
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
requestPermissions
(
arrayOf
(
Manifest
.
permission
.
CAMERA
),
100
)
}
}
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
requestCode
==
INTO_IDCARDSCAN_PAGE
&&
resultCode
==
Activity
.
RESULT_OK
)
{
val
intent
:
Intent
=
Intent
(
this
,
IDCardResultActivity
::
class
.
java
)
if
(
data
!=
null
)
{
intent
.
putExtra
(
"portraitimg_bitmap"
,
data
.
getByteArrayExtra
(
"portraitimg_bitmap"
))
}
if
(
data
!=
null
)
{
intent
.
putExtra
(
"idcardimg_bitmap"
,
data
.
getByteArrayExtra
(
"idcardimg_bitmap"
))
}
startActivity
(
intent
)
}
}
}
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/utils/AccountUtil.kt
View file @
1e1bbb4f
...
@@ -10,11 +10,11 @@ import com.yidian.shenghuoquan.newscontent.bean.TokenBean
...
@@ -10,11 +10,11 @@ import com.yidian.shenghuoquan.newscontent.bean.TokenBean
import
java.util.*
import
java.util.*
class
AccountUtil
{
class
AccountUtil
{
companion
object
{
companion
object
{
@Synchronized
@Synchronized
fun
getGuestUsername
():
String
{
fun
getGuestUsername
():
String
{
var
username
=
Hawk
.
get
(
HawkConfig
.
GuestAccountUsername
,
""
)
var
username
=
Hawk
.
get
(
HawkConfig
.
GuestAccountUsername
,
""
)
if
(
TextUtils
.
isEmpty
(
username
))
{
if
(
TextUtils
.
isEmpty
(
username
))
{
username
=
try
{
username
=
try
{
val
uuid
=
UUID
.
randomUUID
()
val
uuid
=
UUID
.
randomUUID
()
"HG_$uuid"
"HG_$uuid"
...
@@ -30,19 +30,19 @@ class AccountUtil {
...
@@ -30,19 +30,19 @@ class AccountUtil {
return
username
return
username
}
}
fun
getPassword
(
username
:
String
):
String
{
fun
getPassword
(
username
:
String
):
String
{
val
strLower
=
username
.
toLowerCase
()
val
strLower
=
username
.
toLowerCase
()
val
strMd5
=
EncryptUtil
.
getMD5
(
username
)
val
strMd5
=
EncryptUtil
.
getMD5
(
username
)
val
strTemp
=
strLower
+
strMd5
val
strTemp
=
strLower
+
strMd5
return
encryptMore
(
strTemp
,
1000
)
return
encryptMore
(
strTemp
,
1000
)
}
}
private
fun
encryptMore
(
str
:
String
,
count
:
Int
):
String
{
private
fun
encryptMore
(
str
:
String
,
count
:
Int
):
String
{
val
strTemp
=
EncryptUtil
.
encryptToSHA
(
str
)
val
strTemp
=
EncryptUtil
.
encryptToSHA
(
str
)
val
num
=
count
-
1
val
num
=
count
-
1
return
if
(
num
>
0
)
{
return
if
(
num
>
0
)
{
encryptMore
(
strTemp
,
num
)
encryptMore
(
strTemp
,
num
)
}
else
{
}
else
{
strTemp
strTemp
}
}
}
}
...
...
Components/newscontent/src/main/res/layout/activity_idcard_result.xml
0 → 100755
View file @
1e1bbb4f
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:orientation=
"vertical"
android:gravity=
"center_horizontal"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/result_face_image"
android:layout_width=
"100dp"
android:layout_marginTop=
"50dp"
android:layout_height=
"100dp"
android:scaleType=
"fitCenter"
/>
<ImageView
android:id=
"@+id/result_idcard_image"
android:layout_width=
"300dp"
android:layout_height=
"200dp"
android:layout_marginTop=
"10dp"
android:scaleType=
"fitCenter"
/>
</LinearLayout>
\ No newline at end of file
app/build.gradle
View file @
1e1bbb4f
...
@@ -8,7 +8,7 @@ android {
...
@@ -8,7 +8,7 @@ android {
compileSdkVersion
build_versions
.
compileSdkVersion
compileSdkVersion
build_versions
.
compileSdkVersion
defaultConfig
{
defaultConfig
{
applicationId
"com.
yidian.subway
"
applicationId
"com.
shenghuoquan.business
"
minSdkVersion
build_versions
.
minSdkVersion
minSdkVersion
build_versions
.
minSdkVersion
targetSdkVersion
build_versions
.
targetSdkVersion
targetSdkVersion
build_versions
.
targetSdkVersion
versionCode
rootProject
.
ext
.
android
.
versionCode
versionCode
rootProject
.
ext
.
android
.
versionCode
...
...
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