VoiceMessageRecordingView.m 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: GPL-3.0-or-later
  4. */
  5. #import "VoiceMessageRecordingView.h"
  6. @interface VoiceMessageRecordingView ()
  7. @property (strong, nonatomic) IBOutlet UIView *contentView;
  8. @property (weak, nonatomic) IBOutlet UIView *leftBackgroundView;
  9. @end
  10. @implementation VoiceMessageRecordingView
  11. - (instancetype)init
  12. {
  13. self = [super init];
  14. if (self) {
  15. [[NSBundle mainBundle] loadNibNamed:@"VoiceMessageRecordingView" owner:self options:nil];
  16. [self addSubview:self.contentView];
  17. self.contentView.frame = self.bounds;
  18. self.contentView.backgroundColor = [UIColor systemBackgroundColor];
  19. self.leftBackgroundView.backgroundColor = [UIColor systemBackgroundColor];
  20. [self.recordingTimeLabel setTimerType:MZTimerLabelTypeStopWatch];
  21. [self.recordingTimeLabel setTimeFormat:@"mm:ss"];
  22. [self.recordingTimeLabel start];
  23. [self.recordingImageView setImage:[UIImage systemImageNamed:@"mic.fill"]];
  24. [self.recordingImageView setTintColor:[UIColor systemRedColor]];
  25. [self.recordingImageView setContentMode:UIViewContentModeScaleAspectFit];
  26. [UIImageView animateWithDuration:0.5
  27. delay:0
  28. options:(UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse)
  29. animations:^{self.recordingImageView.alpha = 0;}
  30. completion:nil];
  31. NSString *swipeToCancelString = NSLocalizedString(@"Slide to cancel", nil);
  32. self.slideToCancelHintLabel.text = [NSString stringWithFormat:@"<< %@", swipeToCancelString];
  33. }
  34. return self;
  35. }
  36. @end