2 * Copyright (c) 2017 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;
19 using Tizen.NUI.UIComponents;
21 namespace Tizen.NUI.Examples
23 public class WeatherPage : ContentPage
25 private Vector2 bezierPointIn1 = new Vector2(0.21f, 2);
26 private Vector2 bezierPointIn2 = new Vector2(0.14f, 1);
27 private Vector2 bezierPointOut1 = new Vector2(0.19f, 1);
28 private Vector2 bezierPointOut2 = new Vector2(0.22f, 1);
29 private Animation scaleInAni = null;
30 private Animation scaleOutAni = null;
31 private TableView listTable = null;
33 public WeatherPage(Window win) : base (win)
35 Root.BackgroundImage = "/home/owner/apps_rw/org.tizen.example.NUIXAMLTestSample/res/images/weather/bg.bmp";
36 // Root.BackgroundColor = Color.Green;
40 /// To make the ContentPage instance be disposed.
42 protected override void Dispose(DisposeTypes type)
49 if (type == DisposeTypes.Explicit)
53 scaleInAni?.Dispose();
55 scaleOutAni?.Dispose();
57 FocusManager.Instance.PreFocusChange -= OnPreFocusChange;
62 public override void SetFocus()
64 listTable = Root.FindChildByName("ListTable") as TableView;
66 FocusManager.Instance.FocusIndicator = new View();
67 FocusManager.Instance.SetCurrentFocusView(listTable.GetChildAt(0));
68 FocusManager.Instance.PreFocusChange += OnPreFocusChange;
71 private View OnPreFocusChange(object obj, FocusManager.PreFocusChangeEventArgs e)
73 if (!e.ProposedView && !e.CurrentView)
75 e.ProposedView = listTable.GetChildAt(new TableView.CellPosition(0, 0)); ;
77 return e.ProposedView;
80 private void OnFocusGained(object obj, EventArgs e)
82 ImageView view = obj as ImageView;
85 if (scaleInAni == null)
87 scaleInAni = new Animation();
90 scaleInAni.EndAction = Animation.EndActions.StopFinal;
91 scaleInAni.AnimateTo(view, "Scale", new Vector3(1.2f, 1.2f, 0), 0, 1100, new AlphaFunction(bezierPointIn1, bezierPointIn2));
95 private void OnFocusLost(object obj, EventArgs e)
97 ImageView view = obj as ImageView;
99 if (scaleOutAni == null)
101 scaleOutAni = new Animation();
104 scaleOutAni.EndAction = Animation.EndActions.StopFinal;
105 scaleOutAni.AnimateTo(view, "Scale", new Vector3(1.0f, 1.0f, 0), 0, 850, new AlphaFunction(bezierPointOut1, bezierPointOut2));