summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRockchip2015-06-17 10:21:43 +0800
committerRockchip2015-06-17 10:21:43 +0800
commitd30d8de8a56a12a2bac0b39bc8bd282a114586fc (patch)
treea46e93ca44cd6e8fe5539bfdd6c652cc96f9f77d
parent4ee05cf07806d58db41f864eb4c4cca968769a37 (diff)
when the CameraUI View is not painted finished, it's width or height will be zero , but we need a valid value, so we should give the camera device valid screen's width and heightrk32/mid/5.1/develop
-rw-r--r--src/com/android/camera/VideoUI.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index 4da3e2a..db1192a 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -16,6 +16,9 @@
package com.android.camera;
+import android.content.Context;
+import android.view.WindowManager;
+
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.SurfaceTexture;
@@ -274,7 +277,18 @@ public class VideoUI implements PreviewStatusListener {
* @return The size of the available preview area.
*/
public Point getPreviewScreenSize() {
- return new Point(mRootView.getMeasuredWidth(), mRootView.getMeasuredHeight());
+ // when the CameraUI View is not painted finished, it's width or height will be zero , but we need a valid value, so we do these
+ //return new Point(mRootView.getMeasuredWidth(), mRootView.getMeasuredHeight());
+ if (mRootView.getMeasuredWidth() == 0 || mRootView.getMeasuredHeight() == 0) {
+ WindowManager wm = (WindowManager) mActivity.getApplicationContext()
+ .getSystemService(Context.WINDOW_SERVICE);
+ int width = wm.getDefaultDisplay().getWidth();
+ int height = wm.getDefaultDisplay().getHeight();
+
+ return new Point(width, height);
+ } else {
+ return new Point(mRootView.getMeasuredWidth(), mRootView.getMeasuredHeight());
+ }
}
public void onOrientationChanged(int orientation) {