diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-10-19 20:48:56 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-10-19 20:48:56 -0700 |
commit | 7c278bcad6d4cdf7eb4b8e3c0803e65bc671cebd (patch) | |
tree | 2828eacdde04f51ede96c9611322d548f0c0dd75 /src/com | |
parent | a0e0fae73ed1113b9a90c05d972a40ff881ebb37 (diff) | |
parent | eeeea93f90ff788a3d86e1e3bb2bb4725adff9ee (diff) | |
download | LegacyCamera-7c278bcad6d4cdf7eb4b8e3c0803e65bc671cebd.zip LegacyCamera-7c278bcad6d4cdf7eb4b8e3c0803e65bc671cebd.tar.gz LegacyCamera-7c278bcad6d4cdf7eb4b8e3c0803e65bc671cebd.tar.bz2 |
am eeeea93f: Reset the video effect when camcorder application starts.
* commit 'eeeea93f90ff788a3d86e1e3bb2bb4725adff9ee':
Reset the video effect when camcorder application starts.
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/MenuHelper.java | 3 | ||||
-rwxr-xr-x | src/com/android/camera/VideoCamera.java | 72 |
2 files changed, 46 insertions, 29 deletions
diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java index 2e1ec28..07caeb2 100644 --- a/src/com/android/camera/MenuHelper.java +++ b/src/com/android/camera/MenuHelper.java @@ -138,8 +138,9 @@ public class MenuHelper { startCameraActivity(activity, new Intent(action), className); } - public static void gotoVideoMode(Activity activity) { + public static void gotoVideoMode(Activity activity, boolean resetEffect) { Intent intent = new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA); + intent.putExtra(VideoCamera.RESET_EFFECT_EXTRA, resetEffect); startCameraActivity(activity, intent, VIDEO_CAMERA_CLASS); } diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index d5343fb..f244f2d 100755 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -183,6 +183,9 @@ public class VideoCamera extends ActivityBase private int mEffectType = EffectsRecorder.EFFECT_NONE; private Object mEffectParameter = null; private String mEffectUriFromGallery = null; + private String mPrefVideoEffectDefault; + private boolean mResetEffect = true; + public static final String RESET_EFFECT_EXTRA = "reset_effect"; private boolean mMediaRecorderRecording = false; private long mRecordingStartTime; @@ -353,6 +356,11 @@ public class VideoCamera extends ActivityBase CameraSettings.upgradeLocalPreferences(mPreferences.getLocal()); mNumberOfCameras = CameraHolder.instance().getNumberOfCameras(); + mPrefVideoEffectDefault = getString(R.string.pref_video_effect_default); + // Do not reset the effect if users are switching between back and front + // cameras. + mResetEffect = getIntent().getBooleanExtra(RESET_EFFECT_EXTRA, true); + resetEffect(); /* * To reduce startup time, we start the preview in another thread. @@ -704,33 +712,17 @@ public class VideoCamera extends ActivityBase mEffectType = CameraSettings.readEffectType(mPreferences); if (mEffectType != EffectsRecorder.EFFECT_NONE) { mEffectParameter = CameraSettings.readEffectParameter(mPreferences); - // When picking from gallery, mEffectParameter should have been - // initialized in onActivityResult. If not, fall back to no effect - if (mEffectType == EffectsRecorder.EFFECT_BACKDROPPER - && ((String) mEffectParameter).equals(EFFECT_BG_FROM_GALLERY) - && mEffectUriFromGallery == null) { - Log.w(TAG, "No URI from gallery, resetting to no effect"); - mEffectType = EffectsRecorder.EFFECT_NONE; - mEffectParameter = null; - writeDefaultEffectToPrefs(); - if (mIndicatorControlContainer != null) { - mIndicatorControlContainer.overrideSettings( + // Set quality to 480p for effects, unless intent is overriding it + if (!intent.hasExtra(MediaStore.EXTRA_VIDEO_QUALITY)) { + quality = CamcorderProfile.QUALITY_480P; + } + // On initial startup, can get here before indicator control is + // enabled. In that case, UI quality override handled in + // initializeIndicatorControl. + if (mIndicatorControlContainer != null) { + mIndicatorControlContainer.overrideSettings( CameraSettings.KEY_VIDEO_QUALITY, - null); - } - } else { - // Set quality to 480p for effects, unless intent is overriding it - if (!intent.hasExtra(MediaStore.EXTRA_VIDEO_QUALITY)) { - quality = CamcorderProfile.QUALITY_480P; - } - // On initial startup, can get here before indicator control is - // enabled. In that case, UI quality override handled in - // initializeIndicatorControl. - if (mIndicatorControlContainer != null) { - mIndicatorControlContainer.overrideSettings( - CameraSettings.KEY_VIDEO_QUALITY, - Integer.toString(CamcorderProfile.QUALITY_480P)); - } + Integer.toString(CamcorderProfile.QUALITY_480P)); } } else { mEffectParameter = null; @@ -804,6 +796,10 @@ public class VideoCamera extends ActivityBase // some time to get first orientation. mOrientationListener.enable(); if (!mPreviewing) { + if (resetEffect()) { + mBgLearningMessageFrame.setVisibility(View.GONE); + mIndicatorControlContainer.reloadPreferences(); + } try { mCameraDevice = Util.openCamera(this, mCameraId); readVideoPreferences(); @@ -1932,6 +1928,11 @@ public class VideoCamera extends ActivityBase // seen by startPreview from onResume() mEffectUriFromGallery = ((Uri) data.getData()).toString(); Log.v(TAG, "Received URI from gallery: " + mEffectUriFromGallery); + mResetEffect = false; + } else { + mEffectUriFromGallery = null; + Log.w(TAG, "No URI from gallery"); + mResetEffect = true; } break; default: @@ -2052,9 +2053,11 @@ public class VideoCamera extends ActivityBase // animation. if (mIsVideoCaptureIntent) { // If the intent is video capture, stay in video capture mode. - MenuHelper.gotoVideoMode(this, getIntent()); + Intent intent = getIntent(); + intent.putExtra(RESET_EFFECT_EXTRA, false); + MenuHelper.gotoVideoMode(this, intent); } else { - MenuHelper.gotoVideoMode(this); + MenuHelper.gotoVideoMode(this, false); } finish(); } else { @@ -2345,4 +2348,17 @@ public class VideoCamera extends ActivityBase Util.broadcastNewPicture(this, uri); } } + + private boolean resetEffect() { + if (mResetEffect) { + String value = mPreferences.getString(CameraSettings.KEY_VIDEO_EFFECT, + mPrefVideoEffectDefault); + if (!mPrefVideoEffectDefault.equals(value)) { + writeDefaultEffectToPrefs(); + return true; + } + } + mResetEffect = true; + return false; + } } |