MWPhotoBrowserPrivate.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // This file is based on third party code, see below for the original author
  2. // and original license.
  3. // Modifications are (c) by Threema GmbH and licensed under the AGPLv3.
  4. //
  5. // MWPhotoBrowser_Private.h
  6. // MWPhotoBrowser
  7. //
  8. // Created by Michael Waterfall on 08/10/2013.
  9. //
  10. //
  11. #import <UIKit/UIKit.h>
  12. #import <AVKit/AVKit.h>
  13. #import <MBProgressHUD/MBProgressHUD.h>
  14. #import <MediaPlayer/MediaPlayer.h>
  15. #import "MWGridViewController.h"
  16. #import "MWZoomingScrollView.h"
  17. // Declare private methods of browser
  18. @interface MWPhotoBrowser () {
  19. // Data
  20. NSUInteger _photoCount;
  21. NSMutableArray *_photos;
  22. NSMutableArray *_thumbPhotos;
  23. NSArray *_fixedPhotosArray; // Provided via init
  24. // Views
  25. UIScrollView *_pagingScrollView;
  26. // Paging & layout
  27. NSMutableSet *_visiblePages, *_recycledPages;
  28. NSUInteger _currentPageIndex;
  29. NSUInteger _previousPageIndex;
  30. CGRect _previousLayoutBounds;
  31. NSUInteger _pageIndexBeforeRotation;
  32. // Navigation & controls
  33. UIToolbar *_toolbar;
  34. NSTimer *_controlVisibilityTimer;
  35. /***** BEGIN THREEMA MODIFICATION: add delete button *********/
  36. UIBarButtonItem *_previousButton, *_nextButton, *_actionButton, *_actionMultipleButton, *_doneButton, *_deleteSingleButton, *_deleteMultipleButton, *_selectAllButton, *_selectButton;
  37. /***** END THREEMA MODIFICATION: add delete button *********/
  38. MBProgressHUD *_progressHUD;
  39. // Grid
  40. MWGridViewController *_gridController;
  41. UIBarButtonItem *_gridPreviousLeftNavItem;
  42. UIBarButtonItem *_gridPreviousRightNavItem;
  43. // Appearance
  44. BOOL _previousNavBarHidden;
  45. BOOL _previousNavBarTranslucent;
  46. UIBarStyle _previousNavBarStyle;
  47. UIStatusBarStyle _previousStatusBarStyle;
  48. UIColor *_previousNavBarTintColor;
  49. UIColor *_previousNavBarBarTintColor;
  50. UIBarButtonItem *_previousViewControllerBackButton;
  51. UIImage *_previousNavigationBarBackgroundImageDefault;
  52. UIImage *_previousNavigationBarBackgroundImageLandscapePhone;
  53. // Video
  54. AVPlayerViewController *_currentVideoPlayerViewController;
  55. NSUInteger _currentVideoIndex;
  56. UIActivityIndicatorView *_currentVideoLoadingIndicator;
  57. /***** BEGIN THREEMA MODIFICATION: add peeking *********/
  58. BOOL _peeking;
  59. /***** END THREEMA MODIFICATION: add peeking *********/
  60. // Misc
  61. BOOL _hasBelongedToViewController;
  62. BOOL _isVCBasedStatusBarAppearance;
  63. BOOL _statusBarShouldBeHidden;
  64. BOOL _displayActionButton;
  65. BOOL _leaveStatusBarAlone;
  66. BOOL _performingLayout;
  67. BOOL _rotating;
  68. BOOL _viewIsActive; // active as in it's in the view heirarchy
  69. BOOL _didSavePreviousStateOfNavBar;
  70. BOOL _skipNextPagingScrollViewPositioning;
  71. BOOL _viewHasAppearedInitially;
  72. CGPoint _currentGridContentOffset; // ignored since iOS 11
  73. }
  74. // Properties
  75. @property (nonatomic) UIActivityViewController *activityViewController;
  76. // Layout
  77. - (void)layoutVisiblePages;
  78. - (void)performLayout;
  79. - (BOOL)presentingViewControllerPrefersStatusBarHidden;
  80. // Nav Bar Appearance
  81. - (void)setNavBarAppearance:(BOOL)animated;
  82. - (void)storePreviousNavBarAppearance;
  83. - (void)restorePreviousNavBarAppearance:(BOOL)animated;
  84. // Paging
  85. - (void)tilePages;
  86. - (BOOL)isDisplayingPageForIndex:(NSUInteger)index;
  87. - (MWZoomingScrollView *)pageDisplayedAtIndex:(NSUInteger)index;
  88. - (MWZoomingScrollView *)pageDisplayingPhoto:(id<MWPhoto>)photo;
  89. - (MWZoomingScrollView *)dequeueRecycledPage;
  90. - (void)configurePage:(MWZoomingScrollView *)page forIndex:(NSUInteger)index;
  91. - (void)didStartViewingPageAtIndex:(NSUInteger)index;
  92. // Frames
  93. - (CGRect)frameForPagingScrollView;
  94. - (CGRect)frameForPageAtIndex:(NSUInteger)index;
  95. - (CGSize)contentSizeForPagingScrollView;
  96. - (CGPoint)contentOffsetForPageAtIndex:(NSUInteger)index;
  97. - (CGRect)frameForToolbarAtOrientation:(UIInterfaceOrientation)orientation;
  98. - (CGRect)frameForCaptionView:(MWCaptionView *)captionView atIndex:(NSUInteger)index;
  99. - (CGRect)frameForSelectedButton:(UIButton *)selectedButton atIndex:(NSUInteger)index;
  100. // Navigation
  101. - (void)updateNavigation;
  102. - (void)jumpToPageAtIndex:(NSUInteger)index animated:(BOOL)animated;
  103. - (void)gotoPreviousPage;
  104. - (void)gotoNextPage;
  105. // Grid
  106. - (void)showGrid:(BOOL)animated;
  107. - (void)hideGrid;
  108. // Controls
  109. - (void)cancelControlHiding;
  110. - (void)hideControlsAfterDelay;
  111. - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)permanent;
  112. - (void)toggleControls;
  113. - (BOOL)areControlsHidden;
  114. // Data
  115. - (NSUInteger)numberOfPhotos;
  116. - (id<MWPhoto>)photoAtIndex:(NSUInteger)index;
  117. - (id<MWPhoto>)thumbPhotoAtIndex:(NSUInteger)index;
  118. - (UIImage *)imageForPhoto:(id<MWPhoto>)photo;
  119. - (BOOL)photoIsSelectedAtIndex:(NSUInteger)index;
  120. - (void)setPhotoSelected:(BOOL)selected atIndex:(NSUInteger)index;
  121. - (void)loadAdjacentPhotosIfNecessary:(id<MWPhoto>)photo;
  122. - (void)releaseAllUnderlyingPhotos:(BOOL)preserveCurrent;
  123. @end