Skip to content

Commit fa2ee41

Browse files
committed
Match iOS app look on result activity. Update to 2.0.5 version of Ver-ID libraries.
1 parent 569df35 commit fa2ee41

File tree

17 files changed

+43
-186
lines changed

17 files changed

+43
-186
lines changed

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ android {
1818
minSdkVersion 18
1919
targetSdkVersion 25
2020
versionCode 1
21-
versionName "2.0.4"
21+
versionName "2.0.5"
2222

2323
}
2424
buildTypes {
@@ -39,9 +39,9 @@ repositories {
3939
}
4040

4141
dependencies {
42-
compile 'com.appliedrec:shared:2.0.4'
43-
compile 'com.appliedrec:det-rec-lib:2.0.4'
44-
compile 'com.appliedrec:verid:2.0.4'
42+
compile 'com.appliedrec:shared:2.0.5'
43+
compile 'com.appliedrec:det-rec-lib:2.0.5'
44+
compile 'com.appliedrec:verid:2.0.5'
4545
compile 'com.appliedrec:id-capture:2.0.5'
4646
compile 'com.android.support:appcompat-v7:25.3.1'
4747
compile 'com.android.support.constraint:constraint-layout:1.0.2'

src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</intent-filter>
1717
</activity>
1818
<activity android:name=".CaptureResultActivity"></activity>
19-
<meta-data android:name="com.appliedrec.verid.apiSecret" android:value="db65b2122ccd0e5ac858e1c4df1e751d82a21a82e1ebf3c943511d0c11d7c29b" />
19+
<meta-data android:name="com.appliedrec.verid.apiSecret" android:value="940a98644e02ae8c1726f94c926f27d4e06e32f8f6b304906766f8574511a630" />
2020
</application>
2121

2222
</manifest>

src/main/java/com/appliedrec/idcapturesample/CaptureResultActivity.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public class CaptureResultActivity extends AppCompatActivity implements LoaderMa
4343
private ImageView liveFaceView;
4444
private ImageView cardFaceView;
4545
private LikenessGaugeView likenessGaugeView;
46-
private TextView scoreTextView;
46+
// private TextView scoreTextView;
4747
private TextView resultTextView;
48-
private View progressIndicatorView;
48+
// private View progressIndicatorView;
4949

5050
// Extracted card and face images
5151
private Bitmap cardFaceImage;
@@ -129,17 +129,8 @@ protected void onCreate(Bundle savedInstanceState) {
129129
setContentView(R.layout.activity_capture_result);
130130
liveFaceView = (ImageView) findViewById(R.id.live_face);
131131
cardFaceView = (ImageView) findViewById(R.id.card_face);
132-
scoreTextView = (TextView) findViewById(R.id.likeness_score);
133132
resultTextView = (TextView) findViewById(R.id.text);
134133
likenessGaugeView = (LikenessGaugeView) findViewById(R.id.likeness_gauge);
135-
progressIndicatorView = findViewById(R.id.score_progress);
136-
findViewById(R.id.done_button).setOnClickListener(new View.OnClickListener() {
137-
@Override
138-
public void onClick(View v) {
139-
setResult(RESULT_OK);
140-
finish();
141-
}
142-
});
143134
idCaptureResult = CardCaptureResultPersistence.loadCardCaptureResult(this);
144135
Intent intent = getIntent();
145136
if (idCaptureResult != null && idCaptureResult.getFace() != null && idCaptureResult.getFace().isSuitableForRecognition() && intent != null) {
@@ -235,14 +226,10 @@ public void onLoaderReset(Loader loader) {
235226

236227
@UiThread
237228
private void updateScore(Float score) {
238-
progressIndicatorView.setVisibility(View.GONE);
239-
scoreTextView.setVisibility(View.VISIBLE);
240229
if (score != null) {
241-
scoreTextView.setText(String.format("%.0f%%", score.floatValue() * 100f));
242-
resultTextView.setText("");
230+
resultTextView.setText(getResources().getString(R.string.similarity_score, score.floatValue() * 10f));
243231
} else {
244232
score = 0f;
245-
scoreTextView.setText("?");
246233
resultTextView.setText(R.string.face_score_error);
247234
}
248235
likenessGaugeView.setScore(score.floatValue());

src/main/java/com/appliedrec/idcapturesample/LikenessGaugeView.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import android.graphics.Canvas;
77
import android.graphics.Color;
88
import android.graphics.Paint;
9+
import android.graphics.PointF;
10+
import android.graphics.RectF;
911
import android.support.annotation.Nullable;
1012
import android.support.annotation.UiThread;
1113
import android.util.AttributeSet;
@@ -43,7 +45,7 @@ private void init() {
4345
needlePaint.setColor(Color.BLACK);
4446
needlePaint.setStrokeWidth(3 * getContext().getResources().getDisplayMetrics().density);
4547
needlePaint.setStrokeCap(Paint.Cap.ROUND);
46-
setBackgroundResource(R.mipmap.likeness_gauge);
48+
setBackgroundResource(R.mipmap.similarity_dial);
4749
scoreAnimator = ValueAnimator.ofFloat(0f,0.4f);
4850
scoreAnimator.setDuration(8000);
4951
scoreAnimator.setRepeatMode(ValueAnimator.REVERSE);
@@ -105,10 +107,17 @@ public float getScore() {
105107
@Override
106108
protected void onDraw(Canvas canvas) {
107109
super.onDraw(canvas);
108-
double maxScore = 1.0;
109-
double sweep = (double) score / maxScore * Math.PI;
110-
float x = (float)(Math.cos(sweep) * (double) getWidth() / 2.0);
111-
float y = (float)(Math.sin(sweep) * (double) getWidth() / 2.0);
112-
canvas.drawLine(getWidth() / 2f, getHeight(), getWidth() / 2f - x, getHeight() - y, needlePaint);
110+
float top = (float)getHeight() / 93f * 7f;
111+
RectF elipseRect = new RectF(0, top, getWidth(), top + (float)getWidth() / 248f * 158f);
112+
float angleOffset = 0.57f;
113+
float minAngle = (float)(Math.PI + angleOffset);
114+
float maxAngle = (float)(Math.PI * 2 - angleOffset);
115+
float angle = minAngle + score * (maxAngle - minAngle);
116+
float length = elipseRect.right - elipseRect.centerX();
117+
float height = (float)(Math.sin(angle) * length * (elipseRect.height() / elipseRect.width()));
118+
float width = (float)(Math.cos(angle) * length);
119+
PointF origin = new PointF(elipseRect.centerX(), elipseRect.centerY());
120+
PointF destination = new PointF(elipseRect.centerX() + width, elipseRect.centerY() + height);
121+
canvas.drawLine(origin.x, origin.y, destination.x, destination.y, needlePaint);
113122
}
114123
}

src/main/res/layout-land/activity_capture_result.xml

Lines changed: 0 additions & 100 deletions
This file was deleted.

src/main/res/layout/activity_capture_result.xml

Lines changed: 18 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111
<LinearLayout
1212
android:id="@+id/hero"
1313
android:layout_width="match_parent"
14-
android:layout_height="0dp"
15-
android:layout_weight="135"
16-
android:background="@color/topBackground"
14+
android:layout_height="wrap_content"
15+
android:gravity="center"
1716
android:orientation="vertical">
1817

1918
<LinearLayout
2019
android:layout_width="match_parent"
21-
android:layout_height="0dp"
22-
android:layout_marginTop="30dp"
20+
android:layout_height="wrap_content"
21+
android:layout_marginBottom="30dp"
2322
android:layout_weight="1"
2423
android:gravity="center"
2524
android:orientation="horizontal">
@@ -28,73 +27,34 @@
2827
android:id="@+id/card_face"
2928
android:layout_width="80dp"
3029
android:layout_height="100dp"
31-
android:scaleType="centerCrop" />
32-
33-
<TextView
34-
android:id="@+id/likeness_score"
35-
android:layout_width="90dp"
36-
android:layout_height="wrap_content"
37-
android:layout_marginLeft="@dimen/default_padding"
38-
android:layout_marginRight="@dimen/default_padding"
39-
android:gravity="center"
40-
android:text="100"
41-
android:textAppearance="@style/TextAppearance.AppCompat.Display2"
42-
android:visibility="gone" />
43-
44-
<ProgressBar
45-
android:id="@+id/score_progress"
46-
style="@style/Widget.AppCompat.ProgressBar"
47-
android:layout_width="90dp"
48-
android:layout_height="wrap_content" />
30+
android:scaleType="centerCrop"
31+
android:layout_marginRight="8dp"/>
4932

5033
<ImageView
5134
android:id="@+id/live_face"
5235
android:layout_width="80dp"
5336
android:layout_height="100dp"
37+
android:layout_marginLeft="8dp"
5438
android:scaleType="centerCrop" />
5539
</LinearLayout>
5640

5741
<com.appliedrec.idcapturesample.LikenessGaugeView
5842
android:id="@+id/likeness_gauge"
59-
android:layout_width="188dp"
60-
android:layout_height="96dp"
43+
android:layout_width="248dp"
44+
android:layout_height="93dp"
45+
android:layout_marginBottom="30dp"
6146
android:layout_gravity="center" />
62-
</LinearLayout>
63-
64-
<LinearLayout
65-
android:layout_width="match_parent"
66-
android:layout_height="0dp"
67-
android:layout_weight="100"
68-
android:orientation="vertical">
6947

70-
<ScrollView
71-
android:layout_width="match_parent"
72-
android:layout_height="0dp"
73-
android:layout_weight="1"
74-
android:padding="@dimen/padding_default">
75-
76-
<TextView
77-
android:id="@+id/text"
78-
android:layout_width="match_parent"
79-
android:layout_height="wrap_content"
80-
android:text="@string/comparing_faces"
81-
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
82-
</ScrollView>
83-
84-
<LinearLayout
48+
<TextView
49+
android:id="@+id/text"
8550
android:layout_width="match_parent"
8651
android:layout_height="wrap_content"
87-
android:gravity="right"
88-
android:orientation="horizontal"
89-
android:padding="@dimen/padding_default">
52+
android:paddingLeft="8dp"
53+
android:paddingRight="8dp"
54+
android:gravity="center"
55+
android:text="@string/comparing_faces"
56+
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
9057

91-
<Button
92-
android:id="@+id/done_button"
93-
style="@style/Widget.AppCompat.Button.Borderless.Colored"
94-
android:layout_width="wrap_content"
95-
android:layout_height="wrap_content"
96-
android:layout_marginLeft="@dimen/padding_default"
97-
android:text="@string/done" />
98-
</LinearLayout>
9958
</LinearLayout>
59+
10060
</LinearLayout>
-5.54 KB
Binary file not shown.
6.23 KB
Loading
-3.36 KB
Binary file not shown.
4.04 KB
Loading

0 commit comments

Comments
 (0)