diff options
Diffstat (limited to 'src/com')
6 files changed, 65 insertions, 5 deletions
diff --git a/src/com/android/camera/ActivityBase.java b/src/com/android/camera/ActivityBase.java index c3cde8bfc..59bd82c98 100644 --- a/src/com/android/camera/ActivityBase.java +++ b/src/com/android/camera/ActivityBase.java @@ -353,7 +353,7 @@ public abstract class ActivityBase extends AbstractGalleryActivity } } - protected void gotoGallery() { + public void gotoGallery() { // Move the next picture with capture animation. "1" means next. mAppBridge.switchWithCaptureAnimation(1); } diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index f7830a303..2c654fc29 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -91,6 +91,7 @@ public class VideoModule implements CameraModule, private static final int SWITCH_CAMERA = 8; private static final int SWITCH_CAMERA_START_ANIMATION = 9; private static final int HIDE_SURFACE_VIEW = 10; + private static final int CAPTURE_ANIMATION_DONE = 11; private static final int SCREEN_DELAY = 2 * 60 * 1000; @@ -296,6 +297,11 @@ public class VideoModule implements CameraModule, break; } + case CAPTURE_ANIMATION_DONE: { + mUI.enablePreviewThumb(false); + break; + } + default: Log.v(TAG, "Unhandled message: " + msg.what); break; @@ -578,6 +584,14 @@ public class VideoModule implements CameraModule, // the preview. This will cause the preview flicker since the preview // will not be continuous for a short period of time. ((CameraScreenNail) mActivity.mCameraScreenNail).animateCapture(mDisplayRotation); + + mUI.enablePreviewThumb(true); + + // Make sure to disable the thumbnail preview after the + // animation is done to disable the click target. + mHandler.removeMessages(CAPTURE_ANIMATION_DONE); + mHandler.sendEmptyMessageDelayed(CAPTURE_ANIMATION_DONE, + CaptureAnimManager.getAnimationDuration()); } } } @@ -1457,6 +1471,7 @@ public class VideoModule implements CameraModule, private void startVideoRecording() { Log.v(TAG, "startVideoRecording"); + mUI.enablePreviewThumb(false); mActivity.setSwipingEnabled(false); mActivity.updateStorageSpaceAndHint(); diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java index 0c9457204..dc23ec814 100644 --- a/src/com/android/camera/VideoUI.java +++ b/src/com/android/camera/VideoUI.java @@ -76,6 +76,7 @@ public class VideoUI implements SurfaceHolder.Callback, PieRenderer.PieListener, private VideoController mController; private int mZoomMax; private List<Integer> mZoomRatios; + private View mPreviewThumb; public VideoUI(CameraActivity activity, VideoController controller, View parent) { mActivity = activity; @@ -227,6 +228,14 @@ public class VideoUI implements SurfaceHolder.Callback, PieRenderer.PieListener, mGestures.addTouchReceiver(mReviewPlayButton); } } + + mPreviewThumb = mActivity.findViewById(R.id.preview_thumb); + mPreviewThumb.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + mActivity.gotoGallery(); + } + }); } public void setPrefChangedListener(OnPreferenceChangedListener listener) { @@ -520,4 +529,16 @@ public class VideoUI implements SurfaceHolder.Callback, PieRenderer.PieListener, } } + /** + * Enable or disable the preview thumbnail for click events. + */ + public void enablePreviewThumb(boolean enabled) { + if (enabled) { + mGestures.addTouchReceiver(mPreviewThumb); + mPreviewThumb.setVisibility(View.VISIBLE); + } else { + mGestures.removeTouchReceiver(mPreviewThumb); + mPreviewThumb.setVisibility(View.GONE); + } + } } diff --git a/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java b/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java index 0a65cd92f..cfa64bc3c 100644 --- a/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java +++ b/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java @@ -34,7 +34,7 @@ import com.android.gallery3d.filtershow.ui.FilterIconButton; public class CategoryAdapter extends ArrayAdapter<Action> { private static final String LOGTAG = "CategoryAdapter"; - private int mItemHeight = 200; + private int mItemHeight; private View mContainer; private int mItemWidth = ListView.LayoutParams.MATCH_PARENT; private boolean mUseFilterIconButton = false; @@ -43,6 +43,7 @@ public class CategoryAdapter extends ArrayAdapter<Action> { public CategoryAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); + mItemHeight = (int) (context.getResources().getDisplayMetrics().density * 100); } public CategoryAdapter(Context context) { @@ -95,7 +96,7 @@ public class CategoryAdapter extends ArrayAdapter<Action> { new ListView.LayoutParams(mItemWidth, mItemHeight)); view.setTag(position); if (mCategory == MainPanel.LOOKS || mCategory == MainPanel.BORDERS) { - view.setBackground(null); + view.setBackgroundResource(0); } return view; } diff --git a/src/com/android/gallery3d/filtershow/category/CategoryView.java b/src/com/android/gallery3d/filtershow/category/CategoryView.java index 84a973b50..059eb103d 100644 --- a/src/com/android/gallery3d/filtershow/category/CategoryView.java +++ b/src/com/android/gallery3d/filtershow/category/CategoryView.java @@ -44,6 +44,8 @@ public class CategoryView extends View implements View.OnClickListener { private Paint mSelectPaint; CategoryAdapter mAdapter; private int mSelectionStroke; + private Paint mBorderPaint; + private int mBorderStroke; public static void setTextSize(int size) { sTextSize = size; @@ -63,6 +65,9 @@ public class CategoryView extends View implements View.OnClickListener { mSelectPaint = new Paint(); mSelectPaint.setStyle(Paint.Style.FILL); mSelectPaint.setColor(res.getColor(R.color.filtershow_category_selection)); + mBorderPaint = new Paint(mSelectPaint); + mBorderPaint.setColor(Color.BLACK); + mBorderStroke = mSelectionStroke / 3; } public void drawText(Canvas canvas, String text) { @@ -91,8 +96,10 @@ public class CategoryView extends View implements View.OnClickListener { Bitmap bitmap = mAction.getImage(); canvas.drawBitmap(bitmap, 0, 0, mPaint); if (mAdapter.isSelected(this)) { - SelectionRenderer.drawSelection(canvas, 0, 0, bitmap.getWidth(), - bitmap.getHeight(), mSelectionStroke, mSelectPaint); + SelectionRenderer.drawSelection(canvas, 0, 0, + Math.min(bitmap.getWidth(), getWidth()), + Math.min(bitmap.getHeight(), getHeight()), + mSelectionStroke, mSelectPaint, mBorderStroke, mBorderPaint); } } mPaint.setColor(mBackgroundColor); diff --git a/src/com/android/gallery3d/filtershow/ui/SelectionRenderer.java b/src/com/android/gallery3d/filtershow/ui/SelectionRenderer.java index 1b108bd5d..ef40c5e44 100644 --- a/src/com/android/gallery3d/filtershow/ui/SelectionRenderer.java +++ b/src/com/android/gallery3d/filtershow/ui/SelectionRenderer.java @@ -29,4 +29,20 @@ public class SelectionRenderer { canvas.drawRect(right - stroke, top, right, bottom, paint); } + public static void drawSelection(Canvas canvas, int left, int top, int right, int bottom, + int stroke, Paint selectPaint, int border, Paint borderPaint) { + canvas.drawRect(left, top, right, top + stroke, selectPaint); + canvas.drawRect(left, bottom - stroke, right, bottom, selectPaint); + canvas.drawRect(left, top, left + stroke, bottom, selectPaint); + canvas.drawRect(right - stroke, top, right, bottom, selectPaint); + canvas.drawRect(left + stroke, top + stroke, right - stroke, + top + stroke + border, borderPaint); + canvas.drawRect(left + stroke, bottom - stroke - border, right - stroke, + bottom - stroke, borderPaint); + canvas.drawRect(left + stroke, top + stroke, left + stroke + border, + bottom - stroke, borderPaint); + canvas.drawRect(right - stroke - border, top + stroke, right - stroke, + bottom - stroke, borderPaint); + } + } |