Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80a3d636 authored by Sascha Haeberling's avatar Sascha Haeberling
Browse files

Make capture thumbnail tappable in video mode.

  Bug: 9054122

Also make gotoGallery public for LightCycle to use.

Change-Id: I3cd5af26531a756e78c1478de29155dfda709afc
parent aa77f39a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
    }
+15 −0
Original line number Diff line number Diff line
@@ -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();
+21 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }
}