Skip to content

Commit 69c8580

Browse files
author
alexfaceplugin
committed
Redesign liveness detection
1 parent dc0052e commit 69c8580

31 files changed

+138
-203
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ plugins {
44
}
55

66
android {
7-
namespace 'com.faceplugin.facerecognition'
7+
namespace 'com.faceplugin.faceliveness'
88
compileSdk 33
99

1010
defaultConfig {
11-
applicationId "com.faceplugin.facerecognition"
11+
applicationId "com.faceplugin.faceliveness"
1212
minSdk 24
1313
targetSdk 33
1414
versionCode 2

app/src/androidTest/java/com/faceplugin/facerecognition/ExampleInstrumentedTest.kt renamed to app/src/androidTest/java/com/faceplugin/faceliveness/ExampleInstrumentedTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition
1+
package com.faceplugin.faceliveness
22

33
import androidx.test.platform.app.InstrumentationRegistry
44
import androidx.test.ext.junit.runners.AndroidJUnit4

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
android:name=".AttributeActivity"
2020
android:exported="false" />
2121
<activity
22-
android:name=".MainActivity"
22+
android:name=".SplashActivity"
2323
android:exported="false"
2424
android:screenOrientation="portrait"/>
2525
<activity
@@ -48,7 +48,7 @@
4848
android:exported="false"
4949
android:screenOrientation="portrait" />
5050
<activity
51-
android:name=".SplashActivity"
51+
android:name=".MainActivity"
5252
android:exported="true"
5353
android:screenOrientation="portrait">
5454
<intent-filter>

app/src/main/java/com/faceplugin/facerecognition/AboutActivity.kt renamed to app/src/main/java/com/faceplugin/faceliveness/AboutActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition
1+
package com.faceplugin.faceliveness
22

33
import android.content.Intent
44
import android.content.pm.ResolveInfo

app/src/main/java/com/faceplugin/facerecognition/AttributeActivity.kt renamed to app/src/main/java/com/faceplugin/faceliveness/AttributeActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition
1+
package com.faceplugin.faceliveness
22

33
import android.graphics.Bitmap
44
import android.os.Bundle

app/src/main/java/com/faceplugin/facerecognition/CameraActivity.java renamed to app/src/main/java/com/faceplugin/faceliveness/CameraActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33

44
import static androidx.camera.core.ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST;

app/src/main/java/com/faceplugin/facerecognition/CameraActivityKt.kt renamed to app/src/main/java/com/faceplugin/faceliveness/CameraActivityKt.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition
1+
package com.faceplugin.faceliveness
22

33
import android.Manifest
44
import android.content.Context

app/src/main/java/com/faceplugin/facerecognition/CaptureActivity.java renamed to app/src/main/java/com/faceplugin/faceliveness/CaptureActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33

44
import static androidx.camera.core.ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST;

app/src/main/java/com/faceplugin/facerecognition/CaptureView.java renamed to app/src/main/java/com/faceplugin/faceliveness/CaptureView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33
import android.animation.Animator;
44
import android.animation.ValueAnimator;

app/src/main/java/com/faceplugin/facerecognition/DBManager.java renamed to app/src/main/java/com/faceplugin/faceliveness/DBManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33
import android.content.ContentValues;
44
import android.content.Context;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.faceplugin.faceliveness;
2+
3+
import android.os.Bundle;
4+
5+
import androidx.appcompat.app.AppCompatActivity;
6+
7+
public class DatabaseActivity extends AppCompatActivity {
8+
9+
@Override
10+
protected void onCreate(Bundle savedInstanceState) {
11+
super.onCreate(savedInstanceState);
12+
setContentView(R.layout.activity_splash);
13+
}
14+
}

app/src/main/java/com/faceplugin/facerecognition/FACE_CAPTURE_STATE.java renamed to app/src/main/java/com/faceplugin/faceliveness/FACE_CAPTURE_STATE.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33
public enum FACE_CAPTURE_STATE {
44
NO_FACE, MULTIPLE_FACES, FIT_IN_CIRCLE, MOVE_CLOSER, NO_FRONT, FACE_OCCLUDED, EYE_CLOSED, MOUTH_OPENED, SPOOFED_FACE, CAPTURE_OK

app/src/main/java/com/faceplugin/facerecognition/FaceView.java renamed to app/src/main/java/com/faceplugin/faceliveness/FaceView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33
import android.content.Context;
44
import android.graphics.Canvas;

app/src/main/java/com/faceplugin/facerecognition/MainActivity.kt renamed to app/src/main/java/com/faceplugin/faceliveness/MainActivity.kt

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition
1+
package com.faceplugin.faceliveness
22

33
import android.content.Intent
44
import android.graphics.Bitmap
@@ -27,15 +27,14 @@ class MainActivity : AppCompatActivity() {
2727
super.onCreate(savedInstanceState)
2828
setContentView(R.layout.activity_main)
2929

30-
textWarning = findViewById<TextView>(R.id.textWarning)
31-
30+
// textWarning = findViewById<TextView>(R.id.textWarning)
3231

3332
var ret = FaceSDK.setActivation(
34-
"Nd7j+5R17t1DEkFbd8eXiVMSCdYkHNFMaLDYEMPtJehvdILceeRQDlzpCeOBw0BnyWGCK09XfQDX\n" +
35-
"l3jIeFIi001ynzyleFk5IwA7ZCqnYWBXOCaMfPpd/RUKMKewAdj5q5nbNRzTVIT2v2cir9g6yiNb\n" +
36-
"dav0nX3pLt0q+wB5gyyBZiBcL9Qg2vGeM7F/pN5j0m0v04BVle50GOpn7tIc4Bab+WEC3e9tYAQC\n" +
37-
"adKDtlWrV+wwsmvWtxbtafkohUEW/dGcjURPpQ1TVAj20wfpDdz6HEiXkJQ/jCbaQmg7haB9Pj9+\n" +
38-
"yl9CDAj/THRzoz8C193VhFQG6No8iUFc7w6oCg=="
33+
"f0Y15I2DXE4BP9g3pkGRzcM7HQatMXrQ3B85fFNSb80QJ7txgdrdWpX8EbRjafdCoPBmv3TqeHRc\n" +
34+
"lTIrQBGF7sQUpe2XdEcrkjZgvQBhD4zFlAqMrBvaRaSiGE+LLGa/5XjrOlFpk+1UAlZcPiq+YrBG\n" +
35+
"eS5zDY7FkhPze1q9nsg19yJ7yDFFkCc04ChKcXyNAk8UipYc4CWWx8xnVticyDQI74bdm273kQJw\n" +
36+
"IhL/lwCspEDEVScFycCSIPPTDf3JX3jmZIjcKk8cQjWcPT00/Bly/eYM3KyDk19QXgQ9w86yCL3S\n" +
37+
"kpS91aW3SY7PqVZR2fK56bqxP4dsagSIUJHO6Q=="
3938
)
4039

4140
if (ret == FaceSDK.SDK_SUCCESS) {
@@ -61,30 +60,30 @@ class MainActivity : AppCompatActivity() {
6160
dbManager.loadPerson()
6261

6362
personAdapter = PersonAdapter(this, DBManager.personList)
64-
val listView: ListView = findViewById<View>(R.id.listPerson) as ListView
65-
listView.setAdapter(personAdapter)
66-
67-
findViewById<Button>(R.id.buttonEnroll).setOnClickListener {
68-
val intent = Intent()
69-
intent.setType("image/*")
70-
intent.setAction(Intent.ACTION_PICK)
71-
startActivityForResult(Intent.createChooser(intent, getString(R.string.select_picture)), SELECT_PHOTO_REQUEST_CODE)
72-
}
73-
63+
// val listView: ListView = findViewById<View>(R.id.listPerson) as ListView
64+
// listView.setAdapter(personAdapter)
65+
//
66+
// findViewById<Button>(R.id.buttonEnroll).setOnClickListener {
67+
// val intent = Intent()
68+
// intent.setType("image/*")
69+
// intent.setAction(Intent.ACTION_PICK)
70+
// startActivityForResult(Intent.createChooser(intent, getString(R.string.select_picture)), SELECT_PHOTO_REQUEST_CODE)
71+
// }
72+
//
7473
findViewById<Button>(R.id.buttonIdentify).setOnClickListener {
7574
startActivity(Intent(this, CameraActivity::class.java))
7675
}
7776

78-
findViewById<Button>(R.id.buttonCapture).setOnClickListener {
79-
startActivity(Intent(this, CaptureActivity::class.java))
80-
}
81-
82-
findViewById<Button>(R.id.buttonAttribute).setOnClickListener {
83-
val intent = Intent()
84-
intent.setType("image/*")
85-
intent.setAction(Intent.ACTION_PICK)
86-
startActivityForResult(Intent.createChooser(intent, getString(R.string.select_picture)), SELECT_ATTRIBUTE_REQUEST_CODE)
87-
}
77+
// findViewById<Button>(R.id.buttonCapture).setOnClickListener {
78+
// startActivity(Intent(this, CaptureActivity::class.java))
79+
// }
80+
//
81+
// findViewById<Button>(R.id.buttonAttribute).setOnClickListener {
82+
// val intent = Intent()
83+
// intent.setType("image/*")
84+
// intent.setAction(Intent.ACTION_PICK)
85+
// startActivityForResult(Intent.createChooser(intent, getString(R.string.select_picture)), SELECT_ATTRIBUTE_REQUEST_CODE)
86+
// }
8887

8988
findViewById<Button>(R.id.buttonSettings).setOnClickListener {
9089
startActivity(Intent(this, SettingsActivity::class.java))

app/src/main/java/com/faceplugin/facerecognition/MyGlobal.java renamed to app/src/main/java/com/faceplugin/faceliveness/MyGlobal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33
import android.content.Context;
44
import android.graphics.Bitmap;

app/src/main/java/com/faceplugin/facerecognition/Person.java renamed to app/src/main/java/com/faceplugin/faceliveness/Person.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33
import android.graphics.Bitmap;
44

app/src/main/java/com/faceplugin/facerecognition/PersonAdapter.java renamed to app/src/main/java/com/faceplugin/faceliveness/PersonAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33
import android.content.Context;
44
import android.view.LayoutInflater;

app/src/main/java/com/faceplugin/facerecognition/ResultActivity.kt renamed to app/src/main/java/com/faceplugin/faceliveness/ResultActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition
1+
package com.faceplugin.faceliveness
22

33
import android.graphics.Bitmap
44
import androidx.appcompat.app.AppCompatActivity

app/src/main/java/com/faceplugin/facerecognition/SettingsActivity.kt renamed to app/src/main/java/com/faceplugin/faceliveness/SettingsActivity.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition
1+
package com.faceplugin.faceliveness
22

33
import android.content.Context
44
import android.os.Bundle
@@ -170,20 +170,20 @@ class SettingsActivity : AppCompatActivity() {
170170
}
171171
}
172172

173-
rollThresholdPref?.setOnPreferenceChangeListener{ preference, newValue ->
174-
val stringPref = newValue as String
175-
try {
176-
if(stringPref.toFloat() < 0.0f || stringPref.toFloat() > 30.0f) {
177-
Toast.makeText(context, getString(R.string.invalid_value), Toast.LENGTH_SHORT).show()
178-
false
179-
} else {
180-
true
181-
}
182-
} catch (e:Exception) {
183-
Toast.makeText(context, getString(R.string.invalid_value), Toast.LENGTH_SHORT).show()
184-
false
185-
}
186-
}
173+
// rollThresholdPref?.setOnPreferenceChangeListener{ preference, newValue ->
174+
// val stringPref = newValue as String
175+
// try {
176+
// if(stringPref.toFloat() < 0.0f || stringPref.toFloat() > 30.0f) {
177+
// Toast.makeText(context, getString(R.string.invalid_value), Toast.LENGTH_SHORT).show()
178+
// false
179+
// } else {
180+
// true
181+
// }
182+
// } catch (e:Exception) {
183+
// Toast.makeText(context, getString(R.string.invalid_value), Toast.LENGTH_SHORT).show()
184+
// false
185+
// }
186+
// }
187187

188188
pitchThresholdPref?.setOnPreferenceChangeListener{ preference, newValue ->
189189
val stringPref = newValue as String

app/src/main/java/com/faceplugin/facerecognition/SplashActivity.java renamed to app/src/main/java/com/faceplugin/faceliveness/SplashActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33
import androidx.appcompat.app.AppCompatActivity;
44

app/src/main/java/com/faceplugin/facerecognition/Utils.java renamed to app/src/main/java/com/faceplugin/faceliveness/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.faceplugin.facerecognition;
1+
package com.faceplugin.faceliveness;
22

33
import android.content.Context;
44
import android.database.Cursor;

app/src/main/res/layout/activity_about.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
android:gravity="center_vertical | left"
2626
android:text="FacePlugin Ltd specializes in cutting-edge solutions including face liveness detection, ID card recognition, face recognition, biometric authentication, and e-KYC (Electronic Know Your Customer) solutions.\n\n
2727
Our solutions cater to a diverse range of industries, including finance, healthcare, retail, transportation, government, and more.\n\n
28-
We are always available to support you here.\n\n\n
29-
Please contact us:"
28+
We are always available to support you here.\n\n\n"
3029
android:layout_marginLeft="16dp"
3130
android:layout_marginRight="16dp"
3231
android:layout_marginTop="16dp"
@@ -73,7 +72,7 @@ Please contact us:"
7372
android:layout_width="300dp"
7473
android:layout_height="wrap_content"
7574
android:layout_marginLeft="8dp"
76-
android:text="Skype: live:.cid.6f515492327084aa"
75+
android:text="Skype: live:.cid.bd9468a0cefb151d"
7776
app:layout_constraintStart_toEndOf="@id/imageSkype"
7877
app:layout_constraintTop_toTopOf="@id/imageSkype"
7978
app:layout_constraintBottom_toBottomOf="@id/imageSkype"

app/src/main/res/layout/activity_camera.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
app:layout_constraintStart_toStartOf="parent"
1616
app:layout_constraintTop_toTopOf="parent" />
1717

18-
<com.faceplugin.facerecognition.FaceView
18+
<com.faceplugin.faceliveness.FaceView
1919
android:id="@+id/faceView"
2020
android:layout_width="match_parent"
2121
android:layout_height="match_parent"
2222
app:layout_constraintBottom_toBottomOf="parent"
2323
app:layout_constraintEnd_toEndOf="parent"
2424
app:layout_constraintStart_toStartOf="parent"
2525
app:layout_constraintTop_toTopOf="parent">
26-
</com.faceplugin.facerecognition.FaceView>
26+
</com.faceplugin.faceliveness.FaceView>
2727

2828
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/layout/activity_camera_kt.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
android:layout_height="match_parent">
1313

1414
</io.fotoapparat.view.CameraView>
15-
<com.faceplugin.facerecognition.FaceView
15+
<com.faceplugin.faceliveness.FaceView
1616
android:id="@+id/faceView"
1717
android:layout_width="match_parent"
1818
android:layout_height="match_parent"
1919
app:layout_constraintBottom_toBottomOf="parent"
2020
app:layout_constraintEnd_toEndOf="parent"
2121
app:layout_constraintStart_toStartOf="parent"
2222
app:layout_constraintTop_toTopOf="parent">
23-
</com.faceplugin.facerecognition.FaceView>
23+
</com.faceplugin.faceliveness.FaceView>
2424

2525
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/layout/activity_capture.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
app:layout_constraintTop_toTopOf="parent" />
1717

1818

19-
<com.faceplugin.facerecognition.CaptureView
19+
<com.faceplugin.faceliveness.CaptureView
2020
android:id="@+id/captureView"
2121
android:layout_width="match_parent"
2222
android:layout_height="match_parent"
2323
app:layout_constraintBottom_toBottomOf="parent"
2424
app:layout_constraintEnd_toEndOf="parent"
2525
app:layout_constraintStart_toStartOf="parent"
2626
app:layout_constraintTop_toTopOf="parent">
27-
</com.faceplugin.facerecognition.CaptureView>
27+
</com.faceplugin.faceliveness.CaptureView>
2828

2929
<TextView
3030
android:id="@+id/textTitle"

0 commit comments

Comments
 (0)