Browse Source

crop ui fixed

Chris 5 years ago
parent
commit
39d6433745

+ 0 - 10
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/UIConfig/AliyunIConfig.h

@@ -46,16 +46,6 @@ typedef NS_ENUM(NSInteger, AliyunIRecordActionType) {
  */
 @property (nonatomic, strong) UIColor *durationLabelTextColor;
 
-/**
- 裁剪底部分割线的颜色
- */
-@property (nonatomic, strong) UIColor *cutBottomLineColor;
-
-/**
- 裁剪顶部分割线的颜色
- */
-@property (nonatomic, strong) UIColor *cutTopLineColor;
-
 /**
  无滤镜效果的文字
  */

+ 5 - 6
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoCrop/Controller/AliyunCropViewController.m

@@ -104,10 +104,10 @@ typedef NS_ENUM(NSInteger, AliyunCropPlayerStatus) {
     }
 }
 
-//- (BOOL)prefersStatusBarHidden
-//{
-//    return YES;
-//}
+- (BOOL)prefersStatusBarHidden
+{
+    return YES;
+}
 
 // 支持设备自动旋转
 - (BOOL)shouldAutorotate
@@ -128,7 +128,6 @@ typedef NS_ENUM(NSInteger, AliyunCropPlayerStatus) {
     self.previewScrollView = [[UIScrollView alloc] init];
     self.previewScrollView.bounces = NO;
     
-//    self.previewScrollView.frame = CGRectMake(0, SafeTop+44, ScreenWidth, SizeHeight(426));
     self.previewScrollView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
     self.previewScrollView.backgroundColor = _cutInfo.backgroundColor ? :[UIColor blackColor];
     self.previewScrollView.delegate = self;
@@ -216,7 +215,7 @@ typedef NS_ENUM(NSInteger, AliyunCropPlayerStatus) {
     CGRect frame = _previewScrollView.frame;
     frame.size.height = _previewHeight;
     if (_destRatio == 9.0/16.0) {
-        frame.origin.y = SafeTop;
+        frame.origin.y = 0;
     }
     _previewScrollView.frame = frame;
     _previewScrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);

+ 16 - 22
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoCrop/View/AliyunCropThumbnailView.m

@@ -11,6 +11,9 @@
 #import "AliyunMediaConfig.h"
 #import "AVC_ShortVideo_Config.h"
 #import "AlivcMacro.h"
+#import "UIColor+AlivcHelper.h"
+
+#define kCutSegment 12
 
 @interface AliyunCropThumbnailView ()
 @property (nonatomic, strong) UICollectionView *collectionView;
@@ -23,7 +26,6 @@
 @property (nonatomic, strong) UIImageView *imageViewLeftMask;
 @property (nonatomic, strong) UIImageView *imageViewRight;
 @property (nonatomic, strong) UIImageView *imageViewRightMask;
-@property (nonatomic, strong) UIImageView *imageViewBackground;
 @property (nonatomic, strong) UIImageView *imageViewSelected;
 @property (nonatomic, strong) UIImageView *progressView;
 
@@ -47,7 +49,7 @@
     self = [super initWithFrame:frame];
     if (self) {
         _cutInfo = cutInfo;
-        _imagesArray = [NSMutableArray arrayWithCapacity:8];
+        _imagesArray = [NSMutableArray arrayWithCapacity:kCutSegment];
         [self setupCollectionView];
         [self setupSubviews];
     }
@@ -56,11 +58,11 @@
 
 - (void)setupCollectionView {
     UICollectionViewFlowLayout *followLayout = [[UICollectionViewFlowLayout alloc] init];
-    followLayout.itemSize = CGSizeMake(ScreenWidth / 8.0 , 72);
+    followLayout.itemSize = CGSizeMake((ScreenWidth-28)/kCutSegment , 72);
     followLayout.minimumLineSpacing = 0;
     followLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
     
-    _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 38, ScreenWidth, 72) collectionViewLayout:followLayout];
+    _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 38, ScreenWidth-28, 72) collectionViewLayout:followLayout];
     _collectionView.dataSource = (id<UICollectionViewDataSource>)self;
     [_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
     [self addSubview:_collectionView];
@@ -73,26 +75,25 @@
     _progressView.center = CGPointMake(0, CGRectGetMidY(self.bounds) + 19);
     [self addSubview:_progressView];
     
-    _durationLabel = [[UILabel alloc] initWithFrame:CGRectMake(14, 0, ScreenWidth - 200, 18)];
+    _durationLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth - 200, 18)];
     _durationLabel.textColor = [UIColor whiteColor];
     _durationLabel.textAlignment = UITextAlignmentLeft;
     _durationLabel.font = [UIFont systemFontOfSize:13];
     [self addSubview:_durationLabel];
     
-    _imageViewWith = ScreenWidth / 8.0 * 0.35;
+    _imageViewWith = 15;
     _imageViewLeft = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"video_edit_left"]];
-    _imageViewLeft.frame = CGRectMake(0, 38, 15, 72);
+    _imageViewLeft.frame = CGRectMake(0, 38, _imageViewWith, 72);
     _imageViewLeft.userInteractionEnabled = YES;
     _imageViewRight = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"video_edit_right"]];
-    _imageViewRight.frame = CGRectMake(ScreenWidth-28-15, 38, 15, 72);
+    _imageViewRight.frame = CGRectMake(ScreenWidth-28-15, 38, _imageViewWith, 72);
     _imageViewRight.userInteractionEnabled = YES;
     
+    _topLineView = [[UIImageView alloc]initWithFrame:CGRectMake(_imageViewWith - 3 , 38, ScreenWidth-28 - 2*_imageViewWith+6, 3)];
+    _topLineView.backgroundColor = [UIColor colorWithHexString:@"#62CC74"];
     
-    _topLineView = [[UIImageView alloc]initWithFrame:CGRectMake(_imageViewWith - 3 , 38, ScreenWidth - _imageViewWith *2 + 6, 3)];
-    _topLineView.backgroundColor = [AliyunIConfig config].cutTopLineColor;
-    
-    _underLineView = [[UIImageView alloc]initWithFrame:CGRectMake(_imageViewWith - 3, _imageViewLeft.frame.size.height + 38 - 3  , ScreenWidth - _imageViewWith *2 + 6, 3)];
-    _underLineView.backgroundColor = [AliyunIConfig config].cutBottomLineColor;
+    _underLineView = [[UIImageView alloc]initWithFrame:CGRectMake(_imageViewWith - 3, _imageViewLeft.frame.size.height + 38 - 3  , ScreenWidth-28 - 2*_imageViewWith+6, 3)];
+    _underLineView.backgroundColor = [UIColor colorWithHexString:@"#62CC74"];
     
     [self addSubview:_topLineView];
     [self addSubview:_underLineView];
@@ -111,11 +112,6 @@
     
     [self addSubview:_imageViewLeftMask];
     [self addSubview:_imageViewRightMask];
-
-    _imageViewBackground = [[UIImageView alloc] initWithImage:[AliyunImage imageNamed:@"paster_time_edit_slider_bg"]];
-    _imageViewBackground.frame = CGRectMake(CGRectGetMaxX(_imageViewLeft.frame), CGRectGetMinY(_imageViewLeft.frame), CGRectGetMinX(_imageViewRight.frame) - CGRectGetMaxX(_imageViewLeft.frame), 72);
-    [self addSubview:_imageViewBackground];
-    
 }
 
 - (void)loadThumbnailData {
@@ -124,7 +120,7 @@
     CMTime startTime = kCMTimeZero;
     NSMutableArray *array = [NSMutableArray array];
 //    CMTime addTime = CMTimeMake(1000,1000);
-    CGFloat d = _cutInfo.sourceDuration / 7.0;
+    CGFloat d = _cutInfo.sourceDuration / (kCutSegment-1);
     int intd = d * 100;
     float fd = intd / 100.0;
     CMTime addTime = CMTimeMakeWithSeconds(fd, 1000);
@@ -157,7 +153,7 @@
 - (void)updateProgressViewWithProgress:(CGFloat)progress {
     CGPoint center = _progressView.center;
     
-    CGFloat newX = progress *ScreenWidth;
+    CGFloat newX = progress *(ScreenWidth-28);
     if (newX < center.x ) {
         center.x = newX;
 
@@ -233,7 +229,6 @@
             _imageViewLeftMask.frame = maskFrame;
             
             _cutInfo.startTime = left;
-            _imageViewBackground.frame = CGRectMake(CGRectGetMaxX(_imageViewLeft.frame), CGRectGetMinY(_imageViewLeft.frame), CGRectGetMinX(_imageViewRight.frame) - CGRectGetMaxX(_imageViewLeft.frame), 72);
             _durationLabel.text = [NSString stringWithFormat:@"已选取%.1fs",_cutInfo.endTime - _cutInfo.startTime];
             if ([_delegate respondsToSelector:@selector(cutBarDidMovedToTime:)]) {
                 [_delegate cutBarDidMovedToTime:left];
@@ -251,7 +246,6 @@
             maskFrame.origin.x = frame.origin.x + frame.size.width;
             maskFrame.size.width = ScreenWidth - maskFrame.origin.x;
             _imageViewRightMask.frame = maskFrame;
-            _imageViewBackground.frame = CGRectMake(CGRectGetMaxX(_imageViewLeft.frame), CGRectGetMinY(_imageViewLeft.frame), CGRectGetMinX(_imageViewRight.frame) - CGRectGetMaxX(_imageViewLeft.frame), 72);
             _durationLabel.text = [NSString stringWithFormat:@"已选取%.1fs", _cutInfo.endTime - _cutInfo.startTime];
             if ([_delegate respondsToSelector:@selector(cutBarDidMovedToTime:)]) {
                 [_delegate cutBarDidMovedToTime:right];