summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.ControlGallery.Android
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@gmail.com>2017-01-25 18:54:54 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-02-17 11:11:46 (GMT)
commit2ad9cb93f47f46fcb0584370ab8c297b20912718 (patch)
tree96868b61a3a9da1fa98ce4bb0d74e7d0c61e76c8 /Xamarin.Forms.ControlGallery.Android
parenta1c7f9909a16d3253d9afd5cb2e1a839c6fb5a8c (diff)
downloadxamarin-forms-2ad9cb93f47f46fcb0584370ab8c297b20912718.zip
xamarin-forms-2ad9cb93f47f46fcb0584370ab8c297b20912718.tar.gz
xamarin-forms-2ad9cb93f47f46fcb0584370ab8c297b20912718.tar.bz2
Add localized listener for Android numeric input
Diffstat (limited to 'Xamarin.Forms.ControlGallery.Android')
-rw-r--r--Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
index 86876a3..4c6c1a8 100644
--- a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
+++ b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
@@ -19,12 +19,18 @@ using AButton = Android.Widget.Button;
using AView = Android.Views.View;
using Android.OS;
using System.Reflection;
+using Android.Text;
+using Android.Text.Method;
using Xamarin.Forms.Controls.Issues;
[assembly: ExportRenderer(typeof(Bugzilla31395.CustomContentView), typeof(CustomContentRenderer))]
[assembly: ExportRenderer(typeof(NativeListView), typeof(NativeListViewRenderer))]
[assembly: ExportRenderer(typeof(NativeListView2), typeof(NativeAndroidListViewRenderer))]
[assembly: ExportRenderer(typeof(NativeCell), typeof(NativeAndroidCellRenderer))]
+
+[assembly: ExportRenderer(typeof(Bugzilla42000._42000NumericEntryNoDecimal), typeof(EntryRendererNoDecimal))]
+[assembly: ExportRenderer(typeof(Bugzilla42000._42000NumericEntryNoNegative), typeof(EntryRendererNoNegative))]
+
#if PRE_APPLICATION_CLASS
#elif FORMS_APPLICATION_ACTIVITY
#else
@@ -485,5 +491,29 @@ namespace Xamarin.Forms.ControlGallery.Android
base.OnElementChanged(e);
}
}
+
+ // Custom renderers for Bugzilla42000 demonstration purposes
+
+ public class EntryRendererNoNegative : EntryRenderer
+ {
+ protected override NumberKeyListener GetDigitsKeyListener(InputTypes inputTypes)
+ {
+ // Disable the NumberFlagSigned bit
+ inputTypes &= ~InputTypes.NumberFlagSigned;
+
+ return base.GetDigitsKeyListener(inputTypes);
+ }
+ }
+
+ public class EntryRendererNoDecimal : EntryRenderer
+ {
+ protected override NumberKeyListener GetDigitsKeyListener(InputTypes inputTypes)
+ {
+ // Disable the NumberFlagDecimal bit
+ inputTypes &= ~InputTypes.NumberFlagDecimal;
+
+ return base.GetDigitsKeyListener(inputTypes);
+ }
+ }
}