Improve UX, toggle actionbar, disable auto play

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2023-11-08 09:31:39 +01:00
parent d2a8005a30
commit 76176583bd
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF
2 changed files with 12 additions and 6 deletions

View file

@ -211,9 +211,6 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
OCFile videoOfLivePhoto = getFile().videoOfLivePhoto; OCFile videoOfLivePhoto = getFile().videoOfLivePhoto;
// Automatically play live photo
playLivePhoto(videoOfLivePhoto);
// For replay functionality setOnLongClickListener // For replay functionality setOnLongClickListener
binding.image.setOnLongClickListener(v -> { binding.image.setOnLongClickListener(v -> {
playLivePhoto(videoOfLivePhoto); playLivePhoto(videoOfLivePhoto);
@ -222,9 +219,9 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
} }
} }
private void toggleActionBarVisibility(boolean hide) { private void hideActionBar() {
PreviewImageActivity activity = (PreviewImageActivity) requireActivity(); PreviewImageActivity activity = (PreviewImageActivity) requireActivity();
activity.toggleActionBarVisibility(hide); activity.toggleActionBarVisibility(true);
} }
private void playLivePhoto(OCFile file) { private void playLivePhoto(OCFile file) {
@ -232,7 +229,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
return; return;
} }
toggleActionBarVisibility(true); hideActionBar();
Fragment mediaFragment = PreviewMediaFragment.newInstance(file, accountManager.getUser(), 0, true, true); Fragment mediaFragment = PreviewMediaFragment.newInstance(file, accountManager.getUser(), 0, true, true);
FragmentManager fragmentManager = requireActivity().getSupportFragmentManager(); FragmentManager fragmentManager = requireActivity().getSupportFragmentManager();

View file

@ -390,9 +390,18 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
return; return;
} }
showActionBar();
requireActivity().getSupportFragmentManager().popBackStack(); requireActivity().getSupportFragmentManager().popBackStack();
} }
private void showActionBar() {
Activity currentActivity = requireActivity();
if (currentActivity instanceof PreviewImageActivity activity) {
activity.toggleActionBarVisibility(false);
}
}
private void setupVideoView() { private void setupVideoView() {
binding.exoplayerView.setPlayer(exoPlayer); binding.exoplayerView.setPlayer(exoPlayer);
LinearLayout linearLayout = binding.exoplayerView.findViewById(R.id.exo_center_controls); LinearLayout linearLayout = binding.exoplayerView.findViewById(R.id.exo_center_controls);