Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Also show duration for less than 10 second videos

laurenspriem5a76df7f6246
diff --git a/mobile/lib/ui/viewer/file/file_icons_widget.dart b/mobile/lib/ui/viewer/file/file_icons_widget.dart
index f01ec33276..64ff0bf15c 100644
--- a/mobile/lib/ui/viewer/file/file_icons_widget.dart
+++ b/mobile/lib/ui/viewer/file/file_icons_widget.dart
@@ -123,26 +123,20 @@ class VideoOverlayIcon extends StatelessWidget {
class VideoOverlayDuration extends StatelessWidget {
final int duration;
- const VideoOverlayDuration({Key? key, required this.duration})
- : super(key: key);
+ const VideoOverlayDuration({Key? key, required this.duration}) : super(key: key);
@override
Widget build(BuildContext context) {
- final String formattedDuration =
- Duration(seconds: duration).toString().split('.').first;
+ final String formattedDuration = Duration(seconds: duration).toString().split('.').first;
final List<String> separated = formattedDuration.split(':');
- final String hour =
- (separated[0] == '0') ? '' : int.parse(separated[0]).toString() + ':';
+ final String hour = (separated[0] == '0') ? '' : separated[0] + ':';
final String minute = int.parse(separated[1]).toString() + ':';
- final String second = int.parse(separated[2]).toString();
+ final String second = separated[2];
final String strippedDuration = hour + minute + second;
return _BottomRightOverlayText(
Text(
strippedDuration,
- style: Theme.of(context)
- .textTheme
- .titleSmall!
- .copyWith(color: Colors.white),
+ style: Theme.of(context).textTheme.titleSmall!.copyWith(color: Colors.white),
),
);
}
@@ -176,8 +170,7 @@ class TrashedFileOverlayText extends StatelessWidget {
@override
Widget build(BuildContext context) {
final int daysLeft =
- ((file.deleteBy - DateTime.now().microsecondsSinceEpoch) /
- Duration.microsecondsPerDay)
+ ((file.deleteBy - DateTime.now().microsecondsSinceEpoch) / Duration.microsecondsPerDay)
.ceil();
return Container(
decoration: BoxDecoration(
diff --git a/mobile/lib/ui/viewer/file/thumbnail_widget.dart b/mobile/lib/ui/viewer/file/thumbnail_widget.dart
index e48dfc0c83..71bd43c9c8 100644
--- a/mobile/lib/ui/viewer/file/thumbnail_widget.dart
+++ b/mobile/lib/ui/viewer/file/thumbnail_widget.dart
@@ -19,7 +19,6 @@ import 'package:photos/services/collections_service.dart';
import 'package:photos/services/favorites_service.dart';
import 'package:photos/ui/viewer/file/file_icons_widget.dart';
import 'package:photos/utils/file_util.dart';
-import "package:photos/utils/local_settings.dart";
import 'package:photos/utils/thumbnail_util.dart';
class ThumbnailWidget extends StatefulWidget {
@@ -141,16 +140,12 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
}
if (widget.file.fileType == FileType.video) {
- if (widget.file.duration == null ||
- widget.file.duration! < 10 ||
- LocalSettings.instance.getPhotoGridSize() > 4) {
+ if (widget.file.duration == null) {
contentChildren.add(const VideoOverlayIcon());
} else {
- contentChildren
- .add(VideoOverlayDuration(duration: widget.file.duration!));
+ contentChildren.add(VideoOverlayDuration(duration: widget.file.duration!));
}
- } else if (widget.shouldShowLivePhotoOverlay &&
- widget.file.isLiveOrMotionPhoto) {
+ } else if (widget.shouldShowLivePhotoOverlay && widget.file.isLiveOrMotionPhoto) {
contentChildren.add(const LivePhotoOverlayIcon());
}
if (widget.shouldShowOwnerAvatar) {
@@ -203,12 +198,9 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
}
void _loadLocalImage(BuildContext context) {
- if (!_hasLoadedThumbnail &&
- !_errorLoadingLocalThumbnail &&
- !_isLoadingLocalThumbnail) {
+ if (!_hasLoadedThumbnail && !_errorLoadingLocalThumbnail && !_isLoadingLocalThumbnail) {
_isLoadingLocalThumbnail = true;
- final cachedSmallThumbnail =
- ThumbnailInMemoryLruCache.get(widget.file, thumbnailSmallSize);
+ final cachedSmallThumbnail = ThumbnailInMemoryLruCache.get(widget.file, thumbnailSmallSize);
if (cachedSmallThumbnail != null) {
_imageProvider = Image.memory(cachedSmallThumbnail).image;
_hasLoadedThumbnail = true;
@@ -273,9 +265,7 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
}
void _loadNetworkImage() {
- if (!_hasLoadedThumbnail &&
- !_errorLoadingRemoteThumbnail &&
- !_isLoadingRemoteThumbnail) {
+ if (!_hasLoadedThumbnail && !_errorLoadingRemoteThumbnail && !_isLoadingRemoteThumbnail) {
_isLoadingRemoteThumbnail = true;
final cachedThumbnail = ThumbnailInMemoryLruCache.get(widget.file);
if (cachedThumbnail != null) {