-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDialogListViewActivity.cs
81 lines (77 loc) · 3.66 KB
/
DialogListViewActivity.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
78
79
80
81
using System;
using Android.App;
using Android.Content.PM;
using Android.Dialog;
using Android.Graphics;
using Android.OS;
using Android.Views;
using Android.Widget;
namespace DialogSampleApp
{
[Activity(Label = "DialogListView Test",
WindowSoftInputMode = SoftInput.AdjustPan,
ConfigurationChanges = ConfigChanges.KeyboardHidden | ConfigChanges.Orientation,
LaunchMode = LaunchMode.SingleTop,
Theme = "@style/ApplicationTheme")]
public class DialogListViewActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// create from layout file
SetContentView(Resource.Layout.form_with_buttons);
var dialogListView = FindViewById<DialogListView>(Android.Resource.Id.List);
dialogListView.Root = InitializeRoot();
}
private RootElement InitializeRoot()
{
var bitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.icon);
var image = new ImageView(this);
image.SetImageBitmap(bitmap);
return new RootElement("Elements")
{
new Section("Element w/Format Overrides")
{
new CheckboxElement("CheckboxElement", true, "", Resource.Layout.dialog_boolfieldsubright),
new StringElement("String Element", "Value", Resource.Layout.dialog_labelfieldbelow),
new EntryElement("EntryElement", string.Empty, Resource.Layout.dialog_textfieldbelow) { Hint = "Plain" },
new EntryElement("PasswordEntryElement", "Va", Resource.Layout.dialog_textfieldbelow) { Hint = "Password", Password = true, },
new EntryElement("EntryElement2", "Val", Resource.Layout.dialog_textfieldbelow) { Hint = "Plain3" },
},
new Section("Section")
{
new BooleanElement("BooleanElement", true),
new StringElement("StringElement", "Value"),
new EntryElement("EntryElement", "") { Hint = "Pain 2" },
new EntryElement("PasswordEntryElement", string.Empty) { Hint = "Password 2", Password = true, },
new DateTimeElement("DateTimeElement", null),
new DateElement("DateElement", DateTime.Now),
new TimeElement("TimeElement", DateTime.Now),
new CheckboxElement("CheckboxElement", true),
new HtmlElement("HtmlElement (Link)", "http://www.google.com"),
new ImageElement(image),
new StringElement("MultiLineElement", "The quick brown fox jumped over the lazy horse, the quick brown fox jumped over the lazy horse"),
new FloatElement("Range"),
},
new Section("Groups")
{
(Element)new RootElement ("Radio Group", new Android.Dialog.RadioGroup ("dessert", 2))
{
new Section
{
new RadioElement ("Ice Cream Sandwich", "dessert"),
new RadioElement ("Honeycomb", "dessert"),
new RadioElement ("Gingerbread", "dessert")
},
new Section
{
new RadioElement ("Frozen Yogurt", "dessert"),
new RadioElement ("Eclair", "dessert"),
new RadioElement ("Donut", "dessert")
},
}
},
};
}
}
}