Skip to content

Commit f635224

Browse files
[create-pull-request] automated change
1 parent cd7b73d commit f635224

Some content is hidden

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

42 files changed

+76
-196
lines changed

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

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

759759
// Preserve old values that can't be replicated by calling methods above
760-
if (_toolbar != null)
761-
_toolbar.Subtitle = oldToolbar.Subtitle;
760+
_toolbar?.Subtitle = oldToolbar.Subtitle;
762761
}
763762

764763
void SetupToolbar()
@@ -796,10 +795,7 @@ Task<bool> SwitchContentAsync(Page page, bool animated, bool removed = false, bo
796795
Current?.SendDisappearing();
797796
Current = page;
798797

799-
if (Platform != null)
800-
{
801-
Platform.NavAnimationInProgress = true;
802-
}
798+
Platform?.NavAnimationInProgress = true;
803799

804800
FragmentTransaction transaction = FragmentManager.BeginTransactionEx();
805801

@@ -871,10 +867,7 @@ Task<bool> SwitchContentAsync(Page page, bool animated, bool removed = false, bo
871867

872868
Context.HideKeyboard(this);
873869

874-
if (Platform != null)
875-
{
876-
Platform.NavAnimationInProgress = false;
877-
}
870+
Platform?.NavAnimationInProgress = false;
878871

879872
return tcs.Task;
880873
}
@@ -994,8 +987,7 @@ void UpdateToolbar()
994987
if (_toolbar.NavigationIcon != null && textColor != null)
995988
{
996989
var icon = _toolbar.NavigationIcon as DrawerArrowDrawable;
997-
if (icon != null)
998-
icon.Color = textColor.ToAndroid().ToArgb();
990+
icon?.Color = textColor.ToAndroid().ToArgb();
999991
}
1000992

1001993
UpdateTitleIcon();
@@ -1058,8 +1050,7 @@ void UpdateTitleView()
10581050
var rendererType = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : _titleViewRenderer.GetType();
10591051
if (titleView == null || Internals.Registrar.Registered.GetHandlerTypeForObject(titleView) != rendererType)
10601052
{
1061-
if (_titleView != null)
1062-
_titleView.Child = null;
1053+
_titleView?.Child = null;
10631054
Platform.ClearRenderer(_titleViewRenderer.View);
10641055
_titleViewRenderer.Dispose();
10651056
_titleViewRenderer = null;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public class Platform : BindableObject, IPlatformLayout, INavigation
3535
propertyChanged: (bindable, oldvalue, newvalue) =>
3636
{
3737
var view = bindable as VisualElement;
38-
if (view != null)
39-
view.IsPlatformEnabled = newvalue != null;
38+
view?.IsPlatformEnabled = newvalue != null;
4039

4140
if (bindable is IView mauiView)
4241
{

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

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

556556
void ScrollToCurrentPage()
557557
{
558-
if (Platform != null)
559-
{
560-
Platform.NavAnimationInProgress = true;
561-
}
558+
Platform?.NavAnimationInProgress = true;
562559

563560
_viewPager.SetCurrentItem(Element.Children.IndexOf(Element.CurrentPage), Element.OnThisPlatform().IsSmoothScrollEnabled());
564561

565-
if (Platform != null)
566-
{
567-
Platform.NavAnimationInProgress = false;
568-
}
562+
Platform?.NavAnimationInProgress = false;
569563
}
570564

571565
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/DatePickerRenderer.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,19 +196,13 @@ void UpdateFont()
196196
[PortHandler]
197197
void UpdateMaximumDate()
198198
{
199-
if (_dialog != null)
200-
{
201-
_dialog.DatePicker.MaxDate = (long)Element.MaximumDate.ToUniversalTime().Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds;
202-
}
199+
_dialog?.DatePicker.MaxDate = (long)Element.MaximumDate.ToUniversalTime().Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds;
203200
}
204201

205202
[PortHandler]
206203
void UpdateMinimumDate()
207204
{
208-
if (_dialog != null)
209-
{
210-
_dialog.DatePicker.MinDate = (long)Element.MinimumDate.ToUniversalTime().Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds;
211-
}
205+
_dialog?.DatePicker.MinDate = (long)Element.MinimumDate.ToUniversalTime().Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds;
212206
}
213207

214208
abstract protected void UpdateTextColor();

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
@@ -108,8 +108,7 @@ protected override void OnAttachedToWindow()
108108
{
109109
base.OnAttachedToWindow();
110110

111-
if (Control != null)
112-
Control.NestedScrollingEnabled = (Parent.GetParentOfType<NestedScrollView>() != null);
111+
Control?.NestedScrollingEnabled = (Parent.GetParentOfType<NestedScrollView>() != null);
113112

114113
_isAttached = true;
115114
_adapter.IsAttachedToWindow = _isAttached;
@@ -355,8 +354,7 @@ void UpdateFooter()
355354
var rendererType = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : _footerRenderer.GetType();
356355
if (footer == null || Registrar.Registered.GetHandlerTypeForObject(footer) != rendererType)
357356
{
358-
if (_footerView != null)
359-
_footerView.Child = null;
357+
_footerView?.Child = null;
360358
Platform.ClearRenderer(_footerRenderer.View);
361359
_footerRenderer.Dispose();
362360
_footerRenderer = null;
@@ -371,8 +369,7 @@ void UpdateFooter()
371369
else
372370
{
373371
_footerRenderer = Platform.CreateRenderer(footer, Context);
374-
if (_footerView != null)
375-
_footerView.Child = _footerRenderer;
372+
_footerView?.Child = _footerRenderer;
376373
}
377374

378375
Platform.SetRenderer(footer, _footerRenderer);
@@ -387,8 +384,7 @@ void UpdateHeader()
387384
var rendererType = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : _headerRenderer.GetType();
388385
if (header == null || Registrar.Registered.GetHandlerTypeForObject(header) != rendererType)
389386
{
390-
if (_headerView != null)
391-
_headerView.Child = null;
387+
_headerView?.Child = null;
392388
Platform.ClearRenderer(_headerRenderer.View);
393389
_headerRenderer.Dispose();
394390
_headerRenderer = null;
@@ -403,8 +399,7 @@ void UpdateHeader()
403399
else
404400
{
405401
_headerRenderer = Platform.CreateRenderer(header, Context);
406-
if (_headerView != null)
407-
_headerView.Child = _headerRenderer;
402+
_headerView?.Child = _headerRenderer;
408403
}
409404

410405
Platform.SetRenderer(header, _headerRenderer);
@@ -433,16 +428,12 @@ void UpdateIsRefreshing(bool isInitialValue = false)
433428

434429
void UpdateIsSwipeToRefreshEnabled()
435430
{
436-
if (_refresh != null)
437-
_refresh.Enabled = Element.IsPullToRefreshEnabled && (Element as IListViewController).RefreshAllowed;
431+
_refresh?.Enabled = Element.IsPullToRefreshEnabled && (Element as IListViewController).RefreshAllowed;
438432
}
439433

440434
void UpdateFastScrollEnabled()
441435
{
442-
if (Control != null)
443-
{
444-
Control.FastScrollEnabled = Element.OnThisPlatform().IsFastScrollEnabled();
445-
}
436+
Control?.FastScrollEnabled = Element.OnThisPlatform().IsFastScrollEnabled();
446437
}
447438

448439
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
@@ -1471,8 +1471,7 @@ void ExecuteSwipeItem(ISwipeItem item)
14711471

14721472
void EnableParentGesture(bool isGestureEnabled)
14731473
{
1474-
if (_viewPagerParent != null)
1475-
_viewPagerParent.EnableGesture = isGestureEnabled;
1474+
_viewPagerParent?.EnableGesture = isGestureEnabled;
14761475
}
14771476

14781477
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
if (_adapter != null)
8278
{

0 commit comments

Comments
 (0)