summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android
diff options
context:
space:
mode:
authorPaul DiPietro <pauldipietro@users.noreply.github.com>2016-07-11 13:12:58 -0400
committerSamantha Houts <samantha@teamredwall.com>2016-07-11 10:12:58 -0700
commitf167024ef3a02c199c797b5313342dbe5d9a21de (patch)
tree45f98a2f134285f044df8d384f049276bc933209 /Xamarin.Forms.Platform.Android
parenteb84f968f2fac47c375724465854e58c85e45bee (diff)
downloadxamarin-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.cs17
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();
}