Merge pull request #24 from dataticket/master

fix CalledFromWrongThreadException in setTruePreviewSize(80)
pull/1/head
Dylan McIntyre 8 years ago committed by GitHub
commit 3eb3c72811
  1. 8
      camerakit/src/main/base/com/flurgle/camerakit/PreviewImpl.java

@ -61,10 +61,12 @@ abstract class PreviewImpl {
return mHeight; return mHeight;
} }
void setTruePreviewSize(int width, int height) { void setTruePreviewSize(final int width, final int height) {
this.mTrueWidth = width; this.mTrueWidth = width;
this.mTrueHeight = height; this.mTrueHeight = height;
getView().post(new Runnable() {
@Override
public void run() {
if (width != 0 && height != 0) { if (width != 0 && height != 0) {
AspectRatio aspectRatio = AspectRatio.of(width, height); AspectRatio aspectRatio = AspectRatio.of(width, height);
int targetHeight = (int) (getView().getWidth() * aspectRatio.toFloat()); int targetHeight = (int) (getView().getWidth() * aspectRatio.toFloat());
@ -84,6 +86,8 @@ abstract class PreviewImpl {
} }
} }
} }
});
}
int getTrueWidth() { int getTrueWidth() {
return mTrueWidth; return mTrueWidth;

Loading…
Cancel
Save