Skip to content

Commit

Permalink
Add an animation while fetching articles
Browse files Browse the repository at this point in the history
  • Loading branch information
barijaona committed Jun 28, 2016
1 parent d35406a commit f894a88
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ArticleController.m
Expand Up @@ -466,7 +466,18 @@ -(void)selectFolderAndArticle:(NSInteger)folderId guid:(NSString *)guid
-(void)reloadArrayOfArticles
{
reloadArrayOfArticlesSemaphor++;
// add a progress indicator
__block NSProgressIndicator * progressIndicator = [[NSProgressIndicator alloc] initWithFrame:mainArticleView.mainView.visibleRect];
progressIndicator.style = NSProgressIndicatorSpinningStyle;
[progressIndicator setDisplayedWhenStopped:NO];
[mainArticleView.mainView addSubview:progressIndicator];
[progressIndicator startAnimation:self];

[self getArticlesWithCompletionBlock:^(NSArray *resultArray) {
// stop and release the progress indicator
[progressIndicator stopAnimation:self];
[progressIndicator removeFromSuperviewWithoutNeedingDisplay];
progressIndicator = nil;
// when multiple refreshes where queued, we update folderArrayOfArticles only once
reloadArrayOfArticlesSemaphor--;
if (reloadArrayOfArticlesSemaphor <=0)
Expand Down

0 comments on commit f894a88

Please sign in to comment.