summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCheng-Ru Lin <owenlin@google.com>2009-10-04 15:20:33 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-10-04 15:20:33 -0700
commit56aa9c09027bbf2af8d5de9fde2ff7d37e8d31eb (patch)
tree94d1885279ba489e5b5a3ccda700c3f8142d229f /src
parentb0a7d570c1586690f5c33379c5a3172c0080ec58 (diff)
parent542fa8916296196b10d74b439304bd7fc5bf1cef (diff)
downloadpackages_apps_LegacyCamera-56aa9c09027bbf2af8d5de9fde2ff7d37e8d31eb.zip
packages_apps_LegacyCamera-56aa9c09027bbf2af8d5de9fde2ff7d37e8d31eb.tar.gz
packages_apps_LegacyCamera-56aa9c09027bbf2af8d5de9fde2ff7d37e8d31eb.tar.bz2
am 542fa891: Temporally solve the overlay creation problem.
Merge commit '542fa8916296196b10d74b439304bd7fc5bf1cef' into eclair-mr2 * commit '542fa8916296196b10d74b439304bd7fc5bf1cef': Temporally solve the overlay creation problem.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 777a0b4..ff24d45 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -49,6 +49,7 @@ import android.provider.MediaStore;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.util.Log;
+import android.view.Display;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -1619,7 +1620,15 @@ public class Camera extends Activity implements View.OnClickListener,
Size optimalSize = null;
double minDiff = Double.MAX_VALUE;
- int targetHeight = mSurfaceView.getHeight();
+ // Because of bugs of overlay and layout, we sometimes will try to
+ // layout the viewfinder in the portrait orientation and thus get the
+ // wrong size of mSurfaceView. When we change the preview size, the
+ // new overlay will be created before the old one closed, which causes
+ // an exception. For now, just get the screen size
+
+ Display display = getWindowManager().getDefaultDisplay();
+ int targetHeight = Math.min(display.getHeight(), display.getWidth());
+
if (targetHeight <= 0) {
// We don't know the size of SurefaceView, use screen height
WindowManager windowManager = (WindowManager)