summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2013-05-07 17:24:23 -0700
committerMichael Kolb <kolby@google.com>2013-05-08 16:41:55 -0700
commit4615c5c727b4e447b702f1e11213898da28d2f97 (patch)
tree890c3ece7b652bfaa072aaef0332a09171bfd6e0 /src/com
parent83bd9d3e7bb5402c335bad1370cef7f2351352ab (diff)
downloadandroid_packages_apps_Snap-4615c5c727b4e447b702f1e11213898da28d2f97.tar.gz
android_packages_apps_Snap-4615c5c727b4e447b702f1e11213898da28d2f97.tar.bz2
android_packages_apps_Snap-4615c5c727b4e447b702f1e11213898da28d2f97.zip
Add drop shadow to preview thumb
Bug: 8826241 Also, remove animateSlide blocker, it caused frozen review Change-Id: Ic8eb129ec236726550a26bc387967fe0c00473e9
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/ActivityBase.java2
-rw-r--r--src/com/android/camera/CameraScreenNail.java19
-rw-r--r--src/com/android/camera/CaptureAnimManager.java22
3 files changed, 19 insertions, 24 deletions
diff --git a/src/com/android/camera/ActivityBase.java b/src/com/android/camera/ActivityBase.java
index d2a4be58a..c3cde8bfc 100644
--- a/src/com/android/camera/ActivityBase.java
+++ b/src/com/android/camera/ActivityBase.java
@@ -558,7 +558,7 @@ public abstract class ActivityBase extends AbstractGalleryActivity
public ScreenNail attachScreenNail() {
if (mCameraScreenNail == null) {
if (ApiHelper.HAS_SURFACE_TEXTURE) {
- mCameraScreenNail = new CameraScreenNail(this, getResources());
+ mCameraScreenNail = new CameraScreenNail(this, ActivityBase.this);
} else {
Bitmap b = BitmapFactory.decodeResource(getResources(),
R.drawable.wallpaper_picker_preview);
diff --git a/src/com/android/camera/CameraScreenNail.java b/src/com/android/camera/CameraScreenNail.java
index afa46290d..993a7d336 100644
--- a/src/com/android/camera/CameraScreenNail.java
+++ b/src/com/android/camera/CameraScreenNail.java
@@ -17,7 +17,7 @@
package com.android.camera;
import android.annotation.TargetApi;
-import android.content.res.Resources;
+import android.content.Context;
import android.graphics.SurfaceTexture;
import android.opengl.Matrix;
import android.util.Log;
@@ -58,7 +58,7 @@ public class CameraScreenNail extends SurfaceTextureScreenNail {
private final float[] mTextureTransformMatrix = new float[16];
// Animation.
- private CaptureAnimManager mCaptureAnimManager = new CaptureAnimManager();
+ private CaptureAnimManager mCaptureAnimManager;
private SwitchAnimManager mSwitchAnimManager = new SwitchAnimManager();
private int mAnimState = ANIM_NONE;
private RawTexture mAnimTexture;
@@ -120,9 +120,9 @@ public class CameraScreenNail extends SurfaceTextureScreenNail {
RawTexture copyToTexture(GLCanvas c, RawTexture texture, int width, int height);
}
- public CameraScreenNail(Listener listener, Resources res) {
+ public CameraScreenNail(Listener listener, Context ctx) {
mListener = listener;
- mCaptureAnimManager.setResources(res);
+ mCaptureAnimManager = new CaptureAnimManager(ctx);
}
public void setFullScreen(boolean full) {
@@ -293,15 +293,6 @@ public class CameraScreenNail extends SurfaceTextureScreenNail {
public void animateSlide() {
synchronized (mLock) {
- // Ignore the case where animateFlash is skipped but animateSlide is called
- // e.g. Double tap shutter and immediately swipe to gallery, and quickly swipe back
- // to camera. This case only happens in monkey tests, not applicable to normal
- // human beings.
- if (mAnimState != ANIM_CAPTURE_RUNNING) {
- Log.v(TAG, "Cannot animateSlide outside of animateCapture!"
- + " Animation state = " + mAnimState);
- return;
- }
mCaptureAnimManager.animateSlide();
mListener.requestRender();
}
@@ -384,7 +375,7 @@ public class CameraScreenNail extends SurfaceTextureScreenNail {
case ANIM_CAPTURE_START:
copyPreviewTexture(canvas);
mListener.onCaptureTextureCopied();
- mCaptureAnimManager.startAnimation(x, y, width, height);
+ mCaptureAnimManager.startAnimation();
mAnimState = ANIM_CAPTURE_RUNNING;
break;
}
diff --git a/src/com/android/camera/CaptureAnimManager.java b/src/com/android/camera/CaptureAnimManager.java
index f6e112d7e..6e8092566 100644
--- a/src/com/android/camera/CaptureAnimManager.java
+++ b/src/com/android/camera/CaptureAnimManager.java
@@ -16,6 +16,7 @@
package com.android.camera;
+import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.SystemClock;
@@ -24,6 +25,7 @@ import android.view.animation.Interpolator;
import com.android.gallery3d.R;
import com.android.gallery3d.glrenderer.GLCanvas;
+import com.android.gallery3d.glrenderer.NinePatchTexture;
import com.android.gallery3d.glrenderer.RawTexture;
/**
@@ -66,6 +68,8 @@ public class CaptureAnimManager {
private int mMarginTop;
private int mSize;
private Resources mResources;
+ private NinePatchTexture mBorder;
+ private int mShadowSize;
public static int getAnimationDuration() {
return TIME_SLIDE2;
@@ -74,12 +78,9 @@ public class CaptureAnimManager {
/* preview: camera preview view.
* review: view of picture just taken.
*/
- public CaptureAnimManager() {
-
- }
-
- public void setResources(Resources res) {
- mResources = res;
+ public CaptureAnimManager(Context ctx) {
+ mBorder = new NinePatchTexture(ctx, R.drawable.capture_thumbnail_shadow);
+ mResources = ctx.getResources();
}
public void setOrientation(int displayRotation) {
@@ -102,16 +103,15 @@ public class CaptureAnimManager {
mAnimType = ANIM_BOTH;
}
- // x, y, w and h: the rectangle area where the animation takes place.
- public void startAnimation(int x, int y, int w, int h) {
+ public void startAnimation() {
mAnimStartTime = SystemClock.uptimeMillis();
- setAnimationGeometry(x, y, w, h);
}
private void setAnimationGeometry(int x, int y, int w, int h) {
mMarginRight = mResources.getDimensionPixelSize(R.dimen.capture_margin_right);
mMarginTop = mResources.getDimensionPixelSize(R.dimen.capture_margin_top);
mSize = mResources.getDimensionPixelSize(R.dimen.capture_size);
+ mShadowSize = mResources.getDimensionPixelSize(R.dimen.capture_border);
mOffset = mMarginRight + mSize;
// Set the views to the initial positions.
mDrawWidth = w;
@@ -192,6 +192,8 @@ public class CaptureAnimManager {
} else if (animStep == ANIM_HOLD2) {
preview.directDraw(canvas, (int) mX, (int) mY, mDrawWidth, mDrawHeight);
review.draw(canvas, mHoldX, mHoldY, mHoldW, mHoldH);
+ mBorder.draw(canvas, (int) mHoldX - mShadowSize, (int) mHoldY - mShadowSize,
+ (int) mHoldW + 2 * mShadowSize, (int) mHoldH + 2 * mShadowSize);
} else if (animStep == ANIM_SLIDE2) {
float fraction = (float)(timeDiff) / (TIME_SLIDE2 - TIME_HOLD2);
float x = mHoldX;
@@ -212,6 +214,8 @@ public class CaptureAnimManager {
break;
}
preview.directDraw(canvas, (int) mX, (int) mY, mDrawWidth, mDrawHeight);
+ mBorder.draw(canvas, (int) x - mShadowSize, (int) y - mShadowSize,
+ (int) mHoldW + 2 * mShadowSize, (int) mHoldH + 2 * mShadowSize);
review.draw(canvas, (int) x, (int) y, mHoldW, mHoldH);
}
return true;