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