- legacy osc vibration style
- vibration style ios13 compatibility - low ios verision UI fixes
This commit is contained in:
@@ -484,6 +484,8 @@
|
||||
<segment title="rigid"/>
|
||||
<segment title="off"/>
|
||||
</segments>
|
||||
<color key="tintColor" systemColor="systemGray2Color"/>
|
||||
<color key="selectedSegmentTintColor" red="0.23136288842322539" green="0.45776400812558971" blue="0.51492406781186773" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</segmentedControl>
|
||||
</subviews>
|
||||
<constraints>
|
||||
@@ -1460,6 +1462,9 @@
|
||||
<systemColor name="systemBrownColor">
|
||||
<color red="0.63529411764705879" green="0.51764705882352946" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemGray2Color">
|
||||
<color red="0.68235294117647061" green="0.68235294117647061" blue="0.69803921568627447" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemTealColor">
|
||||
<color red="0.18823529411764706" green="0.69019607843137254" blue="0.7803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
_view = view;
|
||||
_view.multipleTouchEnabled = false;
|
||||
|
||||
|
||||
self = [super initWithView:view controllerSup:controllerSupport streamConfig:streamConfig];
|
||||
self.isLayingOut = true; // make sure the super class have a flag to tell it's currently laying out the OSCs, intead play mode.
|
||||
|
||||
@@ -337,6 +337,14 @@ static CGRect streamViewBounds;
|
||||
buttonState.isHidden = oscButtonLayer.isHidden;
|
||||
buttonState.oscLayerSizeFactor = [OnScreenControls getControllerLayerSizeFactor:oscButtonLayer];
|
||||
buttonState.backgroundAlpha = oscButtonLayer.opacity;
|
||||
|
||||
NSNumber *style = [OnScreenControls.layerVibrationStyleDic objectForKey:oscButtonLayer.name];
|
||||
if ([style isKindOfClass:[NSNumber class]]) {
|
||||
buttonState.vibrationStyle = [style unsignedCharValue];
|
||||
// 使用 val
|
||||
}
|
||||
else buttonState.vibrationStyle = UIImpactFeedbackStyleLight;
|
||||
|
||||
// NSLog(@"oscLayerName: %@, opacity: %f, ", oscButtonLayer.name, buttonState.backgroundAlpha);
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ static const float BUTTON_DIST = 20;
|
||||
CGFloat _dPadSizeFactor;
|
||||
}
|
||||
|
||||
+ (NSMutableDictionary *)layerVibrationStyleDic;
|
||||
|
||||
typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
|
||||
OnScreenControlsLevelOff,
|
||||
OnScreenControlsLevelSimple,
|
||||
@@ -104,6 +106,8 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
|
||||
@property OnScreenControlsLevel _level;
|
||||
|
||||
@property NSMutableArray *OSCButtonLayers;
|
||||
@property NSMutableDictionary* layerVibrationStyleDic;
|
||||
|
||||
|
||||
|
||||
+ (NSMutableSet* )touchAddrsCapturedByOnScreenControls;
|
||||
|
||||
@@ -56,6 +56,8 @@ static NSSet *validPositionButtonNames;
|
||||
NSDate* l3TouchStart;
|
||||
NSDate* r3TouchStart;
|
||||
|
||||
UIImpactFeedbackGenerator* vibrationGenerator;
|
||||
|
||||
BOOL l3Set;
|
||||
BOOL r3Set;
|
||||
|
||||
@@ -219,7 +221,6 @@ static float L3_Y;
|
||||
_originalControllerLayerOpacityDict = [[NSMutableDictionary alloc] init];
|
||||
// we have to retrieve largerStickLR1 setting direct from the database, since streamConfig is invalid in LayoutOnScreenControls
|
||||
DataManager* dataMan = [[DataManager alloc] init];
|
||||
Settings* settings = [dataMan retrieveSettings];
|
||||
_largerStickLR1 = true;
|
||||
_oscTapExlusionAreaSizeFactor = 1.05;
|
||||
|
||||
@@ -370,6 +371,7 @@ static float L3_Y;
|
||||
for (NSData *buttonStateEncoded in oscProfile.buttonStates) {
|
||||
OnScreenButtonState* buttonState = [profilesManager unarchiveButtonStateEncoded:buttonStateEncoded];
|
||||
buttonState.position = [self denormalizeWidgetPosition:buttonState.position];
|
||||
[OnScreenControls.layerVibrationStyleDic setObject:@(buttonState.vibrationStyle) forKey:buttonState.name];
|
||||
if(!buttonState.isHidden && [validPositionButtonNames containsObject:buttonState.name] && (buttonState.buttonType == LegacyOscButton || [profilesManager getIndexOfSelectedProfile] == 0 ) ){
|
||||
[_activeCustomOscButtonPositionDict setObject:[NSValue valueWithCGPoint:buttonState.position] forKey:buttonState.name]; // we got a buttonname -> position dict here
|
||||
// NSLog(@"_activeCustomOscButtonPositionDict update, button name:%@, position: %f, %f", buttonState.name, buttonState.position.x, buttonState.position.y);
|
||||
@@ -1098,7 +1100,7 @@ static float L3_Y;
|
||||
// Allow the user to slide their finger to another d-pad button
|
||||
if ([_upButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:UP_FLAG];
|
||||
[self oscButtonTouchDownVisualEffect:_upButton];
|
||||
[self oscButtonTouchDownFeedback:_upButton];
|
||||
updated = true;
|
||||
} else {
|
||||
_upButton.opacity = [_originalControllerLayerOpacityDict[_upButton.name] floatValue];
|
||||
@@ -1107,7 +1109,7 @@ static float L3_Y;
|
||||
|
||||
if ([_downButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:DOWN_FLAG];
|
||||
[self oscButtonTouchDownVisualEffect:_downButton];
|
||||
[self oscButtonTouchDownFeedback:_downButton];
|
||||
updated = true;
|
||||
} else {
|
||||
_downButton.opacity = [_originalControllerLayerOpacityDict[_downButton.name] floatValue];
|
||||
@@ -1116,7 +1118,7 @@ static float L3_Y;
|
||||
|
||||
if ([_leftButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:LEFT_FLAG];
|
||||
[self oscButtonTouchDownVisualEffect:_leftButton];
|
||||
[self oscButtonTouchDownFeedback:_leftButton];
|
||||
updated = true;
|
||||
} else {
|
||||
_leftButton.opacity = [_originalControllerLayerOpacityDict[_leftButton.name] floatValue];
|
||||
@@ -1125,7 +1127,7 @@ static float L3_Y;
|
||||
|
||||
if ([_rightButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:RIGHT_FLAG];
|
||||
[self oscButtonTouchDownVisualEffect:_rightButton];
|
||||
[self oscButtonTouchDownFeedback:_rightButton];
|
||||
updated = true;
|
||||
} else {
|
||||
_rightButton.opacity = [_originalControllerLayerOpacityDict[_rightButton.name] floatValue];
|
||||
@@ -1172,7 +1174,7 @@ static float L3_Y;
|
||||
}
|
||||
|
||||
|
||||
- (void)oscButtonTouchDownVisualEffect:(CALayer* )button{
|
||||
- (void)oscButtonTouchDownFeedback:(CALayer* )button{
|
||||
[CATransaction begin];
|
||||
[CATransaction setDisableActions:YES];
|
||||
|
||||
@@ -1200,6 +1202,26 @@ static float L3_Y;
|
||||
button.shadowOffset = CGSizeZero;
|
||||
button.shadowOpacity = 1.0;
|
||||
button.shadowRadius = 0.0; // Adjust the radius to simulate border thickness
|
||||
|
||||
NSNumber *style = [OnScreenControls.layerVibrationStyleDic objectForKey:button.name];
|
||||
uint8_t vibrationStyle = [style unsignedCharValue];
|
||||
|
||||
bool vibraiontOn;
|
||||
if (@available(iOS 13.0, *)) {
|
||||
vibraiontOn = vibrationStyle < UIImpactFeedbackStyleRigid+1;
|
||||
} else {
|
||||
vibraiontOn = vibrationStyle < UIImpactFeedbackStyleHeavy+1;
|
||||
}
|
||||
// NSLog(@"vibration on: %d",vibraiontOn);
|
||||
|
||||
if(vibraiontOn){
|
||||
vibrationGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:vibrationStyle];
|
||||
[vibrationGenerator prepare];
|
||||
[vibrationGenerator impactOccurred];
|
||||
NSLog(@"vibration instance: %@",vibrationGenerator);
|
||||
}
|
||||
|
||||
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
@@ -1217,28 +1239,28 @@ static float L3_Y;
|
||||
if ([_aButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:A_FLAG];
|
||||
_aTouch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_aButton];
|
||||
[self oscButtonTouchDownFeedback:_aButton];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC A");
|
||||
} else if ([_bButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:B_FLAG];
|
||||
_bTouch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_bButton];
|
||||
[self oscButtonTouchDownFeedback:_bButton];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC B");
|
||||
} else if ([_xButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:X_FLAG];
|
||||
_xTouch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_xButton];
|
||||
[self oscButtonTouchDownFeedback:_xButton];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC X");
|
||||
} else if ([_yButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:Y_FLAG];
|
||||
_yTouch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_yButton];
|
||||
[self oscButtonTouchDownFeedback:_yButton];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC Y");
|
||||
@@ -1246,7 +1268,7 @@ static float L3_Y;
|
||||
[_controllerSupport setButtonFlag:_controller flags:UP_FLAG];
|
||||
_dpadTouch = touch;
|
||||
_upTouch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_upButton];
|
||||
[self oscButtonTouchDownFeedback:_upButton];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC UP");
|
||||
@@ -1254,14 +1276,14 @@ static float L3_Y;
|
||||
[_controllerSupport setButtonFlag:_controller flags:DOWN_FLAG];
|
||||
_dpadTouch = touch;
|
||||
_downTouch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_downButton];
|
||||
[self oscButtonTouchDownFeedback:_downButton];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
} else if ([_leftButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:LEFT_FLAG];
|
||||
_dpadTouch = touch;
|
||||
_leftTouch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_leftButton];
|
||||
[self oscButtonTouchDownFeedback:_leftButton];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC LEFT");
|
||||
@@ -1269,49 +1291,49 @@ static float L3_Y;
|
||||
[_controllerSupport setButtonFlag:_controller flags:RIGHT_FLAG];
|
||||
_dpadTouch = touch;
|
||||
_rightTouch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_rightButton];
|
||||
[self oscButtonTouchDownFeedback:_rightButton];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC RIGHT");
|
||||
} else if ([_startButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:PLAY_FLAG];
|
||||
_startTouch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_startButton];
|
||||
[self oscButtonTouchDownFeedback:_startButton];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC PLAY");
|
||||
} else if ([_selectButton.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:BACK_FLAG];
|
||||
_selectTouch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_selectButton];
|
||||
[self oscButtonTouchDownFeedback:_selectButton];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC BACK");
|
||||
} else if ([_l1Button.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:LB_FLAG];
|
||||
_l1Touch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_l1Button];
|
||||
[self oscButtonTouchDownFeedback:_l1Button];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC LB");
|
||||
} else if ([_r1Button.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:RB_FLAG];
|
||||
_r1Touch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_r1Button];
|
||||
[self oscButtonTouchDownFeedback:_r1Button];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC RB");
|
||||
} else if ([_l2Button.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport updateLeftTrigger:_controller left:0xFF];
|
||||
_l2Touch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_l2Button];
|
||||
[self oscButtonTouchDownFeedback:_l2Button];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC LeftTrigger");
|
||||
} else if ([_r2Button.presentationLayer hitTest:touchLocation]) {
|
||||
[_controllerSupport updateRightTrigger:_controller right:0xFF];
|
||||
_r2Touch = touch;
|
||||
[self oscButtonTouchDownVisualEffect:_r2Button];
|
||||
[self oscButtonTouchDownFeedback:_r2Button];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC RightTrigger");
|
||||
@@ -1351,7 +1373,7 @@ static float L3_Y;
|
||||
double l3TouchTime = [l3TouchStart timeIntervalSinceNow] * -1000.0;
|
||||
if (l3TouchTime < STICK_CLICK_RATE) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:LS_CLK_FLAG];
|
||||
[self oscButtonTouchDownVisualEffect:_leftStick];
|
||||
[self oscButtonTouchDownFeedback:_leftStick];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC LS_CLK3");
|
||||
@@ -1369,7 +1391,7 @@ static float L3_Y;
|
||||
double r3TouchTime = [r3TouchStart timeIntervalSinceNow] * -1000.0;
|
||||
if (r3TouchTime < STICK_CLICK_RATE) {
|
||||
[_controllerSupport setButtonFlag:_controller flags:RS_CLK_FLAG];
|
||||
[self oscButtonTouchDownVisualEffect:_rightStick];
|
||||
[self oscButtonTouchDownFeedback:_rightStick];
|
||||
updated = true;
|
||||
touchEventCapturedByOsc = true;
|
||||
// NSLog(@"Captured OSC LS_CLK4");
|
||||
@@ -1946,5 +1968,14 @@ static float L3_Y;
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSMutableDictionary *)layerVibrationStyleDic{
|
||||
static NSMutableDictionary *dict = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
dict = [NSMutableDictionary dictionary];
|
||||
});
|
||||
return dict;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -283,6 +283,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"About" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "关于"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "关于"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "关于"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Add" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
@@ -381,6 +404,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Add to favorite" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "收藏"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "收藏"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "收藏"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Alias (optional)" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
@@ -703,6 +749,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Collapse" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "收起"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "收起"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "收起"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Command" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
@@ -1635,29 +1704,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Help" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "帮助"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "帮助"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "帮助"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Hide App" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
@@ -2487,6 +2533,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Options" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "选项"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "选项"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "选项"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Others" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
@@ -2901,6 +2970,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Remove" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "移除"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "移除"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "移除"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Remove Host" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
|
||||
+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