0001-fakeVolumeSlider.patch 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From 1bc9328c7b22452eaa4ebfa6923967691c81aa52 Mon Sep 17 00:00:00 2001
  2. From: Carola Nitz <nitz.carola@googlemail.com>
  3. Date: Tue, 30 Jul 2019 17:11:58 +0200
  4. Subject: [PATCH] VLCMovieViewControlpanelView: Add in fake VolumeControl for
  5. screenshots
  6. (closes #575)
  7. ---
  8. Sources/VLCMovieViewControlPanelView.m | 22 +++++++++++++++++++++-
  9. 1 file changed, 21 insertions(+), 1 deletion(-)
  10. diff --git a/Sources/VLCMovieViewControlPanelView.m b/Sources/VLCMovieViewControlPanelView.m
  11. index a0eb8fe2..f35389cc 100644
  12. --- a/Sources/VLCMovieViewControlPanelView.m
  13. +++ b/Sources/VLCMovieViewControlPanelView.m
  14. @@ -24,6 +24,7 @@ @interface VLCMovieViewControlPanelView ()
  15. @property (nonatomic, strong) NSMutableArray *constraints;
  16. @property (nonatomic, assign) BOOL compactMode;
  17. @property (nonatomic, strong) VLCPlaybackController *playbackController;
  18. +@property (nonatomic, strong) UISlider *fakeVolumeSlider; //Needed for Screenshots
  19. @end
  20. @implementation VLCMovieViewControlPanelView
  21. @@ -92,10 +93,17 @@ - (void)setupSubviews
  22. [_moreActionsButton setImage:[UIImage imageNamed:@"More"] forState:UIControlStateNormal];
  23. _moreActionsButton.translatesAutoresizingMaskIntoConstraints = NO;
  24. [self addSubview:_moreActionsButton];
  25. -
  26. +#if TARGET_OS_SIMULATOR
  27. + _fakeVolumeSlider = [UISlider new];
  28. + _fakeVolumeSlider.value = 0.5;
  29. + [_fakeVolumeSlider setThumbImage:[UIImage imageNamed:@"sliderKnob"] forState:UIControlStateNormal];
  30. + _fakeVolumeSlider.translatesAutoresizingMaskIntoConstraints = NO;
  31. + [self addSubview:_fakeVolumeSlider];
  32. +#else
  33. _volumeView = [[VLCVolumeView alloc] initWithFrame:CGRectZero];
  34. _volumeView.translatesAutoresizingMaskIntoConstraints = NO;
  35. [self addSubview:_volumeView];
  36. +#endif
  37. _playbackSpeedButton.accessibilityLabel = NSLocalizedString(@"PLAYBACK_SPEED", nil);
  38. _trackSwitcherButton.accessibilityLabel = NSLocalizedString(@"OPEN_TRACK_PANEL", nil);
  39. @@ -122,7 +130,11 @@ - (void)setupConstraints
  40. @"track" : self.trackSwitcherButton,
  41. @"more" : self.moreActionsButton,
  42. @"filter" : self.videoFilterButton,
  43. +#if TARGET_OS_SIMULATOR
  44. + @"volume" : _fakeVolumeSlider,
  45. +#else
  46. @"volume" : self.volumeView,
  47. +#endif
  48. @"spacer1" : _spacer1,
  49. @"spacer2" : _spacer2,
  50. };
  51. @@ -168,7 +180,11 @@ - (void)setupConstraints:(BOOL)compactMode
  52. @"playback" : self.playbackControls,
  53. @"filter" : self.videoFilterButton,
  54. @"actions" : self.moreActionsButton,
  55. +#if TARGET_OS_SIMULATOR
  56. + @"volume" : _fakeVolumeSlider,
  57. +#else
  58. @"volume" : self.volumeView,
  59. +#endif
  60. };
  61. _constraints = [NSMutableArray array];
  62. @@ -189,7 +205,11 @@ - (void)setupConstraints:(BOOL)compactMode
  63. views:viewsDict]];
  64. } else {
  65. [_constraints addObjectsFromArray:@[
  66. +#if TARGET_OS_SIMULATOR
  67. + [_fakeVolumeSlider.leadingAnchor constraintEqualToAnchor:self.layoutMarginsGuide.leadingAnchor constant:8],
  68. +#else
  69. [self.volumeView.leadingAnchor constraintEqualToAnchor:self.layoutMarginsGuide.leadingAnchor constant:8],
  70. +#endif
  71. [self.moreActionsButton.trailingAnchor constraintEqualToAnchor:self.layoutMarginsGuide.trailingAnchor constant:-8],
  72. ]];
  73. --
  74. 2.20.1 (Apple Git-117)