Add tooltip to live photo indicator

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

View file

@ -83,6 +83,7 @@ import javax.inject.Inject;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.TooltipCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.Fragment;
@ -140,7 +141,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
*
* @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
* TODO better solution
*/
public static PreviewImageFragment newInstance(@NonNull OCFile imageFile,
boolean ignoreFirstSavedState,
@ -208,6 +209,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
if (livePhoto != null) {
binding.livePhotoIndicator.setVisibility(View.VISIBLE);
addTooltipToLivePhotoIndicator();
OCFile videoOfLivePhoto = getFile().videoOfLivePhoto;
@ -219,6 +221,11 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
}
}
private void addTooltipToLivePhotoIndicator() {
TooltipCompat.setTooltipText(binding.livePhotoIndicator, requireContext().getString(R.string.live_photo_indicator_tooltip));
binding.livePhotoIndicator.setOnClickListener(v -> binding.livePhotoIndicator.performLongClick());
}
private void hideActionBar() {
PreviewImageActivity activity = (PreviewImageActivity) requireActivity();
activity.toggleActionBarVisibility(true);

View file

@ -87,6 +87,7 @@
<string name="uploader_upload_files_behaviour_upload_and_delete_from_source">Delete file from source folder</string>
<string name="file_list_seconds_ago">seconds ago</string>
<string name="file_list_live">LIVE</string>
<string name="live_photo_indicator_tooltip">Long-press the image to activate live photo playback</string>
<string name="file_list_empty_headline">No files here</string>
<string name="folder_list_empty_headline">No folders here</string>
<string name="file_list_empty">Upload some content or sync with your devices.</string>