Rework appearance of voice messages and audio attachments.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent ea34cec0d9
commit a15d11c3e6

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "voice-message-large-white@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "voice-message-large-white@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "voice-message-large-white@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

@ -78,7 +78,7 @@ NS_ASSUME_NONNULL_BEGIN
- (CGFloat)bubbleHeight - (CGFloat)bubbleHeight
{ {
return 35.f; return 45.f;
} }
- (CGFloat)iconSize - (CGFloat)iconSize

@ -346,6 +346,8 @@ typedef enum : NSUInteger {
@property (nonatomic) UIView *voiceMemoUI; @property (nonatomic) UIView *voiceMemoUI;
@property (nonatomic) UIView *voiceMemoContentView;
@property (nonatomic) NSDate *voiceMemoStartTime; @property (nonatomic) NSDate *voiceMemoStartTime;
@property (nonatomic) NSTimer *voiceMemoUpdateTimer; @property (nonatomic) NSTimer *voiceMemoUpdateTimer;
@ -387,25 +389,70 @@ typedef enum : NSUInteger {
[self addSubview:self.voiceMemoUI]; [self addSubview:self.voiceMemoUI];
self.voiceMemoUI.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height); self.voiceMemoUI.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
self.voiceMemoContentView = [UIView new];
[self.voiceMemoUI addSubview:self.voiceMemoContentView];
[self.voiceMemoContentView autoPinWidthToSuperview];
[self.voiceMemoContentView autoPinHeightToSuperview];
self.recordingLabel = [UILabel new]; self.recordingLabel = [UILabel new];
self.recordingLabel.textColor = [UIColor ows_materialBlueColor]; self.recordingLabel.textColor = [UIColor ows_destructiveRedColor];
self.recordingLabel.font = [UIFont ows_mediumFontWithSize:14.f]; self.recordingLabel.font = [UIFont ows_mediumFontWithSize:14.f];
[self.voiceMemoUI addSubview:self.recordingLabel]; [self.voiceMemoContentView addSubview:self.recordingLabel];
[self updateVoiceMemo]; [self updateVoiceMemo];
UIImage *icon = [UIImage imageNamed:@"voice-memo-button"]; UIImage *icon = [UIImage imageNamed:@"voice-memo-button"];
OWSAssert(icon); OWSAssert(icon);
UIImageView *imageView = UIImageView *imageView =
[[UIImageView alloc] initWithImage:[icon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; [[UIImageView alloc] initWithImage:[icon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]];
imageView.tintColor = [UIColor ows_materialBlueColor]; imageView.tintColor = [UIColor ows_destructiveRedColor];
[self.voiceMemoUI addSubview:imageView]; [self.voiceMemoContentView addSubview:imageView];
NSMutableAttributedString *cancelString = [NSMutableAttributedString new];
const CGFloat cancelArrowFontSize = ScaleFromIPhone5To7Plus(18.4, 20.f);
const CGFloat cancelFontSize = ScaleFromIPhone5To7Plus(14.f, 16.f);
[cancelString
appendAttributedString:[[NSAttributedString alloc]
initWithString:@"\uf104 "
attributes:@{
NSFontAttributeName : [UIFont ows_fontAwesomeFont:cancelArrowFontSize],
NSForegroundColorAttributeName : [UIColor ows_destructiveRedColor],
NSBaselineOffsetAttributeName : @(-1.f),
}]];
[cancelString
appendAttributedString:[[NSAttributedString alloc]
initWithString:NSLocalizedString(@"VOICE_MESSAGE_CANCEL_INSTRUCTIONS",
@"Indicates how to cancel a voice message.")
attributes:@{
NSFontAttributeName : [UIFont ows_mediumFontWithSize:cancelFontSize],
NSForegroundColorAttributeName : [UIColor ows_destructiveRedColor],
}]];
[cancelString
appendAttributedString:[[NSAttributedString alloc]
initWithString:@" \uf104"
attributes:@{
NSFontAttributeName : [UIFont ows_fontAwesomeFont:cancelArrowFontSize],
NSForegroundColorAttributeName : [UIColor ows_destructiveRedColor],
NSBaselineOffsetAttributeName : @(-1.f),
}]];
UILabel *cancelLabel = [UILabel new]; UILabel *cancelLabel = [UILabel new];
cancelLabel.textColor = [UIColor ows_destructiveRedColor]; cancelLabel.attributedText = cancelString;
cancelLabel.font = [UIFont ows_mediumFontWithSize:14.f]; [self.voiceMemoContentView addSubview:cancelLabel];
cancelLabel.text
= NSLocalizedString(@"VOICE_MESSAGE_CANCEL_INSTRUCTIONS", @"Indicates how to cancel a voice message."); const CGFloat kRedCircleSize = 100.f;
[self.voiceMemoUI addSubview:cancelLabel]; UIView *redCircleView = [UIView new];
redCircleView.backgroundColor = [UIColor ows_destructiveRedColor];
redCircleView.layer.cornerRadius = kRedCircleSize * 0.5f;
[redCircleView autoSetDimension:ALDimensionWidth toSize:kRedCircleSize];
[redCircleView autoSetDimension:ALDimensionHeight toSize:kRedCircleSize];
[self.voiceMemoContentView addSubview:redCircleView];
[redCircleView autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.contentView.rightBarButtonItem];
[redCircleView autoAlignAxis:ALAxisVertical toSameAxisOfView:self.contentView.rightBarButtonItem];
UIImage *whiteIcon = [UIImage imageNamed:@"voice-message-large-white"];
OWSAssert(whiteIcon);
UIImageView *whiteIconView = [[UIImageView alloc] initWithImage:whiteIcon];
[redCircleView addSubview:whiteIconView];
[whiteIconView autoCenterInSuperview];
[imageView autoVCenterInSuperview]; [imageView autoVCenterInSuperview];
[imageView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10]; [imageView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10];
@ -491,9 +538,7 @@ typedef enum : NSUInteger {
// Fade out the voice message views as the cancel gesture // Fade out the voice message views as the cancel gesture
// proceeds as feedback. // proceeds as feedback.
for (UIView *subview in self.voiceMemoUI.subviews) { self.voiceMemoContentView.layer.opacity = MAX(0.f, MIN(1.f, 1.f - (float)cancelAlpha));
subview.layer.opacity = MAX(0.f, MIN(1.f, 1.f - (float)cancelAlpha));
}
} }
- (void)updateVoiceMemo - (void)updateVoiceMemo
@ -3504,6 +3549,7 @@ typedef enum : NSUInteger {
DDLogInfo(@"voiceMemoGestureDidStart"); DDLogInfo(@"voiceMemoGestureDidStart");
[((OWSMessagesInputToolbar *)self.inputToolbar)showVoiceMemoUI]; [((OWSMessagesInputToolbar *)self.inputToolbar)showVoiceMemoUI];
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
[self startRecordingVoiceMemo]; [self startRecordingVoiceMemo];
} }
@ -3515,6 +3561,7 @@ typedef enum : NSUInteger {
[((OWSMessagesInputToolbar *)self.inputToolbar) hideVoiceMemoUI:YES]; [((OWSMessagesInputToolbar *)self.inputToolbar) hideVoiceMemoUI:YES];
[self endRecordingVoiceMemo]; [self endRecordingVoiceMemo];
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
} }
- (void)voiceMemoGestureDidCancel - (void)voiceMemoGestureDidCancel
@ -3525,6 +3572,7 @@ typedef enum : NSUInteger {
[((OWSMessagesInputToolbar *)self.inputToolbar) hideVoiceMemoUI:NO]; [((OWSMessagesInputToolbar *)self.inputToolbar) hideVoiceMemoUI:NO];
[self cancelRecordingVoiceMemo]; [self cancelRecordingVoiceMemo];
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
} }
- (void)voiceMemoGestureDidChange:(CGFloat)cancelAlpha - (void)voiceMemoGestureDidChange:(CGFloat)cancelAlpha

Loading…
Cancel
Save