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

Fix PopupEntryRenderer ABI break from latest Xamarin.Forms 4.1.0 #202

Merged
merged 2 commits into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Tizen.Wearable.CircularUI.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
<dependencies>
<group targetFramework="netstandard2.0">
<dependency id="Xamarin.Forms" version="3.5.0.129452" />
<dependency id="Xamarin.Forms" version="4.1.0.673156" />
</group>
<group targetFramework="tizen40">
<dependency id="Xamarin.Forms" version="3.5.0.129452" />
<dependency id="Xamarin.Forms" version="4.1.0.673156" />
<dependency id="Tizen.NET" version="4.0.0" />
</group>
</dependencies>
Expand Down
33 changes: 21 additions & 12 deletions src/Tizen.Wearable.CircularUI.Forms.Renderer/PopupEntryRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,32 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Tizen;

using Xamarin.Forms.Platform.Tizen.Native;
using EColor = ElmSharp.Color;
using ELayout = ElmSharp.Layout;

[assembly: ExportRenderer(typeof(Tizen.Wearable.CircularUI.Forms.PopupEntry), typeof(Tizen.Wearable.CircularUI.Forms.Renderer.PopupEntryRenderer))]

namespace Tizen.Wearable.CircularUI.Forms.Renderer
{
public class PopupEntryRenderer : EntryRenderer
{
ElmSharp.Background _editorPopup;
ElmSharp.Color _popupBackgroundColor;
Background _editorPopup;
EColor _popupBackgroundColor;

Xamarin.Forms.Platform.Tizen.Native.Entry _editor;

Interop.EFL.InputPanelEventCallback _editorStateChanged;

Interop.EFL.InputPanelState _IMEState;

ElmSharp.Color DefaultColor { get; set; }
EColor DefaultColor { get; set; }

bool _IsPopupOpened = false;

public PopupEntryRenderer()
{
DefaultColor = new ElmSharp.Color(40, 40, 40, 255); //editfield bg default color
DefaultColor = new EColor(40, 40, 40, 255); //editfield bg default color
RegisterPropertyHandler(PopupEntry.PopupBackgroundColorProperty, UpdatePopupBackgroundColor);
RegisterPropertyHandler(PopupEntry.IsPopupOpenedProperty, UpdateIsPopupOpened);
}
Expand Down Expand Up @@ -91,12 +94,12 @@ void CreatePopup()

var root = FindWindow(Xamarin.Forms.Platform.Tizen.Forms.NativeParent);

_editorPopup = new ElmSharp.Background(root)
_editorPopup = new Background(root)
{
Geometry = rect
};

var layout = new ElmSharp.Layout(_editorPopup);
var layout = new ELayout(_editorPopup);
layout.SetTheme("layout", "entry", "default");
layout.Show();

Expand All @@ -109,7 +112,7 @@ void CreatePopup()
_editor.AllowFocus(true);
_editor.Show();

_editor.SetInputPanelReturnKeyType(ElmSharp.InputPanelReturnKeyType.Done);
_editor.SetInputPanelReturnKeyType(InputPanelReturnKeyType.Done);

_editor.UpdateKeyboard(Element.Keyboard, Element.IsSpellCheckEnabled, Element.IsTextPredictionEnabled);

Expand Down Expand Up @@ -137,7 +140,10 @@ void PopupEntryActivated(object sender, EventArgs e)

void HidePopup()
{
Control.TextChanged -= OnTextChanged;
if (Control is IEntry ie)
{
ie.TextChanged -= OnTextChanged;
}

if (_IMEState != Interop.EFL.InputPanelState.Hide)
{
Expand All @@ -160,7 +166,11 @@ void ShowPopup()
CreatePopup();
}
_editor.IsPassword = Control.IsPassword;
_editor.HorizontalTextAlignment = Control.HorizontalTextAlignment;
if (Control is IEntry ie)
{
_editor.HorizontalTextAlignment = ie.HorizontalTextAlignment;
ie.TextChanged += OnTextChanged;
}

_editor.Text = Control.Text;
_editor.TextChanged += PopupEntryTextChanged;
Expand All @@ -171,8 +181,7 @@ void ShowPopup()

_editor.MoveCursorEnd();
_editor.ShowInputPanel();

Control.TextChanged += OnTextChanged;

_IsPopupOpened = true;
((PopupEntry)Element).IsPopupOpened = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.5.0.129452" />
<PackageReference Include="Xamarin.Forms" Version="4.1.0.673156" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/SimpleTextWatchface/SimpleTextWatchface.csproj
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<ExcludeAssets>Runtime</ExcludeAssets>
</PackageReference>
<PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />
<PackageReference Include="Xamarin.Forms" Version="3.5.0.129452" />
<PackageReference Include="Xamarin.Forms" Version="4.1.0.673156" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Tizen.Wearable.CircularUI.Forms.Renderer\Tizen.Wearable.CircularUI.Forms.Renderer.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion test/WearableUIGallery/WearableUIGallery/WearableUIGallery.csproj
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="Tizen.NET" Version="4.0.0" />
<PackageReference Include="Xamarin.Forms" Version="3.5.0.129452" />
<PackageReference Include="Xamarin.Forms" Version="4.1.0.673156" />
</ItemGroup>

<!-- Include Nuget Package for Xamarin building -->
Expand Down