mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 04:28:00 +01:00
properly update the neighbour time holder visibility too
This commit is contained in:
parent
82241c250b
commit
825e40595d
5 changed files with 35 additions and 5 deletions
|
@ -281,7 +281,7 @@ public class ViewPagerActivity extends AppCompatActivity
|
|||
return myMedia;
|
||||
}
|
||||
|
||||
public boolean fragmentClicked() {
|
||||
public void fragmentClicked() {
|
||||
deleteFile();
|
||||
isFullScreen = !isFullScreen;
|
||||
if (isFullScreen) {
|
||||
|
@ -289,7 +289,6 @@ public class ViewPagerActivity extends AppCompatActivity
|
|||
} else {
|
||||
showSystemUI();
|
||||
}
|
||||
return isFullScreen;
|
||||
}
|
||||
|
||||
private void hideSystemUI() {
|
||||
|
@ -361,6 +360,9 @@ public class ViewPagerActivity extends AppCompatActivity
|
|||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
||||
isFullScreen = false;
|
||||
}
|
||||
|
||||
final MyPagerAdapter adapter = (MyPagerAdapter) pager.getAdapter();
|
||||
adapter.updateUiVisibility(isFullScreen, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -54,6 +54,15 @@ public class MyPagerAdapter extends FragmentStatePagerAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateUiVisibility(boolean isFullscreen, int pos) {
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
ViewPagerFragment fragment = fragments.get(pos + i);
|
||||
if (fragment != null) {
|
||||
fragment.systemUiVisibilityChanged(isFullscreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateItems(List<Medium> newPaths) {
|
||||
media.clear();
|
||||
media.addAll(newPaths);
|
||||
|
|
|
@ -45,4 +45,9 @@ public class PhotoFragment extends ViewPagerFragment implements View.OnClickList
|
|||
public void itemDragged() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void systemUiVisibilityChanged(boolean toFullscreen) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,6 +86,14 @@ public class VideoFragment extends ViewPagerFragment
|
|||
pauseVideo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void systemUiVisibilityChanged(boolean toFullscreen) {
|
||||
if (isFullscreen != toFullscreen) {
|
||||
isFullscreen = toFullscreen;
|
||||
checkFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
private void initTimeHolder(View view) {
|
||||
timeHolder = view.findViewById(R.id.video_time_holder);
|
||||
final Resources res = getResources();
|
||||
|
@ -146,16 +154,20 @@ public class VideoFragment extends ViewPagerFragment
|
|||
togglePlayPause();
|
||||
break;
|
||||
default:
|
||||
toggleFullscreen();
|
||||
isFullscreen = !isFullscreen;
|
||||
checkFullscreen();
|
||||
((ViewPagerActivity) getActivity()).fragmentClicked();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleFullscreen() {
|
||||
isFullscreen = ((ViewPagerActivity) getActivity()).fragmentClicked();
|
||||
private void checkFullscreen() {
|
||||
int anim = R.anim.fade_in;
|
||||
if (isFullscreen) {
|
||||
anim = R.anim.fade_out;
|
||||
seekBar.setOnSeekBarChangeListener(null);
|
||||
} else {
|
||||
seekBar.setOnSeekBarChangeListener(this);
|
||||
}
|
||||
|
||||
final Animation animation = AnimationUtils.loadAnimation(getContext(), anim);
|
||||
|
|
|
@ -4,4 +4,6 @@ import android.support.v4.app.Fragment;
|
|||
|
||||
public abstract class ViewPagerFragment extends Fragment {
|
||||
public abstract void itemDragged();
|
||||
|
||||
public abstract void systemUiVisibilityChanged(boolean toFullscreen);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue