2 * Copyright(c) 2021 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.
17 using Tizen.NUI.BaseComponents;
21 namespace NUITizenGallery
23 public partial class CollectionViewItemClickedEventArgs : EventArgs
25 public int ClickedItemId = -1;
26 public CollectionViewItemClickedEventArgs(int id)
32 public partial class CollectionViewItem : View
34 private int ItemId = -1;
35 public event EventHandler<CollectionViewItemClickedEventArgs> CollectionViewItemClicked;
37 private Animation animation;
39 public CollectionViewItem(int id, string poster, string name, string description)
42 InitializeComponent();
44 ItemPoster.ResourceUrl = poster;
45 ItemTitle.Text = name;
46 ItemDescription.Text = description;
47 ItemDescription.MultiLine = true;
49 TouchEvent += OnTouchEvent;
50 animation = new Animation();
53 public bool OnTouchEvent(object sender, TouchEventArgs args)
55 if (args.Touch.GetState(0) == Tizen.NUI.PointStateType.Finished) {
56 CollectionViewItemClicked.Invoke(this, new CollectionViewItemClickedEventArgs(ItemId));
62 public void SetFocused()
64 ItemBackground.BackgroundColor = Color.Blue;
66 animation.AnimateTo(ItemBackground, "SizeWidth", 340, 0, 100);
67 animation.AnimateTo(ItemBackground, "SizeHeight", 900, 0, 100);
68 animation.AnimateTo(ItemPoster, "SizeWidth", 340, 0, 100);
69 animation.AnimateTo(ItemPoster, "SizeHeight", 496, 0, 100);
70 animation.AnimateTo(ItemTitle, "SizeWidth", 340, 0, 100);
71 animation.AnimateTo(ItemDescription, "SizeWidth", 340, 0, 100);
72 animation.AnimateTo(ItemDescription, "SizeHeight", 350, 0, 100);
73 animation.Looping = false;
77 public void SetNormal()
79 ItemBackground.BackgroundColor = Color.Red;
80 animation.AnimateTo(ItemBackground, "SizeWidth", 300, 0, 100);
81 animation.AnimateTo(ItemBackground, "SizeHeight", 700, 0, 100);
82 animation.AnimateTo(ItemPoster, "SizeWidth", 300, 0, 100);
83 animation.AnimateTo(ItemPoster, "SizeHeight", 438, 0, 100);
84 animation.AnimateTo(ItemTitle, "SizeWidth", 300, 0, 100);
85 animation.AnimateTo(ItemDescription, "SizeWidth", 300, 0, 100);
86 animation.AnimateTo(ItemDescription, "SizeHeight", 50, 0, 100);
87 animation.Looping = false;