summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2010-03-16 17:40:54 +0800
committerOwen Lin <owenlin@google.com>2010-03-18 08:31:16 +0800
commit59b5974a4ae078eb7628fd855db89e5be9b0fe6f (patch)
tree81d98666a9b3aadc1f9c7966b6844cdee40ffd68 /src/com/android/camera/ui
parent6988d4e2ef8d14d8bf3ee81c8eb3175bbf1b88ec (diff)
downloadLegacyCamera-59b5974a4ae078eb7628fd855db89e5be9b0fe6f.zip
LegacyCamera-59b5974a4ae078eb7628fd855db89e5be9b0fe6f.tar.gz
LegacyCamera-59b5974a4ae078eb7628fd855db89e5be9b0fe6f.tar.bz2
Some more improvements of the UI.
Use stencial test to draw popup-window Fix the ACTION_UP won't send to mMotionTarget Make the text color in Zoom indicator same as others Reset exposure compensation in onCreate Change-Id: I4ff7c3774fd0573cc6ac4a86dbeeb9588b587d0c
Diffstat (limited to 'src/com/android/camera/ui')
-rw-r--r--src/com/android/camera/ui/GLRootView.java14
-rw-r--r--src/com/android/camera/ui/GLView.java10
-rw-r--r--src/com/android/camera/ui/HeadUpDisplay.java2
-rw-r--r--src/com/android/camera/ui/PopupWindow.java2
-rw-r--r--src/com/android/camera/ui/ZoomController.java5
-rw-r--r--src/com/android/camera/ui/ZoomIndicator.java3
6 files changed, 15 insertions, 21 deletions
diff --git a/src/com/android/camera/ui/GLRootView.java b/src/com/android/camera/ui/GLRootView.java
index 92c0f35..a1b29fb 100644
--- a/src/com/android/camera/ui/GLRootView.java
+++ b/src/com/android/camera/ui/GLRootView.java
@@ -133,7 +133,7 @@ public class GLRootView extends GLSurfaceView
private void initialize() {
mFlags |= FLAG_INITIALIZED;
- setEGLConfigChooser(8, 8, 8, 8, 0, 0);
+ setEGLConfigChooser(8, 8, 8, 8, 0, 4);
getHolder().setFormat(PixelFormat.TRANSLUCENT);
setZOrderOnTop(true);
setDebugFlags(DEBUG_CHECK_GL_ERROR);
@@ -226,6 +226,7 @@ public class GLRootView extends GLSurfaceView
// Enable used features
gl.glEnable(GL11.GL_BLEND);
gl.glEnable(GL11.GL_SCISSOR_TEST);
+ gl.glEnable(GL11.GL_STENCIL_TEST);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glEnable(GL11.GL_TEXTURE_2D);
@@ -233,11 +234,9 @@ public class GLRootView extends GLSurfaceView
gl.glTexEnvf(GL11.GL_TEXTURE_ENV,
GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE);
- // Set the blend function for premultiplied alpha.
- gl.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
-
// Set the background color
gl.glClearColor(0f, 0f, 0f, 0f);
+ gl.glClearStencil(0);
gl.glVertexPointer(2, GL11.GL_FLOAT, 0, mVertexBuffer);
gl.glTexCoordPointer(2, GL11.GL_FLOAT, 0, mTexCoordBuffer);
}
@@ -402,15 +401,10 @@ public class GLRootView extends GLSurfaceView
if ((mFlags & FLAG_NEED_LAYOUT) != 0) layoutContentPane();
clearClip();
- gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
+ gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_STENCIL_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(0, 0, 725, 480);
- gl.glEnable(GL11.GL_TEXTURE_2D);*/
-
mAnimationTime = SystemClock.uptimeMillis();
if (mContentView != null) {
mContentView.render(GLRootView.this, (GL11) gl);
diff --git a/src/com/android/camera/ui/GLView.java b/src/com/android/camera/ui/GLView.java
index 090de39..9d12293 100644
--- a/src/com/android/camera/ui/GLView.java
+++ b/src/com/android/camera/ui/GLView.java
@@ -218,12 +218,12 @@ public class GLView {
return false;
}
- private boolean dispatchTouchEvent(
- MotionEvent event, int x, int y, GLView component) {
+ private boolean dispatchTouchEvent(MotionEvent event,
+ int x, int y, GLView component, boolean checkBounds) {
Rect rect = component.mBounds;
int left = rect.left;
int top = rect.top;
- if (rect.contains(x, y)) {
+ if (!checkBounds || rect.contains(x, y)) {
event.offsetLocation(-left, -top);
if (component.dispatchTouchEvent(event)) {
event.offsetLocation(left, top);
@@ -245,7 +245,7 @@ public class GLView {
cancel.setAction(MotionEvent.ACTION_CANCEL);
mMotionTarget = null;
} else {
- dispatchTouchEvent(event, x, y, mMotionTarget);
+ dispatchTouchEvent(event, x, y, mMotionTarget, false);
if (action == MotionEvent.ACTION_CANCEL
|| action == MotionEvent.ACTION_UP) {
mMotionTarget = null;
@@ -257,7 +257,7 @@ public class GLView {
for (int i = 0, n = getComponentCount(); i < n; ++i) {
GLView component = getComponent(i);
if (component.getVisibility() != GLView.VISIBLE) continue;
- if (dispatchTouchEvent(event, x, y, component)) {
+ if (dispatchTouchEvent(event, x, y, component, true)) {
mMotionTarget = component;
return true;
}
diff --git a/src/com/android/camera/ui/HeadUpDisplay.java b/src/com/android/camera/ui/HeadUpDisplay.java
index 561bd5b..046be6d 100644
--- a/src/com/android/camera/ui/HeadUpDisplay.java
+++ b/src/com/android/camera/ui/HeadUpDisplay.java
@@ -263,7 +263,7 @@ public class HeadUpDisplay extends GLView {
}
private void initializePopupWindow(Context context) {
- mPopupWindow = new PopupWindow();
+ mPopupWindow = new PopupWindowStencilImpl();
mPopupWindow.setBackground(
new NinePatchTexture(context, R.drawable.menu_popup));
mPopupWindow.setAnchor(new ResourceTexture(
diff --git a/src/com/android/camera/ui/PopupWindow.java b/src/com/android/camera/ui/PopupWindow.java
index 3d650cf..cb771cc 100644
--- a/src/com/android/camera/ui/PopupWindow.java
+++ b/src/com/android/camera/ui/PopupWindow.java
@@ -143,7 +143,7 @@ public class PopupWindow extends GLView {
AnimationSet set = new AnimationSet(false);
Animation scale = new ScaleAnimation(
- 0.7f, 1f, 0.7f, 1f, getWidth(), getHeight() / 2);
+ 0.7f, 1f, 0.7f, 1f, getWidth(), mAnchorPosition);
Animation alpha = new AlphaAnimation(0.5f, 1.0f);
set.addAnimation(scale);
diff --git a/src/com/android/camera/ui/ZoomController.java b/src/com/android/camera/ui/ZoomController.java
index e49b36a..83e2d09 100644
--- a/src/com/android/camera/ui/ZoomController.java
+++ b/src/com/android/camera/ui/ZoomController.java
@@ -7,7 +7,6 @@ import android.graphics.Rect;
import android.view.MotionEvent;
import com.android.camera.R;
-
import com.android.camera.Util;
import java.text.DecimalFormat;
@@ -64,9 +63,11 @@ public class ZoomController extends GLView {
}
private void onSliderMoved(int position, boolean isMoving) {
- mSliderPosition = Util.clamp(position,
+ position = Util.clamp(position,
mSliderTop, mSliderBottom - sSlider.getHeight());
+ mSliderPosition = position;
invalidate();
+
int index = mRatios.length - 1 - (int)
((position - mSliderTop) / mValueGap + .5f);
if (index != mIndex || !isMoving) {
diff --git a/src/com/android/camera/ui/ZoomIndicator.java b/src/com/android/camera/ui/ZoomIndicator.java
index 726250d..e9359ed 100644
--- a/src/com/android/camera/ui/ZoomIndicator.java
+++ b/src/com/android/camera/ui/ZoomIndicator.java
@@ -4,7 +4,6 @@ import android.content.Context;
import android.graphics.Color;
import com.android.camera.R;
-
import com.android.camera.ui.ZoomController.ZoomListener;
import java.text.DecimalFormat;
@@ -12,7 +11,7 @@ import java.text.DecimalFormat;
public class ZoomIndicator extends AbstractIndicator {
private static final DecimalFormat sZoomFormat = new DecimalFormat("#.#x");
private static final float FONT_SIZE = 18;
- private static final int FONT_COLOR = Color.WHITE;
+ private static final int FONT_COLOR = 0xA8FFFFFF;
protected static final String TAG = "ZoomIndicator";