Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS-60 #598

Merged
merged 3 commits into from Oct 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions AlfrescoApp/Constants/Constants.h
Expand Up @@ -96,6 +96,14 @@ extern NSString * const kHTTPMethodGET;
// App RevealController
extern CGFloat const kRevealControllerMasterViewWidth;

// Expand control animation speed (e.g. Site Cell)
extern CGFloat const kExpandButtonRotationSpeed;

// UISegmentControl metrics
extern CGFloat kUISegmentControlHorizontalPadding;
extern CGFloat kUISegmentControlVerticalPadding;
extern CGFloat kUISegmentControllerHeight;

// NSUserDefault Keys
extern NSString * const kIsAppFirstLaunch;
extern NSString * const kSearchTypeFiles;
Expand Down
8 changes: 8 additions & 0 deletions AlfrescoApp/Constants/Constants.m
Expand Up @@ -44,6 +44,14 @@
// App RevealController
CGFloat const kRevealControllerMasterViewWidth = 300.0f;

// Expand control animation speed (e.g. Site Cell)
CGFloat const kExpandButtonRotationSpeed = 0.2f;

// UISegmentControl metrics
CGFloat kUISegmentControlHorizontalPadding = 10.0f;
CGFloat kUISegmentControlVerticalPadding = 10.0f;
CGFloat kUISegmentControllerHeight = 40.0f;

// NSUserDefaults Keys
NSString * const kIsAppFirstLaunch = @"IsAppFirstLaunch";
NSString * const kSearchTypeFiles = @"ALFSearchTypeFiles";
Expand Down
1 change: 1 addition & 0 deletions AlfrescoApp/Supporting Files/en.lproj/Localizable.strings
Expand Up @@ -166,6 +166,7 @@
"sites.segmentControl.mysites" = "My Sites"; // string length should not be extended
"sites.segmentControl.favoritesites" = "Favorite Sites"; // string length should not be extended
"sites.segmentControl.allsites" = "All Sites"; // string length should not be extended
"sites.segmentControl.sitefinder" = "Site Finder"; // string length should not be extended
"sites.site.favorited.banner" = "You have favorited %@";
"sites.site.unfavorited.banner" = "You have unfavorited %@";
"sites.site.requested.to.join.banner" = "A request to join %@ has been sent";
Expand Down
Expand Up @@ -30,11 +30,6 @@
#import "PreferenceManager.h"
#import "SiteMembersViewController.h"

CGFloat kSegmentHorizontalPadding = 10.0f;
CGFloat kSegmentVerticalPadding = 10.0f;
CGFloat kSegmentControllerHeight = 40.0f;

static CGFloat const kExpandButtonRotationSpeed = 0.2f;
static CGFloat const kSearchBarSpeed = 0.3f;

static NSString * const kSitesFolderLocation = @"/Sites";
Expand Down Expand Up @@ -92,10 +87,10 @@ - (void)loadView
NSLocalizedString(@"sites.segmentControl.favoritesites", @"Favorite Sites"),
NSLocalizedString(@"sites.segmentControl.mysites", @"My Sites"),
NSLocalizedString(@"sites.segmentControl.allsites", @"All Sites")]];
segment.frame = CGRectMake((view.frame.origin.x + (kSegmentHorizontalPadding / 2)),
(view.frame.origin.y + kSegmentVerticalPadding),
view.frame.size.width - kSegmentVerticalPadding,
kSegmentControllerHeight - kSegmentVerticalPadding);
segment.frame = CGRectMake((view.frame.origin.x + (kUISegmentControlHorizontalPadding / 2)),
(view.frame.origin.y + kUISegmentControlVerticalPadding),
view.frame.size.width - kUISegmentControlVerticalPadding,
kUISegmentControllerHeight - kUISegmentControlVerticalPadding);
[segment addTarget:self action:@selector(loadSitesForSelectedSegment:) forControlEvents:UIControlEventValueChanged];
segment.autoresizingMask = UIViewAutoresizingFlexibleWidth;
segment.selectedSegmentIndex = [self selectionTypeForFilter:self.sitesFilter];
Expand All @@ -105,8 +100,8 @@ - (void)loadView

// create and configure the table view
BOOL shouldHideSegmentControl = (self.sitesFilter != SitesListViewFilterNoFilter);
CGFloat tableOrigin = view.frame.origin.y + kSegmentControllerHeight;
CGFloat tableHeight = view.frame.size.height - kSegmentControllerHeight;
CGFloat tableOrigin = view.frame.origin.y + kUISegmentControllerHeight;
CGFloat tableHeight = view.frame.size.height - kUISegmentControllerHeight;

if (shouldHideSegmentControl)
{
Expand Down Expand Up @@ -712,10 +707,10 @@ - (void)willPresentSearchController:(UISearchController *)searchController
{
[UIView animateWithDuration:kSearchBarSpeed animations:^{
CGRect tableViewFrame = self.tableView.frame;
tableViewFrame.origin.y -= kSegmentControllerHeight;
tableViewFrame.origin.y -= kUISegmentControllerHeight;
self.tableView.frame = tableViewFrame;
CGRect test = searchController.searchBar.frame;
test.origin.y += kSegmentControllerHeight;
test.origin.y += kUISegmentControllerHeight;
searchController.searchBar.frame = test;
}];
}
Expand All @@ -727,7 +722,7 @@ - (void)didDismissSearchController:(UISearchController *)searchController
{
[UIView animateWithDuration:kSearchBarSpeed animations:^{
CGRect tableViewFrame = self.tableView.frame;
tableViewFrame.origin.y += kSegmentControllerHeight;
tableViewFrame.origin.y += kUISegmentControllerHeight;
self.tableView.frame = tableViewFrame;
}];
}
Expand Down
Expand Up @@ -27,8 +27,6 @@
#import "SiteMembersViewController.h"
#import "FileFolderCollectionViewController.h"

static CGFloat const kExpandButtonRotationSpeedDuplicate = 0.2f;

@interface SitesTableListViewController () < UITableViewDelegate, UITableViewDataSource, SiteCellDelegate >

@property (nonatomic, strong) AlfrescoSiteService *siteService;
Expand Down Expand Up @@ -198,7 +196,7 @@ - (void)setExpandedCellIndexPath:(NSIndexPath *)expandedCellIndexPath
if (siteCell)
{
[indexPaths addObject:_expandedCellIndexPath];
[self rotateView:siteCell.expandButton duration:kExpandButtonRotationSpeedDuplicate angle:0.0f];
[self rotateView:siteCell.expandButton duration:kExpandButtonRotationSpeed angle:0.0f];
}
}

Expand All @@ -211,7 +209,7 @@ - (void)setExpandedCellIndexPath:(NSIndexPath *)expandedCellIndexPath
if (siteCell)
{
[indexPaths addObject:expandedCellIndexPath];
[self rotateView:siteCell.expandButton duration:kExpandButtonRotationSpeedDuplicate angle:M_PI];
[self rotateView:siteCell.expandButton duration:kExpandButtonRotationSpeed angle:M_PI];
}
}

Expand Down
Expand Up @@ -23,9 +23,7 @@
#import "UniversalDevice.h"
#import "RootRevealViewController.h"

CGFloat kSegmentHorizontalPaddingDuplicate = 10.0f;
CGFloat kSegmentVerticalPaddingDuplicate = 10.0f;
CGFloat kSegmentControllerHeightDuplicate = 40.0f;
static CGFloat const kSegmentToSearchControlPadding = 8.0f;

@interface SitesViewController ()

Expand All @@ -37,6 +35,7 @@ @interface SitesViewController ()
@property (nonatomic, assign) SiteListTypeSelection selectedListType;
@property (nonatomic, strong) id<AlfrescoSession> session;
@property (nonatomic, strong) AlfrescoListingContext *defaultListingContext;
@property (nonatomic, assign, getter=isActiveAccountOnPremise) BOOL activeAccountOnPremise;

@property (nonatomic, strong) SitesTableListViewController *favoritesVC;
@property (nonatomic, strong) SitesTableListViewController *mySitesVC;
Expand All @@ -54,6 +53,7 @@ - (id)initWithSession:(id<AlfrescoSession>)session
{
self.session = session;
self.title = NSLocalizedString(@"sites.title", @"Sites Title");
self.activeAccountOnPremise = [AccountManager sharedManager].selectedAccount.accountType == UserAccountTypeOnPremise;
}
return self;
}
Expand All @@ -78,25 +78,27 @@ - (void)loadView
UIView *view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
view.backgroundColor = [UIColor whiteColor];

NSString *thirdSegmentLabel = self.isActiveAccountOnPremise ? NSLocalizedString(@"sites.segmentControl.sitefinder", @"Site Finder") : NSLocalizedString(@"sites.segmentControl.allsites", @"All Sites");

UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:@[
NSLocalizedString(@"sites.segmentControl.favoritesites", @"Favorite Sites"),
NSLocalizedString(@"sites.segmentControl.mysites", @"My Sites"),
NSLocalizedString(@"sites.segmentControl.allsites", @"All Sites")]];
segment.frame = CGRectMake((view.frame.origin.x + (kSegmentHorizontalPaddingDuplicate / 2)),
(view.frame.origin.y + kSegmentVerticalPaddingDuplicate),
view.frame.size.width - kSegmentVerticalPaddingDuplicate,
kSegmentControllerHeightDuplicate - kSegmentVerticalPaddingDuplicate);
thirdSegmentLabel]];
segment.frame = CGRectMake((view.frame.origin.x + (kUISegmentControlHorizontalPadding / 2)),
(view.frame.origin.y + kUISegmentControlVerticalPadding),
view.frame.size.width - kUISegmentControlVerticalPadding,
kUISegmentControllerHeight - kUISegmentControlVerticalPadding);
[segment addTarget:self action:@selector(loadSitesForSelectedSegment:) forControlEvents:UIControlEventValueChanged];
segment.autoresizingMask = UIViewAutoresizingFlexibleWidth;
segment.selectedSegmentIndex = [self selectionTypeForFilter:self.sitesFilter];
self.selectedListType = segment.selectedSegmentIndex;
self.segmentedControl = segment;
[view addSubview:self.segmentedControl];

// create and configure the table view
// Create and configure the table view
BOOL shouldHideSegmentControl = (self.sitesFilter != SitesListViewFilterNoFilter);
CGFloat containerOrigin = view.frame.origin.y + kSegmentControllerHeightDuplicate;
CGFloat containerHeight = view.frame.size.height - kSegmentControllerHeightDuplicate;
CGFloat containerOrigin = view.frame.origin.y + kUISegmentControllerHeight;
CGFloat containerHeight = view.frame.size.height - kUISegmentControllerHeight;

if (shouldHideSegmentControl)
{
Expand Down Expand Up @@ -133,23 +135,27 @@ - (void)viewDidLoad
[self addChildViewController:self.mySitesVC];
[self.mySitesVC didMoveToParentViewController:self];

if([AccountManager sharedManager].selectedAccount.accountType == UserAccountTypeCloud)
{
self.allSitesVC = [[SitesTableListViewController alloc] initWithType:SiteListTypeSelectionAllSites session:self.session pushHandler:self];
[self.siteFinderContainerView addSubview:self.allSitesVC.view];
[self addChildViewController:self.allSitesVC];
[self.allSitesVC didMoveToParentViewController:self];
}
else
if (self.isActiveAccountOnPremise)
{
self.searchVC = [[SearchViewController alloc] initWithDataSourceType:SearchViewControllerDataSourceTypeSearchSites session:self.session];
self.searchVC.sitesPushHandler = self;
self.searchVC.shouldHideNavigationBarOnSearchControllerPresentation = NO;
self.searchVC.view.frame = self.siteFinderContainerView.bounds;

// Add spacing between UISegmentControl and search control
CGRect siteFinderRect = CGRectInset(self.siteFinderContainerView.bounds, 0, kSegmentToSearchControlPadding);
self.searchVC.view.frame = siteFinderRect;

[self.siteFinderContainerView addSubview:self.searchVC.view];
[self addChildViewController:self.searchVC];
[self.searchVC didMoveToParentViewController:self];
}
else
{
self.allSitesVC = [[SitesTableListViewController alloc] initWithType:SiteListTypeSelectionAllSites session:self.session pushHandler:self];
[self.siteFinderContainerView addSubview:self.allSitesVC.view];
[self addChildViewController:self.allSitesVC];
[self.allSitesVC didMoveToParentViewController:self];
}

if (self.session)
{
Expand All @@ -174,27 +180,19 @@ - (SiteListTypeSelection)selectionTypeForFilter:(SitesListViewFilter)filter
switch (filter)
{
case SitesListViewFilterNoFilter:
{
returnSelectionType = self.selectedListType;
}
break;

case SitesListViewFilterFavouriteSites:
{
returnSelectionType = SiteListTypeSelectionFavouriteSites;
}
break;

case SitesListViewFilterMySites:
{
returnSelectionType = SiteListTypeSelectionMySites;
}
break;

case SitesListViewFilterAllSites:
{
returnSelectionType = SiteListTypeSelectionAllSites;
}
break;
}

Expand Down
Expand Up @@ -22,8 +22,6 @@
#import "DownloadManager.h"
#import "Constants.h"

static CGFloat const kExpandButtonRotationSpeed = 0.2f;

@interface VersionHistoryViewController ()

@property (nonatomic, strong) AlfrescoDocument *document;
Expand Down