-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathLinkerPleaseInclude.cs
172 lines (148 loc) · 5.63 KB
/
LinkerPleaseInclude.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
using System;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Windows.Input;
using Android.App;
using Android.Runtime;
using Android.Support.Design.Internal;
using Android.Support.Design.Widget;
using Android.Support.V7.Widget;
using Android.Views;
using Android.Widget;
using MvvmCross.Binding.BindingContext;
using MvvmCross.Commands;
using MvvmCross.Core;
using MvvmCross.IoC;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
namespace Chameleon.Droid
{
// This class is never actually executed, but when Xamarin linking is enabled it does how to ensure types and properties
// are preserved in the deployed app
[Preserve(AllMembers = true)]
public class LinkerPleaseInclude
{
public void Include(Button button)
{
button.Click += (s, e) => button.Text = $"{button.Text}";
}
public void Include(View view)
{
view.Click += (s, e) => view.ContentDescription = $"{view.ContentDescription}";
}
public void Include(TextView text)
{
text.AfterTextChanged += (sender, args) => text.Text = $"{text.Text}";
text.Hint = $"{text.Hint}";
}
public void Include(CompoundButton cb)
{
cb.CheckedChange += (sender, args) => cb.Checked = !cb.Checked;
}
public void Include(SeekBar sb)
{
sb.ProgressChanged += (sender, args) => sb.Progress = sb.Progress + 1;
}
public void Include(RadioGroup radioGroup)
{
radioGroup.CheckedChange += (sender, args) => radioGroup.Check(args.CheckedId);
}
public void Include(RatingBar ratingBar)
{
ratingBar.RatingBarChange += (sender, args) => ratingBar.Rating = 0 + ratingBar.Rating;
}
public void Include(NumberPicker numberPicker)
{
numberPicker.ValueChanged += (sender, args) => numberPicker.Value = 0 + args.NewVal + numberPicker.MinValue + numberPicker.MaxValue;
numberPicker.MinValue = numberPicker.MinValue + 1;
numberPicker.MaxValue = numberPicker.MaxValue + 1;
numberPicker.SetDisplayedValues(new string[] { "" });
}
public void Include(TextInputLayout textInputLayout)
{
textInputLayout.Hint = $"{textInputLayout.Hint}";
textInputLayout.Error = $"{textInputLayout.Error}";
textInputLayout.ErrorEnabled = true;
}
public void Include(TextInputEditText textInputEditText)
{
textInputEditText.Hint = $"{textInputEditText.Hint}";
textInputEditText.Error = $"{textInputEditText.Error}";
textInputEditText.SetAutofillHints("");
}
public void Include(Activity act)
{
act.Title = $"{act.Title}";
}
public void Include(ICommand command)
{
command.CanExecuteChanged += (s, e) => { if (command.CanExecute(null)) command.Execute(null); };
}
public void Include(INotifyCollectionChanged changed)
{
changed.CollectionChanged += (s, e) => { _ = $"{e.Action}{e.NewItems}{e.NewStartingIndex}{e.OldItems}{e.OldStartingIndex}"; };
}
public void Include(INotifyPropertyChanged changed)
{
changed.PropertyChanged += (sender, e) => { _ = e.PropertyName; };
}
public void Include(MvxPropertyInjector injector)
{
_ = new MvxPropertyInjector();
}
public void Include(MvxTaskBasedBindingContext context)
{
context.Dispose();
var context2 = new MvxTaskBasedBindingContext();
context2.Dispose();
}
public void Include(MvxViewModelViewTypeFinder viewModelViewTypeFinder)
{
_ = new MvxViewModelViewTypeFinder(null, null);
}
public void Include(MvxNavigationService service, IMvxViewModelLoader loader)
{
_ = new MvxNavigationService(null, loader);
_ = new MvxAppStart<MvxNullViewModel>(null, null);
}
public void Include(ConsoleColor color)
{
Console.Write("");
Console.WriteLine("");
_ = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.ForegroundColor = ConsoleColor.Magenta;
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Gray;
Console.ForegroundColor = ConsoleColor.DarkGray;
}
public void Include(MvvmCross.Plugin.Json.Plugin plugin)
{
plugin.Load();
}
public void Include(AlertDialogLayout alertDialog)
{
_ = new AlertDialogLayout(Application.Context);
}
public void Include(BaselineLayout baselineLayout)
{
_ = new BaselineLayout(Application.Context);
}
public void IncludeMvvmcross64()
{
_ = new MvxSettings();
_ = new MvxStringToTypeParser(); //??
//_ = new MvxPluginManager(null); //should not be required
_ = new MvxViewModelLoader(null);
_ = new MvxNavigationService(null, null);
_ = new MvxViewModelByNameLookup();
_ = new MvxViewModelViewTypeFinder(null, null);
_ = new MvxViewModelViewLookupBuilder();
_ = new MvxCommandCollectionBuilder();
_ = new MvxStringDictionaryNavigationSerializer();
_ = new MvxChildViewModelCache();
_ = new MvxWeakCommandHelper();
}
}
}