@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Log.e(TAG, "ACTIVITY\t\tonCreate");
setContentView(R.layout.video_layout);
- Bundle extras = getIntent().getExtras();
- mFile = extras.getParcelable(EXTRA_FILE);
- mAccount = extras.getParcelable(EXTRA_ACCOUNT);
- mSavedPlaybackPosition = extras.getInt(EXTRA_START_POSITION);
- mAutoplay = extras.getBoolean(EXTRA_AUTOPLAY);
+ if (savedInstanceState == null) {
+ Bundle extras = getIntent().getExtras();
+ mFile = extras.getParcelable(EXTRA_FILE);
+ mAccount = extras.getParcelable(EXTRA_ACCOUNT);
+ mSavedPlaybackPosition = extras.getInt(EXTRA_START_POSITION);
+ mAutoplay = extras.getBoolean(EXTRA_AUTOPLAY);
+
+ } else {
+ mFile = savedInstanceState.getParcelable(EXTRA_FILE);
+ mAccount = savedInstanceState.getParcelable(EXTRA_ACCOUNT);
+ mSavedPlaybackPosition = savedInstanceState.getInt(EXTRA_START_POSITION);
+ mAutoplay = savedInstanceState.getBoolean(EXTRA_AUTOPLAY);
+ }
mVideoPlayer = (VideoView) findViewById(R.id.videoPlayer);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ Log.e(TAG, "ACTIVITY\t\tonSaveInstanceState");
+ outState.putParcelable(PreviewVideoActivity.EXTRA_FILE, mFile);
+ outState.putParcelable(PreviewVideoActivity.EXTRA_ACCOUNT, mAccount);
+ outState.putInt(PreviewVideoActivity.EXTRA_START_POSITION, mVideoPlayer.getCurrentPosition());
+ outState.putBoolean(PreviewVideoActivity.EXTRA_AUTOPLAY , mVideoPlayer.isPlaying());
+ }
+
+
@Override
public void onBackPressed() {
+ Log.e(TAG, "ACTIVTIY\t\tonBackPressed");
Intent i = new Intent();
i.putExtra(EXTRA_AUTOPLAY, mVideoPlayer.isPlaying());
i.putExtra(EXTRA_START_POSITION, mVideoPlayer.getCurrentPosition());
}
+ @Override
+ public void onResume() {
+ super.onResume();
+ Log.e(TAG, "ACTIVTIY\t\tonResume");
+ }
+
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ Log.e(TAG, "ACTIVTIY\t\tonStart");
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ Log.e(TAG, "ACTIVITY\t\tonDestroy");
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ Log.e(TAG, "ACTIVTIY\t\tonStop");
+ }
+
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ Log.e(TAG, "ACTIVTIY\t\tonPause");
+ }
+
+
/**
* Called when the file is ready to be played.
*
* @param mp {@link MediaPlayer} instance performing the playback.
*/
@Override
- public void onPrepared(MediaPlayer vp) {
+ public void onPrepared(MediaPlayer mp) {
+ Log.e(TAG, "ACTIVITY\t\tonPrepare");
mVideoPlayer.seekTo(mSavedPlaybackPosition);
if (mAutoplay) {
mVideoPlayer.start();
*/
@Override
public boolean onTouchEvent (MotionEvent ev){
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- mMediaController.show(MediaService.MEDIA_CONTROL_SHORT_LIFE);
+ /*if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ if (mMediaController.isShowing()) {
+ mMediaController.hide();
+ } else {
+ mMediaController.show(MediaService.MEDIA_CONTROL_SHORT_LIFE);
+ }
return true;
} else {
return false;
- }
+ }*/
+ return false;
}