diff options
author | Chih-Chung Chang <chihchung@google.com> | 2009-10-13 20:20:35 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2009-10-14 11:20:50 +0800 |
commit | 6e9fef5e00072acad09d7138fc992aae4bd17f90 (patch) | |
tree | c6e8a5a6f64396fee38cc09e0e6612b1ef8f1afe /src/com/android/camera | |
parent | 4d2aefbe7c108bae9e4ae735c7cd230792201098 (diff) | |
download | LegacyCamera-6e9fef5e00072acad09d7138fc992aae4bd17f90.zip LegacyCamera-6e9fef5e00072acad09d7138fc992aae4bd17f90.tar.gz LegacyCamera-6e9fef5e00072acad09d7138fc992aae4bd17f90.tar.bz2 |
Fix 2150734.
The problem seems to be the media player is re-created when we get
window focus after onPause. We now only create media player when
the activity is resumed and has focus.
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/MovieView.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/com/android/camera/MovieView.java b/src/com/android/camera/MovieView.java index 54d3e8e..0f4df52 100644 --- a/src/com/android/camera/MovieView.java +++ b/src/com/android/camera/MovieView.java @@ -33,6 +33,9 @@ public class MovieView extends NoSearchActivity { private MovieViewControl mControl; private boolean mFinishOnCompletion; + private boolean mResumed = false; // Whether this activity has been resumed. + private boolean mFocused = false; // Whether this window has focus. + private boolean mControlResumed = false; // Whether the MovieViewControl is resumed. @Override public void onCreate(Bundle icicle) { @@ -62,15 +65,30 @@ public class MovieView extends NoSearchActivity { @Override public void onPause() { - mControl.onPause(); super.onPause(); + mResumed = false; + if (mControlResumed) { + mControl.onPause(); + mControlResumed = false; + } + } + + @Override + public void onResume() { + super.onResume(); + mResumed = true; + if (mFocused && mResumed && !mControlResumed) { + mControl.onResume(); + mControlResumed = true; + } } @Override public void onWindowFocusChanged(boolean hasFocus) { - if (hasFocus) { - Log.v(TAG, "hasFocus"); + mFocused = hasFocus; + if (mFocused && mResumed && !mControlResumed) { mControl.onResume(); + mControlResumed = true; } } } |