2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.Collections.Generic;
19 using System.ComponentModel;
22 using tlog = Tizen.Log;
25 namespace Tizen.NUI.BaseComponents
28 /// AnimatedImageView is a class for displaying Animated-GIF and Image-Array
30 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
31 [EditorBrowsable(EditorBrowsableState.Never)]
32 public class AnimatedImageView : ImageView
34 #region Constructor, Distructor, Dispose
36 /// Construct AnimatedImageView
38 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
39 [EditorBrowsable(EditorBrowsableState.Never)]
40 public AnimatedImageView() : base()
46 /// You can override it to clean-up your own resources
48 /// <param name="type">DisposeTypes</param>
49 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
50 [EditorBrowsable(EditorBrowsableState.Never)]
51 protected override void Dispose(DisposeTypes type)
58 //Release your own unmanaged resources here.
59 //You should not access any managed member here except static instance.
60 //because the execution order of Finalizes is non-deterministic.
63 #endregion Constructor, Distructor, Dispose
67 /// Image URL for Animated-GIF
69 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
70 [EditorBrowsable(EditorBrowsableState.Never)]
71 public new string ResourceUrl
80 /// Image URL list for Image-Array
82 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
83 [EditorBrowsable(EditorBrowsableState.Never)]
84 public List<string> URLs
93 /// Defines the batch size for pre-loading images in the Image-Array animation.
94 /// number of images to pre-load before starting to play. Default value: 1.
96 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
97 [EditorBrowsable(EditorBrowsableState.Never)]
112 /// Defines the cache size for loading images in the Image-Array animation.
113 /// number of images to keep cached ahead during playback. Default value: 1.
116 /// cacheSize should be >= batchSize. If it isn't, then the cache will automatically be changed to batchSize.
117 /// because of the defaults, it is expected that the application developer tune the batch and cache sizes to their particular use case.
119 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
120 [EditorBrowsable(EditorBrowsableState.Never)]
135 /// The number of milliseconds between each frame in the Image-Array animation.
136 /// The number of milliseconds between each frame.
139 /// This is only used when URLs(multiple string) are provided.
141 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
142 [EditorBrowsable(EditorBrowsableState.Never)]
143 public int FrameDelay
157 /// The number of looping.
159 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
160 [EditorBrowsable(EditorBrowsableState.Never)]
177 /// To make the properies be set. This should be called after the properties are set.
179 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
180 [EditorBrowsable(EditorBrowsableState.Never)]
181 public void SetValues()
183 if (mDirtyFlag == false)
189 PropertyMap tMap = new PropertyMap();
190 tMap.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
191 if (mResourceURLs?.Count != 0)
193 PropertyArray tArr = new PropertyArray();
194 foreach (var iter in mResourceURLs)
196 tArr.Add(new PropertyValue(iter));
198 tMap.Insert(ImageVisualProperty.URL, new PropertyValue(tArr));
199 tMap.Insert(ImageVisualProperty.BatchSize, new PropertyValue(mBatchSize));
200 tMap.Insert(ImageVisualProperty.CacheSize, new PropertyValue(mCacheSize));
201 tMap.Insert(ImageVisualProperty.FrameDelay, new PropertyValue(mFrameDelay));
202 tMap.Insert(ImageVisualProperty.LoopCount, new PropertyValue(mLoopCount));
207 tMap.Insert(ImageVisualProperty.URL, new PropertyValue(mUrl));
211 SetProperty(ImageView.Property.IMAGE, new PropertyValue(mMap));
217 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public new void Play()
226 /// Pause animation. Currently pause and stop are same
228 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
229 [EditorBrowsable(EditorBrowsableState.Never)]
230 public new void Pause()
237 /// Stop animation. Currently pause and stop are same
239 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
240 [EditorBrowsable(EditorBrowsableState.Never)]
241 public new void Stop()
249 #region Event, Enum, Struct, ETC
250 #endregion Event, Enum, Struct, ETC
259 List<string> mResourceURLs = new List<string>();
264 bool mDirtyFlag = false;