2 * Copyright(c) 2023 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 Tizen.NUI.BaseComponents;
20 namespace Tizen.NUI.Samples
22 using log = Tizen.Log;
23 public class PlaceHolderImageSample : IExample
25 private const string tag = "NUITEST";
26 private Window mainWin;
27 private ImageView[] imageViews = null;
28 const int imageWidth = 500;
29 const int imageHeight = 500;
30 const int imageMax = 6;
34 private static string[] url = new string[]
36 "https://images.pexels.com/photos/16027424/pexels-photo-16027424.jpeg",
37 "https://images.pexels.com/photos/214574/pexels-photo-214574.jpeg",
38 "https://images.pexels.com/photos/39853/woman-girl-freedom-happy-39853.jpeg",
39 "https://images.pexels.com/photos/842711/pexels-photo-842711.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2",
40 "https://images.pexels.com/photos/15828302/pexels-photo-15828302.jpeg",
44 public void Activate()
49 public void Deactivate()
53 private void Initialize()
55 mainWin = NUIApplication.GetDefaultWindow();
56 mainWin.BackgroundColor = Color.White;
57 mainWin.WindowSize = new Size2D(1920,1080);
58 Size2D windowSize = new Size2D(mainWin.Size.Width,mainWin.Size.Height);
60 imageViews = new ImageView[imageMax];
61 for(int i=0; i<imageMax; i++)
63 int width = (i%(imageMax/2))*imageWidth;
64 int height = (i/(imageMax/2))*imageHeight;
65 imageViews[i] = new ImageView();
66 imageViews[i].Size2D = new Size2D(imageWidth, imageHeight);
67 imageViews[i].Position2D = new Position2D(width,height);
68 imageViews[i].ResourceUrl = url[i];
69 imageViews[i].PlaceHolderUrl = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/placeholder_image.png";
70 imageViews[i].TransitionEffect = true;
71 mainWin.Add(imageViews[i]);
74 mTimer = new Timer(5000);
75 mTimer.Tick += ((object target, Timer.TickEventArgs args) =>
78 for(int i=0;i<imageMax;i++)
80 imageViews[i].ResourceUrl = url[(image_count+i)%imageMax];