南鑫林 5 роки тому
батько
коміт
bf1fec24df

+ 1 - 0
RainbowPlanet/Podfile

@@ -26,6 +26,7 @@ target 'RainbowPlanet' do
   pod 'lottie-ios'
   # 自动布局
   pod 'SnapKit'
+  pod 'Masonry'
   # 键盘
   pod 'InputBarAccessoryView'
   pod 'IQKeyboardManagerSwift'

+ 5 - 1
RainbowPlanet/Podfile.lock

@@ -44,6 +44,7 @@ PODS:
   - Kingfisher (4.10.1)
   - lottie-ios (3.1.2)
   - LYEmptyView (1.2.5)
+  - Masonry (1.1.0)
   - MBProgressHUD (1.1.0)
   - MJRefresh (3.2.0)
   - MLeaksFinder (1.0.0):
@@ -117,6 +118,7 @@ DEPENDENCIES:
   - Kingfisher
   - lottie-ios
   - LYEmptyView
+  - Masonry
   - MBProgressHUD
   - MJRefresh
   - MLeaksFinder
@@ -169,6 +171,7 @@ SPEC REPOS:
     - Kingfisher
     - lottie-ios
     - LYEmptyView
+    - Masonry
     - MBProgressHUD
     - MJRefresh
     - MLeaksFinder
@@ -218,6 +221,7 @@ SPEC CHECKSUMS:
   Kingfisher: c148cd7b47ebde9989f6bc7c27dcaa79d81279a0
   lottie-ios: 49cd85b1f24f61a7708ad7ec76a523ab2d0e3100
   LYEmptyView: b17adfc2dd9ad2988ecaf7c9606efa916e24c767
+  Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
   MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
   MJRefresh: ed450d6eb9d3346a2cb033ab7eb6de090aeef437
   MLeaksFinder: 8c435bd2f6d070af18cff082b503b21adc130fc0
@@ -242,6 +246,6 @@ SPEC CHECKSUMS:
   YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
 
-PODFILE CHECKSUM: 79e6cb82f98469b677e714b62816ea391c322aa9
+PODFILE CHECKSUM: 776426a27b52cade84fb4274fa44db9b949e0984
 
 COCOAPODS: 1.7.4

+ 17 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AliyunEffectFilterView.h

@@ -56,4 +56,21 @@
 
 @property (nonatomic,assign) BOOL isEdit;
 
+/**
+ 选中滤镜的序号
+ */
+@property (nonatomic, assign) NSInteger selectIndex;
+
+/**
+ 数据模型数组
+ */
+@property (nonatomic, strong) NSMutableArray *dataArray;
+
+/**
+ 显示view
+ */
+@property (nonatomic, strong) UICollectionView *collectionView;
+
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath;
+
 @end

+ 1 - 13
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AliyunEffectFilterView.m

@@ -18,18 +18,9 @@
 
 @interface AliyunEffectFilterView()
 
-/**
- 显示view
- */
-@property (nonatomic, strong) UICollectionView *collectionView;
 
 @property (nonatomic, strong) UICollectionView *collectionView1;
 
-/**
- 数据模型数组
- */
-@property (nonatomic, strong) NSMutableArray *dataArray;
-
 /**
  数据模型数组
  */
@@ -50,10 +41,7 @@
  */
 @property (nonatomic, assign) NSInteger beautyLevelSelectIndex;
 
-/**
- 选中滤镜的序号
- */
-@property (nonatomic, assign) NSInteger selectIndex;
+
 
 @property (nonatomic, strong) AlivcEditBottomHeaderView *headerView;
 

+ 77 - 2
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m

@@ -48,6 +48,7 @@
 #import "AlivcEditItemModel.h"
 
 #import "RainbowPlanet-Swift.h"
+#import "Masonry.h"
 
 typedef enum : NSUInteger {
     AlivcEditVCStatus_Normal = 0, //播放或者暂停状态 - 非编辑状态
@@ -116,6 +117,11 @@ AliyunIExporterCallback, AliyunIPlayerCallback>
 
 @property(nonatomic, assign) CGSize inputOutputSize;
 
+/**
+ 滤镜文字
+ */
+@property (nonatomic, strong) UILabel *effectFilterLabel;
+
 @end
 
 @implementation AliyunEditViewController {
@@ -220,6 +226,16 @@ AliyunIExporterCallback, AliyunIPlayerCallback>
     self.movieView.backgroundColor =
     [[UIColor brownColor] colorWithAlphaComponent:.3];
     [self.view addSubview:self.movieView];
+    
+    self.effectFilterLabel = [UILabel new];
+    self.effectFilterLabel.alpha = 0;
+    self.effectFilterLabel.textColor = UIColor.whiteColor;
+    self.effectFilterLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightMedium];
+    [self.view addSubview:self.effectFilterLabel];
+    [self.effectFilterLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(@(64+SafeTop));
+        make.centerX.equalTo(self.view);
+    }];
 
     //返回按钮
     CGFloat y = SafeTop;
@@ -296,6 +312,14 @@ AliyunIExporterCallback, AliyunIPlayerCallback>
     
     [self.view addSubview:self.musicView];
     [self.musicView addVisualEffect];
+    
+    UISwipeGestureRecognizer * rightRecognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(rightRecognizer:)];
+    [rightRecognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
+    [self.view addGestureRecognizer:rightRecognizer];
+    
+    UISwipeGestureRecognizer * leftRecognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(leftRecognizer:)];
+    [leftRecognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
+    [self.view addGestureRecognizer:leftRecognizer];
 }
 
 // slider变动时改变播放进度
@@ -1227,7 +1251,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback>
              });
              
          } else {
-             UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"video_exporting_finish_fail_edit",nil) message:NSLocalizedString(@"video_exporting_check_autho",nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
+     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"video_exporting_finish_fail_edit",nil) message:NSLocalizedString(@"video_exporting_check_autho",nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
              [alert show];
          }
      }];
@@ -1342,10 +1366,61 @@ AliyunIExporterCallback, AliyunIPlayerCallback>
 
 #pragma mark - AliyunEffectFilter2ViewDelegate - 滤镜
 
-- (void)didSelectEffectFilter:(AliyunEffectFilterInfo *)filter {
+/**
+ 右滑 减一
+ 
+ @param rightRecognizer 捏合方法
+ */
+- (void)rightRecognizer:(UISwipeGestureRecognizer *)rightRecognizer {
+    if (self.filterView.selectIndex > 0) {
+        self.filterView.selectIndex = self.filterView.selectIndex - 1;
+    }else {
+        self.filterView.selectIndex = self.filterView.dataArray.count - 1;
+    }
+    [self.filterView collectionView:self.filterView.collectionView didSelectItemAtIndexPath:[NSIndexPath indexPathForItem:self.filterView.selectIndex inSection:0]];
+    [self.filterView.collectionView reloadData];
+    
+    
+    return;
+}
+
+/**
+ 左滑 加一
+ 
+ @param leftRecognizer 捏合方法
+ */
+- (void)leftRecognizer:(UISwipeGestureRecognizer *)leftRecognizer {
+    if (self.filterView.selectIndex < self.filterView.dataArray.count-1) {
+        self.filterView.selectIndex = self.filterView.selectIndex + 1;
+    }else {
+        self.filterView.selectIndex = 0;
+    }
+    [self.filterView collectionView:self.filterView.collectionView didSelectItemAtIndexPath:[NSIndexPath indexPathForItem:self.filterView.selectIndex inSection:0]];
+    [self.filterView.collectionView reloadData];
+    return;
+}
+
+
+//滤镜
+- (void)didSelectEffectFilter:(AliyunEffectFilterInfo *)filter{
     AliyunEffectFilter *filter2 = [[AliyunEffectFilter alloc]
                                    initWithFile:[filter localFilterResourcePath]];
     [self.editor applyFilter:filter2];
+    
+    self.effectFilterLabel.alpha = 1;
+    self.effectFilterLabel.text = filter.name;
+    __weak typeof(self) weakSelf = self;
+    [UIView animateWithDuration:2 animations:^{
+        __strong typeof(weakSelf) strongSelf = weakSelf; //就这一句,搞定
+        strongSelf.effectFilterLabel.alpha = 1;
+    } completion:^(BOOL finished) {
+        __weak typeof(self) weakSelf1 = weakSelf;
+        [UIView animateWithDuration:2 animations:^{
+            __strong typeof(weakSelf1) strongSelf = weakSelf1; //就这一句,搞定
+            strongSelf.effectFilterLabel.alpha = 0;
+        } completion:^(BOOL finished) {
+        }];
+    }];
 }
 
 #pragma mark - AliyunEffectTimeFilterDelegate - 时间特效

+ 56 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/Controller/AliyunMagicCameraViewController.m

@@ -356,6 +356,13 @@
     pinchGesture.delegate = self;
     [_recorder.preview addGestureRecognizer:pinchGesture];
     
+    UISwipeGestureRecognizer * rightRecognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(rightRecognizer:)];
+    [rightRecognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
+    [_recorder.preview addGestureRecognizer:rightRecognizer];
+    
+     UISwipeGestureRecognizer * leftRecognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(leftRecognizer:)];
+    [leftRecognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
+    [_recorder.preview addGestureRecognizer:leftRecognizer];
 
 }
 
@@ -661,6 +668,40 @@
     return;
 }
 
+/**
+ 右滑 减一
+ 
+ @param rightRecognizer 捏合方法
+ */
+- (void)rightRecognizer:(UISwipeGestureRecognizer *)rightRecognizer {
+    if (self.filterView.selectIndex > 0) {
+        self.filterView.selectIndex = self.filterView.selectIndex - 1;
+    }else {
+        self.filterView.selectIndex = self.filterView.dataArray.count - 1;
+    }
+    [self.filterView collectionView:self.filterView.collectionView didSelectItemAtIndexPath:[NSIndexPath indexPathForItem:self.filterView.selectIndex inSection:0]];
+    [self.filterView.collectionView reloadData];
+
+
+    return;
+}
+
+/**
+ 左滑 加一
+ 
+ @param leftRecognizer 捏合方法
+ */
+- (void)leftRecognizer:(UISwipeGestureRecognizer *)leftRecognizer {
+    if (self.filterView.selectIndex < self.filterView.dataArray.count-1) {
+        self.filterView.selectIndex = self.filterView.selectIndex + 1;
+    }else {
+        self.filterView.selectIndex = 0;
+    }
+    [self.filterView collectionView:self.filterView.collectionView didSelectItemAtIndexPath:[NSIndexPath indexPathForItem:self.filterView.selectIndex inSection:0]];
+    [self.filterView.collectionView reloadData];
+    return;
+}
+
 #pragma mark - Getter -
 - (NSMutableArray *)effectFilterItems
 {
@@ -676,6 +717,21 @@
 - (void)didSelectEffectFilter:(AliyunEffectFilterInfo *)filter{
     AliyunEffectFilter *effectFilter =[[AliyunEffectFilter alloc] initWithFile:[filter localFilterResourcePath]];
     [_recorder applyFilter:effectFilter];
+    
+    self.magicCameraView.effectFilterLabel.alpha = 1;
+    self.magicCameraView.effectFilterLabel.text = filter.name;
+    __weak typeof(self) weakSelf = self;
+    [UIView animateWithDuration:2 animations:^{
+        __strong typeof(weakSelf) strongSelf = weakSelf; //就这一句,搞定
+        strongSelf.magicCameraView.effectFilterLabel.alpha = 1;
+    } completion:^(BOOL finished) {
+        __weak typeof(self) weakSelf1 = weakSelf;
+        [UIView animateWithDuration:2 animations:^{
+            __strong typeof(weakSelf1) strongSelf = weakSelf1; //就这一句,搞定
+            strongSelf.magicCameraView.effectFilterLabel.alpha = 0;
+        } completion:^(BOOL finished) {
+        }];
+    }];
 }
 
 - (void)didSelectBeautyLevelIndexPath:(NSIndexPath *)indexPath {

+ 7 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/View/AliyunMagicCameraView.h

@@ -11,6 +11,7 @@
 #import "AliyunRateSelectView.h"
 #import "QUProgressView.h"
 #import "AlivcRecordUIConfig.h"
+
 @class AliyunEffectFilterInfo,AliyunMagicCameraView;
 @protocol MagicCameraViewDelegate <NSObject>
 
@@ -136,6 +137,7 @@
  */
 @property (nonatomic, strong) UIView *selBackView;
 
+
 /**
  底部view
  */
@@ -208,4 +210,9 @@
  */
 - (void)endRecord;
 
+
+/**
+ 滤镜文字
+ */
+@property (nonatomic, strong) UILabel *effectFilterLabel;
 @end

+ 11 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/View/AliyunMagicCameraView.m

@@ -12,6 +12,7 @@
 #import "AlivcRecordFocusView.h"
 #import "AlivcMacro.h"
 #import "UIColor+AlivcHelper.h"
+#import "Masonry.h"
 
 @interface AliyunMagicCameraView ()
 
@@ -91,6 +92,16 @@
     self.selBackView = [[UIView alloc] initWithFrame:CGRectMake(0,(IPHONEX ? 44 + 14 : 14), CGRectGetWidth(self.bounds), 44+8)];
     [self addSubview:self.selBackView];
     
+    self.effectFilterLabel = [UILabel new];
+    self.effectFilterLabel.alpha = 0;
+    self.effectFilterLabel.textColor = UIColor.whiteColor;
+    self.effectFilterLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightMedium];
+    [self addSubview:self.effectFilterLabel];
+    [self.effectFilterLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(@(64+SafeTop));
+        make.centerX.equalTo(self);
+    }];
+    
     [self addSubview:self.backButton];
     [self addSubview:self.reverseButton];
     [self addSubview:self.musicButton];