- legacy osc vibration style
- vibration style ios13 compatibility - low ios verision UI fixes
This commit is contained in:
+36
-1
@@ -37,6 +37,7 @@
|
||||
BOOL widgetPanelMovedByTouch;
|
||||
CGPoint widgetPanelStoredCenter;
|
||||
CGPoint latestTouchLocation;
|
||||
UIImpactFeedbackGenerator *vibrationGenerator;
|
||||
}
|
||||
|
||||
@synthesize trashCanButton;
|
||||
@@ -225,6 +226,8 @@
|
||||
self.toolbarRootView.layer.shadowOffset = CGSizeMake(0, 0);
|
||||
self.toolbarRootView.layer.shadowOpacity = 0.5;
|
||||
self.toolbarRootView.layer.shadowRadius = 7;
|
||||
|
||||
vibrationGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium];
|
||||
}
|
||||
|
||||
|
||||
@@ -561,6 +564,7 @@
|
||||
newWidget.sensitivityFactor = widget.sensitivityFactor;
|
||||
newWidget.stickIndicatorOffset = widget.stickIndicatorOffset;
|
||||
newWidget.minStickOffset = [widgetInitParams[@"minStickOffsetString"] floatValue];
|
||||
[newWidget setVibrationWithStyle:widget.vibrationStyle];
|
||||
// Add the widgetView to the view controller's view
|
||||
[self.view insertSubview:newWidget belowSubview:self.widgetPanelStack];
|
||||
|
||||
@@ -569,6 +573,7 @@
|
||||
[newWidget resizeWidgetView]; // resize must be called after relocation
|
||||
[newWidget adjustTransparencyWithAlpha:widget.backgroundAlpha];
|
||||
[newWidget adjustBorderWithWidth:widget.borderWidth];
|
||||
[newWidget setVibrationWithStyle:widget.vibrationStyle];
|
||||
[self.OnScreenWidgetViews addObject:newWidget];
|
||||
self->selectedWidgetView = newWidget;
|
||||
if(!createNew){
|
||||
@@ -589,6 +594,7 @@
|
||||
[self.view insertSubview:widgetView belowSubview:self.widgetPanelStack];
|
||||
[widgetView setLocationWithPosition:CGPointMake(90, 130)];
|
||||
[widgetView resizeWidgetView];
|
||||
[widgetView setVibrationWithStyle:UIImpactFeedbackStyleLight];
|
||||
}
|
||||
|
||||
|
||||
@@ -667,7 +673,6 @@
|
||||
[self.widgetBorderWidthLabel setText:[LocalizationHelper localizedStringForKey:@"Border Width: %.2f", self->selectedWidgetView.borderWidth]];
|
||||
if([self isIPhone]){
|
||||
self.vibrationStyleSelector.selectedSegmentIndex = self->selectedWidgetView.vibrationStyle;
|
||||
//[self->selectedWidgetView setva]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -696,6 +701,10 @@
|
||||
[self.widgetSizeLabel setText:[LocalizationHelper localizedStringForKey:@"Size: %.2f", sizeFactor]];
|
||||
[self.widgetHeightLabel setText:[LocalizationHelper localizedStringForKey:@"Height: %.2f", sizeFactor]];
|
||||
[self.widgetAlphaLabel setText:[LocalizationHelper localizedStringForKey:@"Alpha: %.2f", alpha]];
|
||||
if([self isIPhone]){
|
||||
NSNumber *style = [OnScreenControls.layerVibrationStyleDic objectForKey:selectedControllerLayer.name];
|
||||
self.vibrationStyleSelector.selectedSegmentIndex = [style unsignedCharValue];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)widgetSizeSliderMoved:(UISlider* )sender{
|
||||
@@ -745,9 +754,24 @@
|
||||
}
|
||||
|
||||
- (void)vibrationStyleChanged:(UISegmentedControl* )sender{
|
||||
bool vibraiontOn;
|
||||
if (@available(iOS 13.0, *)) {
|
||||
vibraiontOn = sender.selectedSegmentIndex < UIImpactFeedbackStyleRigid+1;
|
||||
} else {
|
||||
vibraiontOn = sender.selectedSegmentIndex < UIImpactFeedbackStyleHeavy+1;
|
||||
}
|
||||
if(vibraiontOn){
|
||||
vibrationGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:sender.selectedSegmentIndex];
|
||||
[vibrationGenerator prepare];
|
||||
[vibrationGenerator impactOccurred];
|
||||
NSLog(@"vibration instance: %@", vibrationGenerator);
|
||||
}
|
||||
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||
[self->selectedWidgetView setVibrationWithStyle:sender.selectedSegmentIndex];
|
||||
}
|
||||
if(self->selectedControllerLayer != nil && self->controllerLayerSelected){
|
||||
[OnScreenControls.layerVibrationStyleDic setObject:@(sender.selectedSegmentIndex) forKey:self->selectedControllerLayer.name];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sensitivitySliderMoved:(UISlider* )sender{
|
||||
@@ -848,6 +872,11 @@
|
||||
if([self isIPhone]){
|
||||
[self.vibrationStyleSelector addTarget:self action:@selector(vibrationStyleChanged:) forControlEvents:(UIControlEventValueChanged)];
|
||||
self.vibrationStyleStack.hidden = NO;
|
||||
NSDictionary *normalAttributes = @{
|
||||
NSForegroundColorAttributeName: [UIColor whiteColor]
|
||||
};
|
||||
[self.vibrationStyleSelector setTitleTextAttributes:normalAttributes forState:UIControlStateNormal];
|
||||
|
||||
}
|
||||
|
||||
[self.view bringSubviewToFront:self.toolbarRootView];
|
||||
@@ -875,6 +904,12 @@
|
||||
maskLayer.path = path.CGPath;
|
||||
|
||||
self.widgetPanelStack.layer.mask = maskLayer;
|
||||
|
||||
if (@available(iOS 13.0, *) && self.vibrationStyleSelector.numberOfSegments == 6) {
|
||||
} else {
|
||||
[self.vibrationStyleSelector removeSegmentAtIndex:3 animated:NO];
|
||||
[self.vibrationStyleSelector removeSegmentAtIndex:3 animated:NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1295,7 +1295,7 @@ static NSMutableSet* hostList;
|
||||
[button setImage:image forState:UIControlStateNormal];
|
||||
[button setTitle:[LocalizationHelper localizedStringForKey:@" Add Host"] forState:UIControlStateNormal]; // 注意空格用于间隔
|
||||
} else {
|
||||
[button setTitle:@"Add Host" forState:UIControlStateNormal]; // 注意空格用于间隔
|
||||
[button setTitle:[LocalizationHelper localizedStringForKey:@"Add Host"] forState:UIControlStateNormal]; // 注意空格用于间隔
|
||||
}
|
||||
// [button setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
|
||||
@@ -1335,7 +1335,7 @@ static NSMutableSet* hostList;
|
||||
[button setImage:image forState:UIControlStateNormal];
|
||||
[button setTitle:@"" forState:UIControlStateNormal]; // 注意空格用于间隔
|
||||
} else {
|
||||
[button setTitle:@"Help" forState:UIControlStateNormal]; // 注意空格用于间隔
|
||||
[button setTitle:[LocalizationHelper localizedStringForKey:@"About"] forState:UIControlStateNormal]; // 注意空格用于间隔
|
||||
}
|
||||
// [button setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
|
||||
|
||||
@@ -875,6 +875,8 @@ const int FrontViewPositionNone = 0xff;
|
||||
|
||||
_separatorLine.hidden = _frontViewPosition == FrontViewPositionLeft;
|
||||
|
||||
_contentView.rearNavView.hidden = _frontViewPosition == FrontViewPositionLeft;
|
||||
|
||||
if(_frontViewPosition == FrontViewPositionLeft && currentMenuMode == RemoveSettingItem){
|
||||
[self doneRemoveSettingItemSelected];
|
||||
}
|
||||
@@ -2024,7 +2026,7 @@ const int FrontViewPositionNone = 0xff;
|
||||
(newPosition >= FrontViewPositionRightMostRemoved || newPosition <= FrontViewPositionLeftSideMostRemoved ) &&
|
||||
(_frontViewPosition < FrontViewPositionRightMostRemoved && _frontViewPosition > FrontViewPositionLeftSideMostRemoved && _frontViewPosition != FrontViewPositionNone);
|
||||
|
||||
if ( positionIsChanging )
|
||||
if(positionIsChanging)
|
||||
{
|
||||
if ( [_delegate respondsToSelector:@selector(revealController:willMoveToPosition:)] )
|
||||
[_delegate revealController:self willMoveToPosition:newPosition];
|
||||
|
||||
@@ -415,22 +415,6 @@ BOOL isCustomResolution(CGSize res) {
|
||||
label1.hidden = NO;
|
||||
}
|
||||
|
||||
- (void)updateThemeForLabelsttt:(UIView *)view {
|
||||
for (UIView *subview in view.subviews) {
|
||||
if ([subview isKindOfClass:[UILabel class]]) {
|
||||
UILabel *label = (UILabel *)subview;
|
||||
if(label.accessibilityIdentifier != nil) break;
|
||||
if (@available(iOS 13.0, *)) {
|
||||
label.layer.filters = nil;
|
||||
label.textColor = [ThemeManager textColor];
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
}
|
||||
[self updateThemeForLabels:subview];
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)findCommonSuperViewFor:(UIView *)view1 andView:(UIView *)view2 {
|
||||
if (!view1 || !view2) return nil;
|
||||
// 把 view1 的所有 superview 放入集合
|
||||
@@ -845,7 +829,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
[self addSettingToFavorite:self->capturedStack];
|
||||
self->capturedStack.backgroundColor = [UIColor clearColor];
|
||||
}];
|
||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@""
|
||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:[self isIPhone] ? [LocalizationHelper localizedStringForKey:@"Cancel"] : @""
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
self->capturedStack.backgroundColor = [UIColor clearColor];
|
||||
@@ -952,7 +936,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:16 weight:UIImageSymbolWeightMedium];
|
||||
[button setImage:[UIImage systemImageNamed:@"minus.circle" withConfiguration:config] forState:UIControlStateNormal];
|
||||
} else {
|
||||
[button setTitle:@"Remove" forState:UIControlStateNormal];
|
||||
[button setTitle:[LocalizationHelper localizedStringForKey:@"Remove"] forState:UIControlStateNormal];
|
||||
}
|
||||
button.accessibilityIdentifier = @"removeButton";
|
||||
button.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
|
||||
Reference in New Issue
Block a user