diff --git a/app/src/main/java/com/xypower/mpapp/v2/Camera2VideoActivity.java b/app/src/main/java/com/xypower/mpapp/v2/Camera2VideoActivity.java index fa96fd09..e213ec3e 100644 --- a/app/src/main/java/com/xypower/mpapp/v2/Camera2VideoActivity.java +++ b/app/src/main/java/com/xypower/mpapp/v2/Camera2VideoActivity.java @@ -134,7 +134,7 @@ public class Camera2VideoActivity extends AppCompatActivity { try { long ts = System.currentTimeMillis(); - Bitmap bm = Bitmap.createBitmap(mPreviewWidth, mPreviewHeight, Bitmap.Config.ARGB_8888); + Bitmap bm = Bitmap.createBitmap(mPreviewView.getMeasuredWidth(), mPreviewView.getMeasuredHeight(), Bitmap.Config.ARGB_8888); Bitmap oldBm = null; Canvas canvas = new Canvas(bm); @@ -330,13 +330,8 @@ public class Camera2VideoActivity extends AppCompatActivity { } int statusHeight = mStatusBarHeight; - int bmWidth = 1620; - int bmHeight = 1080; - - AspectRatioFrameLayout frameLayout = (AspectRatioFrameLayout)findViewById(R.id.wrap_view); - - int w = frameLayout.getWidth(); - int h = frameLayout.getMeasuredHeight(); + int bmWidth = bm.getWidth(); + int bmHeight = bm.getHeight(); int margin = mOSDMargin; int x = 0; @@ -474,7 +469,7 @@ public class Camera2VideoActivity extends AppCompatActivity { String[] items = mOSDRightBottom.split("\n"); Point origin = new Point(bmWidth - margin, bmHeight - margin); - for(int idx = items.length-1; idx >= 0; idx--) { + for(int idx = items.length - 1; idx >= 0; idx--) { int mask = 0; String item = items[idx]; @@ -508,7 +503,6 @@ public class Camera2VideoActivity extends AppCompatActivity { origin.y -= (textBounds.height() * 3) >> 1; } } - } private void updateOSD(Bitmap bm, long ts) { @@ -658,8 +652,6 @@ public class Camera2VideoActivity extends AppCompatActivity { private void setUpCamera() { setUpCameraView(); - - if (mNextVideoAbsolutePath == null || mNextVideoAbsolutePath.isEmpty()) { mNextVideoAbsolutePath = getVideoFilePath(this); }