OSDN Git Service

Remove video portrait orientation prompt
authorAlan Newberger <alann@google.com>
Mon, 9 Mar 2015 19:57:14 +0000 (12:57 -0700)
committerAlan Newberger <alann@google.com>
Mon, 9 Mar 2015 19:57:14 +0000 (12:57 -0700)
No longer display visual reminder for users to rotate device to landscape.

Bug: 19416311
Change-Id: Ia03f54809f64e6034479a9021c87b50f186bab99

13 files changed:
res/drawable-hdpi/ic_phone_graphic.png [deleted file]
res/drawable-hdpi/rotate_arrows.png [deleted file]
res/drawable-mdpi/ic_phone_graphic.png [deleted file]
res/drawable-mdpi/rotate_arrows.png [deleted file]
res/drawable-xhdpi/ic_phone_graphic.png [deleted file]
res/drawable-xhdpi/rotate_arrows.png [deleted file]
res/drawable-xxhdpi/ic_phone_graphic.png [deleted file]
res/drawable-xxhdpi/rotate_arrows.png [deleted file]
res/layout/video_module.xml
res/values/dimens.xml
src/com/android/camera/VideoModule.java
src/com/android/camera/VideoUI.java
src/com/android/camera/widget/VideoRecordingHints.java [deleted file]

diff --git a/res/drawable-hdpi/ic_phone_graphic.png b/res/drawable-hdpi/ic_phone_graphic.png
deleted file mode 100644 (file)
index 669d2a7..0000000
Binary files a/res/drawable-hdpi/ic_phone_graphic.png and /dev/null differ
diff --git a/res/drawable-hdpi/rotate_arrows.png b/res/drawable-hdpi/rotate_arrows.png
deleted file mode 100644 (file)
index cd7f877..0000000
Binary files a/res/drawable-hdpi/rotate_arrows.png and /dev/null differ
diff --git a/res/drawable-mdpi/ic_phone_graphic.png b/res/drawable-mdpi/ic_phone_graphic.png
deleted file mode 100644 (file)
index a65f140..0000000
Binary files a/res/drawable-mdpi/ic_phone_graphic.png and /dev/null differ
diff --git a/res/drawable-mdpi/rotate_arrows.png b/res/drawable-mdpi/rotate_arrows.png
deleted file mode 100644 (file)
index 7f557cd..0000000
Binary files a/res/drawable-mdpi/rotate_arrows.png and /dev/null differ
diff --git a/res/drawable-xhdpi/ic_phone_graphic.png b/res/drawable-xhdpi/ic_phone_graphic.png
deleted file mode 100644 (file)
index 7278b35..0000000
Binary files a/res/drawable-xhdpi/ic_phone_graphic.png and /dev/null differ
diff --git a/res/drawable-xhdpi/rotate_arrows.png b/res/drawable-xhdpi/rotate_arrows.png
deleted file mode 100644 (file)
index 750c3d7..0000000
Binary files a/res/drawable-xhdpi/rotate_arrows.png and /dev/null differ
diff --git a/res/drawable-xxhdpi/ic_phone_graphic.png b/res/drawable-xxhdpi/ic_phone_graphic.png
deleted file mode 100644 (file)
index 2fd4cc5..0000000
Binary files a/res/drawable-xxhdpi/ic_phone_graphic.png and /dev/null differ
diff --git a/res/drawable-xxhdpi/rotate_arrows.png b/res/drawable-xxhdpi/rotate_arrows.png
deleted file mode 100644 (file)
index 48f0e42..0000000
Binary files a/res/drawable-xxhdpi/rotate_arrows.png and /dev/null differ
index 90decf2..e6ea14c 100644 (file)
             android:id="@+id/labels" />
     </com.android.camera.ui.RotateLayout>
 
-    <com.android.camera.widget.VideoRecordingHints
-        android:id="@+id/video_shooting_hints"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
-
     <ImageView
         android:id="@+id/review_image"
         android:layout_height="match_parent"
index 11c09a8..3389f70 100644 (file)
     <dimen name="mode_options_toggle_padding">12dp</dimen>
     <dimen name="mode_options_buttons_anim_delta_x">20dp</dimen>
 
-    <dimen name="video_hint_arrow_size">118dp</dimen>
-    <dimen name="video_hint_phone_graphic_height">66dp</dimen>
-    <dimen name="video_hint_phone_graphic_width">36dp</dimen>
     <dimen name="default_cling_width">120dp</dimen>
     <dimen name="settings_cling_width">160dp</dimen>
     <dimen name="settings_cling_triangle_height">15dp</dimen>
index 572c03d..d00af6d 100644 (file)
@@ -1331,7 +1331,6 @@ public class VideoModule extends CameraModule
         mUI.cancelAnimations();
         mUI.setSwipingEnabled(false);
         mUI.hidePassiveFocusIndicator();
-        mUI.showVideoRecordingHints(false);
         mAppController.getCameraAppUI().hideCaptureIndicator();
         mAppController.getCameraAppUI().setShouldSuppressCaptureIndicator(true);
 
@@ -1464,7 +1463,6 @@ public class VideoModule extends CameraModule
 
         mUI.setSwipingEnabled(true);
         mUI.showPassiveFocusIndicator();
-        mUI.showVideoRecordingHints(true);
         mAppController.getCameraAppUI().setShouldSuppressCaptureIndicator(false);
 
         boolean fail = false;
index f07da2d..9d00969 100644 (file)
@@ -33,7 +33,6 @@ import com.android.camera.ui.PreviewOverlay;
 import com.android.camera.ui.PreviewStatusListener;
 import com.android.camera.ui.RotateLayout;
 import com.android.camera.ui.focus.FocusRing;
-import com.android.camera.widget.VideoRecordingHints;
 import com.android.camera2.R;
 import com.android.ex.camera2.portability.CameraCapabilities;
 import com.android.ex.camera2.portability.CameraSettings;
@@ -50,7 +49,6 @@ public class VideoUI implements PreviewStatusListener {
     // An review image having same size as preview. It is displayed when
     // recording is stopped in capture intent.
     private ImageView mReviewImage;
-    private VideoRecordingHints mVideoHints;
     private TextView mRecordingTimeView;
     private LinearLayout mLabelsLinearLayout;
     private RotateLayout mRecordingTimeRect;
@@ -80,11 +78,7 @@ public class VideoUI implements PreviewStatusListener {
             = new GestureDetector.SimpleOnGestureListener() {
         @Override
         public boolean onSingleTapUp(MotionEvent ev) {
-            if (mVideoHints.getVisibility() == View.VISIBLE) {
-                mVideoHints.setVisibility(View.INVISIBLE);
-            } else {
-                mController.onSingleTapUp(null, (int) ev.getX(), (int) ev.getY());
-            }
+            mController.onSingleTapUp(null, (int) ev.getX(), (int) ev.getY());
             return true;
         }
     };
@@ -102,7 +96,6 @@ public class VideoUI implements PreviewStatusListener {
         initializeMiscControls();
         mAnimationManager = new AnimationManager();
         mFocusRing = (FocusRing) mRootView.findViewById(R.id.focus_ring);
-        mVideoHints = (VideoRecordingHints) mRootView.findViewById(R.id.video_shooting_hints);
     }
 
     public void setPreviewSize(int width, int height) {
@@ -250,24 +243,18 @@ public class VideoUI implements PreviewStatusListener {
 
 
     /**
-     * Shows or hides video recording hints.
-     *
-     * @param show shows video recording hints when true, hides it otherwise.
-     */
-    public void showVideoRecordingHints(boolean show) {
-        mVideoHints.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
-    }
-
-    /**
      * @return The size of the available preview area.
      */
     public Point getPreviewScreenSize() {
         return new Point(mRootView.getMeasuredWidth(), mRootView.getMeasuredHeight());
     }
 
+    /**
+     * Adjust UI to an orientation change if necessary.
+     */
     public void onOrientationChanged(OrientationManager orientationManager,
                                      OrientationManager.DeviceOrientation deviceOrientation) {
-        mVideoHints.onOrientationChanged(orientationManager, deviceOrientation);
+        // do nothing.
     }
 
     private class ZoomChangeListener implements PreviewOverlay.OnZoomChangedListener {
diff --git a/src/com/android/camera/widget/VideoRecordingHints.java b/src/com/android/camera/widget/VideoRecordingHints.java
deleted file mode 100644 (file)
index 32754e0..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright (C) 2014 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.camera.widget;
-
-import android.animation.Animator;
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-import android.view.View;
-
-import com.android.camera.app.OrientationManager;
-import com.android.camera2.R;
-
-import java.lang.ref.WeakReference;
-
-/**
- * This class is designed to show the video recording hint when device is held in
- * portrait before video recording. The rotation device indicator will start rotating
- * after a time-out and will fade out if the device is rotated to landscape. A tap
- * on screen will dismiss the indicator.
- */
-public class VideoRecordingHints extends View {
-
-    private static final int PORTRAIT_ROTATE_DELAY_MS = 1000;
-    private static final int ROTATION_DURATION_MS = 1000;
-    private static final int FADE_OUT_DURATION_MS = 600;
-    private static final float ROTATION_DEGREES = 180f;
-    private static final float INITIAL_ROTATION = 0f;
-    private static final int UNSET = -1;
-
-    private final int mRotateArrowsHalfSize;
-    private final int mPhoneGraphicHalfWidth;
-    private final Drawable mRotateArrows;
-    private final Drawable mPhoneGraphic;
-    private final int mPhoneGraphicHalfHeight;
-    private float mRotation = INITIAL_ROTATION;
-    private final ValueAnimator mRotationAnimation;
-    private final ObjectAnimator mAlphaAnimator;
-    private boolean mIsInLandscape = false;
-    private int mCenterX = UNSET;
-    private int mCenterY = UNSET;
-
-    private static class RotationAnimatorListener implements Animator.AnimatorListener {
-        private final WeakReference<VideoRecordingHints> mHints;
-        private boolean mCanceled = false;
-
-        public RotationAnimatorListener(VideoRecordingHints hint) {
-            mHints = new WeakReference<VideoRecordingHints>(hint);
-        }
-
-        @Override
-        public void onAnimationStart(Animator animation) {
-            mCanceled = false;
-        }
-
-        @Override
-        public void onAnimationEnd(Animator animation) {
-            VideoRecordingHints hint = mHints.get();
-            if (hint == null) {
-                return;
-            }
-
-            hint.mRotation = ((int) hint.mRotation) % 360;
-            // If animation is canceled, do not restart it.
-            if (mCanceled) {
-                return;
-            }
-            hint.post(new Runnable() {
-                @Override
-                public void run() {
-                    VideoRecordingHints hint = mHints.get();
-                    if (hint != null) {
-                        hint.continueRotationAnimation();
-                    }
-                }
-            });
-        }
-
-        @Override
-        public void onAnimationCancel(Animator animation) {
-            mCanceled = true;
-        }
-
-        @Override
-        public void onAnimationRepeat(Animator animation) {
-            // Do nothing.
-        }
-    }
-
-    private static class AlphaAnimatorListener implements Animator.AnimatorListener {
-        private final WeakReference<VideoRecordingHints> mHints;
-        AlphaAnimatorListener(VideoRecordingHints hint) {
-            mHints = new WeakReference<VideoRecordingHints>(hint);
-        }
-
-        @Override
-        public void onAnimationStart(Animator animation) {
-            // Do nothing.
-        }
-
-        @Override
-        public void onAnimationEnd(Animator animation) {
-            VideoRecordingHints hint = mHints.get();
-            if (hint == null) {
-                return;
-            }
-
-            hint.invalidate();
-            hint.setAlpha(1f);
-            hint.mRotation = 0;
-        }
-
-        @Override
-        public void onAnimationCancel(Animator animation) {
-            // Do nothing.
-        }
-
-        @Override
-        public void onAnimationRepeat(Animator animation) {
-            // Do nothing.
-        }
-    }
-
-    public VideoRecordingHints(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        mRotateArrows = getResources().getDrawable(R.drawable.rotate_arrows);
-        mPhoneGraphic = getResources().getDrawable(R.drawable.ic_phone_graphic);
-        mRotateArrowsHalfSize = getResources().getDimensionPixelSize(
-                R.dimen.video_hint_arrow_size) / 2;
-        mPhoneGraphicHalfWidth = getResources()
-                .getDimensionPixelSize(R.dimen.video_hint_phone_graphic_width) / 2;
-        mPhoneGraphicHalfHeight = getResources()
-                .getDimensionPixelSize(R.dimen.video_hint_phone_graphic_height) / 2;
-
-        mRotationAnimation = ValueAnimator.ofFloat(mRotation, mRotation + ROTATION_DEGREES);
-        mRotationAnimation.setDuration(ROTATION_DURATION_MS);
-        mRotationAnimation.setStartDelay(PORTRAIT_ROTATE_DELAY_MS);
-        mRotationAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
-            @Override
-            public void onAnimationUpdate(ValueAnimator animation) {
-                mRotation = (Float) animation.getAnimatedValue();
-                invalidate();
-            }
-        });
-
-        mRotationAnimation.addListener(new RotationAnimatorListener(this));
-
-        mAlphaAnimator = ObjectAnimator.ofFloat(this, "alpha", 1f, 0f);
-        mAlphaAnimator.setDuration(FADE_OUT_DURATION_MS);
-        mAlphaAnimator.addListener(new AlphaAnimatorListener(this));
-    }
-
-    /**
-     * Restart the rotation animation using the current rotation as the starting
-     * rotation, and then rotate a pre-defined amount. If the rotation animation
-     * is currently running, do nothing.
-     */
-    private void continueRotationAnimation() {
-        if (mRotationAnimation.isRunning()) {
-            return;
-        }
-        mRotationAnimation.setFloatValues(mRotation, mRotation + ROTATION_DEGREES);
-        mRotationAnimation.start();
-    }
-
-    @Override
-    public void onVisibilityChanged(View v, int visibility) {
-        super.onVisibilityChanged(v, visibility);
-        if (getVisibility() == VISIBLE && !mIsInLandscape) {
-            continueRotationAnimation();
-        } else if (getVisibility() != VISIBLE) {
-            mRotationAnimation.cancel();
-            mRotation = 0;
-        }
-    }
-
-    @Override
-    public void onLayout(boolean changed, int left, int top, int right, int bottom) {
-        super.onLayout(changed, left, top, right, bottom);
-        // Center drawables in the layout
-        mCenterX = (right - left) / 2;
-        mCenterY = (bottom - top) / 2;
-        mRotateArrows.setBounds(mCenterX - mRotateArrowsHalfSize, mCenterY - mRotateArrowsHalfSize,
-                mCenterX + mRotateArrowsHalfSize, mCenterY + mRotateArrowsHalfSize);
-        mPhoneGraphic.setBounds(mCenterX - mPhoneGraphicHalfWidth, mCenterY - mPhoneGraphicHalfHeight,
-                mCenterX + mPhoneGraphicHalfWidth, mCenterY + mPhoneGraphicHalfHeight);
-        invalidate();
-    }
-
-    @Override
-    public void draw(Canvas canvas) {
-        super.draw(canvas);
-        // Don't draw anything after the fade-out animation in landscape.
-        if (mIsInLandscape && !mAlphaAnimator.isRunning()) {
-            return;
-        }
-        canvas.save();
-        canvas.rotate(-mRotation, mCenterX, mCenterY);
-        mRotateArrows.draw(canvas);
-        canvas.restore();
-        if (mIsInLandscape) {
-            canvas.save();
-            canvas.rotate(90, mCenterX, mCenterY);
-            mPhoneGraphic.draw(canvas);
-            canvas.restore();
-        } else {
-            mPhoneGraphic.draw(canvas);
-        }
-    }
-
-    /**
-     * Handles deviceOrientation change by starting/stopping the video hint based on the
-     * new deviceOrientation.
-     */
-    public void onOrientationChanged(OrientationManager orientationManager,
-                                     OrientationManager.DeviceOrientation deviceOrientation) {
-        mIsInLandscape = orientationManager.isInLandscape();
-        if (getVisibility() == VISIBLE) {
-            if (mIsInLandscape) {
-                // Landscape.
-                mRotationAnimation.cancel();
-                // Start fading out.
-                if (mAlphaAnimator.isRunning()) {
-                    return;
-                }
-                mAlphaAnimator.start();
-            } else {
-                // Portrait.
-                continueRotationAnimation();
-            }
-        }
-    }
-}