Skip to content

Commit

Permalink
sealed some internal classes in Controls.Core that are not inhe…
Browse files Browse the repository at this point in the history
…rited from (2) (#17671)

Co-authored-by: Lehonti Ramos <lehonti@ramos>
  • Loading branch information
Lehonti and Lehonti Ramos authored Jan 15, 2024
1 parent fceed19 commit c20f10d
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected override void DisconnectHandler(AView platformView)
c?.DisconnectHandler();
}

internal class ViewCellContainer : ViewGroup, INativeElementView
internal sealed class ViewCellContainer : ViewGroup, INativeElementView
{
readonly View _parent;
readonly BindableProperty _rowHeight;
Expand Down Expand Up @@ -147,20 +147,11 @@ public ViewCellContainer(Context context, IPlatformViewHandler view, ViewCell vi
UpdateWatchForLongPress();
}

protected bool ParentHasUnevenRows
{
get { return (bool)_parent.GetValue(_unevenRows); }
}
private bool ParentHasUnevenRows => (bool)_parent.GetValue(_unevenRows);

protected int ParentRowHeight
{
get { return (int)_parent.GetValue(_rowHeight); }
}
private int ParentRowHeight => (int)_parent.GetValue(_rowHeight);

public Element Element
{
get { return _viewCell; }
}
public Element Element => _viewCell;

public override bool OnInterceptTouchEvent(MotionEvent ev)
{
Expand Down Expand Up @@ -370,7 +361,7 @@ void TriggerLongClick()
ListViewRenderer?.LongClickOn(this);
}

internal class TapGestureListener : Java.Lang.Object, GestureDetector.IOnGestureListener
internal sealed class TapGestureListener : Java.Lang.Object, GestureDetector.IOnGestureListener
{
readonly Action _onClick;

Expand Down Expand Up @@ -415,7 +406,7 @@ public bool OnSingleTapUp(MotionEvent e)
}
}

internal class LongPressGestureListener : Java.Lang.Object, GestureDetector.IOnGestureListener
internal sealed class LongPressGestureListener : Java.Lang.Object, GestureDetector.IOnGestureListener
{
readonly Action _onLongClick;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ListViewRenderer() : base(Mapper, CommandMapper)
AutoPackage = false;
}

internal class ListViewTransparent : WListView
internal sealed class ListViewTransparent : WListView
{
internal ListViewRenderer ListViewRenderer { get; }
public ListViewTransparent(ListViewRenderer listViewRenderer) : base()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace Microsoft.Maui.Controls.Handlers.Compatibility
{
internal class ContextActionsCell : UITableViewCell, INativeElementView
internal sealed class ContextActionsCell : UITableViewCell, INativeElementView
{
public const string Key = "ContextActionsCell";

Expand Down Expand Up @@ -58,15 +58,9 @@ public ContextActionsCell(string templateId) : base(UITableViewCellStyle.Default

public UITableViewCell ContentCell { get; private set; }

public bool IsOpen
{
get { return ScrollDelegate.IsOpen; }
}
public bool IsOpen => ScrollDelegate.IsOpen;

ContextScrollViewDelegate ScrollDelegate
{
get { return (ContextScrollViewDelegate)_scroller.Delegate; }
}
ContextScrollViewDelegate ScrollDelegate => (ContextScrollViewDelegate)_scroller.Delegate;

Element INativeElementView.Element
{
Expand Down Expand Up @@ -628,7 +622,7 @@ internal static void SetupSelection(UITableView table)
table.AddGestureRecognizer(new SelectGestureRecognizer());
}

class SelectGestureRecognizer : UITapGestureRecognizer
private sealed class SelectGestureRecognizer : UITapGestureRecognizer
{
NSIndexPath _lastPath;

Expand Down Expand Up @@ -663,12 +657,9 @@ static void Tapped(UIGestureRecognizer recognizer)
}
}

class MoreActionSheetController : UIAlertController
private sealed class MoreActionSheetController : UIAlertController
{
public override UIAlertControllerStyle PreferredStyle
{
get { return UIAlertControllerStyle.ActionSheet; }
}
public override UIAlertControllerStyle PreferredStyle => UIAlertControllerStyle.ActionSheet;

public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Microsoft.Maui.Controls.Handlers.Compatibility
{
internal class iOS7ButtonContainer : UIView
internal sealed class iOS7ButtonContainer : UIView
{
readonly nfloat _buttonWidth;

Expand Down Expand Up @@ -37,7 +37,7 @@ public override void LayoutSubviews()
}
}

internal class ContextScrollViewDelegate : UIScrollViewDelegate
internal sealed class ContextScrollViewDelegate : UIScrollViewDelegate
{
readonly nfloat _finalButtonSize;
UIView _backgroundView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ void UpdateHorizontalScrollBarVisibility()
}
}

internal class UnevenListViewDataSource : ListViewDataSource
internal sealed class UnevenListViewDataSource : ListViewDataSource
{
IPlatformViewHandler _prototype;
bool _disposed;
Expand Down Expand Up @@ -1500,7 +1500,7 @@ public override void LayoutSubviews()
}
}

internal class FormsUITableViewController : UITableViewController
internal sealed class FormsUITableViewController : UITableViewController
{
ListView _list;
UIRefreshControl _refresh;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell,
return cell;
}

internal class ViewTableCell : UITableViewCell, INativeElementView
internal sealed class ViewTableCell : UITableViewCell, INativeElementView
{
IMauiContext MauiContext => _viewCell.FindMauiContext();
WeakReference<IPlatformViewHandler> _rendererRef;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace Microsoft.Maui.Controls.Platform.Compatibility
{
// This is used to monitor an xplat View and apply layout changes
internal class ShellViewRenderer
internal sealed class ShellViewRenderer
{
public IViewHandler Handler { get; private set; }
IView _view;
Expand Down Expand Up @@ -96,7 +96,7 @@ public Graphics.Size Measure(int widthMeasureSpec, int heightMeasureSpec, int? m
return ((IPlatformViewHandler)_view.Handler).MeasureVirtualView(widthMeasureSpec, heightMeasureSpec);
}

public virtual void OnViewSet(IView view)
public void OnViewSet(IView view)
{
if (view == View)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ protected override void Dispose(bool disposing)
}
}

internal class ScrollLayoutManager : LinearLayoutManager
internal sealed class ScrollLayoutManager : LinearLayoutManager
{
public ScrollMode ScrollVertically { get; set; } = ScrollMode.Auto;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Microsoft.Maui.Controls.Platform.Compatibility
{
internal class ShellFragmentContainer : Fragment
internal sealed class ShellFragmentContainer : Fragment
{
Page _page;
IMauiContext _mauiContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Microsoft.Maui.Controls.Platform.Compatibility
{
internal class ShellFragmentStateAdapter : FragmentStateAdapter
internal sealed class ShellFragmentStateAdapter : FragmentStateAdapter
{
bool _disposed;
ShellSection _shellSection;
Expand Down

0 comments on commit c20f10d

Please sign in to comment.