diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java index b0ec4ee1b4..344f75d0c5 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java @@ -94,12 +94,10 @@ import static com.owncloud.android.datamodel.ThumbnailsCacheManager.PREFIX_THUMB /** * This fragment shows a preview of a downloaded image. - * - * Trying to get an instance with a NULL {@link OCFile} will produce an - * {@link IllegalStateException}. - * - * If the {@link OCFile} passed is not downloaded, an {@link IllegalStateException} is generated on - * instantiation too. + *
+ * Trying to get an instance with a NULL {@link OCFile} will produce an {@link IllegalStateException}. + *
+ * If the {@link OCFile} passed is not downloaded, an {@link IllegalStateException} is generated on instantiation too. */ public class PreviewImageFragment extends FileFragment implements Injectable { @@ -132,17 +130,15 @@ public class PreviewImageFragment extends FileFragment implements Injectable { /** * Public factory method to create a new fragment that previews an image. - * - * Android strongly recommends keep the empty constructor of fragments as the only public - * constructor, and - * use {@link #setArguments(Bundle)} to set the needed arguments. - * + *
+ * Android strongly recommends keep the empty constructor of fragments as the only public constructor, and use + * {@link #setArguments(Bundle)} to set the needed arguments. + *
* This method hides to client objects the need of doing the construction in two steps. * * @param imageFile An {@link OCFile} to preview as an image in the fragment - * @param ignoreFirstSavedState Flag to work around an unexpected behaviour of - * {@link FragmentStatePagerAdapter} - * ; TODO better solution + * @param ignoreFirstSavedState Flag to work around an unexpected behaviour of {@link FragmentStatePagerAdapter} ; + * TODO better solution */ public static PreviewImageFragment newInstance(@NonNull OCFile imageFile, boolean ignoreFirstSavedState, @@ -159,12 +155,11 @@ public class PreviewImageFragment extends FileFragment implements Injectable { /** * Creates an empty fragment for image previews. - * - * MUST BE KEPT: the system uses it when tries to re-instantiate a fragment automatically - * (for instance, when the device is turned a aside). - * - * DO NOT CALL IT: an {@link OCFile} and {@link User} must be provided for a successful - * construction + *
+ * MUST BE KEPT: the system uses it when tries to re-instantiate a fragment automatically (for instance, when the + * device is turned a aside). + *
+ * DO NOT CALL IT: an {@link OCFile} and {@link User} must be provided for a successful construction */ public PreviewImageFragment() { ignoreFirstSavedState = false; @@ -201,11 +196,23 @@ public class PreviewImageFragment extends FileFragment implements Injectable { binding.image.setOnClickListener(v -> togglePreviewImageFullScreen()); + if (getFile().isLivePhoto()) { + binding.image.setOnLongClickListener(v -> { + playLivePhoto(); + return true; + }); + } + setMultiListLoadingMessage(); return view; } + private void playLivePhoto() { + // TODO play video + + } + /** * {@inheritDoc} */ @@ -395,11 +402,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable { public void onFileActionChosen(final int itemId) { if (itemId == R.id.action_send_share_file) { if (getFile().isSharedWithMe() && !getFile().canReshare()) { - Snackbar.make(requireView(), - R.string.resharing_is_not_allowed, - Snackbar.LENGTH_LONG - ) - .show(); + Snackbar.make(requireView(), R.string.resharing_is_not_allowed, Snackbar.LENGTH_LONG).show(); } else { containerActivity.getFileOperationsHelper().sendShareFile(getFile()); } @@ -455,9 +458,9 @@ public class PreviewImageFragment extends FileFragment implements Injectable { /** * Weak reference to the target {@link ImageView} where the bitmap will be loaded into. - * - * Using a weak reference will avoid memory leaks if the target ImageView is retired from - * memory before the load finishes. + *
+ * Using a weak reference will avoid memory leaks if the target ImageView is retired from memory before the load
+ * finishes.
*/
private final WeakReference