@@ -172,6 +172,72 @@ public partial class SfNumericEntry : SfView, ITextElement, ITouchListener, IKey
172
172
/// Another separator string for UI layout.
173
173
/// </summary>
174
174
string ? _anotherSeparator ;
175
+
176
+ /// <summary>
177
+ /// Height of the toolbar in points.
178
+ /// </summary>
179
+ const float ToolbarHeight = 50.0f ;
180
+
181
+ /// <summary>
182
+ /// Thickness of separator lines in points.
183
+ /// </summary>
184
+ const float LineThickness = 0.5f ;
185
+
186
+ /// <summary>
187
+ /// Width threshold for small screens in points.
188
+ /// </summary>
189
+ const float SmallScreenWidth = 320.0f ;
190
+
191
+ /// <summary>
192
+ /// Width threshold for medium screens in points.
193
+ /// </summary>
194
+ const float LargeScreenWidth = 667.0f ;
195
+
196
+ /// <summary>
197
+ /// Divisor used to calculate button width.
198
+ /// </summary>
199
+ const int ButtonDivider = 3 ;
200
+
201
+ /// <summary>
202
+ /// Button spacing for small landscape screens.
203
+ /// </summary>
204
+ const float SmallLandscapeButtonSpacing = 2.5f ;
205
+
206
+ /// <summary>
207
+ /// Separator spacing for small landscape screens.
208
+ /// </summary>
209
+ const float SmallLandscapeSeparatorSpacing = 5.0f ;
210
+
211
+ /// <summary>
212
+ /// Button spacing for large landscape screens.
213
+ /// </summary>
214
+ const float LargeLandscapeButtonSpacing = 3.1f ;
215
+
216
+ /// <summary>
217
+ /// Separator spacing for large landscape screens.
218
+ /// </summary>
219
+ const float LargeLandscapeSeparatorSpacing = 6.1f ;
220
+
221
+ /// <summary>
222
+ /// Button spacing for medium portrait screens.
223
+ /// </summary>
224
+ const float MediumPortraitButtonSpacing = 2.0f ;
225
+
226
+ /// <summary>
227
+ /// Separator spacing for medium portrait screens.
228
+ /// </summary>
229
+ const float MediumPortraitSeparatorSpacing = 4.0f ;
230
+
231
+ /// <summary>
232
+ /// Button spacing for small portrait screens.
233
+ /// </summary>
234
+ const float SmallPortraitButtonSpacing = 1.5f ;
235
+
236
+ /// <summary>
237
+ /// Separator spacing for small portrait screens.
238
+ /// </summary>
239
+ const float SmallPortraitSeparatorSpacing = 3.0f ;
240
+
175
241
#endif
176
242
#elif WINDOWS
177
243
/// <summary>
@@ -403,7 +469,7 @@ protected override List<SemanticsNode> GetSemanticsNodesCore(double width, doubl
403
469
{
404
470
// Ensure any necessary size updates are performed
405
471
UpdateSemanticsSizes ( ) ;
406
- if ( SemanticsDataIsCurrent ( ) )
472
+ if ( SemanticsDataIsCurrent ( ) && IsTextInputLayout )
407
473
{
408
474
return _numericEntrySemanticsNodes ;
409
475
}
@@ -849,11 +915,11 @@ void DeviceRotated(NSNotification notification)
849
915
/// Determines whether the current device orientation is portrait or not.
850
916
/// </summary>
851
917
/// <returns>True if the orientation is portrait or face up/down; otherwise, false.</returns>
852
- static bool IsPortraitOrientation ( )
918
+ static bool IsLandscapeOrientation ( )
853
919
{
854
- return UIDevice . CurrentDevice . Orientation == UIDeviceOrientation . Portrait || UIDevice . CurrentDevice . Orientation == UIDeviceOrientation . PortraitUpsideDown ||
855
- UIDevice . CurrentDevice . Orientation == UIDeviceOrientation . FaceUp || UIDevice . CurrentDevice . Orientation == UIDeviceOrientation . FaceDown ;
856
- }
920
+ return UIDevice . CurrentDevice . Orientation == UIDeviceOrientation . PortraitUpsideDown || UIDevice . CurrentDevice . Orientation == UIDeviceOrientation . LandscapeLeft || UIDevice . CurrentDevice . Orientation == UIDeviceOrientation . LandscapeRight ;
921
+
922
+ }
857
923
858
924
/// <summary>
859
925
/// Configures the frames for minus, separator, and return buttons based on the screen width and provided adjustments.
@@ -878,56 +944,54 @@ void SetButtonFrames(nfloat adjustment, nfloat extraAdjustment)
878
944
}
879
945
}
880
946
881
- /// <summary>
882
- /// Updates the frames and layout of toolbar buttons, adjusting based on screen orientation and size.
883
- /// Ensures the components maintain appropriate spacing and sizing for touch interactions.
884
- /// </summary>
885
- void UpdateFrames ( )
947
+ /// <summary>
948
+ /// Updates the frames and layout of toolbar buttons, adjusting based on screen orientation and size.
949
+ /// Ensures the components maintain appropriate spacing and sizing for touch interactions.
950
+ /// </summary>
951
+ void UpdateFrames ( )
886
952
{
887
- if ( UIDevice . CurrentDevice . Orientation != UIDeviceOrientation . Unknown )
888
- {
889
- if ( _toolbarView == null || _minusButton == null || _separatorButton == null || _returnButton == null
953
+
954
+ if ( _toolbarView == null || _minusButton == null || _separatorButton == null || _returnButton == null
890
955
|| _lineView1 == null || _lineView2 == null || _lineView3 == null || _lineView4 == null )
956
+ {
957
+ return ;
958
+ }
959
+
960
+
961
+ if ( IsLandscapeOrientation ( ) )
962
+ {
963
+ nfloat width = ( nfloat ) Math . Max ( ( double ) UIScreen . MainScreen . Bounds . Height , ( double ) UIScreen . MainScreen . Bounds . Width ) ;
964
+ _buttonWidth = width / ButtonDivider ;
965
+ _toolbarView . Frame = new CGRect ( 0.0f , 0.0f , ( float ) width , ToolbarHeight ) ;
966
+ if ( width <= LargeScreenWidth )
967
+ {
968
+ SetButtonFrames ( SmallLandscapeButtonSpacing , SmallLandscapeSeparatorSpacing ) ;
969
+ }
970
+ else if ( width > LargeScreenWidth )
971
+ {
972
+ SetButtonFrames ( LargeLandscapeButtonSpacing , LargeLandscapeSeparatorSpacing ) ;
973
+ }
974
+ }
975
+ else
976
+ {
977
+ nfloat width = ( nfloat ) Math . Min ( ( double ) UIScreen . MainScreen . Bounds . Height , ( double ) UIScreen . MainScreen . Bounds . Width ) ;
978
+ _buttonWidth = width / ButtonDivider ;
979
+ _toolbarView . Frame = new CGRect ( 0.0f , 0.0f , ( float ) width , ToolbarHeight ) ;
980
+ if ( width > SmallScreenWidth )
891
981
{
892
- return ;
982
+ SetButtonFrames ( MediumPortraitButtonSpacing , MediumPortraitSeparatorSpacing ) ;
893
983
}
984
+ else if ( width <= SmallScreenWidth )
985
+ {
986
+ SetButtonFrames ( SmallPortraitButtonSpacing , SmallPortraitSeparatorSpacing ) ;
894
987
895
- nfloat width = UIScreen . MainScreen . Bounds . Width ;
896
- _buttonWidth = width / 3 ;
897
- _toolbarView . Frame = new CGRect ( 0.0f , 0.0f , ( float ) width , 50.0f ) ;
898
- if ( IsPortraitOrientation ( ) )
899
- {
900
- if ( width <= 375 && width > 320 )
901
- {
902
- SetButtonFrames ( 2 , 4 ) ;
903
- }
904
- else if ( width <= 320 )
905
- {
906
- SetButtonFrames ( ( nfloat ) 1.5 , 3 ) ;
907
-
908
- }
909
- else if ( width > 375 )
910
- {
911
- SetButtonFrames ( 2 , 4 ) ;
912
- }
913
- }
914
- else if ( UIDevice . CurrentDevice . Orientation == UIDeviceOrientation . LandscapeLeft || UIDevice . CurrentDevice . Orientation == UIDeviceOrientation . LandscapeRight )
915
- {
916
- if ( width <= 667 )
917
- {
918
- SetButtonFrames ( ( nfloat ) 2.5 , 5 ) ;
919
- }
920
- else if ( width > 667 )
921
- {
922
- SetButtonFrames ( ( nfloat ) 3.1 , ( nfloat ) 6.1 ) ;
923
- }
924
- }
925
- _lineView1 . Frame = new CGRect ( 0 , 0 , _toolbarView . Frame . Size . Width , 0.5f ) ;
926
- _lineView2 . Frame = new CGRect ( 0 , _toolbarView . Frame . Size . Height - 0.5f , _toolbarView . Frame . Size . Width , 0.5f ) ;
927
- _lineView3 . Frame = new CGRect ( _minusButton . Frame . Right - 0.5f , 0 , 0.5 , _minusButton . Frame . Size . Height ) ;
928
- _lineView4 . Frame = new CGRect ( _returnButton . Frame . Left , 0 , 0.5 , _minusButton . Frame . Size . Height ) ;
929
- }
930
- }
988
+ }
989
+ }
990
+ _lineView1 . Frame = new CGRect ( 0 , 0 , _toolbarView . Frame . Size . Width , LineThickness ) ;
991
+ _lineView2 . Frame = new CGRect ( 0 , _toolbarView . Frame . Size . Height - LineThickness , _toolbarView . Frame . Size . Width , LineThickness ) ;
992
+ _lineView3 . Frame = new CGRect ( _minusButton . Frame . Right - LineThickness , 0 , LineThickness , _minusButton . Frame . Size . Height ) ;
993
+ _lineView4 . Frame = new CGRect ( _returnButton . Frame . Left , 0 , LineThickness , _minusButton . Frame . Size . Height ) ;
994
+ }
931
995
#endif
932
996
#endregion
933
997
}
0 commit comments