summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2010-03-15 14:08:13 +0800
committerOwen Lin <owenlin@google.com>2010-03-16 14:20:33 +0800
commit6988d4e2ef8d14d8bf3ee81c8eb3175bbf1b88ec (patch)
treead890b87333bd67dd33027718f547def10760e1a /src/com/android/camera/ui
parent9ae7d027bb8f55b85a158cddeb7ed84c5a0a7983 (diff)
downloadLegacyCamera-6988d4e2ef8d14d8bf3ee81c8eb3175bbf1b88ec.zip
LegacyCamera-6988d4e2ef8d14d8bf3ee81c8eb3175bbf1b88ec.tar.gz
LegacyCamera-6988d4e2ef8d14d8bf3ee81c8eb3175bbf1b88ec.tar.bz2
Fix several UI issues.
1. Remove the cross in border_last_picture 2. Remove the gripper in VideoCamera 3. Solve the popup triangle locate in wrong position 4. Remove the top and bottom borders of the preview frame in Camera 5. Rotate the on-screen indicators when orientation changed 6. Add the checking for the flash mode in VideoCamera Change-Id: I304ea3582d08c5e46ed750b7371588635a4d8009
Diffstat (limited to 'src/com/android/camera/ui')
-rw-r--r--src/com/android/camera/ui/AbstractIndicator.java39
-rw-r--r--src/com/android/camera/ui/GLRootView.java7
-rw-r--r--src/com/android/camera/ui/HeadUpDisplay.java34
-rw-r--r--src/com/android/camera/ui/IndicatorBar.java6
4 files changed, 58 insertions, 28 deletions
diff --git a/src/com/android/camera/ui/AbstractIndicator.java b/src/com/android/camera/ui/AbstractIndicator.java
index 7b93205..7c6df7c 100644
--- a/src/com/android/camera/ui/AbstractIndicator.java
+++ b/src/com/android/camera/ui/AbstractIndicator.java
@@ -2,12 +2,16 @@
package com.android.camera.ui;
import android.content.Context;
+import android.graphics.Matrix;
import android.graphics.Rect;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Transformation;
import javax.microedition.khronos.opengles.GL11;
public abstract class AbstractIndicator extends GLView {
private static final int DEFAULT_PADDING = 3;
+ private int mOrientation = 0;
abstract protected Texture getIcon();
@@ -27,18 +31,37 @@ public abstract class AbstractIndicator extends GLView {
@Override
protected void render(GLRootView root, GL11 gl) {
Texture icon = getIcon();
-
- Rect p = mPaddings;
- int width = getWidth() - p.left - p.right;
- int height = getHeight() - p.top - p.bottom;
-
if (icon != null) {
- icon.draw(root,
- p.left + (width - icon.getWidth()) / 2,
- p.top + (height - icon.getHeight()) / 2);
+ Rect p = mPaddings;
+ int width = getWidth() - p.left - p.right;
+ int height = getHeight() - p.top - p.bottom;
+ if (mOrientation != 0) {
+ Transformation trans = root.pushTransform();
+ Matrix matrix = trans.getMatrix();
+ matrix.preTranslate(p.left + width / 2, p.top + height / 2);
+ matrix.preRotate(-mOrientation);
+ icon.draw(root, -icon.getWidth() / 2, -icon.getHeight() / 2);
+ root.popTransform();
+ } else {
+ icon.draw(root,
+ p.left + (width - icon.getWidth()) / 2,
+ p.top + (height - icon.getHeight()) / 2);
+ }
}
}
+ public void setOrientation(int orientation) {
+ if (orientation % 90 != 0) throw new IllegalArgumentException();
+ orientation = orientation % 360;
+ if (orientation < 0) orientation += 360;
+
+ if (mOrientation == orientation) return;
+ mOrientation = orientation;
+ AlphaAnimation anim = new AlphaAnimation(0.2f, 1);
+ anim.setDuration(200);
+ startAnimation(anim);
+ }
+
abstract public GLView getPopupContent();
abstract public void overrideSettings(String key, String settings);
diff --git a/src/com/android/camera/ui/GLRootView.java b/src/com/android/camera/ui/GLRootView.java
index 84eea06..92c0f35 100644
--- a/src/com/android/camera/ui/GLRootView.java
+++ b/src/com/android/camera/ui/GLRootView.java
@@ -118,10 +118,11 @@ public class GLRootView extends GLSurfaceView
return mTransformation;
}
- public void pushTransform() {
+ public Transformation pushTransform() {
Transformation trans = obtainTransformation();
trans.set(mTransformation);
mTransformStack.push(trans);
+ return mTransformation;
}
public void popTransform() {
@@ -400,14 +401,14 @@ public class GLRootView extends GLSurfaceView
}
if ((mFlags & FLAG_NEED_LAYOUT) != 0) layoutContentPane();
-
+ clearClip();
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
gl.glEnable(GL11.GL_BLEND);
gl.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
/*gl.glDisable(GL11.GL_TEXTURE_2D);
gl.glColor4f(0, 0, 0.5f, 0.4f);
- drawRect(30, 30, 30, 30);
+ drawRect(0, 0, 725, 480);
gl.glEnable(GL11.GL_TEXTURE_2D);*/
mAnimationTime = SystemClock.uptimeMillis();
diff --git a/src/com/android/camera/ui/HeadUpDisplay.java b/src/com/android/camera/ui/HeadUpDisplay.java
index fc2628e..561bd5b 100644
--- a/src/com/android/camera/ui/HeadUpDisplay.java
+++ b/src/com/android/camera/ui/HeadUpDisplay.java
@@ -17,12 +17,11 @@ import android.view.View.MeasureSpec;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
-import com.android.camera.R;
-
import com.android.camera.CameraSettings;
import com.android.camera.IconListPreference;
import com.android.camera.ListPreference;
import com.android.camera.PreferenceGroup;
+import com.android.camera.R;
import java.util.ArrayList;
import java.util.concurrent.Callable;
@@ -58,8 +57,7 @@ public class HeadUpDisplay extends GLView {
private PopupWindow mPopupWindow;
- private int mAnchorX;
- private int mAnchorY;
+ private GLView mAnchorView;
private int mOrientation = 0;
protected Listener mListener;
@@ -178,7 +176,7 @@ public class HeadUpDisplay extends GLView {
if(mPopupWindow != null
&& mPopupWindow.getVisibility() == GLView.VISIBLE) {
- layoutPopupWindow(mAnchorX, mAnchorY);
+ layoutPopupWindow(mAnchorView);
}
}
@@ -190,9 +188,14 @@ public class HeadUpDisplay extends GLView {
initializeIndicatorBar(context, preferenceGroup);
}
- private void layoutPopupWindow(int anchorX, int anchorY) {
- mAnchorX = anchorX;
- mAnchorY = anchorY;
+ private void layoutPopupWindow(GLView anchorView) {
+
+ mAnchorView = anchorView;
+ Rect rect = new Rect();
+ getBoundsOf(anchorView, rect);
+
+ int anchorX = rect.left + sPopupWindowOverlap;
+ int anchorY = (rect.top + rect.bottom) / 2;
int width = (int) (getWidth() * MAX_WIDTH_RATIO + .5);
int height = (int) (getHeight() * MAX_HEIGHT_RATIO + .5);
@@ -215,8 +218,8 @@ public class HeadUpDisplay extends GLView {
xoffset, yoffset, xoffset + width, yoffset + height);
}
- private void showPopupWindow(int anchorX, int anchorY) {
- layoutPopupWindow(anchorX, anchorY);
+ private void showPopupWindow(GLView anchorView) {
+ layoutPopupWindow(anchorView);
mPopupWindow.popup();
mSharedPrefs.registerOnSharedPreferenceChangeListener(
mSharedPreferenceChangeListener);
@@ -248,9 +251,10 @@ public class HeadUpDisplay extends GLView {
public void setOrientation(int orientation) {
mOrientation = orientation;
+ mIndicatorBar.setOrientation(orientation);
if (mPopupWindow == null) return;
if (mPopupWindow.getVisibility() == GLView.VISIBLE) {
- Animation alpha = new AlphaAnimation(0, 1);
+ Animation alpha = new AlphaAnimation(0.2f, 1);
alpha.setDuration(250);
mPopupWindow.startAnimation(alpha);
scheduleDeactiviateIndicatorBar();
@@ -333,10 +337,6 @@ public class HeadUpDisplay extends GLView {
implements IndicatorBar.OnItemSelectedListener {
public void onItemSelected(GLView view, int position) {
- Rect rect = new Rect();
- getBoundsOf(view, rect);
- int anchorX = rect.left + sPopupWindowOverlap;
- int anchorY = (rect.top + rect.bottom) / 2;
AbstractIndicator indicator = (AbstractIndicator) view;
if (mPopupWindow == null) {
@@ -345,9 +345,9 @@ public class HeadUpDisplay extends GLView {
mPopupWindow.setContent(indicator.getPopupContent());
if (mPopupWindow.getVisibility() == GLView.VISIBLE) {
- layoutPopupWindow(anchorX, anchorY);
+ layoutPopupWindow(indicator);
} else {
- showPopupWindow(anchorX, anchorY);
+ showPopupWindow(indicator);
}
}
diff --git a/src/com/android/camera/ui/IndicatorBar.java b/src/com/android/camera/ui/IndicatorBar.java
index 5ea9261..090a71a 100644
--- a/src/com/android/camera/ui/IndicatorBar.java
+++ b/src/com/android/camera/ui/IndicatorBar.java
@@ -175,4 +175,10 @@ public class IndicatorBar extends GLView {
((AbstractIndicator) getComponent(i)).reloadPreferences();
}
}
+
+ public void setOrientation(int orientation) {
+ for (int i = 1, n = getComponentCount(); i < n; ++i) {
+ ((AbstractIndicator) getComponent(i)).setOrientation(orientation);
+ }
+ }
}