Some extra logging and update affdexsdk to 3.2

This commit is contained in:
Ruben van de Ven 2019-04-12 15:45:01 +02:00
parent 25b2e09f5e
commit 9ed9bd0d58
3 changed files with 10 additions and 6 deletions

View file

@ -33,7 +33,7 @@ dependencies {
}) })
compile 'com.android.support:appcompat-v7:24.2.0' compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:support-v4: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.google.code.gson:gson:2.4'
compile 'com.android.support:design:24.2.0' compile 'com.android.support:design:24.2.0'
compile 'com.loopj.android:android-async-http:1.4.9' compile 'com.loopj.android:android-async-http:1.4.9'

View file

@ -115,6 +115,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
int maxHeight = MirrorMenuActivity.this.getWindow().getDecorView().getHeight(); int maxHeight = MirrorMenuActivity.this.getWindow().getDecorView().getHeight();
int width; int width;
int height; int height;
Log.i(LOG_TAG, "Change the camera preview: " + previewWidth + " + " + measureWidth);
if (previewHeight == 0 || previewWidth == 0) { if (previewHeight == 0 || previewWidth == 0) {
width = measureWidth; width = measureWidth;
height = measureHeight; height = measureHeight;
@ -146,13 +147,13 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
setMeasuredDimension(width,height); 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); // RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(1,1);
params.addRule(RelativeLayout.CENTER_IN_PARENT,RelativeLayout.TRUE); params.addRule(RelativeLayout.CENTER_IN_PARENT,RelativeLayout.TRUE);
// 10% margin:
// params.leftMargin = (int) 120;
// params.rightMargin = params.leftMargin;
cameraPreview.setLayoutParams(params); cameraPreview.setLayoutParams(params);
cameraPreview.setWillNotDraw(false);
videoContentLayout.addView(cameraPreview,0); videoContentLayout.addView(cameraPreview,0);
scenarioView = new ScenarioView(this, null); scenarioView = new ScenarioView(this, null);
@ -321,7 +322,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
// SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surfaceView); // SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
detector = new CameraDetector(this, CameraDetector.CameraType.CAMERA_FRONT, cameraPreview, 1, Detector.FaceDetectorMode.LARGE_FACES); 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.setDetectAllEmotions(true);
detector.setDetectAllAppearances(false); detector.setDetectAllAppearances(false);
@ -375,6 +376,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
previewHeight = height; previewHeight = height;
previewWidth = width; previewWidth = width;
} }
Log.i(LOG_TAG, "onCameraSize "+previewWidth +"x"+previewHeight);
cameraPreview.requestLayout(); cameraPreview.requestLayout();
} }

View file

@ -147,6 +147,8 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
float height = canvas.getHeight(); float height = canvas.getHeight();
float width = canvas.getWidth(); float width = canvas.getWidth();
Log.i("ScenarioView", "onDraw "+ width+" x " +height);
if(_scenario != null) if(_scenario != null)
{ {