Commit 81a6ffde authored by Javohir Savriy's avatar Javohir Savriy
Browse files

2.0.9

parent 1b3ebd3a
......@@ -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 ->
radioGroupEntryType.setOnCheckedChangeListener { _, checkedId ->
myIdEntryType = if (checkedId == R.id.radioFace) {
MyIdEntryType.FACE
} else {
MyIdEntryType.AUTH
}
}
radioGroupBuildType.setOnCheckedChangeListener { _, checkedId ->
radioGroupBuildMode.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)
......
......@@ -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="16dp"
android:layout_marginTop="8dp"
android:checkedButton="@id/radioEn"
android:orientation="vertical">
android:orientation="horizontal">
<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/radioGroupEntryType"
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="16dp"
android:layout_marginStart="12dp"
android:text="@string/face" />
</RadioGroup>
<RadioGroup
android:id="@+id/radioGroupBuildType"
android:id="@+id/radioGroupBuildMode"
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,27 +169,13 @@
android:text="@string/dev" />
</RadioGroup>
<RadioGroup
android:id="@+id/radioGroupPhoto"
android:layout_width="wrap_content"
<CheckBox
android:id="@+id/checkboxWithPhoto"
android:layout_width="match_parent"
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"
android:layout_height="wrap_content"
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>
android:layout_marginTop="8dp"
android:checked="true"
android:text="@string/with_photo" />
<com.google.android.material.button.MaterialButton
android:id="@+id/buttonStart"
......@@ -165,20 +183,20 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="32dp"
android:layout_marginTop="20dp"
android:text="@string/scan_face_data" />
<TextView
android:id="@+id/textResult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginTop="20dp"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginTop="20dp"
android:text="@string/result_image"
android:textSize="20sp" />
......
......@@ -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>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment