更换AI皮肤逻辑图片 + 更换placeholdimage
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 11 KiB |
@@ -208,6 +208,9 @@
|
||||
UIColor *bg = mgr.current.keyboardBackground;
|
||||
self.backgroundColor = hasImg ? [UIColor clearColor] : bg;
|
||||
self.keyboardView.backgroundColor = hasImg ? [UIColor clearColor] : bg;
|
||||
if ([self.topBar respondsToSelector:@selector(kb_applyTheme)]) {
|
||||
[self.topBar kb_applyTheme];
|
||||
}
|
||||
[self.keyboardView reloadKeys];
|
||||
if (self.emojiView) {
|
||||
[self.emojiView applyTheme:mgr.current];
|
||||
|
||||
@@ -34,6 +34,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, strong, readonly) UIButton *settingsButton;
|
||||
@property (nonatomic, strong, readonly) UIButton *undoButton;
|
||||
|
||||
/// 应用皮肤(更新 AI 按钮背景图)
|
||||
- (void)kb_applyTheme;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#import "KBToolBar.h"
|
||||
#import "KBResponderUtils.h" // 查找 UIInputViewController,用于系统切换输入法
|
||||
#import "KBBackspaceUndoManager.h"
|
||||
#import "KBSkinManager.h"
|
||||
|
||||
@interface KBToolBar ()
|
||||
@property (nonatomic, strong) UIView *leftContainer;
|
||||
@@ -21,6 +22,10 @@
|
||||
|
||||
@implementation KBToolBar
|
||||
|
||||
static NSString * const kKBAIKeyIdentifier = @"ai";
|
||||
static const CGFloat kKBAIButtonWidth = 36.0f;
|
||||
static const CGFloat kKBAIButtonHeight = 36.0f;
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
@@ -61,6 +66,7 @@
|
||||
[obj setTitle:self.leftButtonTitles[idx] forState:UIControlStateNormal];
|
||||
}
|
||||
}];
|
||||
[self kb_updateAIButtonAppearance];
|
||||
}
|
||||
|
||||
#pragma mark - 视图搭建
|
||||
@@ -103,7 +109,13 @@
|
||||
[buttons addObject:btn];
|
||||
|
||||
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.equalTo(self.leftContainer);
|
||||
if (i == 1) {
|
||||
make.centerY.equalTo(self.leftContainer);
|
||||
make.width.mas_equalTo(kKBAIButtonWidth);
|
||||
make.height.mas_equalTo(kKBAIButtonHeight);
|
||||
} else {
|
||||
make.top.bottom.equalTo(self.leftContainer);
|
||||
}
|
||||
|
||||
if (previous) {
|
||||
make.left.equalTo(previous.mas_right).offset(8);
|
||||
@@ -129,6 +141,7 @@
|
||||
// 初始刷新地球键的可见性与事件绑定
|
||||
[self kb_refreshGlobeVisibility];
|
||||
[self kb_updateUndoVisibilityAnimated:NO];
|
||||
[self kb_applyTheme];
|
||||
}
|
||||
|
||||
- (UIButton *)buildActionButtonAtIndex:(NSInteger)idx {
|
||||
@@ -152,6 +165,46 @@
|
||||
return btn;
|
||||
}
|
||||
|
||||
#pragma mark - Theme
|
||||
|
||||
- (void)kb_applyTheme {
|
||||
[self kb_updateAIButtonAppearance];
|
||||
}
|
||||
|
||||
- (void)kb_updateAIButtonAppearance {
|
||||
UIButton *aiButton = [self kb_aiButton];
|
||||
if (!aiButton) { return; }
|
||||
|
||||
KBSkinManager *skinManager = [KBSkinManager shared];
|
||||
UIImage *icon = [skinManager iconImageForKeyIdentifier:kKBAIKeyIdentifier caseVariant:0];
|
||||
NSString *skinId = skinManager.current.skinId ?: @"";
|
||||
BOOL usingDefaultSkin = (skinId.length == 0 || [skinId isEqualToString:@"default"]);
|
||||
if (!icon && usingDefaultSkin) {
|
||||
icon = [UIImage imageNamed:@"ai_key_icon"];
|
||||
}
|
||||
|
||||
if (icon) {
|
||||
[aiButton setBackgroundImage:icon forState:UIControlStateNormal];
|
||||
[aiButton setBackgroundImage:icon forState:UIControlStateHighlighted];
|
||||
[aiButton setBackgroundImage:icon forState:UIControlStateSelected];
|
||||
[aiButton setTitle:@"" forState:UIControlStateNormal];
|
||||
aiButton.backgroundColor = [UIColor clearColor];
|
||||
aiButton.layer.cornerRadius = 0;
|
||||
aiButton.layer.masksToBounds = NO;
|
||||
aiButton.contentEdgeInsets = UIEdgeInsetsZero;
|
||||
} else {
|
||||
[aiButton setBackgroundImage:nil forState:UIControlStateNormal];
|
||||
[aiButton setBackgroundImage:nil forState:UIControlStateHighlighted];
|
||||
[aiButton setBackgroundImage:nil forState:UIControlStateSelected];
|
||||
NSString *title = (self.leftButtonTitles.count > 1) ? self.leftButtonTitles[1] : @"AI";
|
||||
[aiButton setTitle:title forState:UIControlStateNormal];
|
||||
aiButton.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9];
|
||||
aiButton.layer.cornerRadius = 16;
|
||||
aiButton.layer.masksToBounds = YES;
|
||||
aiButton.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 10);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (void)onLeftAction:(UIButton *)sender {
|
||||
@@ -224,6 +277,11 @@
|
||||
return _undoButtonInternal;
|
||||
}
|
||||
|
||||
- (UIButton *)kb_aiButton {
|
||||
if (self.leftButtonsInternal.count <= 1) { return nil; }
|
||||
return self.leftButtonsInternal[1];
|
||||
}
|
||||
|
||||
#pragma mark - Globe (Input Mode Switch)
|
||||
|
||||
// 根据宿主是否已提供系统切换键,决定是否显示地球按钮;并绑定系统事件。
|
||||
|
||||
22
keyBoard/Assets.xcassets/Ohter/placeholder_image_icon.imageset/Contents.json
vendored
Normal file
22
keyBoard/Assets.xcassets/Ohter/placeholder_image_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "placeholder_image_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "placeholder_image_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
keyBoard/Assets.xcassets/Ohter/placeholder_image_icon.imageset/placeholder_image_icon@2x.png
vendored
Normal file
BIN
keyBoard/Assets.xcassets/Ohter/placeholder_image_icon.imageset/placeholder_image_icon@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
BIN
keyBoard/Assets.xcassets/Ohter/placeholder_image_icon.imageset/placeholder_image_icon@3x.png
vendored
Normal file
BIN
keyBoard/Assets.xcassets/Ohter/placeholder_image_icon.imageset/placeholder_image_icon@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
@@ -85,7 +85,7 @@
|
||||
self.titleLabel.text = character.characterName ?: @"";
|
||||
self.subLabel.text = character.download ?: @"";
|
||||
|
||||
[self.avatarView kb_setAvatarURL:character.avatarUrl placeholder:KBPlaceholderImage];
|
||||
[self.avatarView kb_setAvatarURL:character.avatarUrl placeholder:KBAvatarPlaceholderImage];
|
||||
|
||||
// 加入状态
|
||||
BOOL joined = character.added;
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
self.titleLabel.text = character.characterName;
|
||||
self.descLabel.text = character.characterBackground;
|
||||
self.peopleLabel.text = character.download;
|
||||
[self.averImageView kb_setAvatarURL:character.avatarUrl placeholder:KBPlaceholderImage];
|
||||
[self.averImageView kb_setAvatarURL:character.avatarUrl placeholder:KBAvatarPlaceholderImage];
|
||||
if (added) {
|
||||
// 已添加:灰底、对勾
|
||||
self.actionBtn.backgroundColor = [UIColor colorWithWhite:0.93 alpha:1.0];
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
self.titleLabel.text = character.characterName ?: @"";
|
||||
self.downloadLabel.text = character.download ?: @"";
|
||||
self.descLabel.text = character.characterBackground ?: @"";
|
||||
[self.avatarView kb_setImageURL:character.avatarUrl placeholder:KBPlaceholderImage];
|
||||
[self.avatarView kb_setImageURL:character.avatarUrl placeholder:KBAvatarPlaceholderImage];
|
||||
}
|
||||
|
||||
#pragma mark - Build UI
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
self.cardImageView.image = image;
|
||||
|
||||
// 头像图片
|
||||
[self.avatarCircleView kb_setAvatarURL:character.avatarUrl placeholder:KBPlaceholderImage];
|
||||
[self.avatarCircleView kb_setAvatarURL:character.avatarUrl placeholder:KBAvatarPlaceholderImage];
|
||||
|
||||
// 圆圈描边
|
||||
self.avatarCircleView.layer.borderColor = [UIColor colorWithRed:0.83 green:0.95 blue:0.27 alpha:1.0].CGColor;
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
self.nameLabel.text = name;
|
||||
|
||||
// 头像:使用通用占位图
|
||||
[self.avatarView kb_setAvatarURL:user.avatarUrl placeholder:KBPlaceholderImage];
|
||||
[self.avatarView kb_setAvatarURL:user.avatarUrl placeholder:KBAvatarPlaceholderImage];
|
||||
|
||||
BOOL isVip = user.isVip;
|
||||
self.vipIconView.hidden = !isVip;
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
[self.viewModel fetchUserDetailWithCompletion:^(KBUser * _Nullable user, NSError * _Nullable error) {
|
||||
if (user) {
|
||||
weakSelf.userModel = user;
|
||||
[weakSelf.avatarView kb_setAvatarURL:weakSelf.userModel.avatarUrl placeholder:KBPlaceholderImage];
|
||||
[weakSelf.avatarView kb_setAvatarURL:weakSelf.userModel.avatarUrl placeholder:KBAvatarPlaceholderImage];
|
||||
weakSelf.modifyLabel.text = weakSelf.userModel.nickName;
|
||||
// 根据用户模型的 gender 显示当前性别,支持多语言
|
||||
NSString *genderText = [weakSelf kb_genderDisplayText];
|
||||
|
||||
@@ -75,7 +75,9 @@
|
||||
#define KBUserEmailKey @"KBUserEmailKey"
|
||||
|
||||
|
||||
#define KBPlaceholderImage [UIImage imageNamed:@"placeholder_icon"]
|
||||
#define KBAvatarPlaceholderImage [UIImage imageNamed:@"placeholder_icon"]
|
||||
#define KBPlaceholderImage [UIImage imageNamed:@"placeholder_image_icon"]
|
||||
|
||||
|
||||
/// UI 尺寸/设备宏
|
||||
// 屏幕尺寸
|
||||
|
||||
Reference in New Issue
Block a user