summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Renderers
diff options
context:
space:
mode:
authordarkleem <cdark.lim@samsung.com>2017-06-21 15:43:46 +0900
committerKangho Hur <kangho.hur@samsung.com>2017-07-10 11:11:27 +0900
commit217712866c28213ec574662eef9a65764577f15f (patch)
tree80d0e5afa360aaba833664c50c53663de76ea14f /Xamarin.Forms.Platform.Tizen/Renderers
parent535265c5ad415d89ea596385ac4d75436f957a3a (diff)
downloadxamarin-forms-217712866c28213ec574662eef9a65764577f15f.tar.gz
xamarin-forms-217712866c28213ec574662eef9a65764577f15f.tar.bz2
xamarin-forms-217712866c28213ec574662eef9a65764577f15f.zip
fix Date/TimePicker crash and handle issue
- TASK=TCAP-2529 - editfield style handle issue(opacity, enabled..) Change-Id: Ie07113aa5d1f625a6dcc69492d38c5ca1d98aad1 Signed-off-by: darkleem <cdark.lim@samsung.com>
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs31
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs35
2 files changed, 32 insertions, 34 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs
index fefadcc7..2fa86a57 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs
@@ -1,13 +1,11 @@
using System;
-using ELayout = ElmSharp.Layout;
namespace Xamarin.Forms.Platform.Tizen
{
- public class DatePickerRenderer : ViewRenderer<DatePicker, ELayout>
+ public class DatePickerRenderer : ViewRenderer<DatePicker, Native.EditfieldEntry>
{
//TODO need to add internationalization support
const string DialogTitle = "Choose Date";
- Native.Entry _realControl = null;
public DatePickerRenderer()
{
@@ -20,31 +18,34 @@ namespace Xamarin.Forms.Platform.Tizen
{
if (Control == null)
{
- var layout = new ELayout(Forms.Context.MainWindow);
- layout.SetTheme("layout", "editfield", "singleline");
- _realControl = new Native.Entry(layout)
+ var entry = new Native.EditfieldEntry(Forms.Context.MainWindow)
{
IsSingleLine = true,
HorizontalTextAlignment = Native.TextAlignment.Center,
};
- _realControl.AllowFocus(false);
- layout.SetPartContent("elm.swallow.content", _realControl);
- SetNativeControl(layout);
+ entry.SetVerticalTextAlignment("elm.text", 0.5);
+ entry.AllowFocus(false);
+ SetNativeControl(entry);
}
if (e.OldElement != null)
{
- _realControl.Clicked -= ClickedHandler;
+ Control.Clicked -= ClickedHandler;
}
if (e.NewElement != null)
{
- _realControl.Clicked += ClickedHandler;
+ Control.Clicked += ClickedHandler;
}
base.OnElementChanged(e);
}
+ protected override Size MinimumSize()
+ {
+ return Control.Measure(Control.MinimumWidth, Control.MinimumHeight).ToDP();
+ }
+
void ClickedHandler(object sender, EventArgs e)
{
Native.DateTimePickerDialog dialog = new Native.DateTimePickerDialog(Forms.Context.MainWindow)
@@ -61,7 +62,7 @@ namespace Xamarin.Forms.Platform.Tizen
void DialogDateTimeChangedHandler(object sender, Native.DateChangedEventArgs dcea)
{
Element.Date = dcea.NewDate;
- _realControl.Text = dcea.NewDate.ToString(Element.Format);
+ Control.Text = dcea.NewDate.ToString(Element.Format);
}
void DialogDismissedHandler(object sender, EventArgs e)
@@ -73,12 +74,12 @@ namespace Xamarin.Forms.Platform.Tizen
void UpdateDate()
{
- _realControl.Text = Element.Date.ToString(Element.Format);
+ Control.Text = Element.Date.ToString(Element.Format);
}
void UpdateTextColor()
{
- _realControl.TextColor = Element.TextColor.ToNative();
+ Control.TextColor = Element.TextColor.ToNative();
}
}
-}
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
index 547f9312..6c517c9d 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
@@ -1,20 +1,16 @@
using System;
using System.Globalization;
-using ELayout = ElmSharp.Layout;
namespace Xamarin.Forms.Platform.Tizen
{
- public class TimePickerRenderer : ViewRenderer<TimePicker, ELayout>
+ public class TimePickerRenderer : ViewRenderer<TimePicker, Native.EditfieldEntry>
{
//TODO need to add internationalization support
const string DialogTitle = "Choose Time";
static readonly string s_defaultFormat = CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern;
- string _format;
-
TimeSpan _time;
- Native.Entry _realControl;
public TimePickerRenderer()
{
@@ -27,35 +23,37 @@ namespace Xamarin.Forms.Platform.Tizen
{
if (Control == null)
{
- var layout = new ELayout(Forms.Context.MainWindow);
- layout.SetTheme("layout", "editfield", "singleline");
- _realControl = new Native.Entry(layout)
+ var entry = new Native.EditfieldEntry(Forms.Context.MainWindow)
{
IsSingleLine = true,
HorizontalTextAlignment = Native.TextAlignment.Center,
};
- _realControl.AllowFocus(false);
- layout.SetPartContent("elm.swallow.content", _realControl);
- SetNativeControl(layout);
+ entry.SetVerticalTextAlignment("elm.text", 0.5);
+ entry.AllowFocus(false);
+ SetNativeControl(entry);
}
if (e.OldElement != null)
{
- _realControl.Clicked -= ClickedHandler;
+ Control.Clicked -= ClickedHandler;
}
if (e.NewElement != null)
{
_time = DateTime.Now.TimeOfDay;
- _format = s_defaultFormat;
UpdateTimeAndFormat();
- _realControl.Clicked += ClickedHandler;
+ Control.Clicked += ClickedHandler;
}
base.OnElementChanged(e);
}
+ protected override Size MinimumSize()
+ {
+ return Control.Measure(Control.MinimumWidth, Control.MinimumHeight).ToDP();
+ }
+
void ClickedHandler(object o, EventArgs e)
{
Native.DateTimePickerDialog dialog = new Native.DateTimePickerDialog(Forms.Context.MainWindow)
@@ -63,7 +61,7 @@ namespace Xamarin.Forms.Platform.Tizen
Title = DialogTitle
};
- dialog.InitializeTimePicker(_time, _format);
+ dialog.InitializeTimePicker(_time, null);
dialog.DateTimeChanged += DialogDateTimeChangedHandler;
dialog.Dismissed += DialogDismissedHandler;
dialog.Show();
@@ -84,13 +82,12 @@ namespace Xamarin.Forms.Platform.Tizen
void UpdateFormat()
{
- _format = Element.Format ?? s_defaultFormat;
UpdateTimeAndFormat();
}
void UpdateTextColor()
{
- _realControl.TextColor = Element.TextColor.ToNative();
+ Control.TextColor = Element.TextColor.ToNative();
}
void UpdateTime()
@@ -102,7 +99,7 @@ namespace Xamarin.Forms.Platform.Tizen
void UpdateTimeAndFormat()
{
// Xamarin using DateTime formatting (https://developer.xamarin.com/api/property/Xamarin.Forms.TimePicker.Format/)
- _realControl.Text = new DateTime(_time.Ticks).ToString(_format);
+ Control.Text = new DateTime(_time.Ticks).ToString(Element.Format ?? s_defaultFormat);
}
}
-}
+} \ No newline at end of file