OSDN Git Service

Let VideoModule override default mode options enable/disable
authorSpike Sprague <spikuru@google.com>
Mon, 22 Sep 2014 21:53:04 +0000 (14:53 -0700)
committerSpike Sprague <spikuru@google.com>
Tue, 30 Sep 2014 02:08:09 +0000 (19:08 -0700)
bug: 17553759
Change-Id: Iadb2690d81e3efce4e84c8c49f6e684a700c247b

src/com/android/camera/VideoModule.java
src/com/android/camera/app/CameraAppUI.java

index f855d95..e2fdcfb 100644 (file)
@@ -694,8 +694,14 @@ public class VideoModule extends CameraModule
         boolean stop = mMediaRecorderRecording;
 
         if (stop) {
+            // CameraAppUI mishandles mode option enable/disable
+            // for video, override that
+            mAppController.getCameraAppUI().enableModeOptions();
             onStopVideoRecording();
         } else {
+            // CameraAppUI mishandles mode option enable/disable
+            // for video, override that
+            mAppController.getCameraAppUI().disableModeOptions();
             startVideoRecording();
         }
         mAppController.setShutterEnabled(false);
index d79f013..cc9becf 100644 (file)
@@ -1351,24 +1351,6 @@ public class CameraAppUI implements ModeListView.ModeSwitchListener,
         hideModeCover();
     }
 
-    /**
-     * Set the mode options toggle clickable.
-     */
-    public void enableModeOptions() {
-        /*
-         * For modules using camera 1 api, this gets called in
-         * onSurfaceTextureUpdated whenever the preview gets stopped and
-         * started after each capture.  This also takes care of the
-         * case where the mode options might be unclickable when we
-         * switch modes
-         *
-         * For modules using camera 2 api, they're required to call this
-         * method when a capture is "completed".  Unfortunately this differs
-         * per module implementation.
-         */
-        mModeOptionsOverlay.setToggleClickable(true);
-    }
-
     @Override
     public void onShutterButtonClick() {
         /*
@@ -1380,7 +1362,7 @@ public class CameraAppUI implements ModeListView.ModeSwitchListener,
          * can clearly see when the toggle becomes clickable again,
          * keep all of that logic at this level.
          */
-        mModeOptionsOverlay.setToggleClickable(false);
+        disableModeOptions();
     }
 
     @Override
@@ -1394,6 +1376,31 @@ public class CameraAppUI implements ModeListView.ModeSwitchListener,
     }
 
     /**
+     * Set the mode options toggle clickable.
+     */
+    public void enableModeOptions() {
+        /*
+         * For modules using camera 1 api, this gets called in
+         * onSurfaceTextureUpdated whenever the preview gets stopped and
+         * started after each capture.  This also takes care of the
+         * case where the mode options might be unclickable when we
+         * switch modes
+         *
+         * For modules using camera 2 api, they're required to call this
+         * method when a capture is "completed".  Unfortunately this differs
+         * per module implementation.
+         */
+        mModeOptionsOverlay.setToggleClickable(true);
+    }
+
+    /**
+     * Set the mode options toggle not clickable.
+     */
+    public void disableModeOptions() {
+        mModeOptionsOverlay.setToggleClickable(false);
+    }
+
+    /**
      * Gets called when a mode is selected from {@link com.android.camera.ui.ModeListView}
      *
      * @param modeIndex mode index of the selected mode