diff options
22 files changed, 104 insertions, 238 deletions
diff --git a/res/drawable-hdpi/border_last_picture_highlight.9.png b/res/drawable-hdpi/border_last_picture_highlight.9.png Binary files differindex d92e795..ae4a0e2 100644 --- a/res/drawable-hdpi/border_last_picture_highlight.9.png +++ b/res/drawable-hdpi/border_last_picture_highlight.9.png diff --git a/res/drawable-hdpi/border_last_picture_normal.9.png b/res/drawable-hdpi/border_last_picture_normal.9.png Binary files differindex 4ed2a34..64d17a0 100644 --- a/res/drawable-hdpi/border_last_picture_normal.9.png +++ b/res/drawable-hdpi/border_last_picture_normal.9.png diff --git a/res/drawable-hdpi/border_last_picture_pressed.9.png b/res/drawable-hdpi/border_last_picture_pressed.9.png Binary files differindex bcdb34b..2c7ba22 100644 --- a/res/drawable-hdpi/border_last_picture_pressed.9.png +++ b/res/drawable-hdpi/border_last_picture_pressed.9.png diff --git a/res/drawable-hdpi/border_view_finder.9.png b/res/drawable-hdpi/border_view_finder.9.png Binary files differindex 07737df..b5922bf 100644 --- a/res/drawable-hdpi/border_view_finder.9.png +++ b/res/drawable-hdpi/border_view_finder.9.png diff --git a/res/drawable-hdpi/gripper_handle.9.png b/res/drawable-hdpi/gripper_handle.9.png Binary files differdeleted file mode 100644 index e7a2c20..0000000 --- a/res/drawable-hdpi/gripper_handle.9.png +++ /dev/null diff --git a/res/drawable-mdpi/border_last_picture_highlight.9.png b/res/drawable-mdpi/border_last_picture_highlight.9.png Binary files differindex 8bbac44..a78cd12 100755 --- a/res/drawable-mdpi/border_last_picture_highlight.9.png +++ b/res/drawable-mdpi/border_last_picture_highlight.9.png diff --git a/res/drawable-mdpi/border_last_picture_normal.9.png b/res/drawable-mdpi/border_last_picture_normal.9.png Binary files differindex 0bebf8f..021286f 100755 --- a/res/drawable-mdpi/border_last_picture_normal.9.png +++ b/res/drawable-mdpi/border_last_picture_normal.9.png diff --git a/res/drawable-mdpi/border_last_picture_pressed.9.png b/res/drawable-mdpi/border_last_picture_pressed.9.png Binary files differindex 7671494..d18e929 100755 --- a/res/drawable-mdpi/border_last_picture_pressed.9.png +++ b/res/drawable-mdpi/border_last_picture_pressed.9.png diff --git a/res/drawable-mdpi/gripper_handle.9.png b/res/drawable-mdpi/gripper_handle.9.png Binary files differdeleted file mode 100644 index b599583..0000000 --- a/res/drawable-mdpi/gripper_handle.9.png +++ /dev/null diff --git a/res/drawable-mdpi/menu_popup.9.png b/res/drawable-mdpi/menu_popup.9.png Binary files differindex a655a03..2a75324 100644 --- a/res/drawable-mdpi/menu_popup.9.png +++ b/res/drawable-mdpi/menu_popup.9.png diff --git a/res/drawable-mdpi/menu_popup_triangle.png b/res/drawable-mdpi/menu_popup_triangle.png Binary files differindex 91b6523..52b805e 100644 --- a/res/drawable-mdpi/menu_popup_triangle.png +++ b/res/drawable-mdpi/menu_popup_triangle.png diff --git a/res/layout/on_screen_menu.xml b/res/layout/on_screen_menu.xml deleted file mode 100644 index f80a846..0000000 --- a/res/layout/on_screen_menu.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2007 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/main_panel" - android:background="@drawable/camera_background" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <FrameLayout android:layout_width="match_parent" - android:background="@android:color/black" - android:layout_height="match_parent" - android:layout_toLeftOf="@+id/btn_gripper"> - <ListView android:id="@+id/menu_view" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - <ListView android:id="@+id/sub_menu" - android:visibility="invisible" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - </FrameLayout> - <ImageView android:id="@+id/btn_gripper" - android:layout_height="match_parent" - android:layout_width="wrap_content" - android:background="@drawable/gripper_handle" - android:layout_alignParentRight="true"/> -</RelativeLayout> diff --git a/res/layout/on_screen_menu_header.xml b/res/layout/on_screen_menu_header.xml deleted file mode 100644 index 29e9176..0000000 --- a/res/layout/on_screen_menu_header.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/title" - android:background="#222" - android:paddingLeft="5dp" - android:paddingRight="5dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:singleLine="true" /> diff --git a/res/layout/on_screen_menu_list_item.xml b/res/layout/on_screen_menu_list_item.xml deleted file mode 100644 index de83a4c..0000000 --- a/res/layout/on_screen_menu_list_item.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeight" - android:paddingLeft="10dp" - android:paddingRight="5dp" > - <TextView android:id="@+id/title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:maxLines="2" - android:ellipsize="end" - android:textAppearance="?android:attr/textAppearanceLarge" - android:fadingEdge="horizontal" /> - - <TextView android:id="@+id/summary" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@id/title" - android:layout_alignLeft="@id/title" - android:textAppearance="?android:attr/textAppearanceSmall" - android:singleLine="true" /> -</RelativeLayout> diff --git a/res/layout/video_camera.xml b/res/layout/video_camera.xml index 482750c..3172f28 100644 --- a/res/layout/video_camera.xml +++ b/res/layout/video_camera.xml @@ -25,10 +25,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> - <ImageView android:id="@+id/btn_gripper" - android:background="@drawable/btn_gripper" - android:layout_width="wrap_content" - android:layout_height="wrap_content"/> <FrameLayout android:id="@+id/frame" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 774bc5a..1e7cec2 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -26,8 +26,6 @@ import android.media.CamcorderProfile; import android.preference.PreferenceManager; import android.util.Log; -import com.android.camera.R; - import java.util.ArrayList; import java.util.List; @@ -138,6 +136,8 @@ public class CameraSettings { ListPreference flashMode = group.findPreference(KEY_FLASH_MODE); ListPreference focusMode = group.findPreference(KEY_FOCUS_MODE); ListPreference exposure = group.findPreference(KEY_EXPOSURE); + ListPreference videoFlashMode = + group.findPreference(KEY_VIDEOCAMERA_FLASH_MODE); // Since the screen could be loaded from different resources, we need // to check if the preference is available here @@ -181,6 +181,10 @@ public class CameraSettings { filterUnsupportedOptions(group, focusMode, mParameters.getSupportedFocusModes()); } + if (videoFlashMode != null) { + filterUnsupportedOptions(group, + videoFlashMode, mParameters.getSupportedFlashModes()); + } if (exposure != null) { buildExposureCompensation(group, exposure); diff --git a/src/com/android/camera/PreviewFrameLayout.java b/src/com/android/camera/PreviewFrameLayout.java index 09081bb..d30f6c8 100644 --- a/src/com/android/camera/PreviewFrameLayout.java +++ b/src/com/android/camera/PreviewFrameLayout.java @@ -20,13 +20,9 @@ import android.app.Activity; import android.content.Context; import android.util.AttributeSet; import android.util.DisplayMetrics; -import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.FrameLayout; -import com.android.camera.R; - /** * A layout which handles the preview aspect ratio and the position of * the gripper. @@ -40,10 +36,12 @@ public class PreviewFrameLayout extends ViewGroup { } private double mAspectRatio = 4.0 / 3.0; - private ImageView mGripper; private FrameLayout mFrame; private OnSizeChangedListener mSizeListener; - private DisplayMetrics mMetrics = new DisplayMetrics(); + private final DisplayMetrics mMetrics = new DisplayMetrics(); + + private int mPreviewWidth; + private int mPreviewHeight; public PreviewFrameLayout(Context context, AttributeSet attrs) { super(context, attrs); @@ -57,7 +55,6 @@ public class PreviewFrameLayout extends ViewGroup { @Override protected void onFinishInflate() { - mGripper = (ImageView) findViewById(R.id.btn_gripper); mFrame = (FrameLayout) findViewById(R.id.frame); if (mFrame == null) { throw new IllegalStateException( @@ -75,29 +72,26 @@ public class PreviewFrameLayout extends ViewGroup { } @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - - int gripperWidth = 0; - int gripperHeight = 0; - - if (mGripper != null) { - measureChild(mGripper, widthMeasureSpec, heightMeasureSpec); - gripperWidth = mGripper.getMeasuredWidth(); - gripperHeight = mGripper.getMeasuredHeight(); - } + protected void onLayout(boolean changed, int l, int t, int r, int b) { + // Try to layout the "frame" in the center of the area, and put + // "gripper" just to the left of it. If there is no enough space for + // the gripper, the "frame" will be moved a little right so that + // they won't overlap with each other. - int frameWidth = getMeasuredWidth() - (int) Math.max( - gripperWidth, MIN_HORIZONTAL_MARGIN * mMetrics.density); - int frameHeight = getMeasuredHeight(); + int frameWidth = getWidth(); + int frameHeight = getHeight(); FrameLayout f = mFrame; - int horizontalPadding = f.getPaddingLeft() + f.getPaddingRight(); + int horizontalPadding = Math.max( + f.getPaddingLeft() + f.getPaddingRight(), + (int) (MIN_HORIZONTAL_MARGIN * mMetrics.density)); int verticalPadding = f.getPaddingBottom() + f.getPaddingTop(); + // Ignore the vertical paddings, so that we won't draw the frame on the + // top and bottom sides + int previewHeight = frameHeight; int previewWidth = frameWidth - horizontalPadding; - int previewHeight = frameHeight - verticalPadding; // resize frame and preview for aspect ratio if (previewWidth > previewHeight * mAspectRatio) { @@ -105,46 +99,19 @@ public class PreviewFrameLayout extends ViewGroup { } else { previewHeight = (int) (previewWidth / mAspectRatio + .5); } + frameWidth = previewWidth + horizontalPadding; frameHeight = previewHeight + verticalPadding; - measureChild(mFrame, - MeasureSpec.makeMeasureSpec(MeasureSpec.EXACTLY, frameWidth), - MeasureSpec.makeMeasureSpec(MeasureSpec.EXACTLY, frameHeight)); - } - - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - // Try to layout the "frame" in the center of the area, and put - // "gripper" just to the left of it. If there is no enough space for - // the gripper, the "frame" will be moved a little right so that - // they won't overlap with each other. - - int frameWidth = mFrame.getMeasuredWidth(); - int frameHeight = mFrame.getMeasuredHeight(); - - int leftSpace = ((r - l) - frameWidth) / 2; - int topSpace = ((b - t) - frameHeight) / 2; - - int gripperWidth = 0; - int gripperHeight = 0; - if (mGripper != null) { - gripperWidth = mGripper.getMeasuredWidth(); - gripperHeight = mGripper.getMeasuredHeight(); - myLayoutChild(mGripper, - Math.max(l, l + (leftSpace - gripperWidth)), - t + ((b - t) - gripperHeight) / 2, - gripperWidth, gripperHeight); - } - myLayoutChild(mFrame, Math.max(l + leftSpace, l + gripperWidth), - t + topSpace, frameWidth, frameHeight); + int hSpace = ((r - l) - frameWidth) / 2; + int vSpace = ((b - t) - frameHeight) / 2; + mFrame.measure( + MeasureSpec.makeMeasureSpec(frameWidth, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(frameHeight, MeasureSpec.EXACTLY)); + mFrame.layout(l + hSpace, t + vSpace, r - hSpace, b - vSpace); if (mSizeListener != null) { mSizeListener.onSizeChanged(); } } - - private static void myLayoutChild(View child, int l, int t, int w, int h) { - child.layout(l, t, l + w, t + h); - } } diff --git a/src/com/android/camera/RotateImageView.java b/src/com/android/camera/RotateImageView.java index 14d1628..dcec5e4 100644 --- a/src/com/android/camera/RotateImageView.java +++ b/src/com/android/camera/RotateImageView.java @@ -21,7 +21,6 @@ import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; -import android.view.animation.AnimationUtils; import android.widget.ImageView; /** @@ -32,16 +31,7 @@ public class RotateImageView extends ImageView { @SuppressWarnings("unused") private static final String TAG = "RotateImageView"; - private static final int ANIMATION_SPEED = 180; // 180 deg/sec - - private int mCurrentDegree = 0; // [0, 359] - private int mStartDegree = 0; - private int mTargetDegree = 0; - - private boolean mClockwise = false; - - private long mAnimationStartTime = 0; - private long mAnimationEndTime = 0; + private int mDegree = 0; // [0, 359] public RotateImageView(Context context, AttributeSet attrs) { super(context, attrs); @@ -50,23 +40,8 @@ public class RotateImageView extends ImageView { public void setDegree(int degree) { // make sure in the range of [0, 359] degree = degree >= 0 ? degree % 360 : degree % 360 + 360; - if (degree == mTargetDegree) return; - - mTargetDegree = degree; - mStartDegree = mCurrentDegree; - mAnimationStartTime = AnimationUtils.currentAnimationTimeMillis(); - - int diff = mTargetDegree - mCurrentDegree; - diff = diff >= 0 ? diff : 360 + diff; // make it in range [0, 359] - - // Make it in range [-179, 180]. That's the shorted distance between the - // two angles - diff = diff > 180 ? diff - 360 : diff; - - mClockwise = diff >= 0; - mAnimationEndTime = mAnimationStartTime - + Math.abs(diff) * 1000 / ANIMATION_SPEED; - + if (degree == mDegree) return; + mDegree = degree; invalidate(); } @@ -74,31 +49,27 @@ public class RotateImageView extends ImageView { protected void onDraw(Canvas canvas) { Drawable drawable = getDrawable(); - if (drawable == null) return; + if (drawable == null) return; Rect bounds = drawable.getBounds(); int w = bounds.right - bounds.left; int h = bounds.bottom - bounds.top; if (w == 0 || h == 0) return; // nothing to draw - if (mCurrentDegree != mTargetDegree) { - long time = AnimationUtils.currentAnimationTimeMillis(); - if (time < mAnimationEndTime) { - int deltaTime = (int)(time - mAnimationStartTime); - int degree = mStartDegree + ANIMATION_SPEED - * (mClockwise ? deltaTime : -deltaTime) / 1000; - degree = degree >= 0 ? degree % 360 : degree % 360 + 360; - mCurrentDegree = degree; - invalidate(); - } else { - mCurrentDegree = mTargetDegree; - } - } - int saveCount = canvas.getSaveCount(); - canvas.translate(getPaddingLeft(), getPaddingTop()); - canvas.rotate(-mCurrentDegree, w / 2, h / 2); + + int left = getPaddingLeft(); + int top = getPaddingTop(); + int right = getPaddingRight(); + int bottom = getPaddingBottom(); + + int width = getWidth() - left - right; + int height = getHeight() - top - bottom; + + canvas.translate(left + width / 2, top + height / 2); + canvas.rotate(-mDegree); + canvas.translate(-w / 2, -h / 2); drawable.draw(canvas); canvas.restoreToCount(saveCount); } 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); + } + } } |