Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MYID Public Code
MyID Sample Android
Commits
81a6ffde
Commit
81a6ffde
authored
Aug 30, 2022
by
Javohir Savriy
Browse files
2.0.9
parent
1b3ebd3a
Changes
125
Show whitespace changes
Inline
Side-by-side
app/libs/myid-sdk-2.0.
8
-release.aar
→
app/libs/myid-sdk-2.0.
9
-release.aar
View file @
81a6ffde
No preview for this file type
app/src/main/java/uz/myid/sdk/sample/MainActivity.kt
View file @
81a6ffde
...
...
@@ -4,6 +4,7 @@ import android.os.Bundle
import
android.widget.EditText
import
androidx.appcompat.app.AppCompatActivity
import
uz.myid.android.sdk.capture.*
import
uz.myid.android.sdk.capture.model.OrganizationDetails
import
uz.myid.sdk.sample.databinding.ActivityMainBinding
class
MainActivity
:
AppCompatActivity
(),
MyIdResultListener
{
...
...
@@ -16,7 +17,6 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
private
var
myIdEntryType
=
MyIdEntryType
.
AUTH
private
var
myIdBuildMode
=
MyIdBuildMode
.
PRODUCTION
private
var
myIdLocale
=
MyIdLocale
.
EN
private
var
withPhoto
=
false
private
var
code
=
""
...
...
@@ -34,23 +34,20 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
else
->
MyIdLocale
.
RU
}
}
radioGroupEntry
.
setOnCheckedChangeListener
{
_
,
checkedId
->
radioGroupEntry
Type
.
setOnCheckedChangeListener
{
_
,
checkedId
->
myIdEntryType
=
if
(
checkedId
==
R
.
id
.
radioFace
)
{
MyIdEntryType
.
FACE
}
else
{
MyIdEntryType
.
AUTH
}
}
radioGroupBuild
Typ
e
.
setOnCheckedChangeListener
{
_
,
checkedId
->
radioGroupBuild
Mod
e
.
setOnCheckedChangeListener
{
_
,
checkedId
->
myIdBuildMode
=
if
(
checkedId
==
R
.
id
.
radioProd
)
{
MyIdBuildMode
.
PRODUCTION
}
else
{
MyIdBuildMode
.
DEBUG
}
}
radioGroupPhoto
.
setOnCheckedChangeListener
{
_
,
checkedId
->
withPhoto
=
(
checkedId
==
R
.
id
.
radioWith
)
}
buttonStart
.
setOnClickListener
{
startMyId
()
}
}
...
...
@@ -61,7 +58,10 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
with
(
binding
)
{
imageResult
.
setImageBitmap
(
result
.
bitmap
)
"Result code: ${result.code}"
.
also
{
textResult
.
text
=
it
}
"""
Result code: ${result.code}
Comparison value: ${result.comparison}
"""
.
trimIndent
().
also
{
textResult
.
text
=
it
}
}
}
...
...
@@ -87,14 +87,21 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
}
private
fun
startMyId
()
{
val
organizationDetails
=
OrganizationDetails
(
phoneNumber
=
binding
.
inputPhoneNumber
.
value
,
logo
=
R
.
drawable
.
image_logo
)
val
myIdConfig
=
MyIdConfig
.
builder
(
binding
.
inputClientId
.
value
)
.
withPassportData
(
binding
.
inputPassportData
.
value
)
.
withBirthDate
(
binding
.
inputDate
.
value
)
.
withExternalId
(
binding
.
inputExternalId
.
value
)
.
withThreshold
(
binding
.
thresholdSlider
.
value
)
.
withEntryType
(
myIdEntryType
)
.
withOrganizationDetails
(
organizationDetails
)
.
withBuildMode
(
myIdBuildMode
)
.
withLocale
(
myIdLocale
)
.
withPhoto
(
withPhoto
)
.
withPhoto
(
binding
.
checkboxWithPhoto
.
isChecked
)
.
build
()
val
intent
=
client
.
createIntent
(
this
,
myIdConfig
)
...
...
app/src/main/res/drawable/image_logo.png
0 → 100644
View file @
81a6ffde
9.91 KB
app/src/main/res/layout/activity_main.xml
View file @
81a6ffde
...
...
@@ -66,13 +66,43 @@
android:inputType=
"textMultiLine"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style=
"@style/TextInputOutlined"
android:layout_marginTop=
"12dp"
android:hint=
"@string/organization_phone_number"
app:helperText=
"* Optional"
app:helperTextEnabled=
"true"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/inputPhoneNumber"
style=
"@style/TextInput"
android:importantForAutofill=
"no"
android:inputType=
"phone"
/>
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:text=
"@string/threshold"
android:textSize=
"16sp"
/>
<com.google.android.material.slider.Slider
android:id=
"@+id/thresholdSlider"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:stepSize=
"0.01"
android:valueFrom=
"0.50"
android:valueTo=
"0.99"
app:labelBehavior=
"floating"
/>
<RadioGroup
android:id=
"@+id/radioGroupLang"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"
16
dp"
android:layout_marginTop=
"
8
dp"
android:checkedButton=
"@id/radioEn"
android:orientation=
"
vertic
al"
>
android:orientation=
"
horizont
al"
>
<RadioButton
android:id=
"@+id/radioUz"
...
...
@@ -84,20 +114,22 @@
android:id=
"@+id/radioEn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/english"
/>
<RadioButton
android:id=
"@+id/radioRu"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:text=
"@string/russian"
/>
</RadioGroup>
<RadioGroup
android:id=
"@+id/radioGroupEntry"
android:id=
"@+id/radioGroupEntry
Type
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"
@dimen/myid_dp_12
"
android:layout_marginTop=
"
8dp
"
android:checkedButton=
"@id/radioAuth"
android:orientation=
"horizontal"
>
...
...
@@ -111,15 +143,15 @@
android:id=
"@+id/radioFace"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"1
6
dp"
android:layout_marginStart=
"1
2
dp"
android:text=
"@string/face"
/>
</RadioGroup>
<RadioGroup
android:id=
"@+id/radioGroupBuild
Typ
e"
android:id=
"@+id/radioGroupBuild
Mod
e"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"
@dimen/myid_dp_12
"
android:layout_marginTop=
"
8dp
"
android:checkedButton=
"@id/radioProd"
android:orientation=
"horizontal"
>
...
...
@@ -137,48 +169,34 @@
android:text=
"@string/dev"
/>
</RadioGroup>
<RadioGroup
android:id=
"@+id/radioGroupPhoto"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/myid_dp_12"
android:checkedButton=
"@id/radioWithout"
android:orientation=
"horizontal"
>
<RadioButton
android:id=
"@+id/radioWith"
android:layout_width=
"wrap_content"
<CheckBox
android:id=
"@+id/checkboxWithPhoto"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:checked=
"true"
android:text=
"@string/with_photo"
/>
<RadioButton
android:id=
"@+id/radioWithout"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:text=
"@string/without_photo"
/>
</RadioGroup>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/buttonStart"
style=
"@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginTop=
"
3
2dp"
android:layout_marginTop=
"2
0
dp"
android:text=
"@string/scan_face_data"
/>
<TextView
android:id=
"@+id/textResult"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"
3
2dp"
android:layout_marginTop=
"2
0
dp"
android:textSize=
"20sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"
3
2dp"
android:layout_marginTop=
"2
0
dp"
android:text=
"@string/result_image"
android:textSize=
"20sp"
/>
...
...
app/src/main/res/values/strings.xml
View file @
81a6ffde
...
...
@@ -15,7 +15,9 @@
<string
name=
"result_image"
>
Result image
</string>
<string
name=
"russian"
>
RUSSIAN
</string>
<string
name=
"scan_face_data"
>
Scan face data
</string>
<string
name=
"threshold"
>
Threshold
</string>
<string
name=
"uzbek"
>
UZBEK
</string>
<string
name=
"with_photo"
>
WITH PHOTO
</string>
<string
name=
"without_photo"
>
WITHOUT PHOTO
</string>
<string
name=
"organization_phone_number"
>
Phone number
</string>
</resources>
Prev
1
…
3
4
5
6
7
Next
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