ed2e763dd231e044564670ed4d3ac657900aabe5
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / Progress.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 using System;
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.Binding;
20 using System.ComponentModel;
21 using System.Diagnostics;
22
23 namespace Tizen.NUI.Components
24 {
25     /// <summary>
26     /// The Progress class is used to show the ongoing status with a long narrow bar.
27     /// </summary>
28     /// <since_tizen> 6 </since_tizen>
29     public partial class Progress : Control
30     {
31         /// <summary>
32         /// MaxValueProperty
33         /// </summary>
34         [EditorBrowsable(EditorBrowsableState.Never)]
35         public static readonly BindableProperty MaxValueProperty = BindableProperty.Create(nameof(MaxValue), typeof(float), typeof(Progress), default(float), propertyChanged: (bindable, oldValue, newValue) =>
36         {
37             var instance = (Progress)bindable;
38             if (newValue != null)
39             {
40                 instance.maxValue = (float)newValue;
41                 instance.UpdateValue();
42             }
43         },
44         defaultValueCreator: (bindable) =>
45         {
46             var instance = (Progress)bindable;
47             return instance.maxValue;
48         });
49
50         /// <summary>
51         /// MinValueProperty
52         /// </summary>
53         [EditorBrowsable(EditorBrowsableState.Never)]
54         public static readonly BindableProperty MinValueProperty = BindableProperty.Create(nameof(MinValue), typeof(float), typeof(Progress), default(float), propertyChanged: (bindable, oldValue, newValue) =>
55         {
56             var instance = (Progress)bindable;
57             if (newValue != null)
58             {
59                 instance.minValue = (float)newValue;
60                 instance.UpdateValue();
61             }
62         },
63         defaultValueCreator: (bindable) =>
64         {
65             var instance = (Progress)bindable;
66             return instance.minValue;
67         });
68
69         /// <summary>
70         /// CurrentValueProperty
71         /// </summary>
72         [EditorBrowsable(EditorBrowsableState.Never)]
73         public static readonly BindableProperty CurrentValueProperty = BindableProperty.Create(nameof(CurrentValue), typeof(float), typeof(Progress), default(float), propertyChanged: (bindable, oldValue, newValue) =>
74         {
75             var instance = (Progress)bindable;
76             if (newValue != null)
77             {
78                 if ((float)newValue > instance.maxValue || (float)newValue < instance.minValue)
79                 {
80                     return;
81                 }
82                 instance.currentValue = (float)newValue;
83                 instance.UpdateValue();
84             }
85         },
86         defaultValueCreator: (bindable) =>
87         {
88             var instance = (Progress)bindable;
89             return instance.currentValue;
90         });
91
92         /// <summary>
93         /// BufferValueProperty
94         /// </summary>
95         [EditorBrowsable(EditorBrowsableState.Never)]
96         public static readonly BindableProperty BufferValueProperty = BindableProperty.Create(nameof(BufferValue), typeof(float), typeof(Progress), default(float), propertyChanged: (bindable, oldValue, newValue) =>
97         {
98             var instance = (Progress)bindable;
99             if (newValue != null)
100             {
101                 if ((float)newValue > instance.maxValue || (float)newValue < instance.minValue)
102                 {
103                     return;
104                 }
105                 instance.bufferValue = (float)newValue;
106                 instance.UpdateValue();
107             }
108         },
109         defaultValueCreator: (bindable) =>
110         {
111             var instance = (Progress)bindable;
112             return instance.bufferValue;
113         });
114
115         /// <summary>
116         /// ProgressStateProperty
117         /// </summary>
118         [EditorBrowsable(EditorBrowsableState.Never)]
119         public static readonly BindableProperty ProgressStateProperty = BindableProperty.Create(nameof(ProgressState), typeof(ProgressStatusType), typeof(Progress), ProgressStatusType.Indeterminate, propertyChanged: (bindable, oldValue, newValue) =>
120         {
121             var instance = (Progress)bindable;
122             if (newValue != null)
123             {
124                 instance.state = (ProgressStatusType)newValue;
125                 instance.UpdateStates();
126             }
127         },
128         defaultValueCreator: (bindable) =>
129         {
130             var instance = (Progress)bindable;
131             return instance.state;
132         });
133
134         /// <summary>
135         /// IsEnabledProperty
136         /// </summary>
137         [EditorBrowsable(EditorBrowsableState.Never)]
138         public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool), typeof(Progress), true, propertyChanged: (bindable, oldValue, newValue) =>
139         {
140             var instance = (Progress)bindable;
141             if (newValue != null)
142             {
143                 bool newEnabled = (bool)newValue;
144                 if (instance.isEnabled != newEnabled)
145                 {
146                     instance.isEnabled = newEnabled;
147                     instance.Sensitive = newEnabled;
148                     instance.UpdateStates();
149                 }
150             }
151         },
152         defaultValueCreator: (bindable) => ((Progress)bindable).isEnabled);
153
154         /// This needs to be considered more if public-open is necessary.
155         private ProgressStatusType state = ProgressStatusType.Determinate;
156
157         private Vector2 size = null;
158         private const float round = 0.5f;
159         private ImageView trackImage = null;
160         private ImageView progressImage = null;
161         private ImageView bufferImage = null;
162         private ImageVisual indeterminateImage = null;
163         private float maxValue = 100;
164         private float minValue = 0;
165         private float currentValue = 0;
166         private float bufferValue = 0;
167         private Animation indeterminateAnimation = null;
168         bool isEnabled = true;
169
170         static Progress() { }
171         /// <summary>
172         /// The constructor of Progress
173         /// </summary>
174         /// <since_tizen> 6 </since_tizen>
175         public Progress() : base()
176         {
177             Initialize();
178         }
179
180         /// <summary>
181         /// The constructor of the Progress class with specific style.
182         /// </summary>
183         /// <param name="style">style name</param>
184         /// <since_tizen> 8 </since_tizen>
185         public Progress(string style) : base(style)
186         {
187             Initialize();
188         }
189
190         /// <summary>
191         /// The constructor of the Progress class with specific style.
192         /// </summary>
193         /// <param name="progressStyle">The style object to initialize the Progress.</param>
194         /// <since_tizen> 8 </since_tizen>
195         public Progress(ProgressStyle progressStyle) : base(progressStyle)
196         {
197             Initialize();
198         }
199
200         /// <summary>
201         /// The status type of the Progress.
202         /// </summary>
203         /// <since_tizen> 6 </since_tizen>
204         public enum ProgressStatusType
205         {
206             /// <summary>
207             /// Show BufferImage
208             /// </summary>
209             /// <since_tizen> 6 </since_tizen>
210             Buffering,
211
212             /// <summary>
213             /// Show ProgressImage and BufferImage
214             /// </summary>
215             /// <since_tizen> 6 </since_tizen>
216             Determinate,
217
218             /// <summary>
219             /// Show TrackImage
220             /// </summary>
221             /// <since_tizen> 6 </since_tizen>
222             Indeterminate
223         }
224
225         /// <summary>
226         /// Return currently applied style.
227         /// </summary>
228         /// <remarks>
229         /// Modifying contents in style may cause unexpected behaviour.
230         /// </remarks>
231         /// <since_tizen> 8 </since_tizen>
232         public ProgressStyle Style => (ProgressStyle)(ViewStyle as ProgressStyle)?.Clone();
233
234         /// <summary>
235         /// The property to get/set Track image object URL of the Progress.
236         /// </summary>
237         /// <since_tizen> 6 </since_tizen>
238         public string TrackImageURL
239         {
240             get
241             {
242                 return GetValue(TrackImageURLProperty) as string;
243             }
244             set
245             {
246                 SetValue(TrackImageURLProperty, value);
247                 NotifyPropertyChanged();
248             }
249         }
250         private string InternalTrackImageURL
251         {
252             get => trackImage.ResourceUrl;
253             set => trackImage.ResourceUrl = value;
254         }
255
256         /// <summary>
257         /// The property to get/set Progress object image URL of the Progress.
258         /// </summary>
259         /// <since_tizen> 6 </since_tizen>
260         public string ProgressImageURL
261         {
262             get
263             {
264                 return GetValue(ProgressImageURLProperty) as string;
265             }
266             set
267             {
268                 SetValue(ProgressImageURLProperty, value);
269                 NotifyPropertyChanged();
270             }
271         }
272         private string InternalProgressImageURL
273         {
274             get => progressImage.ResourceUrl;
275             set => progressImage.ResourceUrl = value;
276         }
277
278         /// <summary>
279         /// The property to get/set Buffer object image resource URL of the Progress.
280         /// </summary>
281         /// <since_tizen> 6 </since_tizen>
282         public string BufferImageURL
283         {
284             get
285             {
286                 return GetValue(BufferImageURLProperty) as string;
287             }
288             set
289             {
290                 SetValue(BufferImageURLProperty, value);
291                 NotifyPropertyChanged();
292             }
293         }
294         private string InternalBufferImageURL
295         {
296             get => bufferImage.ResourceUrl;
297             set => bufferImage.ResourceUrl = value;
298         }
299
300         /// <summary>
301         /// The property to get/set the indeterminate image.
302         /// </summary>
303         /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
304         /// <since_tizen> 9 </since_tizen>
305         public string IndeterminateImageUrl
306         {
307             get
308             {
309                 return GetValue(IndeterminateImageUrlProperty) as string;
310             }
311             set
312             {
313                 SetValue(IndeterminateImageUrlProperty, value);
314                 NotifyPropertyChanged();
315             }
316         }
317         private string InternalIndeterminateImageUrl
318         {
319             get
320             {
321                 if (indeterminateImage == null)
322                 {
323                     return null;
324                 }
325                 else
326                 {
327                     return indeterminateImage?.URL;
328                 }
329             }
330             set
331             {
332                 if (value == null || indeterminateImage == null)
333                 {
334                     throw new NullReferenceException("Progress.IndeterminateImage is null");
335                 }
336                 else
337                 {
338                     indeterminateImage.URL = value;
339                 }
340             }
341         }
342
343         /// <summary>
344         /// The property to get/set Track object color of the Progress.
345         /// </summary>
346         /// <since_tizen> 6 </since_tizen>
347         public Color TrackColor
348         {
349             get
350             {
351                 return GetValue(TrackColorProperty) as Color;
352             }
353             set
354             {
355                 SetValue(TrackColorProperty, value);
356                 NotifyPropertyChanged();
357             }
358         }
359         private Color InternalTrackColor
360         {
361             get => trackImage.BackgroundColor;
362             set => trackImage.BackgroundColor = value;
363         }
364
365         /// <summary>
366         /// The property to get/set Progress object color of the Progress.
367         /// </summary>
368         /// <since_tizen> 6 </since_tizen>
369         public Color ProgressColor
370         {
371             get
372             {
373                 return GetValue(ProgressColorProperty) as Color;
374             }
375             set
376             {
377                 SetValue(ProgressColorProperty, value);
378                 NotifyPropertyChanged();
379             }
380         }
381         private Color InternalProgressColor
382         {
383             get => progressImage.BackgroundColor;
384             set => progressImage.BackgroundColor = value;
385         }
386
387         /// <summary>
388         /// The property to get/set Buffer object color of the Progress.
389         /// </summary>
390         /// <since_tizen> 6 </since_tizen>
391         public Color BufferColor
392         {
393             get
394             {
395                 return GetValue(BufferColorProperty) as Color;
396             }
397             set
398             {
399                 SetValue(BufferColorProperty, value);
400                 NotifyPropertyChanged();
401             }
402         }
403         private Color InternalBufferColor
404         {
405             get => bufferImage.BackgroundColor;
406             set => bufferImage.BackgroundColor = value;
407         }
408
409         /// <summary>
410         /// The property to get/set the maximum value of the Progress.
411         /// </summary>
412         /// <since_tizen> 6 </since_tizen>
413         public float MaxValue
414         {
415             get
416             {
417                 return (float)GetValue(MaxValueProperty);
418             }
419             set
420             {
421                 SetValue(MaxValueProperty, value);
422             }
423         }
424
425         /// <summary>
426         /// The property to get/set the minim value of the Progress.
427         /// </summary>
428         /// <since_tizen> 6 </since_tizen>
429         public float MinValue
430         {
431             get
432             {
433                 return (float)GetValue(MinValueProperty);
434             }
435             set
436             {
437                 SetValue(MinValueProperty, value);
438             }
439         }
440
441         /// <summary>
442         /// The property to get/set the current value of the Progress.
443         /// </summary>
444         /// <since_tizen> 6 </since_tizen>
445         public float CurrentValue
446         {
447             get
448             {
449                 return (float)GetValue(CurrentValueProperty);
450             }
451             set
452             {
453                 SetValue(CurrentValueProperty, value);
454                 if (Accessibility.Accessibility.IsEnabled && IsHighlighted)
455                 {
456                     EmitAccessibilityEvent(AccessibilityPropertyChangeEvent.Value);
457                 }
458             }
459         }
460
461         /// <summary>
462         /// The property to get/set the buffer value of the Progress.
463         /// </summary>
464         /// <since_tizen> 6 </since_tizen>
465         public float BufferValue
466         {
467             get
468             {
469                 return (float)GetValue(BufferValueProperty);
470             }
471             set
472             {
473                 SetValue(BufferValueProperty, value);
474             }
475         }
476
477         /// <summary>
478         /// Gets or sets state of progress.
479         /// </summary>
480         /// <since_tizen> 6 </since_tizen>
481         public ProgressStatusType ProgressState
482         {
483             get
484             {
485                 return (ProgressStatusType)GetValue(ProgressStateProperty);
486             }
487             set
488             {
489                 SetValue(ProgressStateProperty, value);
490             }
491         }
492
493         /// <summary>
494         /// Flag to decide enable or disable in Progress.
495         /// </summary>
496         [EditorBrowsable(EditorBrowsableState.Never)]
497         public bool IsEnabled
498         {
499             get
500             {
501                 return (bool)GetValue(IsEnabledProperty);
502             }
503             set
504             {
505                 SetValue(IsEnabledProperty, value);
506             }
507         }
508
509         /// <inheritdoc/>
510         [EditorBrowsable(EditorBrowsableState.Never)]
511         public override void OnInitialize()
512         {
513             base.OnInitialize();
514             SetAccessibilityConstructor(Role.ProgressBar, AccessibilityInterface.Value);
515             // create necessary components
516             InitializeTrack();
517             InitializeBuffer();
518             InitializeProgress();
519             InitializeIndeterminate();
520
521             indeterminateAnimation?.Stop();
522             indeterminateAnimation = null;
523         }
524
525         /// <inheritdoc/>
526         [EditorBrowsable(EditorBrowsableState.Never)]
527         public override void ApplyStyle(ViewStyle style)
528         {
529             base.ApplyStyle(style);
530
531             if (style is ProgressStyle progressStyle)
532             {
533                 Debug.Assert(trackImage != null);
534                 Debug.Assert(progressImage != null);
535                 Debug.Assert(bufferImage != null);
536
537                 trackImage.ApplyStyle(progressStyle.Track);
538                 progressImage.ApplyStyle(progressStyle.Progress);
539                 bufferImage.ApplyStyle(progressStyle.Buffer);
540
541                 if (null != indeterminateImage && null != progressStyle.IndeterminateImageUrl)
542                 {
543                     indeterminateImage.URL = progressStyle.IndeterminateImageUrl;
544                 }
545             }
546         }
547
548         /// <summary>
549         /// Prevents from showing child widgets in AT-SPI tree.
550         /// </summary>
551         [EditorBrowsable(EditorBrowsableState.Never)]
552         protected override bool AccessibilityShouldReportZeroChildren()
553         {
554             return true;
555         }
556
557         /// <summary>
558         /// Gets minimum value for Accessibility.
559         /// </summary>
560         [EditorBrowsable(EditorBrowsableState.Never)]
561         protected override double AccessibilityGetMinimum()
562         {
563             if (this.ProgressState == Progress.ProgressStatusType.Determinate)
564             {
565                 return (double)MinValue;
566             }
567             else
568             {
569                 return 0.0;
570             }
571         }
572
573         /// <summary>
574         /// Gets the current value for Accessibility.
575         /// </summary>
576         [EditorBrowsable(EditorBrowsableState.Never)]
577         protected override double AccessibilityGetCurrent()
578         {
579             if (this.ProgressState == Progress.ProgressStatusType.Determinate)
580             {
581                 return (double)CurrentValue;
582             }
583             else
584             {
585                 return 0.0;
586             }
587         }
588
589         /// <summary>
590         /// Gets maximum value for Accessibility.
591         /// </summary>
592         [EditorBrowsable(EditorBrowsableState.Never)]
593         protected override double AccessibilityGetMaximum()
594         {
595             if (this.ProgressState == Progress.ProgressStatusType.Determinate)
596             {
597                 return (double)MaxValue;
598             }
599             else
600             {
601                 return 0.0;
602             }
603         }
604
605         /// <summary>
606         /// Dispose Progress and all children on it.
607         /// </summary>
608         /// <param name="type">Dispose type.</param>
609         /// <since_tizen> 6 </since_tizen>
610         protected override void Dispose(DisposeTypes type)
611         {
612             if (disposed)
613             {
614                 return;
615             }
616
617             if (type == DisposeTypes.Explicit)
618             {
619                 //Called by User
620                 //Release your own managed resources here.
621                 //You should release all of your own disposable objects here.
622                 Utility.Dispose(trackImage);
623                 Utility.Dispose(progressImage);
624                 Utility.Dispose(bufferImage);
625                 indeterminateImage = null;
626             }
627
628             //You must call base.Dispose(type) just before exit.
629             base.Dispose(type);
630         }
631
632         /// <summary>
633         /// Change Image status. It can be override.
634         /// </summary>
635         /// This needs to be considered more if public-open is necessary.
636         [EditorBrowsable(EditorBrowsableState.Never)]
637         private void UpdateStates()
638         {
639             ChangeImageState(state);
640         }
641
642         /// <inheritdoc/>
643         [EditorBrowsable(EditorBrowsableState.Never)]
644         public override void OnRelayout(Vector2 size, RelayoutContainer container)
645         {
646             if (size == null) return;
647
648             if (size.Equals(this.size))
649             {
650                 return;
651             }
652
653             this.size = new Vector2(size);
654             UpdateValue();
655         }
656
657         /// <summary>
658         /// Update progress value
659         /// </summary>
660         /// This needs to be considered more if public-open is necessary.
661         [EditorBrowsable(EditorBrowsableState.Never)]
662         private void UpdateValue()
663         {
664             if (null == trackImage || null == progressImage)
665             {
666                 return;
667             }
668
669             if (minValue >= maxValue || currentValue < minValue || currentValue > maxValue)
670             {
671                 return;
672             }
673
674             float width = this.SizeWidth;
675             float height = this.SizeHeight;
676             float progressRatio = (float)(currentValue - minValue) / (float)(maxValue - minValue);
677             float progressWidth = width * progressRatio;
678             progressImage.Size2D = new Size2D((int)(progressWidth + round), (int)height); //Add const round to reach Math.Round function.
679             if (null != bufferImage)
680             {
681                 if (bufferValue < minValue || bufferValue > maxValue)
682                 {
683                     return;
684                 }
685
686                 float bufferRatio = (float)(bufferValue - minValue) / (float)(maxValue - minValue);
687                 float bufferWidth = width * bufferRatio;
688                 bufferImage.Size2D = new Size2D((int)(bufferWidth + round), (int)height); //Add const round to reach Math.Round function.
689             }
690         }
691
692         private Vector4 destinationValue = new Vector4(-1.0f, 0.0f, 10.0f, 1.0f);
693         private Vector4 initialValue = new Vector4(0.0f, 0.0f, 10.0f, 1.0f);
694
695         /// <summary>
696         /// Update Animation for Indeterminate mode.
697         /// </summary>
698         /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
699         [EditorBrowsable(EditorBrowsableState.Never)]
700         private void UpdateIndeterminateAnimation()
701         {
702             indeterminateAnimation?.Stop();
703
704             if (null != indeterminateImage)
705             {
706                 indeterminateAnimation = AnimateVisual(indeterminateImage, "pixelArea", destinationValue, 0, 1000,  AlphaFunction.BuiltinFunctions.Default, initialValue);
707                 indeterminateAnimation.Looping = true;
708                 indeterminateAnimation.Play();
709             }
710         }
711
712         /// <summary>
713         /// Get Progress style.
714         /// </summary>
715         /// <returns>The default progress style.</returns>
716         /// <since_tizen> 8 </since_tizen>
717         protected override ViewStyle CreateViewStyle()
718         {
719             return new ProgressStyle();
720         }
721
722         /// <summary>
723         /// Change Image status
724         /// </summary>
725         /// <since_tizen> 6 </since_tizen>
726         /// <param name="statusType">New status type</param>
727         protected void ChangeImageState(ProgressStatusType statusType)
728         {
729             if (!IsEnabled)
730             {
731                 ControlState = ControlState.Disabled;
732
733                 indeterminateAnimation?.Stop();
734                 indeterminateAnimation = null;
735
736                 if (null != indeterminateImage)
737                 {
738                     indeterminateImage.Opacity = 0.0f;
739                 }
740                 progressImage.Hide();
741                 bufferImage.Hide();
742                 return;
743             }
744
745             if (statusType == ProgressStatusType.Buffering)
746             {
747                 indeterminateAnimation?.Stop();
748                 indeterminateAnimation = null;
749
750                 if (null != indeterminateImage)
751                 {
752                     indeterminateImage.Opacity = 0.0f;
753                 }
754                 progressImage.Hide();
755                 bufferImage.Show();
756             }
757             else if (statusType == ProgressStatusType.Determinate)
758             {
759                 indeterminateAnimation?.Stop();
760                 indeterminateAnimation = null;
761
762                 if (null != indeterminateImage)
763                 {
764                     indeterminateImage.Opacity = 0.0f;
765                 }
766                 bufferImage.Hide();
767                 progressImage.Show();
768
769                 UpdateValue();
770             }
771             else if (statusType == ProgressStatusType.Indeterminate)
772             {
773                 bufferImage.Hide();
774                 progressImage.Hide();
775                 if (null != indeterminateImage)
776                 {
777                     indeterminateImage.Opacity = 1.0f;
778                 }
779
780                 UpdateIndeterminateAnimation();
781             }
782         }
783
784         private void Initialize()
785         {
786             AccessibilityHighlightable = true;
787         }
788
789         private void InitializeTrack()
790         {
791             if (null == trackImage)
792             {
793                 trackImage = new ImageView
794                 {
795                     WidthResizePolicy = ResizePolicyType.FillToParent,
796                     HeightResizePolicy = ResizePolicyType.FillToParent,
797                     PositionUsesPivotPoint = true,
798                     ParentOrigin = NUI.ParentOrigin.TopLeft,
799                     PivotPoint = NUI.PivotPoint.TopLeft
800                 };
801                 Add(trackImage);
802             }
803         }
804
805         private void InitializeProgress()
806         {
807             if (null == progressImage)
808             {
809                 progressImage = new ImageView
810                 {
811                     WidthResizePolicy = ResizePolicyType.FillToParent,
812                     HeightResizePolicy = ResizePolicyType.FillToParent,
813                     PositionUsesPivotPoint = true,
814                     ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
815                     PivotPoint = Tizen.NUI.PivotPoint.TopLeft
816                 };
817                 Add(progressImage);
818             }
819         }
820
821         private void InitializeBuffer()
822         {
823             if (null == bufferImage)
824             {
825                 bufferImage = new ImageView
826                 {
827                     WidthResizePolicy = ResizePolicyType.FillToParent,
828                     HeightResizePolicy = ResizePolicyType.FillToParent,
829                     PositionUsesPivotPoint = true,
830                     ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
831                     PivotPoint = Tizen.NUI.PivotPoint.TopLeft
832                 };
833                 Add(bufferImage);
834                 bufferImage.Hide(); // At first, buffer image does not show.
835             }
836         }
837
838         private void InitializeIndeterminate()
839         {
840             indeterminateImage = new ImageVisual
841             {
842                 PixelArea = new Vector4(0.0f, 0.0f, 10.0f, 1.0f),
843                 WrapModeU = WrapModeType.Repeat,
844                 SizePolicy = VisualTransformPolicyType.Relative,
845                 Origin = Visual.AlignType.Center,
846                 AnchorPoint = Visual.AlignType.Center,
847                 Opacity = 0.0f,
848                 Size = new Size2D(1, 1),
849                 URL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "nui_component_default_progress_indeterminate.png"
850             };
851             AddVisual("Indeterminate", indeterminateImage);
852
853             if (state == ProgressStatusType.Indeterminate)
854             {
855                 indeterminateImage.Opacity = 1.0f;
856             }
857         }
858     }
859 }