From 9ed9bd0d584c7dcac9913c50943676ba3f1941ed Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Fri, 12 Apr 2019 15:45:01 +0200 Subject: [PATCH] Some extra logging and update affdexsdk to 3.2 --- app/build.gradle | 2 +- .../emotionhero/MirrorMenuActivity.java | 12 +++++++----- .../com/rubenvandeven/emotionhero/ScenarioView.java | 2 ++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4f92589..e04c7e9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,7 +33,7 @@ dependencies { }) compile 'com.android.support:appcompat-v7:24.2.0' compile 'com.android.support:support-v4:24.2.0' - compile 'com.affectiva.android:affdexsdk:3.1.2' + compile 'com.affectiva.android:affdexsdk:3.2' compile 'com.google.code.gson:gson:2.4' compile 'com.android.support:design:24.2.0' compile 'com.loopj.android:android-async-http:1.4.9' diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/MirrorMenuActivity.java b/app/src/main/java/com/rubenvandeven/emotionhero/MirrorMenuActivity.java index d555b2f..4fc0dd7 100644 --- a/app/src/main/java/com/rubenvandeven/emotionhero/MirrorMenuActivity.java +++ b/app/src/main/java/com/rubenvandeven/emotionhero/MirrorMenuActivity.java @@ -115,6 +115,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im int maxHeight = MirrorMenuActivity.this.getWindow().getDecorView().getHeight(); int width; int height; + Log.i(LOG_TAG, "Change the camera preview: " + previewWidth + " + " + measureWidth); if (previewHeight == 0 || previewWidth == 0) { width = measureWidth; height = measureHeight; @@ -146,13 +147,13 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im setMeasuredDimension(width,height); } }; - RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + + RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); // RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(1,1); params.addRule(RelativeLayout.CENTER_IN_PARENT,RelativeLayout.TRUE); - // 10% margin: -// params.leftMargin = (int) 120; -// params.rightMargin = params.leftMargin; + cameraPreview.setLayoutParams(params); + cameraPreview.setWillNotDraw(false); videoContentLayout.addView(cameraPreview,0); scenarioView = new ScenarioView(this, null); @@ -321,7 +322,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im // SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surfaceView); detector = new CameraDetector(this, CameraDetector.CameraType.CAMERA_FRONT, cameraPreview, 1, Detector.FaceDetectorMode.LARGE_FACES); - detector.setLicensePath("emotionhero_dev.license"); +// detector.setLicensePath("emotionhero_dev.license"); detector.setDetectAllEmotions(true); detector.setDetectAllAppearances(false); @@ -375,6 +376,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im previewHeight = height; previewWidth = width; } + Log.i(LOG_TAG, "onCameraSize "+previewWidth +"x"+previewHeight); cameraPreview.requestLayout(); } diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioView.java b/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioView.java index 1b76e53..d04e731 100644 --- a/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioView.java +++ b/app/src/main/java/com/rubenvandeven/emotionhero/ScenarioView.java @@ -147,6 +147,8 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback float height = canvas.getHeight(); float width = canvas.getWidth(); + Log.i("ScenarioView", "onDraw "+ width+" x " +height); + if(_scenario != null) {