mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-22 13:48:09 +00:00
Finish adding player
This commit is contained in:
parent
8796f8b2d8
commit
f11fb7388a
3 changed files with 39 additions and 9 deletions
|
|
@ -84,21 +84,22 @@ static UILinphoneAudioPlayer *player;
|
|||
[self setFrame:frame];
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected {
|
||||
-(void)setSelected:(BOOL)selected animated:(BOOL)animated{
|
||||
[super setSelected:selected animated:animated];
|
||||
if (!selected)
|
||||
return;
|
||||
if (!player)
|
||||
player = [UILinphoneAudioPlayer audioPlayerWithFilePath:[self recording]];
|
||||
else
|
||||
[player setFile:[self recording]];
|
||||
|
||||
UILinphoneAudioPlayer *p = player;
|
||||
[p.view removeFromSuperview];
|
||||
[self addSubview:p.view];
|
||||
[self bringSubviewToFront:p.view];
|
||||
p.view.frame = _playerView.frame;
|
||||
p.view.bounds = _playerView.bounds;
|
||||
if ([player isOpened])
|
||||
[player close];
|
||||
[player.view removeFromSuperview];
|
||||
[self addSubview:player.view];
|
||||
[self bringSubviewToFront:player.view];
|
||||
player.view.frame = _playerView.frame;
|
||||
player.view.bounds = _playerView.bounds;
|
||||
[player open];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -62,6 +62,12 @@ typedef enum {
|
|||
|
||||
@end
|
||||
|
||||
@interface UIImage (systemIcons)
|
||||
|
||||
+ (UIImage *)imageFromSystemBarButton:(UIBarButtonSystemItem)systemItem :(UIColor *) color;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSString (linphoneExt)
|
||||
|
||||
- (NSString *)md5;
|
||||
|
|
|
|||
|
|
@ -569,6 +569,29 @@
|
|||
|
||||
@end
|
||||
|
||||
@implementation UIImage (systemIcons)
|
||||
|
||||
+ (UIImage *)imageFromSystemBarButton:(UIBarButtonSystemItem)systemItem :(UIColor *) color {
|
||||
// thanks to Renetik https://stackoverflow.com/a/49822488
|
||||
UIToolbar *bar = UIToolbar.new;
|
||||
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:systemItem target:nil action:nil];
|
||||
[bar setItems:@[buttonItem] animated:NO];
|
||||
[bar snapshotViewAfterScreenUpdates:YES];
|
||||
for (UIView *view in [(id) buttonItem view].subviews)
|
||||
if ([view isKindOfClass:UIButton.class]) {
|
||||
UIImage *image = [((UIButton *) view).imageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
|
||||
//[color set];
|
||||
[image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
|
||||
image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return image;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSString (md5)
|
||||
|
||||
- (NSString *)md5 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue