更换AI皮肤逻辑图片 + 更换placeholdimage

This commit is contained in:
2025-12-19 21:29:11 +08:00
parent 200b1ab9f8
commit 2cacaab974
15 changed files with 96 additions and 8 deletions

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

View File

@@ -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];

View File

@@ -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

View File

@@ -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)
// 宿

View 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
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View File

@@ -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;

View File

@@ -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];

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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];

View File

@@ -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 尺寸/设备宏
// 屏幕尺寸