|
|
|
@ -8,6 +8,7 @@ import android.hardware.Camera.CameraInfo;
|
|
|
|
|
import android.hardware.Camera.Parameters;
|
|
|
|
|
import android.hardware.Camera.Size;
|
|
|
|
|
import android.os.AsyncTask;
|
|
|
|
|
import android.os.Build.VERSION;
|
|
|
|
|
import android.os.Build.VERSION_CODES;
|
|
|
|
|
import android.support.annotation.NonNull;
|
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
@ -122,8 +123,14 @@ import java.util.List;
|
|
|
|
|
}
|
|
|
|
|
final float newWidth = visibleRect.width() * scale;
|
|
|
|
|
final float newHeight = visibleRect.height() * scale;
|
|
|
|
|
final float centerX = previewWidth / 2;
|
|
|
|
|
final float centerX;
|
|
|
|
|
final float centerY = previewHeight / 2;
|
|
|
|
|
if (VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH) {
|
|
|
|
|
centerX = previewWidth - newWidth / 2;
|
|
|
|
|
} else {
|
|
|
|
|
centerX = previewWidth / 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
visibleRect.set((int) (centerX - newWidth / 2),
|
|
|
|
|
(int) (centerY - newHeight / 2),
|
|
|
|
|
(int) (centerX + newWidth / 2),
|
|
|
|
|