Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge remote-tracking branch 'upstream/main' into codex/gallery-file-viewer-filmstrip

ashil-pilot6531519ac91e
diff --cc mobile/apps/photos/lib/ui/viewer/file/video_control/gallery_video_controls.dart
index 1bba993669,49efe3d17b..a9b4295645
--- a/mobile/apps/photos/lib/ui/viewer/file/video_control/gallery_video_controls.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/video_control/gallery_video_controls.dart
@@@ -12,42 -10,54 +12,89 @@@ const kVideoProgressRowHeight = 32.0
const kVideoCaptionGap = 6.0;
const kVideoCaptionLineHeight = 16.0;
const kVideoScrimTopPadding = 12.0;
+ const kVideoLongPressPlaybackSpeed = 2.0;
+
+ OverlayEntry showVideoLongPressSpeedIndicator(BuildContext context) {
+ final entry = OverlayEntry(
+ builder: (context) {
+ final screenSize = MediaQuery.sizeOf(context);
+ final isLandscape = screenSize.width > screenSize.height;
+ return Positioned(
+ top:
+ MediaQuery.paddingOf(context).top +
+ (isLandscape ? 12 : kToolbarHeight + 16),
+ left: 0,
+ right: 0,
+ child: const IgnorePointer(
+ child: Material(
+ type: MaterialType.transparency,
+ child: Center(child: VideoLongPressSpeedIndicator()),
+ ),
+ ),
+ );
+ },
+ );
+ Overlay.of(context, rootOverlay: true).insert(entry);
+ return entry;
+ }
+
+ class VideoLongPressSpeedIndicator extends StatelessWidget {
+ const VideoLongPressSpeedIndicator({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final textTheme = getEnteTextTheme(context);
+ return DecoratedBox(
+ decoration: BoxDecoration(
+ color: Colors.black.withValues(alpha: 0.72),
+ borderRadius: BorderRadius.circular(16),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
+ child: Text(
+ "2x",
+ style: textTheme.smallBold.copyWith(color: textBaseDark),
+ ),
+ ),
+ );
+ }
+ }
+ValueListenable<double> galleryBottomControlsAdditionalInsetListenable(
+ BuildContext context,
+) {
+ return InheritedDetailPageState.maybeOf(
+ context,
+ )?.bottomControlsAdditionalInsetNotifier ??
+ const AlwaysStoppedAnimation(0);
+}
+
+// This widget returns Positioned, so its parent must be a Stack.
+class GalleryBottomControlsPositioned extends StatelessWidget {
+ final double bottom;
+ final Widget child;
+
+ const GalleryBottomControlsPositioned({
+ required this.bottom,
+ required this.child,
+ super.key,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ return ValueListenableBuilder<double>(
+ valueListenable: galleryBottomControlsAdditionalInsetListenable(context),
+ builder: (context, additionalBottomInset, child) => Positioned(
+ left: 0,
+ right: 0,
+ bottom: bottom + additionalBottomInset,
+ child: child!,
+ ),
+ child: child,
+ );
+ }
+}
+
class EqualHeightSliderTrackShape extends RoundedRectSliderTrackShape {
const EqualHeightSliderTrackShape();
diff --cc mobile/apps/photos/lib/ui/viewer/file/video_widget.dart
index be5b45263d,9b128bdcd5..71003c0880
--- a/mobile/apps/photos/lib/ui/viewer/file/video_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/video_widget.dart
@@@ -238,42 -197,72 +240,46 @@@ class _VideoWidgetState extends State<V
),
),
);
- }
-
- final shouldUseNativeVideoPlayer =
- useNativeVideoPlayer &&
- !widget.file.isDeviceTrash &&
- (!playPreview || Platform.isAndroid);
+ } else {
+ final shouldUseNativeVideoPlayer =
+ useNativeVideoPlayer &&
+ !widget.file.isDeviceTrash &&
+ (!playPreview || Platform.isAndroid);
- if (shouldUseNativeVideoPlayer) {
- return VideoWidgetNative(
- widget.file,
- key: nativePlayerKey,
- tagPrefix: widget.tagPrefix,
- playbackCallback: widget.playbackCallback,
- shouldDisableScroll: widget.shouldDisableScroll,
- playlistData: playlistData,
- selectedPreview: playPreview,
- playbackSpeed: _playbackSpeed,
- isFromMemories: widget.isFromMemories,
- isActive: _isActive,
- isAudioMutedOverride: widget.isAudioMutedOverride,
- onFinalFileLoad: widget.onFinalFileLoad,
- );
+ child = shouldUseNativeVideoPlayer
+ ? VideoWidgetNative(
+ widget.file,
+ key: nativePlayerKey,
+ tagPrefix: widget.tagPrefix,
+ playbackCallback: widget.playbackCallback,
+ shouldDisableScroll: widget.shouldDisableScroll,
+ playlistData: playlistData,
+ selectedPreview: playPreview,
+ playbackSpeed: _playbackSpeed,
+ isFromMemories: widget.isFromMemories,
+ isActive: _isActive,
+ isAudioMutedOverride: widget.isAudioMutedOverride,
- onStreamChange: () {
- setState(() {
- selectPreviewForPlay = !selectPreviewForPlay;
- Bus.instance.fire(
- StreamSwitchedEvent(
- selectPreviewForPlay,
- Platform.isAndroid && useNativeVideoPlayer
- ? PlayerType.nativeVideoPlayer
- : PlayerType.mediaKit,
- ),
- );
- });
- },
+ onFinalFileLoad: widget.onFinalFileLoad,
+ )
+ : VideoWidgetMediaKit(
+ widget.file,
+ key: mediaKitKey,
+ tagPrefix: widget.tagPrefix,
+ playbackCallback: widget.playbackCallback,
+ shouldDisableScroll: widget.shouldDisableScroll,
+ preview: playlistData?.preview,
+ selectedPreview: playPreview,
+ playbackSpeed: _playbackSpeed,
+ isFromMemories: widget.isFromMemories,
+ isActive: _isActive,
+ isAudioMutedOverride: widget.isAudioMutedOverride,
- onStreamChange: () {
- setState(() {
- selectPreviewForPlay = !selectPreviewForPlay;
- Bus.instance.fire(
- StreamSwitchedEvent(
- selectPreviewForPlay,
- Platform.isAndroid
- ? PlayerType.nativeVideoPlayer
- : PlayerType.mediaKit,
- ),
- );
- });
- },
+ onFinalFileLoad: widget.onFinalFileLoad,
+ );
}
- return VideoWidgetMediaKit(
- widget.file,
- key: mediaKitKey,
- tagPrefix: widget.tagPrefix,
- playbackCallback: widget.playbackCallback,
- shouldDisableScroll: widget.shouldDisableScroll,
- preview: playlistData?.preview,
- selectedPreview: playPreview,
- playbackSpeed: _playbackSpeed,
- isFromMemories: widget.isFromMemories,
- isActive: _isActive,
- isAudioMutedOverride: widget.isAudioMutedOverride,
- onFinalFileLoad: widget.onFinalFileLoad,
+
+ return AnnotatedRegion<SystemUiOverlayStyle>(
+ value: SystemUiOverlayStyle.light,
+ child: child,
);
}