mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 23:48:29 +02:00
Merge MatrixKit develop with commit hash: b85b736313bec0592bd1cabc68035d97f5331137
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// Copyright 2020 The Matrix.org Foundation C.I.C
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import "MXKActivityHandlingViewController.h"
|
||||
|
||||
@interface MXKActivityHandlingViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation MXKActivityHandlingViewController
|
||||
@synthesize activityIndicator;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
// Add default activity indicator
|
||||
activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
|
||||
activityIndicator.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1.0];
|
||||
activityIndicator.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
||||
activityIndicator.hidesWhenStopped = YES;
|
||||
|
||||
CGRect frame = activityIndicator.frame;
|
||||
frame.size.width += 30;
|
||||
frame.size.height += 30;
|
||||
activityIndicator.bounds = frame;
|
||||
[activityIndicator.layer setCornerRadius:5];
|
||||
|
||||
activityIndicator.center = self.view.center;
|
||||
[self.view addSubview:activityIndicator];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (activityIndicator)
|
||||
{
|
||||
[activityIndicator removeFromSuperview];
|
||||
activityIndicator = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Activity indicator
|
||||
|
||||
- (void)startActivityIndicator
|
||||
{
|
||||
if (activityIndicator)
|
||||
{
|
||||
[self.view bringSubviewToFront:activityIndicator];
|
||||
[activityIndicator startAnimating];
|
||||
|
||||
// Show the loading wheel after a delay so that if the caller calls stopActivityIndicator
|
||||
// in a short future, the loading wheel will not be displayed to the end user.
|
||||
activityIndicator.alpha = 0;
|
||||
[UIView animateWithDuration:0.3 delay:0.3 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
|
||||
self->activityIndicator.alpha = 1;
|
||||
} completion:^(BOOL finished)
|
||||
{
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopActivityIndicator
|
||||
{
|
||||
[activityIndicator stopAnimating];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user