Merge "Add a property to control audio effect"
diff --git a/src/com/android/gallery3d/app/MoviePlayer.java b/src/com/android/gallery3d/app/MoviePlayer.java
index 9b6e386..06773f8 100755
--- a/src/com/android/gallery3d/app/MoviePlayer.java
+++ b/src/com/android/gallery3d/app/MoviePlayer.java
@@ -67,6 +67,7 @@
import java.io.DataOutputStream;
import java.util.HashMap;
import java.util.Map;
+import java.util.Timer;
public class MoviePlayer implements
MediaPlayer.OnErrorListener, MediaPlayer.OnCompletionListener,
@@ -194,6 +195,18 @@
}
};
+ public interface TimerProgress {
+ void startTimer();
+ }
+
+ private TimerProgress mTimerController = new TimerProgress() {
+ @Override
+ public void startTimer() {
+ mHandler.removeCallbacks(mProgressChecker);
+ mHandler.post(mProgressChecker);
+ }
+ };
+
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -234,6 +247,7 @@
mVideoView.setOnErrorListener(this);
mVideoView.setOnCompletionListener(this);
+ mVideoView.setTimerProgress(mTimerController);
if (mVirtualizer != null) {
mVirtualizer.release();
@@ -515,7 +529,7 @@
mHandler.postDelayed(mPlayingChecker, 250);
}
- mHandler.post(mProgressChecker);
+ mTimerController.startTimer();
}
private void pauseVideoMoreThanThreeMinutes() {
diff --git a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java
index 2bd1216..f5a5689 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java
@@ -156,6 +156,7 @@
}
public void updateOrAddFilterRepresentation(FilterRepresentation rep) {
+ if (rep == null) return;
int pos = getPositionForRepresentation(rep);
if (pos != -1) {
mFilters.elementAt(pos).useParametersFrom(rep);
diff --git a/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java b/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java
index 7fefbb8..6b5a9be 100644
--- a/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java
+++ b/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java
@@ -28,6 +28,7 @@
import android.widget.MediaController;
import android.widget.MediaController.MediaPlayerControl;
+import com.android.gallery3d.app.MoviePlayer;
import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.common.ApiHelper.Metadata;
@@ -85,6 +86,7 @@
private MediaPlayer.OnVideoSizeChangedListener mVideoSizeListener;
private MediaPlayer.OnPreparedListener mPreparedListener;
private ScreenModeManager mScreenManager;
+ private MoviePlayer.TimerProgress mTimerController;
private int mCurrentBufferPercentage;
private OnErrorListener mOnErrorListener;
private OnInfoListener mOnInfoListener;
@@ -621,6 +623,16 @@
mOnInfoListener = l;
}
+ /**
+ * Register a callback to start Timer for time progress bar
+ * occurs during this.start()
+ *
+ * @param c The callback that will be run
+ */
+ public void setTimerProgress(MoviePlayer.TimerProgress c) {
+ mTimerController = c;
+ }
+
SurfaceHolder.Callback mSHCallback = new SurfaceHolder.Callback() {
public void surfaceChanged(SurfaceHolder holder, int format,
int w, int h) {
@@ -772,6 +784,7 @@
if (mIsShowDialog) return;
if (isInPlaybackState()) {
mMediaPlayer.start();
+ mTimerController.startTimer();
mCurrentState = STATE_PLAYING;
}
mTargetState = STATE_PLAYING;