forked from Clancey/MonoDroid.Dialog
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathEnums.cs
77 lines (69 loc) · 2.55 KB
/
Enums.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System.Collections.Generic;
using Android.Text;
using Android.Views.InputMethods;
namespace Android.Dialog
{
public enum UITableViewCellAccessory
{
DisclosureIndicator,
}
public enum UITextFieldViewMode
{
WhileEditing,
}
public enum UIKeyboardType
{
Default,
NumberPad,
DecimalPad,
ASCIICapable,
EmailAddress,
PhonePad,
NamePhonePad,
NumbersAndPunctuation,
}
public enum UIReturnKeyType
{
Default,
Go,
Google,
Join,
Next,
Route,
Search,
Send,
Yahoo,
Done,
}
public static class AndroidDialogEnumHelper
{
public static readonly Dictionary<UIKeyboardType, InputTypes> KeyboardTypeMap = new Dictionary<UIKeyboardType, InputTypes>
{
{ UIKeyboardType.Default, InputTypes.ClassText },
{ UIKeyboardType.DecimalPad, InputTypes.ClassNumber | InputTypes.NumberFlagDecimal | InputTypes.NumberFlagSigned },
{ UIKeyboardType.NumberPad, InputTypes.ClassNumber },
{ UIKeyboardType.PhonePad, InputTypes.ClassPhone },
{ UIKeyboardType.NamePhonePad, InputTypes.TextVariationPersonName | InputTypes.ClassText },
{ UIKeyboardType.ASCIICapable, InputTypes.TextVariationVisiblePassword | InputTypes.ClassText },
{ UIKeyboardType.NumbersAndPunctuation, InputTypes.TextVariationVisiblePassword | InputTypes.ClassText },
{ UIKeyboardType.EmailAddress, InputTypes.TextVariationEmailAddress | InputTypes.ClassText },
};
public static readonly Dictionary<UIReturnKeyType, ImeAction> ReturnKeyTypeMap = new Dictionary<UIReturnKeyType, ImeAction>
{
{ UIReturnKeyType.Default, ImeAction.Unspecified },
{ UIReturnKeyType.Done, ImeAction.Done },
{ UIReturnKeyType.Go, ImeAction.Go },
{ UIReturnKeyType.Next, ImeAction.Next },
{ UIReturnKeyType.Search, ImeAction.Search },
{ UIReturnKeyType.Send, ImeAction.Send },
};
public static ImeAction ImeActionFromUIReturnKeyType(this UIReturnKeyType returnKeyType)
{
return ReturnKeyTypeMap.ContainsKey(returnKeyType) ? ReturnKeyTypeMap[returnKeyType] : ImeAction.Unspecified;
}
public static InputTypes InputTypesFromUIKeyboardType(this UIKeyboardType keyboardType)
{
return KeyboardTypeMap.ContainsKey(keyboardType) ? KeyboardTypeMap[keyboardType] : InputTypes.ClassText;
}
}
}