
- Removed YuMi/Library/ (138 MB, not tracked) - Removed YuMi/Resources/ (23 MB, not tracked) - Removed old version assets (566 files, not tracked) - Excluded Pods/, xcuserdata/ and other build artifacts - Clean repository optimized for company server deployment
100 lines
2.9 KiB
Objective-C
100 lines
2.9 KiB
Objective-C
//
|
|
// RoomBoomEntryView.m
|
|
// YuMi
|
|
//
|
|
// Created by P on 2024/10/8.
|
|
//
|
|
|
|
#import "RoomBoomEntryView.h"
|
|
|
|
#import "BoomInfoModel.h"
|
|
|
|
@interface RoomBoomEntryView()
|
|
|
|
@property (nonatomic, strong) NetImageView *icon;
|
|
@property (nonatomic, strong) UIImageView *progress;
|
|
@property (nonatomic, strong) UIImageView *progressBG;
|
|
|
|
@end
|
|
|
|
@implementation RoomBoomEntryView
|
|
|
|
- (void)setBoomModel:(BoomDetailModel *)boomModel {
|
|
_boomModel = boomModel;
|
|
@kWeakify(self);
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@kStrongify(self);
|
|
self.icon.imageUrl = boomModel.pic;
|
|
CGFloat progress = boomModel.speed * 1.0 / 100.0;
|
|
if (progress == 0) {
|
|
self.progress.hidden = YES;
|
|
} else {
|
|
self.progress.hidden = NO;
|
|
[UIView animateWithDuration:0.3 animations:^{
|
|
[self.progress mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(46 * progress);
|
|
}];
|
|
[self layoutIfNeeded];
|
|
}];
|
|
}
|
|
});
|
|
}
|
|
|
|
- (instancetype)init {
|
|
if (self = [super init]) {
|
|
[self addSubview:self.icon];
|
|
[self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerX.mas_equalTo(self);
|
|
make.bottom.mas_equalTo(-10);
|
|
make.size.mas_equalTo(CGSizeMake(55,55));
|
|
}];
|
|
|
|
[self addSubview:self.progressBG];
|
|
[self.progressBG mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.bottom.mas_equalTo(self).offset(-3);
|
|
make.centerX.mas_equalTo(self);
|
|
make.width.mas_equalTo(47);
|
|
make.height.mas_equalTo(8);
|
|
}];
|
|
|
|
[self.progressBG addSubview:self.progress];
|
|
[self.progress mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerY.mas_equalTo(self.progressBG);
|
|
make.leading.mas_equalTo(self.progress);//.offset(0.5);
|
|
make.width.mas_equalTo(0);
|
|
make.height.mas_equalTo(7);
|
|
}];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (UIImageView *)icon {
|
|
if (!_icon) {
|
|
_icon = [[NetImageView alloc] init];
|
|
_icon.userInteractionEnabled = YES;
|
|
_icon.contentMode = UIViewContentModeScaleAspectFit;
|
|
_icon.transform = CGAffineTransformMakeRotation(-M_PI / 6);
|
|
}
|
|
return _icon;
|
|
}
|
|
|
|
- (UIImageView *)progress {
|
|
if (!_progress) {
|
|
UIImage *progressImage = [kImage(@"room_boom_entry_progress_bar") resizableImageWithCapInsets:UIEdgeInsetsMake(0, 6, 0, 6) resizingMode:UIImageResizingModeStretch];
|
|
_progress = [[UIImageView alloc] initWithImage:progressImage];
|
|
_progress.userInteractionEnabled = YES;
|
|
_progress.hidden = NO;
|
|
}
|
|
return _progress;
|
|
}
|
|
|
|
- (UIImageView *)progressBG {
|
|
if (!_progressBG) {
|
|
_progressBG = [[UIImageView alloc] initWithImage:kImage(@"room_boom_entry_progress_bar_bg")];
|
|
_progressBG.userInteractionEnabled = YES;
|
|
}
|
|
return _progressBG;
|
|
}
|
|
|
|
@end
|