Skip to content

Commit 72c221c

Browse files
[create-pull-request] automated change
1 parent cac2084 commit 72c221c

File tree

300 files changed

+2451
-2845
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+2451
-2845
lines changed

src/BlazorWebView/tests/DeviceTests/WebViewHelpers.Shared.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ private static async Task Retry(Func<Task<bool>> tryAction, Func<int, Task<Excep
4141
/// <param name="webView">The WKWebView instance</param>
4242
/// <param name="asyncFunctionBody">The body of the async function (without function wrapper)</param>
4343
/// <returns>The result stored in controlDiv after the async operation completes</returns>
44+
[RequiresUnreferencedCode()]
4445
public static async Task<T?> ExecuteAsyncScriptAndWaitForResult<T>(PlatformWebView webView, string asyncFunctionBody)
4546
{
4647
// Inject script that executes the async function and stores result in controlDiv

src/Compatibility/Core/src/Android/AppCompat/NavigationPageRenderer.cs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,7 @@ void ResetToolbar()
745745
UpdateMenu();
746746

747747
// Preserve old values that can't be replicated by calling methods above
748-
if (_toolbar != null)
749-
_toolbar.Subtitle = oldToolbar.Subtitle;
748+
_toolbar?.Subtitle = oldToolbar.Subtitle;
750749
}
751750

752751
void SetupToolbar()
@@ -784,10 +783,7 @@ Task<bool> SwitchContentAsync(Page page, bool animated, bool removed = false, bo
784783
Current?.SendDisappearing();
785784
Current = page;
786785

787-
if (Platform != null)
788-
{
789-
Platform.NavAnimationInProgress = true;
790-
}
786+
Platform?.NavAnimationInProgress = true;
791787

792788
FragmentTransaction transaction = FragmentManager.BeginTransactionEx();
793789

@@ -859,10 +855,7 @@ Task<bool> SwitchContentAsync(Page page, bool animated, bool removed = false, bo
859855

860856
Context.HideKeyboard(this);
861857

862-
if (Platform != null)
863-
{
864-
Platform.NavAnimationInProgress = false;
865-
}
858+
Platform?.NavAnimationInProgress = false;
866859

867860
return tcs.Task;
868861
}
@@ -982,8 +975,7 @@ void UpdateToolbar()
982975
if (_toolbar.NavigationIcon != null && textColor != null)
983976
{
984977
var icon = _toolbar.NavigationIcon as DrawerArrowDrawable;
985-
if (icon != null)
986-
icon.Color = textColor.ToAndroid().ToArgb();
978+
icon?.Color = textColor.ToAndroid().ToArgb();
987979
}
988980

989981
UpdateTitleIcon();
@@ -1046,8 +1038,7 @@ void UpdateTitleView()
10461038
var rendererType = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : _titleViewRenderer.GetType();
10471039
if (titleView == null || Internals.Registrar.Registered.GetHandlerTypeForObject(titleView) != rendererType)
10481040
{
1049-
if (_titleView != null)
1050-
_titleView.Child = null;
1041+
_titleView?.Child = null;
10511042
Platform.ClearRenderer(_titleViewRenderer.View);
10521043
_titleViewRenderer.Dispose();
10531044
_titleViewRenderer = null;

src/Compatibility/Core/src/Android/AppCompat/Platform.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public class Platform : BindableObject, IPlatformLayout, INavigation
3737
propertyChanged: (bindable, oldvalue, newvalue) =>
3838
{
3939
var view = bindable as VisualElement;
40-
if (view != null)
41-
view.IsPlatformEnabled = newvalue != null;
40+
view?.IsPlatformEnabled = newvalue != null;
4241

4342
if (bindable is IView mauiView)
4443
{

src/Compatibility/Core/src/Android/AppCompat/TabbedPageRenderer.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -552,17 +552,11 @@ void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e)
552552

553553
void ScrollToCurrentPage()
554554
{
555-
if (Platform != null)
556-
{
557-
Platform.NavAnimationInProgress = true;
558-
}
555+
Platform?.NavAnimationInProgress = true;
559556

560557
_viewPager.SetCurrentItem(Element.Children.IndexOf(Element.CurrentPage), Element.OnThisPlatform().IsSmoothScrollEnabled());
561558

562-
if (Platform != null)
563-
{
564-
Platform.NavAnimationInProgress = false;
565-
}
559+
Platform?.NavAnimationInProgress = false;
566560
}
567561

568562
void UpdateIgnoreContainerAreas()

src/Compatibility/Core/src/Android/Cells/SwitchCellRenderer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ void UpdateIsEnabled(SwitchCellView cell, SwitchCell switchCell)
6868
{
6969
cell.Enabled = switchCell.IsEnabled;
7070
var aSwitch = cell.AccessoryView as ASwitch;
71-
if (aSwitch != null)
72-
aSwitch.Enabled = switchCell.IsEnabled;
71+
aSwitch?.Enabled = switchCell.IsEnabled;
7372
}
7473

7574
void UpdateFlowDirection()

src/Compatibility/Core/src/Android/Renderers/DescendantFocusToggler.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ public bool RequestFocus(global::Android.Views.View control, Func<bool> baseRequ
3131
// Call the original RequestFocus implementation for the View
3232
bool result = baseRequestFocus();
3333

34-
if (cfl != null)
35-
{
36-
// Toggle descendantfocusability back to whatever it was
37-
cfl.DescendantFocusability = previousFocusability;
38-
}
34+
// Toggle descendantfocusability back to whatever it was
35+
cfl?.DescendantFocusability = previousFocusability;
3936

4037
return result;
4138
}

src/Compatibility/Core/src/Android/Renderers/ListViewRenderer.cs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ protected override void OnAttachedToWindow()
105105
{
106106
base.OnAttachedToWindow();
107107

108-
if (Control != null)
109-
Control.NestedScrollingEnabled = (Parent.GetParentOfType<NestedScrollView>() != null);
108+
Control?.NestedScrollingEnabled = (Parent.GetParentOfType<NestedScrollView>() != null);
110109

111110
_isAttached = true;
112111
_adapter.IsAttachedToWindow = _isAttached;
@@ -349,8 +348,7 @@ void UpdateFooter()
349348
var rendererType = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : _footerRenderer.GetType();
350349
if (footer == null || Registrar.Registered.GetHandlerTypeForObject(footer) != rendererType)
351350
{
352-
if (_footerView != null)
353-
_footerView.Child = null;
351+
_footerView?.Child = null;
354352
Platform.ClearRenderer(_footerRenderer.View);
355353
_footerRenderer.Dispose();
356354
_footerRenderer = null;
@@ -365,8 +363,7 @@ void UpdateFooter()
365363
else
366364
{
367365
_footerRenderer = Platform.CreateRenderer(footer, Context);
368-
if (_footerView != null)
369-
_footerView.Child = _footerRenderer;
366+
_footerView?.Child = _footerRenderer;
370367
}
371368

372369
Platform.SetRenderer(footer, _footerRenderer);
@@ -381,8 +378,7 @@ void UpdateHeader()
381378
var rendererType = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : _headerRenderer.GetType();
382379
if (header == null || Registrar.Registered.GetHandlerTypeForObject(header) != rendererType)
383380
{
384-
if (_headerView != null)
385-
_headerView.Child = null;
381+
_headerView?.Child = null;
386382
Platform.ClearRenderer(_headerRenderer.View);
387383
_headerRenderer.Dispose();
388384
_headerRenderer = null;
@@ -397,8 +393,7 @@ void UpdateHeader()
397393
else
398394
{
399395
_headerRenderer = Platform.CreateRenderer(header, Context);
400-
if (_headerView != null)
401-
_headerView.Child = _headerRenderer;
396+
_headerView?.Child = _headerRenderer;
402397
}
403398

404399
Platform.SetRenderer(header, _headerRenderer);
@@ -427,16 +422,12 @@ void UpdateIsRefreshing(bool isInitialValue = false)
427422

428423
void UpdateIsSwipeToRefreshEnabled()
429424
{
430-
if (_refresh != null)
431-
_refresh.Enabled = Element.IsPullToRefreshEnabled && (Element as IListViewController).RefreshAllowed;
425+
_refresh?.Enabled = Element.IsPullToRefreshEnabled && (Element as IListViewController).RefreshAllowed;
432426
}
433427

434428
void UpdateFastScrollEnabled()
435429
{
436-
if (Control != null)
437-
{
438-
Control.FastScrollEnabled = Element.OnThisPlatform().IsFastScrollEnabled();
439-
}
430+
Control?.FastScrollEnabled = Element.OnThisPlatform().IsFastScrollEnabled();
440431
}
441432

442433
void UpdateSelectionMode()

src/Compatibility/Core/src/Android/Renderers/SearchBarRenderer.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,7 @@ void UpdateEnabled()
226226
else
227227
control.InputType = (int)_inputType;
228228

229-
if (_editText != null)
230-
{
231-
_editText.Enabled = model.IsEnabled;
232-
}
229+
_editText?.Enabled = model.IsEnabled;
233230
}
234231

235232
void ClearFocus(SearchView view)
@@ -275,10 +272,7 @@ void UpdateCharacterSpacing()
275272
{
276273
_editText = _editText ?? Control.GetChildrenOfType<AppCompatAutoCompleteTextView>().FirstOrDefault();
277274

278-
if (_editText != null)
279-
{
280-
_editText.LetterSpacing = Element.CharacterSpacing.ToEm();
281-
}
275+
_editText?.LetterSpacing = Element.CharacterSpacing.ToEm();
282276
}
283277

284278
void UpdateTextColor()
@@ -334,8 +328,7 @@ void UpdateInputType()
334328
if (keyboard == Keyboard.Numeric)
335329
{
336330
_editText = _editText ?? Control.GetChildrenOfType<AppCompatAutoCompleteTextView>().FirstOrDefault();
337-
if (_editText != null)
338-
_editText.KeyListener = GetDigitsKeyListener(_inputType);
331+
_editText?.KeyListener = GetDigitsKeyListener(_inputType);
339332
}
340333
}
341334

src/Compatibility/Core/src/Android/Renderers/SwipeViewRenderer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,8 +1468,7 @@ void ExecuteSwipeItem(ISwipeItem item)
14681468

14691469
void EnableParentGesture(bool isGestureEnabled)
14701470
{
1471-
if (_viewPagerParent != null)
1472-
_viewPagerParent.EnableGesture = isGestureEnabled;
1471+
_viewPagerParent?.EnableGesture = isGestureEnabled;
14731472
}
14741473

14751474
void OnOpenRequested(object sender, OpenRequestedEventArgs e)

src/Compatibility/Core/src/Android/Renderers/TableViewRenderer.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ protected override void OnAttachedToWindow()
5757
{
5858
base.OnAttachedToWindow();
5959

60-
if (Control != null)
61-
Control.NestedScrollingEnabled = (Parent.GetParentOfType<NestedScrollView>() != null);
60+
Control?.NestedScrollingEnabled = (Parent.GetParentOfType<NestedScrollView>() != null);
6261
}
6362

6463
protected override void Dispose(bool disposing)
@@ -73,10 +72,7 @@ protected override void Dispose(bool disposing)
7372
if (disposing)
7473
{
7574
// Unhook the adapter from the ListView before disposing of it
76-
if (Control != null)
77-
{
78-
Control.Adapter = null;
79-
}
75+
Control?.Adapter = null;
8076

8177
_adapter?.Dispose();
8278
_adapter = null;

0 commit comments

Comments
 (0)