mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
remember the state on orientation change
This commit is contained in:
parent
186b5bfd4f
commit
ba76a4a215
1 changed files with 8 additions and 5 deletions
|
@ -34,7 +34,7 @@ public class VideoFragment extends ViewPagerFragment
|
||||||
implements View.OnClickListener, SurfaceHolder.Callback, MediaPlayer.OnCompletionListener, MediaPlayer.OnVideoSizeChangedListener,
|
implements View.OnClickListener, SurfaceHolder.Callback, MediaPlayer.OnCompletionListener, MediaPlayer.OnVideoSizeChangedListener,
|
||||||
SeekBar.OnSeekBarChangeListener {
|
SeekBar.OnSeekBarChangeListener {
|
||||||
private static final String TAG = VideoFragment.class.getSimpleName();
|
private static final String TAG = VideoFragment.class.getSimpleName();
|
||||||
private static final String MEDIUM = "medium";
|
private static final String PROGRESS = "progress";
|
||||||
private MediaPlayer mediaPlayer;
|
private MediaPlayer mediaPlayer;
|
||||||
private SurfaceView surfaceView;
|
private SurfaceView surfaceView;
|
||||||
private SurfaceHolder surfaceHolder;
|
private SurfaceHolder surfaceHolder;
|
||||||
|
@ -56,8 +56,9 @@ public class VideoFragment extends ViewPagerFragment
|
||||||
final View view = inflater.inflate(R.layout.pager_video_item, container, false);
|
final View view = inflater.inflate(R.layout.pager_video_item, container, false);
|
||||||
|
|
||||||
medium = (Medium) getArguments().getSerializable(Constants.MEDIUM);
|
medium = (Medium) getArguments().getSerializable(Constants.MEDIUM);
|
||||||
if (medium == null)
|
if (savedInstanceState != null) {
|
||||||
return view;
|
currTime = savedInstanceState.getInt(PROGRESS);
|
||||||
|
}
|
||||||
|
|
||||||
isFullscreen = (getActivity().getWindow().getDecorView().getSystemUiVisibility() & View.SYSTEM_UI_FLAG_FULLSCREEN) ==
|
isFullscreen = (getActivity().getWindow().getDecorView().getSystemUiVisibility() & View.SYSTEM_UI_FLAG_FULLSCREEN) ==
|
||||||
View.SYSTEM_UI_FLAG_FULLSCREEN;
|
View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||||
|
@ -144,7 +145,7 @@ public class VideoFragment extends ViewPagerFragment
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
outState.putSerializable(MEDIUM, medium);
|
outState.putInt(PROGRESS, currTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -242,7 +243,9 @@ public class VideoFragment extends ViewPagerFragment
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
cleanup();
|
if (getActivity() != null && !getActivity().isChangingConfigurations()) {
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanup() {
|
private void cleanup() {
|
||||||
|
|
Loading…
Reference in a new issue