-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from regulaforensics/v3.2upd
Release 3.2
- Loading branch information
Showing
10 changed files
with
321 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...mple/app/src/main/java/com/regula/facesample/items/customization/HideFlashButtonItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.regula.facesample.items.customization; | ||
|
||
import android.content.Context; | ||
|
||
import com.regula.facesample.items.CategoryItem; | ||
import com.regula.facesdk.FaceSDK; | ||
import com.regula.facesdk.configuration.FaceCaptureConfiguration; | ||
|
||
/** | ||
* Created by Sergey Yakimchik on 6.09.21. | ||
* Copyright (c) 2021 Regula. All rights reserved. | ||
*/ | ||
|
||
public class HideFlashButtonItem extends CategoryItem { | ||
|
||
@Override | ||
public void onItemSelected(Context context) { | ||
FaceCaptureConfiguration configuration = new FaceCaptureConfiguration.Builder() | ||
.setTorchButtonEnabled(false) | ||
.setCameraId(0) | ||
.build(); | ||
FaceSDK.Instance().presentFaceCaptureActivity(context, configuration, faceCaptureResponse -> { }); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Hide flash button using default UI"; | ||
} | ||
|
||
@Override | ||
public String getTitle() { | ||
return "Hide flash button"; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...src/main/java/com/regula/facesample/items/customization/LivenessProcessingCustomItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.regula.facesample.items.customization; | ||
|
||
import android.content.Context; | ||
|
||
import com.regula.facesample.items.CategoryItem; | ||
import com.regula.facesample.items.customization.fragment.LivenessProcessingCustomFragment; | ||
import com.regula.facesdk.FaceSDK; | ||
import com.regula.facesdk.configuration.LivenessConfiguration; | ||
|
||
/** | ||
* Created by Sergey Yakimchik on 29.04.22. | ||
* Copyright (c) 2022 Regula. All rights reserved. | ||
*/ | ||
|
||
public class LivenessProcessingCustomItem extends CategoryItem { | ||
|
||
@Override | ||
public void onItemSelected(Context context) { | ||
LivenessConfiguration configuration = new LivenessConfiguration.Builder() | ||
.registerProcessingFragment(LivenessProcessingCustomFragment.class) | ||
.build(); | ||
FaceSDK.Instance().startLiveness(context, configuration, livenessResponse -> {}); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Customize liveness processing and retry screens"; | ||
} | ||
|
||
@Override | ||
public String getTitle() { | ||
return "Custom liveness process"; | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
...main/java/com/regula/facesample/items/customization/fragment/HideCloseButtonFragment.java
This file was deleted.
Oops, something went wrong.
83 changes: 83 additions & 0 deletions
83
.../com/regula/facesample/items/customization/fragment/LivenessProcessingCustomFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package com.regula.facesample.items.customization.fragment; | ||
|
||
import android.graphics.PorterDuff; | ||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ProgressBar; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
import com.regula.facesample.R; | ||
import com.regula.common.utils.RegulaLog; | ||
import com.regula.facesdk.fragment.BaseFaceLivenessProcessingFragment; | ||
|
||
/** | ||
* Created by Sergey Yakimchik on 04/29/22. | ||
* Copyright (c) 2020 Regula. All rights reserved. | ||
*/ | ||
|
||
public final class LivenessProcessingCustomFragment extends BaseFaceLivenessProcessingFragment { | ||
|
||
private TextView guidelinesTextView; | ||
|
||
@Override | ||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
View view = super.onCreateView(inflater, container, savedInstanceState); | ||
if (view == null) | ||
return null; | ||
|
||
guidelinesTextView = view.findViewById(R.id.guidelines_text_view); | ||
|
||
return view; | ||
} | ||
|
||
@Override | ||
public int getResourceLayoutId() { | ||
return R.layout.custom_liveness_processing; | ||
} | ||
|
||
@Override | ||
public View getRetryButton(View view) { | ||
return view.findViewById(R.id.retry_button); | ||
} | ||
|
||
@Override | ||
public View getCancelButton(View view) { | ||
return view.findViewById(R.id.cancel_button); | ||
} | ||
|
||
@Override | ||
public void faceSdkError(int[] stringResourceId) { | ||
StringBuilder guidelineTextBuilder = new StringBuilder(); | ||
if (stringResourceId == null) { | ||
stringResourceId = new int[] { com.regula.facesdk.R.string.livenessRetry_text_environment, com.regula.facesdk.R.string.livenessRetry_text_subject }; | ||
RegulaLog.e("Not defined error caught"); | ||
} | ||
|
||
for (int strId : stringResourceId) { | ||
guidelineTextBuilder.append(String.format("- %s\n", getString(strId))); | ||
} | ||
|
||
guidelinesTextView.setText(guidelineTextBuilder); | ||
} | ||
|
||
@Override | ||
public View getProcessingLayout(View v) { | ||
return v.findViewById(R.id.processing_layout); | ||
} | ||
|
||
@Override | ||
public View getRetryLayout(View v) { | ||
return v.findViewById(R.id.result_layout); | ||
} | ||
|
||
@Override | ||
public View getCloseButton(View v) { | ||
return v.findViewById(R.id.close_button); | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
FaceSample/app/src/main/res/drawable/rounded_button_corner.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<corners android:radius="25dp"/> | ||
<solid android:color="@android:color/holo_blue_bright" /> | ||
</shape> |
18 changes: 18 additions & 0 deletions
18
FaceSample/app/src/main/res/layout/custom_liveness_processing.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@android:color/white" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<include | ||
android:id="@+id/processing_layout" | ||
layout="@layout/custom_liveness_processing_layout" /> | ||
|
||
<include | ||
android:id="@+id/result_layout" | ||
android:visibility="invisible" | ||
tools:visibility="visible" | ||
layout="@layout/custom_liveness_retry_layout" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
52 changes: 52 additions & 0 deletions
52
FaceSample/app/src/main/res/layout/custom_liveness_processing_layout.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
tools:background="@android:color/white"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:textColor="@android:color/holo_blue_dark" | ||
android:textSize="22sp" | ||
android:text="In process" | ||
android:gravity="center" | ||
android:layout_marginTop="15dp" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent"/> | ||
|
||
<ProgressBar | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintBottom_toBottomOf="parent" /> | ||
|
||
<androidx.constraintlayout.widget.Guideline | ||
android:id="@+id/button_guideline" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal" | ||
app:layout_constraintGuide_percent="0.90" /> | ||
|
||
<Button | ||
android:id="@+id/cancel_button" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:background="@drawable/rounded_button_corner" | ||
android:textColor="@color/white" | ||
android:paddingTop="10dp" | ||
android:paddingBottom="10dp" | ||
android:paddingStart="25dp" | ||
android:paddingEnd="25dp" | ||
android:text="Cancel" | ||
android:textAllCaps="true" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintBottom_toBottomOf="@id/button_guideline" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
89 changes: 89 additions & 0 deletions
89
FaceSample/app/src/main/res/layout/custom_liveness_retry_layout.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:background="@android:color/white" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
android:padding="@dimen/reg_small_img_button_padding"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:textColor="@android:color/holo_red_dark" | ||
android:textSize="22sp" | ||
android:text="Let's try one more time" | ||
android:padding="@dimen/reg_small_img_button_padding" | ||
android:layout_gravity="center_horizontal"/> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:textColor="@android:color/holo_blue_dark" | ||
android:textSize="19sp" | ||
android:layout_marginTop="10dp" | ||
android:padding="6dp" | ||
android:text="Make sure that" | ||
android:layout_gravity="center_horizontal"/> | ||
|
||
<TextView | ||
android:id="@+id/guidelines_text_view" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="20dp" | ||
android:layout_gravity="center_horizontal" | ||
android:textColor="@android:color/holo_purple" | ||
android:textSize="19sp" | ||
tools:text="- Some guideliness for the user"/> | ||
|
||
</LinearLayout> | ||
|
||
<androidx.constraintlayout.widget.Guideline | ||
android:id="@+id/guideline" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal" | ||
app:layout_constraintGuide_percent="0.65" /> | ||
|
||
<Button | ||
android:id="@+id/retry_button" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:background="@drawable/rounded_button_corner" | ||
android:textColor="@color/white" | ||
android:paddingTop="10dp" | ||
android:paddingBottom="10dp" | ||
android:paddingStart="25dp" | ||
android:paddingEnd="25dp" | ||
android:text="Try again" | ||
android:textAllCaps="true" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toTopOf="@id/guideline" /> | ||
|
||
<Button | ||
android:id="@+id/close_button" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:background="@android:color/transparent" | ||
android:textColor="@android:color/holo_blue_light" | ||
android:paddingTop="10dp" | ||
android:paddingBottom="10dp" | ||
android:paddingStart="25dp" | ||
android:paddingEnd="25dp" | ||
android:text="Cancel" | ||
android:textAllCaps="true" | ||
android:layout_marginTop="10dp" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/retry_button" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |