Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use generic file extension search icon

ashilkn2563b8a37ca0
diff --git a/mobile/apps/photos/assets/2.0x/type_AVI.png b/mobile/apps/photos/assets/2.0x/type_AVI.png
deleted file mode 100644
index 1d702e56e4..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_AVI.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_GIF.png b/mobile/apps/photos/assets/2.0x/type_GIF.png
deleted file mode 100644
index 56ac4c1d59..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_GIF.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_HEIC.png b/mobile/apps/photos/assets/2.0x/type_HEIC.png
deleted file mode 100644
index 9ba580df35..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_HEIC.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_JPEG.png b/mobile/apps/photos/assets/2.0x/type_JPEG.png
deleted file mode 100644
index 1ca74c9bb9..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_JPEG.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_JPG.png b/mobile/apps/photos/assets/2.0x/type_JPG.png
deleted file mode 100644
index d523baa66f..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_JPG.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_MKV.png b/mobile/apps/photos/assets/2.0x/type_MKV.png
deleted file mode 100644
index 2d158f9049..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_MKV.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_MP4.png b/mobile/apps/photos/assets/2.0x/type_MP4.png
deleted file mode 100644
index 613ba74c25..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_MP4.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_PNG.png b/mobile/apps/photos/assets/2.0x/type_PNG.png
deleted file mode 100644
index ae48640a6c..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_PNG.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_WEBP.png b/mobile/apps/photos/assets/2.0x/type_WEBP.png
deleted file mode 100644
index f9d1e1dd57..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_WEBP.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_live.png b/mobile/apps/photos/assets/2.0x/type_live.png
deleted file mode 100644
index 762cd162c8..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_live.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_photos.png b/mobile/apps/photos/assets/2.0x/type_photos.png
deleted file mode 100644
index 07332e836a..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_photos.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/type_videos.png b/mobile/apps/photos/assets/2.0x/type_videos.png
deleted file mode 100644
index d56bbb556f..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/type_videos.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_AVI.png b/mobile/apps/photos/assets/3.0x/type_AVI.png
deleted file mode 100644
index 556d292f20..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_AVI.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_GIF.png b/mobile/apps/photos/assets/3.0x/type_GIF.png
deleted file mode 100644
index a4829a1968..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_GIF.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_HEIC.png b/mobile/apps/photos/assets/3.0x/type_HEIC.png
deleted file mode 100644
index f3c1b7cf55..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_HEIC.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_JPEG.png b/mobile/apps/photos/assets/3.0x/type_JPEG.png
deleted file mode 100644
index 55b6aed020..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_JPEG.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_JPG.png b/mobile/apps/photos/assets/3.0x/type_JPG.png
deleted file mode 100644
index 5122ab5d9c..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_JPG.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_MKV.png b/mobile/apps/photos/assets/3.0x/type_MKV.png
deleted file mode 100644
index 684dbf7c4e..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_MKV.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_MP4.png b/mobile/apps/photos/assets/3.0x/type_MP4.png
deleted file mode 100644
index db072dfc50..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_MP4.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_PNG.png b/mobile/apps/photos/assets/3.0x/type_PNG.png
deleted file mode 100644
index 84b447e6ba..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_PNG.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_WEBP.png b/mobile/apps/photos/assets/3.0x/type_WEBP.png
deleted file mode 100644
index 57a6957ac4..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_WEBP.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_live.png b/mobile/apps/photos/assets/3.0x/type_live.png
deleted file mode 100644
index a374691284..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_live.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_photos.png b/mobile/apps/photos/assets/3.0x/type_photos.png
deleted file mode 100644
index 8a9279a4fc..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_photos.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/type_videos.png b/mobile/apps/photos/assets/3.0x/type_videos.png
deleted file mode 100644
index 99967ea5f6..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/type_videos.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/file_extension_outline.svg b/mobile/apps/photos/assets/file_extension_outline.svg
new file mode 100644
index 0000000000..6924677fe1
--- /dev/null
+++ b/mobile/apps/photos/assets/file_extension_outline.svg
@@ -0,0 +1,4 @@
+<svg width="22" height="13" viewBox="0 0 22 13" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M2.05469 11.75V10.9463C2.05469 7.97893 2.05469 6.49524 2.52362 5.31025C3.2775 3.40523 4.87182 1.90256 6.89305 1.19202C8.15032 0.750047 9.7245 0.750046 12.8729 0.750046C14.6719 0.750046 15.5715 0.750045 16.2899 1.0026C17.4449 1.40863 18.3559 2.26729 18.7867 3.35588C19.0547 4.03302 19.0547 4.88084 19.0547 6.57648V10.7642V11.75" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ <path d="M2.05469 10.75C2.05469 8.90906 3.54707 7.41668 5.38802 7.41668C6.0538 7.41668 6.83872 7.53334 7.48605 7.35989C8.06121 7.20578 8.51045 6.75653 8.66456 6.18138C8.83801 5.53405 8.72135 4.74913 8.72135 4.08335C8.72135 2.2424 10.2137 0.750014 12.0547 0.750014" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/mobile/apps/photos/assets/type_AVI.png b/mobile/apps/photos/assets/type_AVI.png
deleted file mode 100644
index 1272d3d078..0000000000
Binary files a/mobile/apps/photos/assets/type_AVI.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_GIF.png b/mobile/apps/photos/assets/type_GIF.png
deleted file mode 100644
index b93e1ffaff..0000000000
Binary files a/mobile/apps/photos/assets/type_GIF.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_HEIC.png b/mobile/apps/photos/assets/type_HEIC.png
deleted file mode 100644
index 50c6bc9bda..0000000000
Binary files a/mobile/apps/photos/assets/type_HEIC.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_JPEG.png b/mobile/apps/photos/assets/type_JPEG.png
deleted file mode 100644
index 7f639e5867..0000000000
Binary files a/mobile/apps/photos/assets/type_JPEG.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_JPG.png b/mobile/apps/photos/assets/type_JPG.png
deleted file mode 100644
index aa6eefceaa..0000000000
Binary files a/mobile/apps/photos/assets/type_JPG.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_MKV.png b/mobile/apps/photos/assets/type_MKV.png
deleted file mode 100644
index 3d9e550422..0000000000
Binary files a/mobile/apps/photos/assets/type_MKV.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_MP4.png b/mobile/apps/photos/assets/type_MP4.png
deleted file mode 100644
index f01d126de4..0000000000
Binary files a/mobile/apps/photos/assets/type_MP4.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_PNG.png b/mobile/apps/photos/assets/type_PNG.png
deleted file mode 100644
index f56b2b97c0..0000000000
Binary files a/mobile/apps/photos/assets/type_PNG.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_WEBP.png b/mobile/apps/photos/assets/type_WEBP.png
deleted file mode 100644
index b66d4cc048..0000000000
Binary files a/mobile/apps/photos/assets/type_WEBP.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_live.png b/mobile/apps/photos/assets/type_live.png
deleted file mode 100644
index f2dbd30953..0000000000
Binary files a/mobile/apps/photos/assets/type_live.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_photos.png b/mobile/apps/photos/assets/type_photos.png
deleted file mode 100644
index b83abe698d..0000000000
Binary files a/mobile/apps/photos/assets/type_photos.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/type_videos.png b/mobile/apps/photos/assets/type_videos.png
deleted file mode 100644
index c86768afcb..0000000000
Binary files a/mobile/apps/photos/assets/type_videos.png and /dev/null differ
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/file_type_section.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/file_type_section.dart
index 3cd15f2ddd..3d40131bad 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/file_type_section.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/file_type_section.dart
@@ -4,6 +4,7 @@ import "dart:math" as math;
import "package:ente_components/theme/text_styles.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
+import "package:flutter_svg/flutter_svg.dart";
import "package:hugeicons/hugeicons.dart";
import "package:logging/logging.dart";
import "package:photos/models/file/file_type.dart";
@@ -60,7 +61,7 @@ class FileTypeSection extends StatelessWidget {
);
}
- final tiles = _previewTiles(context);
+ final previewTiles = _previewTiles(context);
return Padding(
padding: const EdgeInsets.only(bottom: 20),
child: Column(
@@ -74,9 +75,9 @@ class FileTypeSection extends StatelessWidget {
padding: EdgeInsets.zero,
physics: const BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
- itemCount: tiles.length,
+ itemCount: previewTiles.length,
itemBuilder: (context, index) {
- return _FileTypeRecommendation(tiles[index]);
+ return _FileTypeRecommendation(previewTiles[index]);
},
separatorBuilder: (context, index) => const SizedBox(width: 10),
),
@@ -109,30 +110,10 @@ class FileTypeSection extends StatelessWidget {
type: FileType.livePhoto,
icon: HugeIcons.strokeRoundedPlayCircle,
),
- const _FileTypeTile.extension(
- label: "PNG",
- name: "PNGs",
- extension: "PNG",
- icon: HugeIcons.strokeRoundedFile01,
- ),
- const _FileTypeTile.extension(
- label: "JPG",
- name: "JPGs",
- extension: "JPG",
- icon: HugeIcons.strokeRoundedFile01,
- ),
- const _FileTypeTile.extension(
- label: "HEIC",
- name: "HEICs",
- extension: "HEIC",
- icon: HugeIcons.strokeRoundedFile01,
- ),
- const _FileTypeTile.extension(
- label: "MP4",
- name: "MP4s",
- extension: "MP4",
- icon: HugeIcons.strokeRoundedFile01,
- ),
+ const _FileTypeTile.extension("PNG"),
+ const _FileTypeTile.extension("JPG"),
+ const _FileTypeTile.extension("HEIC"),
+ const _FileTypeTile.extension("MP4"),
];
}
}
@@ -141,8 +122,8 @@ class _FileTypeTile {
final String label;
final String name;
final FileType? fileType;
- final String? extension;
- final List<List<dynamic>> icon;
+ final String extension;
+ final List<List<dynamic>>? icon;
bool get isFileType => fileType != null;
const _FileTypeTile.fileType({
@@ -151,14 +132,13 @@ class _FileTypeTile {
required FileType type,
required this.icon,
}) : fileType = type,
- extension = null;
+ extension = "";
- const _FileTypeTile.extension({
- required this.label,
- required this.name,
- required this.extension,
- required this.icon,
- }) : fileType = null;
+ const _FileTypeTile.extension(this.extension)
+ : label = extension,
+ name = "",
+ fileType = null,
+ icon = null;
Future<GenericSearchResult> resolve() {
final type = fileType;
@@ -168,9 +148,10 @@ class _FileTypeTile {
typeName: name,
);
}
+ final normalizedExtension = _normalizedExtension(extension);
return SearchService.instance.getFileExtensionResult(
- extension: extension!,
- extensionName: name,
+ extension: normalizedExtension,
+ extensionName: "${normalizedExtension}s",
);
}
}
@@ -254,7 +235,7 @@ class _FileTypeCard extends StatelessWidget {
height: 34,
child: Center(
child: HugeIcon(
- icon: tile.icon,
+ icon: tile.icon!,
size: 18,
color: colorScheme.textBase,
),
@@ -282,21 +263,78 @@ class _FileExtensionPill extends StatelessWidget {
color: colorScheme.fill,
borderRadius: BorderRadius.circular(25),
),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
+ child: Center(
+ child: _FileExtensionIcon(
+ extension: tile.extension,
+ color: colorScheme.textBase,
+ ),
+ ),
+ );
+ }
+}
+
+class _FileExtensionIcon extends StatelessWidget {
+ static const _outlineAsset = "assets/file_extension_outline.svg";
+ static const _maxExtensionLength = 5;
+
+ final String extension;
+ final Color color;
+
+ const _FileExtensionIcon({required this.extension, required this.color});
+
+ @override
+ Widget build(BuildContext context) {
+ final label = _displayExtension(extension);
+ return SizedBox(
+ width: 34,
+ height: 23.2041,
+ child: Stack(
+ alignment: Alignment.center,
children: [
- HugeIcon(icon: tile.icon, size: 22, color: colorScheme.textBase),
- const SizedBox(height: 2),
- Text(
- tile.label,
- style: TextStyles.tiny.copyWith(color: colorScheme.textBase),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
+ Positioned(
+ top: 0,
+ child: SvgPicture.asset(
+ _outlineAsset,
+ width: 22,
+ height: 13,
+ colorFilter: ColorFilter.mode(color, BlendMode.srcIn),
+ ),
+ ),
+ Positioned(
+ left: 0,
+ right: 0,
+ bottom: 0,
+ height: 8,
+ child: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ label,
+ style: TextStyle(
+ color: color,
+ fontFamily: TextStyles.fontFamily,
+ package: TextStyles.fontPackage,
+ fontSize: 7.8,
+ fontWeight: FontWeight.w700,
+ height: 1,
+ letterSpacing: 0,
+ ),
+ maxLines: 1,
+ textAlign: TextAlign.center,
+ ),
+ ),
),
],
),
);
}
+
+ String _displayExtension(String extension) {
+ final normalizedExtension = _normalizedExtension(extension);
+ if (normalizedExtension.length <= _maxExtensionLength) {
+ return normalizedExtension;
+ }
+ return normalizedExtension.substring(0, _maxExtensionLength);
+ }
}
class _FileTypeCardBackgroundPainter extends CustomPainter {
@@ -387,3 +425,9 @@ class _FileTypeCardPath {
return path;
}
}
+
+String _normalizedExtension(String extension) {
+ final trimmed = extension.trim();
+ final withoutDot = trimmed.startsWith(".") ? trimmed.substring(1) : trimmed;
+ return withoutDot.toUpperCase();
+}