summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/NewPhotoModule.java13
-rw-r--r--src/com/android/camera/NewPhotoUI.java15
-rw-r--r--src/com/android/camera/NewPreviewGestures.java11
-rw-r--r--src/com/android/camera/NewVideoModule.java9
-rw-r--r--src/com/android/camera/NewVideoUI.java19
-rw-r--r--src/com/android/camera/PhotoController.java1
-rw-r--r--src/com/android/camera/PhotoModule.java1
-rw-r--r--src/com/android/camera/VideoController.java2
-rw-r--r--src/com/android/camera/VideoModule.java3
-rw-r--r--src/com/android/camera/ui/CameraControls.java85
-rw-r--r--src/com/android/camera/ui/NewCameraRootView.java50
-rw-r--r--src/com/android/camera/ui/RotatableLayout.java52
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java8
-rw-r--r--src/com/android/gallery3d/filtershow/category/Action.java2
-rw-r--r--src/com/android/gallery3d/filtershow/tools/IconFactory.java2
-rw-r--r--src/com/android/photos/drawables/MtpThumbnailDrawable.java61
16 files changed, 175 insertions, 159 deletions
diff --git a/src/com/android/camera/NewPhotoModule.java b/src/com/android/camera/NewPhotoModule.java
index 9911e8f4b..55eb0e46f 100644
--- a/src/com/android/camera/NewPhotoModule.java
+++ b/src/com/android/camera/NewPhotoModule.java
@@ -542,6 +542,8 @@ public class NewPhotoModule
mFocusManager.setParameters(mInitialParams);
setupPreview();
+ // reset zoom value index
+ mZoomValue = 0;
openCameraCommon();
if (ApiHelper.HAS_SURFACE_TEXTURE) {
@@ -752,6 +754,10 @@ public class NewPhotoModule
if (mPaused) {
return;
}
+ //TODO: We should show the picture taken rather than frozen preview here
+ if (mIsImageCaptureIntent) {
+ stopPreview();
+ }
if (mSceneMode == Util.SCENE_MODE_HDR) {
mUI.showSwitcher();
mUI.setSwipingEnabled(true);
@@ -1389,6 +1395,13 @@ public class NewPhotoModule
}
@Override
+ public void updateCameraOrientation() {
+ if (mDisplayRotation != Util.getDisplayRotation(mActivity)) {
+ setDisplayOrientation();
+ }
+ }
+
+ @Override
public void onActivityResult(
int requestCode, int resultCode, Intent data) {
switch (requestCode) {
diff --git a/src/com/android/camera/NewPhotoUI.java b/src/com/android/camera/NewPhotoUI.java
index 4d9469743..15b9409ed 100644
--- a/src/com/android/camera/NewPhotoUI.java
+++ b/src/com/android/camera/NewPhotoUI.java
@@ -43,12 +43,14 @@ import android.widget.Toast;
import com.android.camera.CameraPreference.OnPreferenceChangedListener;
import com.android.camera.FocusOverlayManager.FocusUI;
import com.android.camera.ui.AbstractSettingPopup;
+import com.android.camera.ui.CameraControls;
import com.android.camera.ui.CameraSwitcher.CameraSwitchListener;
import com.android.camera.ui.CountDownView;
import com.android.camera.ui.CountDownView.OnCountDownFinishedListener;
import com.android.camera.ui.CameraSwitcher;
import com.android.camera.ui.FaceView;
import com.android.camera.ui.FocusIndicator;
+import com.android.camera.ui.NewCameraRootView;
import com.android.camera.ui.PieRenderer;
import com.android.camera.ui.PieRenderer.PieListener;
import com.android.camera.ui.RenderOverlay;
@@ -62,7 +64,7 @@ import java.util.List;
public class NewPhotoUI implements PieListener,
NewPreviewGestures.SingleTapListener,
FocusUI, TextureView.SurfaceTextureListener,
- LocationManager.Listener,
+ LocationManager.Listener, NewCameraRootView.MyDisplayListener,
FaceDetectionListener {
private static final String TAG = "CAM_UI";
@@ -88,7 +90,7 @@ public class NewPhotoUI implements PieListener,
private View mBlocker;
private NewPhotoMenu mMenu;
private CameraSwitcher mSwitcher;
- private View mCameraControls;
+ private CameraControls mCameraControls;
// Small indicators which show the camera settings in the viewfinder.
private OnScreenIndicators mOnScreenIndicators;
@@ -180,7 +182,8 @@ public class NewPhotoUI implements PieListener,
(SurfaceTextureSizeChangedListener) mFaceView);
}
}
- mCameraControls = mRootView.findViewById(R.id.camera_controls);
+ mCameraControls = (CameraControls) mRootView.findViewById(R.id.camera_controls);
+ ((NewCameraRootView) mRootView).setDisplayChangeListener(this);
}
public void onScreenSizeChanged(int width, int height, int previewWidth, int previewHeight) {
@@ -293,6 +296,7 @@ public class NewPhotoUI implements PieListener,
mGestures = new NewPreviewGestures(mActivity, this, mZoomRenderer, mPieRenderer);
mRenderOverlay.setGestures(mGestures);
}
+ mGestures.setZoomEnabled(params.isZoomSupported());
mGestures.setRenderOverlay(mRenderOverlay);
mRenderOverlay.requestLayout();
@@ -783,4 +787,9 @@ public class NewPhotoUI implements PieListener,
mFaceView.setFaces(faces);
}
+ public void onDisplayChanged() {
+ mCameraControls.checkLayoutFlip();
+ mController.updateCameraOrientation();
+ }
+
}
diff --git a/src/com/android/camera/NewPreviewGestures.java b/src/com/android/camera/NewPreviewGestures.java
index 39c4be664..339c4b33f 100644
--- a/src/com/android/camera/NewPreviewGestures.java
+++ b/src/com/android/camera/NewPreviewGestures.java
@@ -69,6 +69,7 @@ public class NewPreviewGestures
private int mMode;
private int mSlop;
private int mTapTimeout;
+ private boolean mZoomEnabled;
private boolean mEnabled;
private boolean mZoomOnly;
private int mOrientation;
@@ -148,6 +149,10 @@ public class NewPreviewGestures
mEnabled = enabled;
}
+ public void setZoomEnabled(boolean enable) {
+ mZoomEnabled = enable;
+ }
+
public void setZoomOnly(boolean zoom) {
mZoomOnly = zoom;
}
@@ -178,7 +183,10 @@ public class NewPreviewGestures
mScale.onTouchEvent(m);
if (MotionEvent.ACTION_POINTER_DOWN == m.getActionMasked()) {
mMode = MODE_ZOOM;
- mZoom.onScaleBegin(mScale);
+ if (mZoomEnabled) {
+ // Start showing zoom UI as soon as there is a second finger down
+ mZoom.onScaleBegin(mScale);
+ }
} else if (MotionEvent.ACTION_POINTER_UP == m.getActionMasked()) {
mZoom.onScaleEnd(mScale);
}
@@ -241,6 +249,7 @@ public class NewPreviewGestures
if (mPie == null || !mPie.isOpen()) {
mMode = MODE_ZOOM;
mGestureDetector.onTouchEvent(makeCancelEvent(mCurrent));
+ if (!mZoomEnabled) return false;
return mZoom.onScaleBegin(detector);
}
return false;
diff --git a/src/com/android/camera/NewVideoModule.java b/src/com/android/camera/NewVideoModule.java
index 188a38965..87899a249 100644
--- a/src/com/android/camera/NewVideoModule.java
+++ b/src/com/android/camera/NewVideoModule.java
@@ -800,6 +800,14 @@ public class NewVideoModule implements NewCameraModule,
}
@Override
+ public void updateCameraOrientation() {
+ if (mMediaRecorderRecording) return;
+ if (mDisplayRotation != Util.getDisplayRotation(mActivity)) {
+ setDisplayOrientation();
+ }
+ }
+
+ @Override
public int onZoomChanged(int index) {
// Not useful to change zoom value when the activity is paused.
if (mPaused) return index;
@@ -2015,6 +2023,7 @@ public class NewVideoModule implements NewCameraModule,
initializeVideoControl();
// From onResume
+ mZoomValue = 0;
mUI.initializeZoom(mParameters);
mUI.setOrientationIndicator(0, false);
diff --git a/src/com/android/camera/NewVideoUI.java b/src/com/android/camera/NewVideoUI.java
index 02c8e1c7a..35676aff5 100644
--- a/src/com/android/camera/NewVideoUI.java
+++ b/src/com/android/camera/NewVideoUI.java
@@ -42,7 +42,9 @@ import android.widget.TextView;
import com.android.camera.CameraPreference.OnPreferenceChangedListener;
import com.android.camera.ui.AbstractSettingPopup;
+import com.android.camera.ui.CameraControls;
import com.android.camera.ui.CameraSwitcher;
+import com.android.camera.ui.NewCameraRootView;
import com.android.camera.ui.PieRenderer;
import com.android.camera.ui.RenderOverlay;
import com.android.camera.ui.RotateLayout;
@@ -55,6 +57,7 @@ import java.util.List;
public class NewVideoUI implements PieRenderer.PieListener,
NewPreviewGestures.SingleTapListener,
+ NewCameraRootView.MyDisplayListener,
SurfaceTextureListener, SurfaceHolder.Callback {
private final static String TAG = "CAM_VideoUI";
private static final int UPDATE_TRANSFORM_MATRIX = 1;
@@ -76,7 +79,7 @@ public class NewVideoUI implements PieRenderer.PieListener,
private RenderOverlay mRenderOverlay;
private PieRenderer mPieRenderer;
private NewVideoMenu mVideoMenu;
- private View mCameraControls;
+ private CameraControls mCameraControls;
private AbstractSettingPopup mPopup;
private ZoomRenderer mZoomRenderer;
private NewPreviewGestures mGestures;
@@ -139,6 +142,7 @@ public class NewVideoUI implements PieRenderer.PieListener,
mTextureView = (TextureView) mRootView.findViewById(R.id.preview_content);
mTextureView.setSurfaceTextureListener(this);
mRootView.addOnLayoutChangeListener(mLayoutListener);
+ ((NewCameraRootView) mRootView).setDisplayChangeListener(this);
mShutterButton = (ShutterButton) mRootView.findViewById(R.id.shutter_button);
mSwitcher = (CameraSwitcher) mRootView.findViewById(R.id.camera_switcher);
mSwitcher.setCurrentIndex(1);
@@ -167,7 +171,7 @@ public class NewVideoUI implements PieRenderer.PieListener,
}
});
- mCameraControls = mActivity.findViewById(R.id.camera_controls);
+ mCameraControls = (CameraControls) mActivity.findViewById(R.id.camera_controls);
mOnScreenIndicators = new OnScreenIndicators(mActivity,
mActivity.findViewById(R.id.on_screen_indicators));
mOnScreenIndicators.resetToDefault();
@@ -581,7 +585,11 @@ public class NewVideoUI implements PieRenderer.PieListener,
}
public void initializeZoom(Parameters param) {
- if (param == null || !param.isZoomSupported()) return;
+ if (param == null || !param.isZoomSupported()) {
+ mGestures.setZoomEnabled(false);
+ return;
+ }
+ mGestures.setZoomEnabled(true);
mZoomMax = param.getMaxZoom();
mZoomRatios = param.getZoomRatios();
// Currently we use immediate zoom for fast zooming to get better UX and
@@ -616,6 +624,11 @@ public class NewVideoUI implements PieRenderer.PieListener,
return mTextureView.getVisibility() == View.VISIBLE;
}
+ public void onDisplayChanged() {
+ mCameraControls.checkLayoutFlip();
+ mController.updateCameraOrientation();
+ }
+
/**
* Enable or disable the preview thumbnail for click events.
*/
diff --git a/src/com/android/camera/PhotoController.java b/src/com/android/camera/PhotoController.java
index b76022e57..47c17218a 100644
--- a/src/com/android/camera/PhotoController.java
+++ b/src/com/android/camera/PhotoController.java
@@ -59,4 +59,5 @@ public interface PhotoController extends OnShutterButtonListener {
public void onScreenSizeChanged(int width, int height, int previewWidth, int previewHeight);
+ public void updateCameraOrientation();
}
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index c3d152716..ecda6c6e3 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -2101,4 +2101,5 @@ public class PhotoModule
mHeading += 360;
}
}
+ public void updateCameraOrientation() {}
}
diff --git a/src/com/android/camera/VideoController.java b/src/com/android/camera/VideoController.java
index 474f521de..b53dec616 100644
--- a/src/com/android/camera/VideoController.java
+++ b/src/com/android/camera/VideoController.java
@@ -33,4 +33,6 @@ public interface VideoController extends OnShutterButtonListener {
public void onSingleTapUp(View view, int x, int y);
public void stopPreview();
+
+ public void updateCameraOrientation();
}
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 2c654fc29..977986d1f 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -2316,4 +2316,7 @@ public class VideoModule implements CameraModule,
public void onMediaSaveServiceConnected(MediaSaveService s) {
// do nothing.
}
+
+ @Override
+ public void updateCameraOrientation() {}
}
diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java
index 7940ae0d9..7fa6890a7 100644
--- a/src/com/android/camera/ui/CameraControls.java
+++ b/src/com/android/camera/ui/CameraControls.java
@@ -20,8 +20,6 @@ import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
-import android.hardware.display.DisplayManager;
-import android.hardware.display.DisplayManager.DisplayListener;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
@@ -40,44 +38,13 @@ public class CameraControls extends RotatableLayout {
private View mMenu;
private View mIndicators;
private View mPreview;
- private Object mDisplayListener = null;
- private int mLastRotation = 0;
public CameraControls(Context context, AttributeSet attrs) {
super(context, attrs);
- initDisplayListener();
}
public CameraControls(Context context) {
super(context);
- initDisplayListener();
- }
-
- public void initDisplayListener() {
- if (ApiHelper.HAS_DISPLAY_LISTENER) {
- mDisplayListener = new DisplayListener() {
-
- @Override
- public void onDisplayAdded(int arg0) {}
-
- @Override
- public void onDisplayChanged(int arg0) {
- checkLayoutFlip();
- }
-
- @Override
- public void onDisplayRemoved(int arg0) {}
- };
- }
- }
-
- private void checkLayoutFlip() {
- int currentRotation = Util.getDisplayRotation((Activity) getContext());
- if ((currentRotation - mLastRotation + 360) % 360 == 180) {
- mLastRotation = currentRotation;
- flipChildren();
- getParent().requestLayout();
- }
}
@Override
@@ -92,36 +59,7 @@ public class CameraControls extends RotatableLayout {
}
@Override
- public void onAttachedToWindow() {
- super.onAttachedToWindow();
- adjustControlsToRightPosition();
- mLastRotation = Util.getDisplayRotation((Activity) getContext());
- if (ApiHelper.HAS_DISPLAY_LISTENER) {
- ((DisplayManager) getContext().getSystemService(Context.DISPLAY_SERVICE))
- .registerDisplayListener((DisplayListener) mDisplayListener, null);
- }
- }
-
- @Override
- public void onWindowVisibilityChanged(int visibility) {
- if (visibility == View.VISIBLE) {
- // Make sure when coming back from onPause, the layout is rotated correctly
- checkLayoutFlip();
- }
- }
-
- @Override
- public void onDetachedFromWindow () {
- super.onDetachedFromWindow();
- if (ApiHelper.HAS_DISPLAY_LISTENER) {
- ((DisplayManager) getContext().getSystemService(Context.DISPLAY_SERVICE))
- .unregisterDisplayListener((DisplayListener) mDisplayListener);
- }
- }
-
- @Override
public void onLayout(boolean changed, int l, int t, int r, int b) {
- mLastRotation = Util.getDisplayRotation((Activity) getContext());
int orientation = getResources().getConfiguration().orientation;
int size = getResources().getDimensionPixelSize(R.dimen.camera_controls_size);
int rotation = getUnifiedRotation();
@@ -168,19 +106,6 @@ public class CameraControls extends RotatableLayout {
}
}
- private int getUnifiedRotation() {
- // all the layout code assumes camera device orientation to be portrait
- // adjust rotation for landscape
- int orientation = getResources().getConfiguration().orientation;
- int rotation = Util.getDisplayRotation((Activity) getContext());
- int camOrientation = (rotation % 180 == 0) ? Configuration.ORIENTATION_PORTRAIT
- : Configuration.ORIENTATION_LANDSCAPE;
- if (camOrientation != orientation) {
- return (rotation + 90) % 360;
- }
- return rotation;
- }
-
private void center(View v, int l, int t, int r, int b, int orientation, int rotation, Rect result) {
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) v.getLayoutParams();
int tw = lp.leftMargin + v.getMeasuredWidth() + lp.rightMargin;
@@ -313,16 +238,6 @@ public class CameraControls extends RotatableLayout {
v.layout(r - v.getMeasuredWidth() - mr, t + mt, r - mr, t + mt + v.getMeasuredHeight());
}
- // In reverse landscape and reverse portrait, camera controls will be laid out
- // on the wrong side of the screen. We need to make adjustment to move the controls
- // to the USB side
- public void adjustControlsToRightPosition() {
- int orientation = getUnifiedRotation();
- if (orientation >= 180) {
- flipChildren();
- }
- }
-
private void adjustBackground() {
int rotation = getUnifiedRotation();
// remove current drawable and reset rotation
diff --git a/src/com/android/camera/ui/NewCameraRootView.java b/src/com/android/camera/ui/NewCameraRootView.java
index bf8192564..710d6d304 100644
--- a/src/com/android/camera/ui/NewCameraRootView.java
+++ b/src/com/android/camera/ui/NewCameraRootView.java
@@ -20,6 +20,8 @@ import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
+import android.hardware.display.DisplayManager;
+import android.hardware.display.DisplayManager.DisplayListener;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
@@ -28,6 +30,7 @@ import android.widget.FrameLayout;
import com.android.camera.Util;
import com.android.gallery3d.R;
+import com.android.gallery3d.common.ApiHelper;
public class NewCameraRootView extends FrameLayout {
@@ -37,8 +40,15 @@ public class NewCameraRootView extends FrameLayout {
private int mRightMargin = 0;
private Rect mCurrentInsets;
private int mOffset = 0;
+ private Object mDisplayListener;
+ private MyDisplayListener mListener;
+ public interface MyDisplayListener {
+ public void onDisplayChanged();
+ }
+
public NewCameraRootView(Context context, AttributeSet attrs) {
super(context, attrs);
+ initDisplayListener();
setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
@@ -59,6 +69,46 @@ public class NewCameraRootView extends FrameLayout {
return true;
}
+ public void initDisplayListener() {
+ if (ApiHelper.HAS_DISPLAY_LISTENER) {
+ mDisplayListener = new DisplayListener() {
+
+ @Override
+ public void onDisplayAdded(int arg0) {}
+
+ @Override
+ public void onDisplayChanged(int arg0) {
+ mListener.onDisplayChanged();
+ }
+
+ @Override
+ public void onDisplayRemoved(int arg0) {}
+ };
+ }
+ }
+
+ public void setDisplayChangeListener(MyDisplayListener listener) {
+ mListener = listener;
+ }
+
+ @Override
+ public void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ if (ApiHelper.HAS_DISPLAY_LISTENER) {
+ ((DisplayManager) getContext().getSystemService(Context.DISPLAY_SERVICE))
+ .registerDisplayListener((DisplayListener) mDisplayListener, null);
+ }
+ }
+
+ @Override
+ public void onDetachedFromWindow () {
+ super.onDetachedFromWindow();
+ if (ApiHelper.HAS_DISPLAY_LISTENER) {
+ ((DisplayManager) getContext().getSystemService(Context.DISPLAY_SERVICE))
+ .unregisterDisplayListener((DisplayListener) mDisplayListener);
+ }
+ }
+
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int rotation = Util.getDisplayRotation((Activity) getContext());
diff --git a/src/com/android/camera/ui/RotatableLayout.java b/src/com/android/camera/ui/RotatableLayout.java
index 8355c8826..965d62a90 100644
--- a/src/com/android/camera/ui/RotatableLayout.java
+++ b/src/com/android/camera/ui/RotatableLayout.java
@@ -65,9 +65,11 @@ public class RotatableLayout extends FrameLayout {
mPrevRotation = Util.getDisplayRotation((Activity) getContext());
// check if there is any rotation before the view is attached to window
int currentOrientation = getResources().getConfiguration().orientation;
- if (mInitialOrientation == currentOrientation) {
+ int orientation = getUnifiedRotation();
+ if (mInitialOrientation == currentOrientation && orientation < 180) {
return;
}
+
if (mInitialOrientation == Configuration.ORIENTATION_LANDSCAPE
&& currentOrientation == Configuration.ORIENTATION_PORTRAIT) {
rotateLayout(true);
@@ -75,19 +77,62 @@ public class RotatableLayout extends FrameLayout {
&& currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
rotateLayout(false);
}
+ // In reverse landscape and reverse portrait, camera controls will be laid out
+ // on the wrong side of the screen. We need to make adjustment to move the controls
+ // to the USB side
+ if (orientation >= 180) {
+ flipChildren();
+ }
+ }
+
+ protected int getUnifiedRotation() {
+ // all the layout code assumes camera device orientation to be portrait
+ // adjust rotation for landscape
+ int orientation = getResources().getConfiguration().orientation;
+ int rotation = Util.getDisplayRotation((Activity) getContext());
+ int camOrientation = (rotation % 180 == 0) ? Configuration.ORIENTATION_PORTRAIT
+ : Configuration.ORIENTATION_LANDSCAPE;
+ if (camOrientation != orientation) {
+ return (rotation + 90) % 360;
+ }
+ return rotation;
+ }
+
+ public void checkLayoutFlip() {
+ int currentRotation = Util.getDisplayRotation((Activity) getContext());
+ if ((currentRotation - mPrevRotation + 360) % 360 == 180) {
+ mPrevRotation = currentRotation;
+ flipChildren();
+ getParent().requestLayout();
+ }
+ }
+
+ @Override
+ public void onWindowVisibilityChanged(int visibility) {
+ if (visibility == View.VISIBLE) {
+ // Make sure when coming back from onPause, the layout is rotated correctly
+ checkLayoutFlip();
+ }
}
@Override
public void onConfigurationChanged(Configuration config) {
super.onConfigurationChanged(config);
int rotation = Util.getDisplayRotation((Activity) getContext());
- if ((rotation - mPrevRotation + 360) % 180 == 0) {
+ int diff = (rotation - mPrevRotation + 360) % 360;
+ if ( diff == 0) {
+ // No rotation
+ return;
+ } else if (diff == 180) {
+ // 180-degree rotation
mPrevRotation = rotation;
+ flipChildren();
return;
}
+ // 90 or 270-degree rotation
boolean clockwise = isClockWiseRotation(mPrevRotation, rotation);
- rotateLayout(clockwise);
mPrevRotation = rotation;
+ rotateLayout(clockwise);
}
protected void rotateLayout(boolean clockwise) {
@@ -113,7 +158,6 @@ public class RotatableLayout extends FrameLayout {
}
protected void flipChildren() {
- mPrevRotation = Util.getDisplayRotation((Activity) getContext());
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index fbe09b999..2d745968b 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -37,6 +37,7 @@ import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.util.DisplayMetrics;
import android.util.TypedValue;
+import android.util.Log;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
@@ -511,6 +512,10 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
cannotLoadImage();
}
+ if (null == CachingPipeline.getRenderScriptContext()){
+ Log.v(LOGTAG,"RenderScript context destroyed during load");
+ return;
+ }
final View loading = findViewById(R.id.loading);
loading.setVisibility(View.GONE);
final View imageShow = findViewById(R.id.imageShow);
@@ -978,6 +983,9 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
public void done() {
hideSavingProgress();
+ if (mLoadBitmapTask != null) {
+ mLoadBitmapTask.cancel(false);
+ }
finish();
}
diff --git a/src/com/android/gallery3d/filtershow/category/Action.java b/src/com/android/gallery3d/filtershow/category/Action.java
index 506b2bf0f..b46147961 100644
--- a/src/com/android/gallery3d/filtershow/category/Action.java
+++ b/src/com/android/gallery3d/filtershow/category/Action.java
@@ -134,7 +134,7 @@ public class Action implements RenderingRequestCaller {
m.mapRect(image);
m.setRectToRect(image, frame, Matrix.ScaleToFit.FILL);
Canvas canvas = new Canvas(destination);
- canvas.drawBitmap(source, m, new Paint());
+ canvas.drawBitmap(source, m, new Paint(Paint.FILTER_BITMAP_FLAG));
}
@Override
diff --git a/src/com/android/gallery3d/filtershow/tools/IconFactory.java b/src/com/android/gallery3d/filtershow/tools/IconFactory.java
index ccc49e13d..9e39f27fc 100644
--- a/src/com/android/gallery3d/filtershow/tools/IconFactory.java
+++ b/src/com/android/gallery3d/filtershow/tools/IconFactory.java
@@ -103,6 +103,6 @@ public class IconFactory {
rec.roundOut(srcRect);
}
- canvas.drawBitmap(sourceImage, srcRect, destRect, new Paint());
+ canvas.drawBitmap(sourceImage, srcRect, destRect, new Paint(Paint.FILTER_BITMAP_FLAG));
}
}
diff --git a/src/com/android/photos/drawables/MtpThumbnailDrawable.java b/src/com/android/photos/drawables/MtpThumbnailDrawable.java
deleted file mode 100644
index e35e06943..000000000
--- a/src/com/android/photos/drawables/MtpThumbnailDrawable.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-package com.android.photos.drawables;
-
-import android.mtp.MtpDevice;
-import android.mtp.MtpObjectInfo;
-
-import com.android.gallery3d.ingest.MtpDeviceIndex;
-
-import java.io.InputStream;
-
-public class MtpThumbnailDrawable extends AutoThumbnailDrawable<MtpObjectInfo> {
- public void setImage(MtpObjectInfo data) {
- if (data == null) {
- setImage(null, 0, 0);
- } else {
- setImage(data, data.getImagePixWidth(), data.getImagePixHeight());
- }
- }
-
- @Override
- protected byte[] getPreferredImageBytes(MtpObjectInfo data) {
- if (data == null) {
- return null;
- }
- MtpDevice device = MtpDeviceIndex.getInstance().getDevice();
- if (device != null) {
- return device.getThumbnail(data.getObjectHandle());
- } else {
- return null;
- }
- }
-
- @Override
- protected InputStream getFallbackImageStream(MtpObjectInfo data) {
- // No fallback
- return null;
- }
-
- @Override
- protected boolean dataChangedLocked(MtpObjectInfo data) {
- // We only fetch the MtpObjectInfo once when creating
- // the index so checking the reference is enough
- return mData == data;
- }
-
-}