diff options
author | Paul DiPietro <pauldipietro@users.noreply.github.com> | 2016-07-11 13:12:58 -0400 |
---|---|---|
committer | Samantha Houts <samantha@teamredwall.com> | 2016-07-11 10:12:58 -0700 |
commit | f167024ef3a02c199c797b5313342dbe5d9a21de (patch) | |
tree | 45f98a2f134285f044df8d384f049276bc933209 /Xamarin.Forms.Platform.Android | |
parent | eb84f968f2fac47c375724465854e58c85e45bee (diff) | |
download | xamarin-forms-f167024ef3a02c199c797b5313342dbe5d9a21de.tar.gz xamarin-forms-f167024ef3a02c199c797b5313342dbe5d9a21de.tar.bz2 xamarin-forms-f167024ef3a02c199c797b5313342dbe5d9a21de.zip |
Fix DatePicker dialog regression (#249)
KitKat doesn't use the cancel button, so it has to be accounted for.
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r-- | Xamarin.Forms.Platform.Android/Renderers/DatePickerRenderer.cs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/DatePickerRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/DatePickerRenderer.cs index 328336ff..73e5183f 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/DatePickerRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/DatePickerRenderer.cs @@ -31,7 +31,9 @@ namespace Xamarin.Forms.Platform.Android _disposed = true; if (_dialog != null) { - _dialog.CancelEvent -= OnCancelButtonClicked; + if (Forms.IsLollipopOrNewer) + _dialog.CancelEvent -= OnCancelButtonClicked; + _dialog.Hide(); _dialog.Dispose(); _dialog = null; @@ -85,7 +87,10 @@ namespace Xamarin.Forms.Platform.Android _dialog.Hide(); ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); Control.ClearFocus(); - _dialog.CancelEvent -= OnCancelButtonClicked; + + if (Forms.IsLollipopOrNewer) + _dialog.CancelEvent -= OnCancelButtonClicked; + _dialog = null; } } @@ -99,7 +104,9 @@ namespace Xamarin.Forms.Platform.Android ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); Control.ClearFocus(); - _dialog.CancelEvent -= OnCancelButtonClicked; + if (Forms.IsLollipopOrNewer) + _dialog.CancelEvent -= OnCancelButtonClicked; + _dialog = null; }, year, month, day); } @@ -128,7 +135,9 @@ namespace Xamarin.Forms.Platform.Android UpdateMinimumDate(); UpdateMaximumDate(); - _dialog.CancelEvent += OnCancelButtonClicked; + if (Forms.IsLollipopOrNewer) + _dialog.CancelEvent += OnCancelButtonClicked; + _dialog.Show(); } |