Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Show video duration only on GalleryFileWidget and show a centered play icon otherwise

ashilknd282ef2eae08
diff --git a/mobile/lib/ui/viewer/file/thumbnail_widget.dart b/mobile/lib/ui/viewer/file/thumbnail_widget.dart
index 27a20e95ca..e86c0a36a8 100644
--- a/mobile/lib/ui/viewer/file/thumbnail_widget.dart
+++ b/mobile/lib/ui/viewer/file/thumbnail_widget.dart
@@ -26,6 +26,7 @@ import 'package:photos/utils/thumbnail_util.dart';
class ThumbnailWidget extends StatefulWidget {
final EnteFile file;
final BoxFit fit;
+
final bool shouldShowSyncStatus;
final bool shouldShowArchiveStatus;
final bool shouldShowPinIcon;
@@ -37,6 +38,10 @@ class ThumbnailWidget extends StatefulWidget {
final bool shouldShowOwnerAvatar;
final bool shouldShowFavoriteIcon;
+ ///On video thumbnails, shows the video duration if true. If false,
+ ///shows a centered play icon.
+ final bool shouldShowVideoDuration;
+
ThumbnailWidget(
this.file, {
Key? key,
@@ -51,6 +56,7 @@ class ThumbnailWidget extends StatefulWidget {
this.serverLoadDeferDuration,
this.thumbnailSize = thumbnailSmallSize,
this.shouldShowFavoriteIcon = true,
+ this.shouldShowVideoDuration = false,
}) : super(key: key ?? Key(file.tag));
@override
@@ -142,8 +148,12 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
}
if (widget.file.fileType == FileType.video) {
- contentChildren
- .add(VideoOverlayDuration(duration: widget.file.duration!));
+ if (widget.shouldShowVideoDuration) {
+ contentChildren
+ .add(VideoOverlayDuration(duration: widget.file.duration!));
+ } else {
+ contentChildren.add(const VideoOverlayIcon());
+ }
} else if (widget.shouldShowLivePhotoOverlay &&
widget.file.isLiveOrMotionPhoto) {
contentChildren.add(const LivePhotoOverlayIcon());
diff --git a/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart b/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart
index 5f1ce7cbfa..6bd6725376 100644
--- a/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart
+++ b/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart
@@ -55,6 +55,7 @@ class GalleryFileWidget extends StatelessWidget {
? thumbnailLargeSize
: thumbnailSmallSize,
shouldShowOwnerAvatar: !isFileSelected,
+ shouldShowVideoDuration: true,
);
return GestureDetector(
onTap: () {
diff --git a/mobile/lib/ui/viewer/search/result/person_face_widget.dart b/mobile/lib/ui/viewer/search/result/person_face_widget.dart
index 57fe5af654..e7fcf4b889 100644
--- a/mobile/lib/ui/viewer/search/result/person_face_widget.dart
+++ b/mobile/lib/ui/viewer/search/result/person_face_widget.dart
@@ -74,7 +74,9 @@ class PersonFaceWidget extends StatelessWidget {
log('Error getting cover face for person: ${snapshot.error}');
}
return thumbnailFallback
- ? ThumbnailWidget(file)
+ ? ThumbnailWidget(
+ file,
+ )
: const EnteLoadingWidget();
}
},
@@ -96,7 +98,9 @@ class PersonFaceWidget extends StatelessWidget {
log('Error getting cover face for person: ${snapshot.error}');
}
return thumbnailFallback
- ? ThumbnailWidget(file)
+ ? ThumbnailWidget(
+ file,
+ )
: const EnteLoadingWidget();
}
},
@@ -188,7 +192,7 @@ class PersonFaceWidget extends StatelessWidget {
stackTrace: s,
);
resetPool(fullFile: useFullFile);
- if(fetchAttempt <= retryLimit) {
+ if (fetchAttempt <= retryLimit) {
return getFaceCrop(fetchAttempt: fetchAttempt + 1);
}
return null;