mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various Fixes
This commit is contained in:
parent
9413744c4a
commit
f0f340fdc5
@ -6,6 +6,12 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface TGCameraSmallFlipButton : TGModernButton
|
||||||
|
|
||||||
|
- (void)setHidden:(bool)hidden animated:(bool)animated;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface TGCameraCancelButton : TGModernButton
|
@interface TGCameraCancelButton : TGModernButton
|
||||||
|
|
||||||
- (void)setHidden:(bool)hidden animated:(bool)animated;
|
- (void)setHidden:(bool)hidden animated:(bool)animated;
|
||||||
|
@ -455,7 +455,9 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus
|
|||||||
}
|
}
|
||||||
|
|
||||||
[_autorotationCorrectionView addSubview:_interfaceView];
|
[_autorotationCorrectionView addSubview:_interfaceView];
|
||||||
|
if ((int)self.view.frame.size.width > 320 || [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
|
||||||
[_autorotationCorrectionView addSubview:_cornersView];
|
[_autorotationCorrectionView addSubview:_cornersView];
|
||||||
|
}
|
||||||
|
|
||||||
_photoSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
|
_photoSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
|
||||||
_photoSwipeGestureRecognizer.delegate = self;
|
_photoSwipeGestureRecognizer.delegate = self;
|
||||||
@ -2660,6 +2662,8 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
if (widescreenWidth == 926.0f)
|
||||||
|
return CGRectMake(0, 154, screenSize.width, screenSize.height - 154 - 249);
|
||||||
if (widescreenWidth == 896.0f)
|
if (widescreenWidth == 896.0f)
|
||||||
return CGRectMake(0, 121, screenSize.width, screenSize.height - 121 - 223);
|
return CGRectMake(0, 121, screenSize.width, screenSize.height - 121 - 223);
|
||||||
else if (widescreenWidth == 844.0f)
|
else if (widescreenWidth == 844.0f)
|
||||||
|
@ -64,6 +64,53 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@implementation TGCameraSmallFlipButton
|
||||||
|
|
||||||
|
- (instancetype)initWithFrame:(CGRect)frame
|
||||||
|
{
|
||||||
|
self = [super initWithFrame:frame];
|
||||||
|
if (self != nil)
|
||||||
|
{
|
||||||
|
self.exclusiveTouch = true;
|
||||||
|
UIImage *image = TGTintedImage(TGComponentsImageNamed(@"CameraFlipButton"), [UIColor whiteColor]);
|
||||||
|
[self setImage:image forState:UIControlStateNormal];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setHidden:(BOOL)hidden
|
||||||
|
{
|
||||||
|
self.alpha = hidden ? 0.0f : 1.0f;
|
||||||
|
super.hidden = hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setHidden:(bool)hidden animated:(bool)animated
|
||||||
|
{
|
||||||
|
if (animated)
|
||||||
|
{
|
||||||
|
super.hidden = false;
|
||||||
|
self.userInteractionEnabled = false;
|
||||||
|
|
||||||
|
[UIView animateWithDuration:0.25f animations:^
|
||||||
|
{
|
||||||
|
self.alpha = hidden ? 0.0f : 1.0f;
|
||||||
|
} completion:^(BOOL finished)
|
||||||
|
{
|
||||||
|
self.userInteractionEnabled = true;
|
||||||
|
|
||||||
|
if (finished)
|
||||||
|
self.hidden = hidden;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self.alpha = hidden ? 0.0f : 1.0f;
|
||||||
|
super.hidden = hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
@implementation TGCameraCancelButton
|
@implementation TGCameraCancelButton
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@
|
|||||||
UIView *_videoLandscapePanelView;
|
UIView *_videoLandscapePanelView;
|
||||||
|
|
||||||
TGCameraFlashControl *_flashControl;
|
TGCameraFlashControl *_flashControl;
|
||||||
TGCameraFlashActiveView *_flashActiveView;
|
|
||||||
|
TGCameraSmallFlipButton *_topFlipButton;
|
||||||
|
|
||||||
bool _hasResults;
|
bool _hasResults;
|
||||||
|
|
||||||
@ -295,6 +296,11 @@
|
|||||||
_flashControl = [[TGCameraFlashControl alloc] initWithFrame:CGRectMake(3.0, 0, TGCameraFlashControlHeight, TGCameraFlashControlHeight)];
|
_flashControl = [[TGCameraFlashControl alloc] initWithFrame:CGRectMake(3.0, 0, TGCameraFlashControlHeight, TGCameraFlashControlHeight)];
|
||||||
[_topPanelView addSubview:_flashControl];
|
[_topPanelView addSubview:_flashControl];
|
||||||
|
|
||||||
|
_topFlipButton = [[TGCameraSmallFlipButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
|
||||||
|
_topFlipButton.hidden = true;
|
||||||
|
[_topFlipButton addTarget:self action:@selector(flipButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
[_topPanelView addSubview:_topFlipButton];
|
||||||
|
|
||||||
_timecodeView = [[TGCameraTimeCodeView alloc] initWithFrame:CGRectMake((frame.size.width - 120) / 2, 12, 120, 28)];
|
_timecodeView = [[TGCameraTimeCodeView alloc] initWithFrame:CGRectMake((frame.size.width - 120) / 2, 12, 120, 28)];
|
||||||
_timecodeView.alpha = 0.0;
|
_timecodeView.alpha = 0.0;
|
||||||
_timecodeView.requestedRecordingDuration = ^NSTimeInterval
|
_timecodeView.requestedRecordingDuration = ^NSTimeInterval
|
||||||
@ -394,13 +400,15 @@
|
|||||||
if (results.count == 0)
|
if (results.count == 0)
|
||||||
{
|
{
|
||||||
_hasResults = false;
|
_hasResults = false;
|
||||||
|
_topFlipButton.hidden = true;
|
||||||
_flipButton.hidden = false;
|
_flipButton.hidden = false;
|
||||||
_doneButton.hidden = true;
|
_doneButton.hidden = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_hasResults = true;
|
_hasResults = true;
|
||||||
_flipButton.hidden = false;
|
_topFlipButton.hidden = _modeControl.cameraMode == PGCameraModePhotoScan;
|
||||||
|
_flipButton.hidden = true;
|
||||||
_doneButton.hidden = false;
|
_doneButton.hidden = false;
|
||||||
if (_modeControl.cameraMode == PGCameraModePhotoScan) {
|
if (_modeControl.cameraMode == PGCameraModePhotoScan) {
|
||||||
_modeControl.hidden = true;
|
_modeControl.hidden = true;
|
||||||
@ -585,7 +593,8 @@
|
|||||||
_modeControl.hidden = false;
|
_modeControl.hidden = false;
|
||||||
_cancelButton.hidden = false;
|
_cancelButton.hidden = false;
|
||||||
_flashControl.hidden = false;
|
_flashControl.hidden = false;
|
||||||
_flipButton.hidden = false;
|
_flipButton.hidden = hasDoneButton;
|
||||||
|
_topFlipButton.hidden = !hasDoneButton;
|
||||||
_bottomPanelBackgroundView.hidden = false;
|
_bottomPanelBackgroundView.hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,6 +610,7 @@
|
|||||||
_cancelButton.alpha = alpha;
|
_cancelButton.alpha = alpha;
|
||||||
_flashControl.alpha = alpha;
|
_flashControl.alpha = alpha;
|
||||||
_flipButton.alpha = alpha;
|
_flipButton.alpha = alpha;
|
||||||
|
_topFlipButton.alpha = alpha;
|
||||||
_bottomPanelBackgroundView.alpha = alpha;
|
_bottomPanelBackgroundView.alpha = alpha;
|
||||||
|
|
||||||
if (hasDoneButton)
|
if (hasDoneButton)
|
||||||
@ -612,7 +622,8 @@
|
|||||||
_modeControl.hidden = hidden;
|
_modeControl.hidden = hidden;
|
||||||
_cancelButton.hidden = hidden;
|
_cancelButton.hidden = hidden;
|
||||||
_flashControl.hidden = hidden;
|
_flashControl.hidden = hidden;
|
||||||
_flipButton.hidden = hidden;
|
_flipButton.hidden = hidden || hasDoneButton;
|
||||||
|
_topFlipButton.hidden = hidden || !hasDoneButton;
|
||||||
_bottomPanelBackgroundView.hidden = hidden;
|
_bottomPanelBackgroundView.hidden = hidden;
|
||||||
|
|
||||||
if (hasDoneButton)
|
if (hasDoneButton)
|
||||||
@ -631,8 +642,10 @@
|
|||||||
_cancelButton.alpha = alpha;
|
_cancelButton.alpha = alpha;
|
||||||
_flashControl.hidden = hidden;
|
_flashControl.hidden = hidden;
|
||||||
_flashControl.alpha = alpha;
|
_flashControl.alpha = alpha;
|
||||||
_flipButton.hidden = hidden;
|
_flipButton.hidden = hidden || hasDoneButton;
|
||||||
_flipButton.alpha = alpha;
|
_flipButton.alpha = alpha;
|
||||||
|
_topFlipButton.hidden = hidden || !hasDoneButton;
|
||||||
|
_topFlipButton.alpha = alpha;
|
||||||
_bottomPanelBackgroundView.hidden = hidden;
|
_bottomPanelBackgroundView.hidden = hidden;
|
||||||
_bottomPanelBackgroundView.alpha = alpha;
|
_bottomPanelBackgroundView.alpha = alpha;
|
||||||
|
|
||||||
@ -675,6 +688,7 @@
|
|||||||
_zoomModeView.interfaceOrientation = orientation;
|
_zoomModeView.interfaceOrientation = orientation;
|
||||||
_timecodeView.interfaceOrientation = orientation;
|
_timecodeView.interfaceOrientation = orientation;
|
||||||
_zoomWheelView.interfaceOrientation = orientation;
|
_zoomWheelView.interfaceOrientation = orientation;
|
||||||
|
_topFlipButton.transform = CGAffineTransformMakeRotation(TGRotationForInterfaceOrientation(orientation));
|
||||||
} completion:^(__unused BOOL finished)
|
} completion:^(__unused BOOL finished)
|
||||||
{
|
{
|
||||||
if (_modeControl.cameraMode == PGCameraModeVideo)
|
if (_modeControl.cameraMode == PGCameraModeVideo)
|
||||||
@ -706,6 +720,7 @@
|
|||||||
_zoomModeView.interfaceOrientation = orientation;
|
_zoomModeView.interfaceOrientation = orientation;
|
||||||
_timecodeView.interfaceOrientation = orientation;
|
_timecodeView.interfaceOrientation = orientation;
|
||||||
_zoomWheelView.interfaceOrientation = orientation;
|
_zoomWheelView.interfaceOrientation = orientation;
|
||||||
|
_topFlipButton.transform = CGAffineTransformMakeRotation(TGRotationForInterfaceOrientation(orientation));
|
||||||
|
|
||||||
[self _layoutTopPanelSubviewsForInterfaceOrientation:orientation];
|
[self _layoutTopPanelSubviewsForInterfaceOrientation:orientation];
|
||||||
}
|
}
|
||||||
@ -799,6 +814,8 @@
|
|||||||
|
|
||||||
_flipButton.frame = CGRectMake(self.frame.size.width - _flipButton.frame.size.width - 20.0f, round(_shutterButton.center.y - _flipButton.frame.size.height / 2.0f), _flipButton.frame.size.width, _flipButton.frame.size.height);
|
_flipButton.frame = CGRectMake(self.frame.size.width - _flipButton.frame.size.width - 20.0f, round(_shutterButton.center.y - _flipButton.frame.size.height / 2.0f), _flipButton.frame.size.width, _flipButton.frame.size.height);
|
||||||
|
|
||||||
|
_topFlipButton.frame = CGRectMake(self.frame.size.width - _topFlipButton.frame.size.width - 4.0f, 0.0f, _topFlipButton.frame.size.width, _topFlipButton.frame.size.height);
|
||||||
|
|
||||||
_toastView.frame = CGRectMake(0, self.frame.size.height - _bottomPanelHeight - _bottomPanelOffset - 32 - 16, self.frame.size.width, 32);
|
_toastView.frame = CGRectMake(0, self.frame.size.height - _bottomPanelHeight - _bottomPanelOffset - 32 - 16, self.frame.size.width, 32);
|
||||||
|
|
||||||
CGFloat photosViewSize = TGPhotoThumbnailSizeForCurrentScreen().height + 4 * 2;
|
CGFloat photosViewSize = TGPhotoThumbnailSizeForCurrentScreen().height + 4 * 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user