forked from syncfusion/xamarin-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBusyIndicator_Tab.cs
262 lines (235 loc) · 10.8 KB
/
BusyIndicator_Tab.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#region Copyright Syncfusion Inc. 2001-2016.
// Copyright Syncfusion Inc. 2001-2016. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// [email protected]. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.Collections.Generic;
using Android.Content;
using Android.Views;
using Android.Widget;
using Com.Syncfusion.Sfbusyindicator;
using Android.Graphics;
using Com.Syncfusion.Sfbusyindicator.Enums;
using Android.Util;
namespace SampleBrowser
{
public class BusyIndicator_Tab : SamplePage
{
/*********************************
**Local Variable Inizialisation**
*********************************/
int animationSpinnerPosition = 0, totalWidth = 0;
SfBusyIndicator sfBusyIndicator;
TextView animationTypeText;
Spinner animationSpinner;
Context con;
Context context1;
int width;
TextView showBusyText;
Spinner showBusySpinner;
private void showBusyLayout()
{
showBusyText = new TextView(context1);
showBusyText.TextSize = 20;
showBusyText.SetPadding(0,0,0,20);
showBusyText.Text = "Animation Types";
showBusySpinner = new Spinner(context1, SpinnerMode.Dialog);
//View Mode List
List<String> animationList = new List<String>();
animationList.Add("Ball");
animationList.Add("Battery");
animationList.Add("DoubleCircle");
animationList.Add("ECG");
animationList.Add("Globe");
animationList.Add("HorizontalPulsingBox");
animationList.Add("MovieTimer");
animationList.Add("Print");
animationList.Add("Rectangle");
animationList.Add("RollingBall");
animationList.Add("SingleCircle");
animationList.Add("SlicedCircle");
animationList.Add("ZoomingTarget");
animationList.Add("Gear");
//Data Adapter
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context1, Android.Resource.Layout.SimpleSpinnerItem, animationList);
dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
showBusySpinner.Adapter = dataAdapter;
//Mode Spinner Item Selected Listener
showBusySpinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(animationSpinner_ItemSelected);
}
public override View GetPropertyWindowLayout(Context context)
{
context1 = context;
width = (context.Resources.DisplayMetrics.WidthPixels) / 2;
showBusyLayout();
/******************
**propertylayout**
******************/
//Separator
LinearLayout.LayoutParams separatorLayoutParams = new LinearLayout.LayoutParams(width * 2, 5);
separatorLayoutParams.SetMargins(0, 20, 0, 0);
SeparatorView separate = new SeparatorView(context1, width * 2);
separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
LinearLayout propertylayout = new LinearLayout(context);
propertylayout.Orientation = Orientation.Vertical;
propertylayout.AddView(showBusyText);
showBusyText.SetPadding(0,10,0,30);
propertylayout.AddView(showBusySpinner);
return propertylayout;
}
public override View GetSampleContent(Context con1)
{
con = con1;
//sfBusyIndicator
sfBusyIndicator = new SfBusyIndicator(con);
sfBusyIndicator.IsBusy = true;
sfBusyIndicator.TextColor = Color.Rgb(62, 101, 254);
sfBusyIndicator.AnimationType = AnimationTypes.Ball;
sfBusyIndicator.ViewBoxWidth = 150;
sfBusyIndicator.ViewBoxHeight = 150;
sfBusyIndicator.TextSize = 60;
sfBusyIndicator.Title = "";
sfBusyIndicator.SetBackgroundColor(Color.Rgb(255, 255, 255));
FrameLayout mainView = new FrameLayout(con);
mainView.AddView(sfBusyIndicator);
return mainView;
}
private void AnimationModeLayout()
{
/*********************
**Animation Mode**
*********************/
animationSpinner = new Spinner(con,SpinnerMode.Dialog);
animationSpinner.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center);
animationSpinner.SetMinimumHeight(60);
animationSpinner.DropDownWidth = 500;
animationSpinner.SetSelection(animationSpinnerPosition);
animationSpinner.SetBackgroundColor(Color.Gray);
//Animation List
List<String> animationList = new List<String>();
animationList.Add("Ball");
animationList.Add("Battery");
animationList.Add("DoubleCircle");
animationList.Add("ECG");
animationList.Add("Globe");
animationList.Add("HorizontalPulsingBox");
animationList.Add("MovieTimer");
animationList.Add("Print");
animationList.Add("Rectangle");
animationList.Add("RollingBall");
animationList.Add("SingleCircle");
animationList.Add("SlicedCircle");
animationList.Add("ZoomingTarget");
animationList.Add("Gear");
//Data Adapter
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>
(con, Android.Resource.Layout.SimpleSpinnerItem, animationList);
dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
animationSpinner.Adapter = dataAdapter;
animationSpinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(animationSpinner_ItemSelected);
//Animation Text
animationTypeText = new TextView(con);
animationTypeText.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center);
animationTypeText.TextSize = 15;
animationTypeText.Text = "Animation Types";
}
/*****************************************
**Animation Spinner ItemSelected Method**
*****************************************/
private void animationSpinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
{
Spinner animationSpinner = (Spinner)sender;
animationSpinnerPosition = e.Position;
String selectedItem = animationSpinner.GetItemAtPosition(e.Position).ToString();
if (selectedItem.Equals("Ball"))
{
sfBusyIndicator.Duration = 1000;
sfBusyIndicator.TextColor = Color.ParseColor("#243FD9");
sfBusyIndicator.AnimationType = AnimationTypes.Ball;
}
else if (selectedItem.Equals("Battery"))
{
sfBusyIndicator.Duration = 300;
sfBusyIndicator.TextColor = Color.ParseColor("#A70015");
sfBusyIndicator.AnimationType = AnimationTypes.Battery;
}
else if (selectedItem.Equals("DoubleCircle"))
{
sfBusyIndicator.Duration = 1400;
sfBusyIndicator.TextColor = Color.ParseColor("#958C7B");
sfBusyIndicator.AnimationType = AnimationTypes.DoubleCircle;
}
else if (selectedItem.Equals("ECG"))
{
sfBusyIndicator.Duration = 1500;
sfBusyIndicator.TextColor = Color.ParseColor("#DA901A");
sfBusyIndicator.AnimationType = AnimationTypes.Ecg;
}
else if (selectedItem.Equals("Globe"))
{
sfBusyIndicator.Duration = 800;
sfBusyIndicator.TextColor = Color.ParseColor("#9EA8EE");
sfBusyIndicator.AnimationType = AnimationTypes.Globe;
}
else if (selectedItem.Equals("HorizontalPulsingBox"))
{
sfBusyIndicator.Duration = 500;
sfBusyIndicator.TextColor = Color.ParseColor("#E42E06");
sfBusyIndicator.AnimationType = AnimationTypes.HorizontalPulsingBox;
}
else if (selectedItem.Equals("MovieTimer"))
{
sfBusyIndicator.Duration = 600;
sfBusyIndicator.TextColor = Color.ParseColor("#2d2d2d");
sfBusyIndicator.SecondaryColor = Color.ParseColor("#9b9b9b");
sfBusyIndicator.AnimationType = AnimationTypes.MovieTimer;
}
else if (selectedItem.Equals("Print"))
{
sfBusyIndicator.Duration = 1000;
sfBusyIndicator.TextColor = Color.ParseColor("#5E6FF8");
sfBusyIndicator.AnimationType = AnimationTypes.Print;
}
else if (selectedItem.Equals("Rectangle"))
{
sfBusyIndicator.Duration = 200;
sfBusyIndicator.TextColor = Color.ParseColor("#27AA9E");
sfBusyIndicator.AnimationType = AnimationTypes.Rectangle;
}
else if (selectedItem.Equals("RollingBall"))
{
sfBusyIndicator.Duration = 1000;
sfBusyIndicator.TextColor = Color.ParseColor("#2d2d2d");
sfBusyIndicator.SecondaryColor = Color.White;
sfBusyIndicator.AnimationType = AnimationTypes.RollingBall;
}
else if (selectedItem.Equals("SingleCircle"))
{
sfBusyIndicator.Duration = 1000;
sfBusyIndicator.TextColor = Color.ParseColor("#AF2541");
sfBusyIndicator.AnimationType = AnimationTypes.SingleCircle;
}
else if (selectedItem.Equals("SlicedCircle"))
{
sfBusyIndicator.Duration = 1600;
sfBusyIndicator.TextColor = Color.ParseColor("#779772");
sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle;
}
else if (selectedItem.Equals("ZoomingTarget"))
{
sfBusyIndicator.Duration = 600;
sfBusyIndicator.TextColor = Color.ParseColor("#ED8F3C");
sfBusyIndicator.AnimationType = AnimationTypes.ZoomingTarget;
}
else if (selectedItem.Equals("Gear"))
{
sfBusyIndicator.Duration = 1500;
sfBusyIndicator.TextColor = Color.Gray;
sfBusyIndicator.AnimationType = AnimationTypes.GearBox;
}
}
}
}