Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Renamed NativeView to PlatformView to align naming with .NET MAUI Core
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarezruiz committed May 31, 2023
1 parent ab57c66 commit 86c59ca
Show file tree
Hide file tree
Showing 40 changed files with 207 additions and 207 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace Microsoft.Maui.Graphics.Controls
{
public interface IMixedNativeView : IInvalidatable
public interface IMixedPlatformView : IInvalidatable
{
string[] NativeLayers { get; }
string[] PlatformLayers { get; }
IDrawable Drawable { get; set; }
IMixedGraphicsHandler? GraphicsControl { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ protected override GraphicsDatePicker CreatePlatformView()
return new GraphicsDatePicker(Context!) { GraphicsControl = this };
}

protected override void ConnectHandler(GraphicsDatePicker nativeView)
protected override void ConnectHandler(GraphicsDatePicker platformView)
{
base.ConnectHandler(nativeView);
base.ConnectHandler(platformView);

nativeView.DateSelected += OnDateSelected;
platformView.DateSelected += OnDateSelected;
}

protected override void DisconnectHandler(GraphicsDatePicker nativeView)
protected override void DisconnectHandler(GraphicsDatePicker platformView)
{
base.DisconnectHandler(nativeView);
base.DisconnectHandler(platformView);

nativeView.DateSelected -= OnDateSelected;
platformView.DateSelected -= OnDateSelected;
}

public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Microsoft.Maui.Graphics.Controls
{
public partial class DatePickerHandler : MixedGraphicsControlHandler<IDatePickerDrawable, IDatePicker, object>
{
protected override object CreateNativeView() => throw new NotImplementedException();
protected override object CreatePlatformView() => throw new NotImplementedException();

public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker) { }
public static void MapMaximumDate(DatePickerHandler handler, IDatePicker datePicker) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ protected override GraphicsDatePicker CreatePlatformView()
return new GraphicsDatePicker() { GraphicsControl = this };
}

protected override void ConnectHandler(GraphicsDatePicker nativeView)
protected override void ConnectHandler(GraphicsDatePicker platformView)
{
base.ConnectHandler(nativeView);
base.ConnectHandler(platformView);

nativeView.DateSelected += OnDateSelected;
platformView.DateSelected += OnDateSelected;
}

protected override void DisconnectHandler(GraphicsDatePicker nativeView)
protected override void DisconnectHandler(GraphicsDatePicker platformView)
{
base.DisconnectHandler(nativeView);
base.DisconnectHandler(platformView);

nativeView.DateSelected -= OnDateSelected;
platformView.DateSelected -= OnDateSelected;
}

public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ protected override GraphicsDatePicker CreatePlatformView()
return new GraphicsDatePicker() { GraphicsControl = this };
}

protected override void ConnectHandler(GraphicsDatePicker nativeView)
protected override void ConnectHandler(GraphicsDatePicker platformView)
{
base.ConnectHandler(nativeView);
base.ConnectHandler(platformView);

nativeView.DateSelected += OnDateSelected;
platformView.DateSelected += OnDateSelected;
}

protected override void DisconnectHandler(GraphicsDatePicker nativeView)
protected override void DisconnectHandler(GraphicsDatePicker platformView)
{
base.DisconnectHandler(nativeView);
base.DisconnectHandler(platformView);

nativeView.DateSelected -= OnDateSelected;
platformView.DateSelected -= OnDateSelected;
}

public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Microsoft.Maui.Graphics.Controls
{
public partial class GraphicsDatePicker : View, IMixedNativeView
public partial class GraphicsDatePicker : View, IMixedPlatformView
{
DateTime _date;
DateTime _minimumDate;
Expand Down Expand Up @@ -92,9 +92,9 @@ public IDrawable Drawable

public event EventHandler<DateSelectedEventArgs> DateSelected;

static readonly string[] DefaultNativeLayers = new string[] { };
static readonly string[] DefaultPlatformLayers = new string[] { };

public string[] NativeLayers => DefaultNativeLayers;
public string[] PlatformLayers => DefaultPlatformLayers;

public void DrawBaseLayer(RectF dirtyRect) { }

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

namespace Microsoft.Maui.Graphics.Controls
{
public class GraphicsDatePicker : UserControl, IMixedNativeView
public class GraphicsDatePicker : UserControl, IMixedPlatformView
{
DateTime _date;
DateTime _minimumDate;
Expand Down Expand Up @@ -78,9 +78,9 @@ public IDrawable Drawable

public event EventHandler<DateSelectedEventArgs> DateSelected;

static readonly string[] DefaultNativeLayers = new string[] { };
static readonly string[] DefaultPlatformLayers = new string[] { };

public string[] NativeLayers => DefaultNativeLayers;
public string[] PlatformLayers => DefaultPlatformLayers;

public void DrawBaseLayer(RectF dirtyRect) { }

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

namespace Microsoft.Maui.Graphics.Controls
{
public class GraphicsDatePicker : UIView, IMixedNativeView
public class GraphicsDatePicker : UIView, IMixedPlatformView
{
DateTime _date;
DateTime _minimumDate;
Expand Down Expand Up @@ -104,9 +104,9 @@ public override CGRect Bounds
}
}

static readonly string[] DefaultNativeLayers = new string[] { };
static readonly string[] DefaultPlatformLayers = new string[] { };

public string[] NativeLayers => DefaultNativeLayers;
public string[] PlatformLayers => DefaultPlatformLayers;

public void Invalidate()
{
Expand Down
36 changes: 18 additions & 18 deletions src/GraphicsControls/Handlers/Editor/EditorHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,43 @@ public partial class EditorHandler : MixedGraphicsControlHandler<IEditorDrawable

protected override GraphicsEditor CreatePlatformView()
{
var nativeView = new GraphicsEditor(Context!)
var platformView = new GraphicsEditor(Context!)
{
GraphicsControl = this,
ImeOptions = ImeAction.Done
};

nativeView.SetSingleLine(false);
nativeView.Gravity = GravityFlags.Top;
nativeView.TextAlignment = ATextAlignment.ViewStart;
nativeView.SetHorizontallyScrolling(false);
platformView.SetSingleLine(false);
platformView.Gravity = GravityFlags.Top;
platformView.TextAlignment = ATextAlignment.ViewStart;
platformView.SetHorizontallyScrolling(false);

if (Drawable is MaterialEditorDrawable)
nativeView.SetPadding(12, 18, 0, 0);
else if (Drawable is FluentEditorDrawable)
nativeView.SetPadding(12, 12, 0, 0);
platformView.SetPadding(12, 18, 0, 0);
else if (Drawable is FluentEditorDrawable)
platformView.SetPadding(12, 12, 0, 0);
else if (Drawable is CupertinoEditorDrawable)
nativeView.SetPadding(12, 12, 0, 0);
platformView.SetPadding(12, 12, 0, 0);

return nativeView;
return platformView;
}

protected override void ConnectHandler(GraphicsEditor nativeView)
protected override void ConnectHandler(GraphicsEditor platformView)
{
FocusChangeListener.Handler = this;

nativeView.OnFocusChangeListener = FocusChangeListener;
platformView.OnFocusChangeListener = FocusChangeListener;

nativeView.TextChanged += OnTextChanged;
platformView.TextChanged += OnTextChanged;
}

protected override void DisconnectHandler(GraphicsEditor nativeView)
protected override void DisconnectHandler(GraphicsEditor platformView)
{
nativeView.OnFocusChangeListener = null;
platformView.OnFocusChangeListener = null;

FocusChangeListener.Handler = null;
nativeView.TextChanged -= OnTextChanged;
FocusChangeListener.Handler = null;

platformView.TextChanged -= OnTextChanged;
}

public static void MapText(EditorHandler handler, IEditor editor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Microsoft.Maui.Graphics.Controls
{
public partial class EditorHandler : MixedGraphicsControlHandler<IEditorDrawable, IEditor, object>
{
protected override object CreateNativeView() => throw new NotImplementedException();
protected override object CreatePlatformView() => throw new NotImplementedException();

public static void MapText(IViewHandler handler, IEditor editor) { }
public static void MapTextColor(IViewHandler handler, IEditor editor) { }
Expand Down
16 changes: 8 additions & 8 deletions src/GraphicsControls/Handlers/Editor/EditorHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ protected override GraphicsEditor CreatePlatformView()
return new GraphicsEditor { GraphicsControl = this, EdgeInsets = edgeInsets };
}

protected override void ConnectHandler(GraphicsEditor nativeView)
protected override void ConnectHandler(GraphicsEditor platformView)
{
base.ConnectHandler(nativeView);
base.ConnectHandler(platformView);

nativeView.Started += OnStarted;
nativeView.Ended += OnEnded;
platformView.Started += OnStarted;
platformView.Ended += OnEnded;
}

protected override void DisconnectHandler(GraphicsEditor nativeView)
protected override void DisconnectHandler(GraphicsEditor platformView)
{
base.DisconnectHandler(nativeView);
base.DisconnectHandler(platformView);

nativeView.Started -= OnStarted;
nativeView.Ended -= OnEnded;
platformView.Started -= OnStarted;
platformView.Ended -= OnEnded;
}

public static void MapText(EditorHandler handler, IEditor editor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Microsoft.Maui.Graphics.Controls
{
public class GraphicsEditor : AppCompatEditText, IMixedNativeView
public class GraphicsEditor : AppCompatEditText, IMixedPlatformView
{
readonly PlatformCanvas _canvas;
readonly ScalingCanvas _scalingCanvas;
Expand Down Expand Up @@ -54,9 +54,9 @@ public IDrawable Drawable
}
}

static readonly string[] DefaultNativeLayers = new[] { nameof(IEntry.Text) };
static readonly string[] DefaultPlatformLayers = new[] { nameof(IEntry.Text) };

public string[] NativeLayers => DefaultNativeLayers;
public string[] PlatformLayers => DefaultPlatformLayers;

public void DrawBaseLayer(RectF dirtyRect) { }

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

namespace Microsoft.Maui.Graphics.Controls
{
public class GraphicsEditor : UserControl, IMixedNativeView
public class GraphicsEditor : UserControl, IMixedPlatformView
{
CanvasControl _canvasControl;
readonly W2DCanvas _canvas = new W2DCanvas();
Expand Down Expand Up @@ -37,9 +37,9 @@ public IDrawable Drawable
}
}

static readonly string[] DefaultNativeLayers = new[] { nameof(IEntry.Text) };
static readonly string[] DefaultPlatformLayers = new[] { nameof(IEntry.Text) };

public string[] NativeLayers => DefaultNativeLayers;
public string[] PlatformLayers => DefaultPlatformLayers;

public void DrawBaseLayer(RectF dirtyRect) { }

Expand Down
6 changes: 3 additions & 3 deletions src/GraphicsControls/Handlers/Editor/GraphicsEditor.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Microsoft.Maui.Graphics.Controls
{
public class GraphicsEditor : UITextView, IMixedNativeView
public class GraphicsEditor : UITextView, IMixedPlatformView
{
readonly PlatformCanvas _canvas;
readonly UITapGestureRecognizer _tapGesture;
Expand Down Expand Up @@ -62,9 +62,9 @@ public UIEdgeInsets EdgeInsets
}
}

static readonly string[] DefaultNativeLayers = new[] { nameof(IEntry.Text) };
static readonly string[] DefaultPlatformLayers = new[] { nameof(IEntry.Text) };

public string[] NativeLayers => DefaultNativeLayers;
public string[] PlatformLayers => DefaultPlatformLayers;

public void Invalidate()
{
Expand Down
32 changes: 16 additions & 16 deletions src/GraphicsControls/Handlers/Entry/EntryHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,45 @@ public partial class EntryHandler : MixedGraphicsControlHandler<IEntryDrawable,

protected override GraphicsEntry CreatePlatformView()
{
var nativeView = new GraphicsEntry(Context!)
var platformView = new GraphicsEntry(Context!)
{
GraphicsControl = this
};

if (Drawable is MaterialEntryDrawable)
nativeView.SetPadding(12, 18, 0, 0);
platformView.SetPadding(12, 18, 0, 0);
else if (Drawable is FluentEntryDrawable)
nativeView.SetPadding(12, 12, 0, 0);
platformView.SetPadding(12, 12, 0, 0);
else if (Drawable is CupertinoEntryDrawable)
nativeView.SetPadding(12, 12, 0, 0);
platformView.SetPadding(12, 12, 0, 0);

return nativeView;
return platformView;
}

protected override void ConnectHandler(GraphicsEntry nativeView)
protected override void ConnectHandler(GraphicsEntry platformView)
{
Watcher.Handler = this;
ActionListener.Handler = this;
FocusChangeListener.Handler = this;

nativeView.AddTextChangedListener(Watcher);
nativeView.SetOnEditorActionListener(ActionListener);
nativeView.OnFocusChangeListener = FocusChangeListener;
platformView.AddTextChangedListener(Watcher);
platformView.SetOnEditorActionListener(ActionListener);
platformView.OnFocusChangeListener = FocusChangeListener;

base.ConnectHandler(nativeView);
base.ConnectHandler(platformView);
}

protected override void DisconnectHandler(GraphicsEntry nativeView)
protected override void DisconnectHandler(GraphicsEntry platformView)
{
nativeView.RemoveTextChangedListener(Watcher);
nativeView.SetOnEditorActionListener(null);
nativeView.OnFocusChangeListener = null;
platformView.RemoveTextChangedListener(Watcher);
platformView.SetOnEditorActionListener(null);
platformView.OnFocusChangeListener = null;

Watcher.Handler = null;
ActionListener.Handler = null;
FocusChangeListener.Handler = null;

base.DisconnectHandler(nativeView);
base.DisconnectHandler(platformView);
}

public override bool StartInteraction(PointF[] points)
Expand Down Expand Up @@ -86,7 +86,7 @@ public static void MapFont(EntryHandler handler, IEntry entry)
{
// TODO: Get require service FontManager
//IFontManager? fontManager = null;
//handler.NativeView?.UpdateFont(editor, fontManager);
//handler.PlatformView?.UpdateFont(editor, fontManager);
}

public static void MapHorizontalTextAlignment(EntryHandler handler, IEntry entry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Microsoft.Maui.Graphics.Controls
{
public partial class EntryHandler : MixedGraphicsControlHandler<IEntryDrawable, IEntry, object>
{
protected override object CreateNativeView() => throw new NotImplementedException();
protected override object CreatePlatformView() => throw new NotImplementedException();

public static void MapText(IViewHandler handler, IEntry entry) { }
public static void MapCharacterSpacing(IViewHandler handler, IEntry entry) { }
Expand Down
Loading

0 comments on commit 86c59ca

Please sign in to comment.