Files
DoImagePicker/DoPhotoBrowserPrivate.h
2015-06-29 11:51:01 +08:00

138 lines
4.1 KiB
Objective-C

//
// DoPhotoBrowserPrivate.h
// XiaoYu
//
// Created by xmfish on 14-9-23.
// Copyright (c) 2014年 厦门小鱼网. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MBProgressHUD.h"
#import "MWGridViewController.h"
#import "MWZoomingScrollView.h"
#import "DoPhotoBrowser.h"
// Declare private methods of browser
@interface DoPhotoBrowser () {
// Data
NSUInteger _photoCount;
NSMutableArray *_photos;
NSMutableArray *_thumbPhotos;
NSArray *_depreciatedPhotoData; // Depreciated
// 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;
UIActionSheet *_actionsSheet;
// Grid
MWGridViewController *_gridController;
UIBarButtonItem *_gridPreviousLeftNavItem;
UIBarButtonItem *_gridPreviousRightNavItem;
// Appearance
BOOL _previousNavBarHidden;
BOOL _previousNavToolbarHidden;
BOOL _previousNavBarTranslucent;
UIBarStyle _previousNavBarStyle;
UIStatusBarStyle _previousStatusBarStyle;
UIColor *_previousNavBarTintColor;
UIColor *_previousNavBarBarTintColor;
UIBarButtonItem *_previousViewControllerBackButton;
UIImage *_previousNavigationBarBackgroundImageDefault;
UIImage *_previousNavigationBarBackgroundImageLandscapePhone;
// 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;
// Actions
- (void)savePhoto;
- (void)copyPhoto;
- (void)emailPhoto;
@end