diff --git a/CustomKeyboard/KeyboardViewController.m b/CustomKeyboard/KeyboardViewController.m index 20ab610..7206e6e 100644 --- a/CustomKeyboard/KeyboardViewController.m +++ b/CustomKeyboard/KeyboardViewController.m @@ -78,6 +78,7 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center, @property(nonatomic, strong) UIImageView *bgImageView; // 背景图(在底层) @property(nonatomic, strong) UIImageView *personaAvatarImageView; // 语音模式下显示的 persona 小头像 @property(nonatomic, strong) UIImageView *personaGrayImageView; // 语音模式下显示的 persona 小头像 +@property(nonatomic, strong) UIVisualEffectView *personaBlurView; // 语音模式下头像高斯模糊层 @property(nonatomic, strong) KBChatPanelView *chatPanelView; @property(nonatomic, strong) KBKeyboardSubscriptionView *subscriptionView; @@ -1407,6 +1408,10 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center, _personaAvatarImageView.contentMode = UIViewContentModeScaleAspectFill; _personaAvatarImageView.clipsToBounds = YES; _personaAvatarImageView.hidden = YES; + [_personaAvatarImageView addSubview:self.personaBlurView]; + [self.personaBlurView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(_personaAvatarImageView); + }]; } return _personaAvatarImageView; } @@ -1419,6 +1424,16 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center, return _personaGrayImageView; } +- (UIVisualEffectView *)personaBlurView { + if (!_personaBlurView) { + UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; + _personaBlurView = [[UIVisualEffectView alloc] initWithEffect:effect]; + _personaBlurView.hidden = YES; + _personaBlurView.userInteractionEnabled = NO; + } + return _personaBlurView; +} + #pragma mark - Persona Avatar /// 从 AppGroup 读取选中的 persona 信息 @@ -1475,6 +1490,7 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center, if (image) { self.personaAvatarImageView.image = image; self.personaAvatarImageView.hidden = NO; + self.personaBlurView.hidden = NO; NSLog(@"[Keyboard] persona 封面图加载成功"); } else { NSLog(@"[Keyboard] persona 封面图加载失败"); @@ -1485,6 +1501,7 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center, - (void)kb_hidePersonaAvatar { self.personaAvatarImageView.hidden = YES; self.personaAvatarImageView.image = nil; + self.personaBlurView.hidden = YES; } #pragma mark - Actions