mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Improve recording lock icon
This commit is contained in:
parent
ee8b068355
commit
0f4d4b4503
@ -88,5 +88,6 @@
|
||||
- (void)_commitLocked;
|
||||
|
||||
- (void)setHidesPanelOnLock;
|
||||
- (UIView *)createLockPanelView;
|
||||
|
||||
@end
|
||||
|
@ -115,7 +115,7 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
UIImageView *_innerIconView;
|
||||
|
||||
UIView *_lockPanelWrapperView;
|
||||
UIImageView *_lockPanelView;
|
||||
UIView *_lockPanelView;
|
||||
UIImageView *_lockArrowView;
|
||||
TGModernConversationInputLockView *_lockView;
|
||||
UIImage *_previousIcon;
|
||||
@ -265,7 +265,9 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
if (!update)
|
||||
return;
|
||||
|
||||
_lockPanelView.image = [self panelBackgroundImage];
|
||||
if ([_lockPanelView isKindOfClass:[UIImageView class]]) {
|
||||
((UIImageView *)_lockPanelView).image = [self panelBackgroundImage];
|
||||
}
|
||||
_lockArrowView.image = TGTintedImage(TGComponentsImageNamed(@"VideoRecordArrow"), self.pallete != nil ? self.pallete.lockColor : UIColorRGB(0x9597a0));
|
||||
_lockView.color = self.pallete.lockColor;
|
||||
|
||||
@ -341,6 +343,13 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
return stopButtonImage;
|
||||
}
|
||||
|
||||
- (UIView *)createLockPanelView {
|
||||
UIImageView *view = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 40.0f, 72.0f)];
|
||||
view.userInteractionEnabled = true;
|
||||
view.image = [self panelBackgroundImage];
|
||||
return view;
|
||||
}
|
||||
|
||||
- (void)animateIn {
|
||||
if (!_locked) {
|
||||
_lockView.lockness = 0.0f;
|
||||
@ -373,9 +382,7 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
_lockPanelWrapperView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 40.0f, 72.0f)];
|
||||
[[_presentation view] addSubview:_lockPanelWrapperView];
|
||||
|
||||
_lockPanelView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 40.0f, 72.0f)];
|
||||
_lockPanelView.userInteractionEnabled = true;
|
||||
_lockPanelView.image = [self panelBackgroundImage];
|
||||
_lockPanelView = [self createLockPanelView];
|
||||
|
||||
[_lockPanelWrapperView addSubview:_lockPanelView];
|
||||
|
||||
|
@ -445,6 +445,15 @@ public final class ChatTextInputMediaRecordingButton: TGModernConversationInputM
|
||||
(self.micLockValue as? LockView)?.updateTheme(theme)
|
||||
}
|
||||
|
||||
public override func createLockPanelView() -> UIView! {
|
||||
if self.hidesOnLock {
|
||||
let view = WrapperBlurrredBackgroundView(frame: CGRect(origin: .zero, size: CGSize(width: 40.0, height: 72.0)))
|
||||
return view
|
||||
} else {
|
||||
return super.createLockPanelView()
|
||||
}
|
||||
}
|
||||
|
||||
public func cancelRecording() {
|
||||
self.isEnabled = false
|
||||
self.isEnabled = true
|
||||
@ -572,3 +581,31 @@ public final class ChatTextInputMediaRecordingButton: TGModernConversationInputM
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class WrapperBlurrredBackgroundView: UIView {
|
||||
let view: BlurredBackgroundView
|
||||
|
||||
override init(frame: CGRect) {
|
||||
let view = BlurredBackgroundView(color: UIColor(white: 0.0, alpha: 0.5), enableBlur: true)
|
||||
view.frame = CGRect(origin: .zero, size: frame.size)
|
||||
view.update(size: frame.size, cornerRadius: frame.width / 2.0, transition: .immediate)
|
||||
self.view = view
|
||||
|
||||
super.init(frame: frame)
|
||||
|
||||
self.addSubview(view)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
override var frame: CGRect {
|
||||
get {
|
||||
return super.frame
|
||||
} set {
|
||||
super.frame = newValue
|
||||
self.view.update(size: newValue.size, cornerRadius: newValue.width / 2.0, transition: .immediate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ final class LockView: UIButton, TGModernConversationInputMicButtonLock {
|
||||
[
|
||||
"Rectangle.Заливка 1": theme.chat.inputPanel.panelBackgroundColor,
|
||||
"Rectangle.Rectangle.Обводка 1": theme.chat.inputPanel.panelControlAccentColor,
|
||||
"Rectangle 2.Rectangle.Обводка 1": theme.chat.inputPanel.panelControlAccentColor,
|
||||
"Path.Path.Обводка 1": theme.chat.inputPanel.panelControlAccentColor,
|
||||
"Path 4.Path 4.Обводка 1": theme.chat.inputPanel.panelControlAccentColor
|
||||
].forEach { key, value in
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user