diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2016-04-19 01:01:58 -0600 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-04-19 00:01:58 -0700 |
commit | a98f3fb2aae3c5b6a3fa5140e51f51ec67843a49 (patch) | |
tree | 654fa47cbd3cc889061466939630dcd5133cc837 /Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs | |
parent | 89a50d4bc1f4aaf83d5f92a28c2a7a96282cc0d3 (diff) | |
download | xamarin-forms-a98f3fb2aae3c5b6a3fa5140e51f51ec67843a49.tar.gz xamarin-forms-a98f3fb2aae3c5b6a3fa5140e51f51ec67843a49.tar.bz2 xamarin-forms-a98f3fb2aae3c5b6a3fa5140e51f51ec67843a49.zip |
Add TextColor Property to Picker, TimePicker, DatePicker (#84)
* Add TextColor property to TimePicker
Add TextColor page to TimePicker gallery
Add TimePicker color toggling to color toggle test page
Split color toggle tests up among tabs
* Implement TimePicker.TextColor in iOS
* Implement TimePicker.TextColor for WinRT tablet
* Add IsEnabled=false tests to DefaultColorToggleTest Button and TimePicker
Consolidate ColorStates array
Fix IsEnabled changing color bug on iOS
* Implement TimePicker.TextColor for WP8
* Add TextColor property to DatePicker
Add DatePicker section to DefaultColorToggleTest
Impement DatePicker.TextColor for WP8
* Implement DatePicker.TextColor for WinRT/UWP/Windows Phone 8.1
* Implement DatePicker.TextColor for iOS
* Add TextColor to DatePicker Gallery Page
* Implement DatePicker.TextColor for Android
* Add Picker Gallery page for TextColor
Implement Picker.TextColor on Android
Consolidate TextColor management for Button, Picker, DatePicker, TimePicker
Implement
* Add untracked TextColorSwitcher
Implement Picker.TextColor in iOS
* Implement Picker.TextColor in WinRT/UWP/Windows Phone 8.1
Remove Pioker Loaded handlers in Dispose
* Implement Picker.TextColor in WP8
* Removed unused field
Update ignored warnings
* Update docs
* Use nameof() for BindableProperties
* Cleanup
* Fix custom renderer crashes for classes using TextColorSwitcher
* Correct property name references
* Fix typo and 'if' formatting
* Add missing else
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs index b9114d22..e9cc3942 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs @@ -2,19 +2,21 @@ using System; using System.ComponentModel; using System.Linq; using Android.App; +using Android.Content.Res; using Android.Views; using Android.Widget; using ADatePicker = Android.Widget.DatePicker; using ATimePicker = Android.Widget.TimePicker; using Object = Java.Lang.Object; +using Orientation = Android.Widget.Orientation; namespace Xamarin.Forms.Platform.Android { public class PickerRenderer : ViewRenderer<Picker, EditText> { AlertDialog _dialog; - bool _isDisposed; + TextColorSwitcher _textColorSwitcher; public PickerRenderer() { @@ -44,9 +46,11 @@ namespace Xamarin.Forms.Platform.Android { var textField = new EditText(Context) { Focusable = false, Clickable = true, Tag = this }; textField.SetOnClickListener(PickerListener.Instance); + _textColorSwitcher = new TextColorSwitcher(textField.TextColors); SetNativeControl(textField); } UpdatePicker(); + UpdateTextColor(); } base.OnElementChanged(e); @@ -60,6 +64,8 @@ namespace Xamarin.Forms.Platform.Android UpdatePicker(); if (e.PropertyName == Picker.SelectedIndexProperty.PropertyName) UpdatePicker(); + if (e.PropertyName == Picker.TextColorProperty.PropertyName) + UpdateTextColor(); } internal override void OnFocusChangeRequested(object sender, VisualElement.FocusRequestArgs e) @@ -148,6 +154,11 @@ namespace Xamarin.Forms.Platform.Android ((IVisualElementController)Element).NativeSizeChanged(); } + void UpdateTextColor() + { + _textColorSwitcher?.UpdateTextColor(Control, Element.TextColor); + } + class PickerListener : Object, IOnClickListener { public static readonly PickerListener Instance = new PickerListener(); |