Browse Source

动画加载方式处理

Steven 8 months ago
parent
commit
05dab6fe79

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Common/Base/AccompanyWebView/AccompanyLoadingView.m

@@ -91,7 +91,7 @@
 
 - (LOTAnimationView *)animationView {
     if (!_animationView) {
-        _animationView = [LOTAnimationView animationNamed:self.jsonString];
+        _animationView = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:self.jsonString ofType:@"json"]];
         _animationView.contentMode = UIViewContentModeScaleAspectFill;
         _animationView.animationSpeed = 1.0;
         _animationView.loopAnimation = YES;

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Common/LoadingManager/KSCustomLoadingView.m

@@ -64,7 +64,7 @@
 
 - (LOTAnimationView *)animationView {
     if (!_animationView) {
-        _animationView = [LOTAnimationView animationNamed:@"teacher_refresh"];
+        _animationView = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:@"teacher_refresh" ofType:@"json"]];
         _animationView.contentMode = UIViewContentModeScaleAspectFill;
         _animationView.animationSpeed = 1.0;
         _animationView.loopAnimation = YES;

+ 13 - 14
KulexiuForTeacher/KulexiuForTeacher/Common/MediaMerge/AudioMerge/KSMergeAudioControlView.m

@@ -97,10 +97,11 @@
     self.recordSlider.value = recordVolume;
     self.bgVolume = bgVolume;
     self.bgSlider.value = bgVolume;
+    
     // 处理数据
     self.recordBubbleLabel.text = [NSString stringWithFormat:@"%zd",bgVolume];
     self.recordCenterX.constant = [self getBubbleCenterX:self.recordSlider];
-
+    
     self.bgVolumeBubble.text = [NSString stringWithFormat:@"%zd",bgVolume];
     self.bgCenterX.constant = [self getBubbleCenterX:self.bgSlider];
 }
@@ -120,11 +121,13 @@
 #pragma mark ----- 音量控制
 
 - (void)configRecordVolumeValue:(NSInteger)volume {
+    NSLog(@"---- record volume ---- %zd", volume);
     self.recordVolume = volume;
-    
     self.recordBubbleLabel.text = [NSString stringWithFormat:@"%zd",volume];
     self.recordCenterX.constant = [self getBubbleCenterX:self.recordSlider];
-
+    if (self.callback) {
+        self.callback(MERGEACTION_MODIFY, self.recordVolume, self.bgVolume, self.offsetTime);
+    }
     [UIView animateWithDuration:0.1f animations:^{
         [self layoutIfNeeded];
     } completion:^(BOOL finished) {
@@ -135,9 +138,13 @@
 }
 
 - (void)configBgVolumeValue:(NSInteger)volume {
+    NSLog(@"---- bg volume ---- %zd", volume);
     self.bgVolume = volume;
     self.bgVolumeBubble.text = [NSString stringWithFormat:@"%zd",volume];
     self.bgCenterX.constant = [self getBubbleCenterX:self.bgSlider];
+    if (self.callback) {
+        self.callback(MERGEACTION_MODIFY, self.recordVolume, self.bgVolume, self.offsetTime);
+    }
     [UIView animateWithDuration:0.1f animations:^{
         [self layoutIfNeeded];
     } completion:^(BOOL finished) {
@@ -147,7 +154,6 @@
     }];
 }
 
-
 - (CGFloat)getBubbleCenterX:(UISlider *)slider {
     // 根据滑块当前值计算拇指位置
     CGRect trackRect = [slider trackRectForBounds:slider.bounds];
@@ -289,12 +295,8 @@
 }
 
 - (void)refreshRecordValue:(NSInteger)value {
-    NSLog(@"---- record volume ---- %zd", value);
     [self.recordSlider setValue:value animated:NO];
     [self configRecordVolumeValue:value];
-    if (self.callback) {
-        self.callback(MERGEACTION_MODIFY, self.recordVolume, self.bgVolume, self.offsetTime);
-    }
     @weakObj(self);
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(500 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
         @strongObj(self);
@@ -303,18 +305,16 @@
 }
 
 - (void)refreshBgValue:(NSInteger)value {
-    NSLog(@"---- bg volume ---- %zd", value);
     [self.bgSlider setValue:value animated:NO];
     [self configBgVolumeValue:value];
-    if (self.callback) {
-        self.callback(MERGEACTION_MODIFY, self.recordVolume, self.bgVolume, self.offsetTime);
-    }
     @weakObj(self);
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(500 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
         @strongObj(self);
         self.bgBubble.hidden = YES;
     });
 }
+
+
 - (IBAction)leftAction:(id)sender {
     if (self.offsetTime <= -MAX_OFFSET) {
         self.offsetTime = -MAX_OFFSET;
@@ -324,8 +324,8 @@
     if (self.callback) {
         self.callback(MERGEACTION_DELAY, self.recordVolume, self.bgVolume, self.offsetTime);
     }
+    
 }
-
 - (IBAction)rightAction:(id)sender {
     if (self.offsetTime >= MAX_OFFSET) {
         self.offsetTime = MAX_OFFSET;
@@ -343,7 +343,6 @@
     }
 }
 
-
 #pragma mark ------ lazying
 - (void)setOffsetTime:(NSInteger)offsetTime {
     _offsetTime = offsetTime;

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/GifRefresh/KSGifRefreshFooter.m

@@ -20,7 +20,7 @@
 
 - (instancetype)init {
     if (self = [super init]) {
-        [self setJsonName:@"teacher_refresh.json"];
+        [self setJsonName:@"teacher_refresh"];
     }
     return self;
 }
@@ -33,7 +33,7 @@
 - (LOTAnimationView *)loadingView {
     if(_loadingView == nil) {
         //1.加载本地json
-        _loadingView = [LOTAnimationView animationNamed:self.jsonString];
+        _loadingView = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:self.jsonString ofType:@"json"]];
         //2.加载后台给的json(url)
         _loadingView.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width / 2.0) - 21, 0, 42, 55);
         _loadingView.loopAnimation = YES;

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/GifRefresh/KSGifRefreshHeader.m

@@ -22,7 +22,7 @@
     if (self = [super init]) {
         self.lastUpdatedTimeLabel.hidden = YES;
         self.stateLabel.hidden = YES;
-        [self setJsonName:@"teacher_refresh.json"];
+        [self setJsonName:@"teacher_refresh"];
     }
     return self;
 }
@@ -35,7 +35,7 @@
 - (LOTAnimationView *)loadingView {
     if(_loadingView == nil) {
         //1.加载本地json
-        _loadingView = [LOTAnimationView animationNamed:self.jsonString];
+        _loadingView = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:self.jsonString ofType:@"json"]];
         //2.加载后台给的json(url)
         _loadingView.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width / 2.0) - 21, 0, 42, 55);
         _loadingView.loopAnimation = YES;

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/GifRefresh/KSNewGifRefreshFooter.m

@@ -18,7 +18,7 @@
 @implementation KSNewGifRefreshFooter
 - (instancetype)init {
     if (self = [super init]) {
-        [self setJsonName:@"refresh_bottom.json"];
+        [self setJsonName:@"refresh_bottom"];
         self.stateLabel.textColor = HexRGB(0x777777);
 //        self.stateLabel.font = [UIFont systemFontOfSize:12.0f];
     }
@@ -53,7 +53,7 @@
 - (LOTAnimationView *)loadingView {
     if(_loadingView == nil) {
         //1.加载本地json
-        _loadingView = [LOTAnimationView animationNamed:self.jsonString];
+        _loadingView = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:self.jsonString ofType:@"json"]];
         //2.加载后台给的json(url)
         _loadingView.loopAnimation = YES;
         _loadingView.contentMode = UIViewContentModeScaleAspectFill;

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/AnimationLaunch/Controller/LaunchAnimationViewController.m

@@ -34,7 +34,7 @@
 - (void)configUI {
     self.view.backgroundColor = [UIColor whiteColor];
     
-    [self setJsonName:@"launchAni.json"];
+    [self setJsonName:@"launchAni"];
 }
 
 - (void)setJsonName:(NSString *)jsonName {
@@ -67,7 +67,7 @@
 - (LOTAnimationView *)loadingView {
     if(_loadingView == nil) {
         //1.加载本地json
-        _loadingView = [LOTAnimationView animationNamed:self.jsonString];
+        _loadingView = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:self.jsonString ofType:@"json"]];
         //2.加载后台给的json(url)
         _loadingView.loopAnimation = YES;
         _loadingView.contentMode = UIViewContentModeScaleAspectFill;

+ 4 - 4
KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeRecentCourseView.m

@@ -57,13 +57,13 @@
 
     NSString *jsonString = @"";
     if ([self.courseModel.courseType isEqualToString:@"LIVE"]) {
-        jsonString = @"live_animation.json";
+        jsonString = @"live_animation";
     }
     else if ([self.courseModel.courseType isEqualToString:@"PIANO_ROOM_CLASS"]) {
-        jsonString = @"musicRoom_animation.json";
+        jsonString = @"musicRoom_animation";
     }
     else {
-        jsonString = @"accomapny_animation.json";
+        jsonString = @"accomapny_animation";
     }
     [self configAnimationView:jsonString];
 }
@@ -72,7 +72,7 @@
     if ([self.imageBgView.subviews containsObject:self.animationView]) {
         [self.animationView removeFromSuperview];
     }
-    self.animationView = [LOTAnimationView animationNamed:jsonString];
+    self.animationView = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:jsonString ofType:@"json"]];
     //2.加载后台给的json(url)
     self.animationView.frame = CGRectMake(0, 0, 128, 91);
     self.animationView.loopAnimation = YES;