--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
+ </startup>
+</configuration>
\ No newline at end of file
--- /dev/null
+namespace NuiCommonUiSamples
+{
+ interface IExample
+ {
+ void Activate();
+ void Deactivate();
+ }
+}
+
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>netcoreapp2.0</TargetFramework>
+ <RootNamespace>NuiCommonUiSamples</RootNamespace>
+ <AssemblyName>NuiCommonUiSamples</AssemblyName>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.FH.NUI" Version="0.0.3" />
+ <PackageReference Include="Tizen.NET" Version="6.0.0.14859" />
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />
+ </ItemGroup>
+
+</Project>
+
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.705
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuiCommonUiSamples", "NuiCommonUiSamples.csproj", "{0C9E7275-202D-4E38-8C87-D74274176164}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0C9E7275-202D-4E38-8C87-D74274176164}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0C9E7275-202D-4E38-8C87-D74274176164}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0C9E7275-202D-4E38-8C87-D74274176164}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0C9E7275-202D-4E38-8C87-D74274176164}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {355D568D-D02A-490A-A6AC-FD6C7D97457A}
+ EndGlobalSection
+EndGlobal
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+
+namespace NuiCommonUiSamples
+{
+ public class Application
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ new DaliDemo().Run(args);
+ //new SampleMain().Run(args);
+ }
+ }
+}
--- /dev/null
+# CommonUI Sample
+
+## Still be under modifying
+
+### Open NuiCommonUiSamples.sln to start
+
+### Required patches :
+https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-csharp-binder/+/211085/
+https://github.com/Samsung/TizenFX/pull/950
+
+### Required nuget package :
+https://tizen.myget.org/F/da-fhub-tizenfx-nui/api/v3/index.json
+Tizen.FH.NUI 0.0.3
+
+### Prerequired packages gbs built in local
+http://165.213.149.170/gerrit/#/admin/projects/product/da/platform/core/csapi/fhub-nui
+fhub-nui-0.0.3-20000.armv7l.rpm
--- /dev/null
+using Tizen.FH.NUI.Controls;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using StyleManager = Tizen.NUI.CommonUI.StyleManager;
+
+namespace NuiCommonUiSamples
+{
+ public class SampleLayout : ImageView
+ {
+ private Tizen.FH.NUI.Controls.Header LayoutHeader;
+
+ private bool isThemeButtonVisible = true;
+ private Tizen.NUI.CommonUI.Button UtilityButton;
+ private Tizen.NUI.CommonUI.Button FoodButton;
+ private Tizen.NUI.CommonUI.Button FamilyButton;
+ private Tizen.NUI.CommonUI.Button KitchenButton;
+
+ private View Content;
+ private View LayoutContent;
+ public string HeaderText
+ {
+ get
+ {
+ return LayoutHeader.HeaderText;
+ }
+
+ set
+ {
+ LayoutHeader.HeaderText = value;
+ }
+ }
+
+
+ public new void Add(View view)
+ {
+ Content.Add(view);
+ }
+
+
+ public SampleLayout(bool isThemeButtonVisiable = true)
+ {
+ Size2D = new Size2D(Window.Instance.Size.Width, Window.Instance.Size.Height);
+ //Window.Instance.Add(this);
+ LayoutHeader = new Tizen.FH.NUI.Controls.Header("DefaultHeader");
+ LayoutHeader.PositionY = 0;
+
+ LayoutContent = new View
+ {
+ Size2D = new Size2D(Window.Instance.Size.Width, Window.Instance.Size.Height - 128),
+ Position2D = new Position2D(0, 128),
+ };
+
+ Content = new View
+ {
+ Size2D = new Size2D(Window.Instance.Size.Width, Window.Instance.Size.Height - 128 - 150),
+ Position2D = new Position2D(0, 150),
+ };
+ LayoutContent.Add(Content);
+
+ if (isThemeButtonVisiable)
+ {
+ ButtonAttributes buttonAttributes = new ButtonAttributes
+ {
+ IsSelectable = true,
+ BackgroundImageAttributes = new ImageAttributes
+ {
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "3. Button/rectangle_point_btn_normal.png" },
+ Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) }
+ },
+
+ ShadowImageAttributes = new ImageAttributes
+ {
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "3. Button/rectangle_btn_shadow.png" },
+ Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) }
+ },
+
+ OverlayImageAttributes = new ImageAttributes
+ {
+ ResourceURL = new StringSelector { Pressed = CommonResource.GetResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" },
+ Border = new RectangleSelector { All = new Rectangle(5, 5, 5, 5) },
+ },
+
+ TextAttributes = new TextAttributes
+ {
+ PointSize = new FloatSelector { All = 30 },
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+
+ TextColor = new ColorSelector
+ {
+ All = new Color(0, 0, 0, 1),
+ },
+ }
+ };
+
+ UtilityButton = new Tizen.NUI.CommonUI.Button(buttonAttributes);
+ UtilityButton.Size2D = new Size2D(200, 80);
+ UtilityButton.Position2D = new Position2D(56, 32);
+ UtilityButton.Text = "Utility";
+ UtilityButton.ClickEvent += UtilityButton_ClickEvent;
+ LayoutContent.Add(UtilityButton);
+
+ buttonAttributes.BackgroundImageAttributes.ResourceURL.All = CommonResource.GetResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_ec7510.png";
+ FoodButton = new Tizen.NUI.CommonUI.Button(buttonAttributes);
+ FoodButton.Size2D = new Size2D(200, 80);
+ FoodButton.Position2D = new Position2D(312, 32);
+ FoodButton.Text = "Food";
+ FoodButton.ClickEvent += FoodButton_ClickEvent;
+ LayoutContent.Add(FoodButton);
+
+ buttonAttributes.BackgroundImageAttributes.ResourceURL.All = CommonResource.GetResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_24c447.png";
+ FamilyButton = new Tizen.NUI.CommonUI.Button(buttonAttributes);
+ FamilyButton.Size2D = new Size2D(200, 80);
+ FamilyButton.Position2D = new Position2D(578, 32);
+ FamilyButton.Text = "Family";
+ FamilyButton.ClickEvent += FamilyButton_ClickEvent;
+ LayoutContent.Add(FamilyButton);
+
+ buttonAttributes.BackgroundImageAttributes.ResourceURL.All = CommonResource.GetResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_9762d9.png";
+ KitchenButton = new Tizen.NUI.CommonUI.Button(buttonAttributes);
+ KitchenButton.Size2D = new Size2D(200, 80);
+ KitchenButton.Position2D = new Position2D(834, 32);
+ KitchenButton.Text = "Kitchen";
+ KitchenButton.ClickEvent += KitchenButton_ClickEvent;
+ LayoutContent.Add(KitchenButton);
+ }
+
+ this.isThemeButtonVisible = isThemeButtonVisiable;
+ Window.Instance.Add(LayoutHeader);
+ Window.Instance.Add(LayoutContent);
+
+ //SampleMain.SampleNaviFrame.NaviFrameItemPush(LayoutHeader, LayoutContent);
+
+ //this.ResourceUrl = CommonResource.GetResourcePath() + "0. BG/background_default_overlay.png";
+ }
+
+ public void AttachSearchBar(Tizen.FH.NUI.Controls.SearchBar searchBar)
+ {
+ LayoutHeader.HeaderText = "";
+ searchBar.WidthResizePolicy = ResizePolicyType.FillToParent;
+ searchBar.SizeHeight = 92;
+ searchBar.PositionY = 16;
+ LayoutHeader.Add(searchBar);
+ //LayoutHeader.PositionY = 100;
+ }
+
+ private void KitchenButton_ClickEvent(object sender, Tizen.NUI.CommonUI.Button.ClickEventArgs e)
+ {
+ StyleManager.Instance.Theme = "Kitchen";
+ }
+
+ private void FamilyButton_ClickEvent(object sender, Tizen.NUI.CommonUI.Button.ClickEventArgs e)
+ {
+ StyleManager.Instance.Theme = "Family";
+ }
+
+ private void FoodButton_ClickEvent(object sender, Tizen.NUI.CommonUI.Button.ClickEventArgs e)
+ {
+ StyleManager.Instance.Theme = "Food";
+ }
+
+ private void UtilityButton_ClickEvent(object sender, Tizen.NUI.CommonUI.Button.ClickEventArgs e)
+ {
+ StyleManager.Instance.Theme = "Utility";
+ }
+
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if (LayoutContent != null)
+ {
+ LayoutContent.Remove(Content);
+ Content.Dispose();
+ Content = null;
+
+ if (isThemeButtonVisible)
+ {
+ LayoutContent.Remove(UtilityButton);
+ UtilityButton.Dispose();
+ LayoutContent.Remove(FoodButton);
+ FoodButton.Dispose();
+ LayoutContent.Remove(FamilyButton);
+ FamilyButton.Dispose();
+ LayoutContent.Remove(KitchenButton);
+ KitchenButton.Dispose();
+ }
+
+ LayoutContent.GetParent().Remove(LayoutContent);
+ LayoutContent.Dispose();
+ LayoutContent = null;
+ }
+
+ if (LayoutHeader != null)
+ {
+ LayoutHeader.GetParent().Remove(LayoutHeader);
+ LayoutHeader.Dispose();
+ LayoutHeader = null;
+ }
+ }
+
+ base.Dispose(type);
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Tizen.FH.NUI;
+using Tizen.FH.NUI.Controls;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using StyleManager = Tizen.NUI.CommonUI.StyleManager;
+
+namespace NuiCommonUiSamples
+{
+ public class CommonResource
+ {
+ public static string GetResourcePath()
+ {
+ return @"/opt/usr/globalapps/NuiCommonUiSamples/res/images/FH3/";
+ }
+ public static string GetDaliResourcePath()
+ {
+ return @"/opt/usr/globalapps/NuiCommonUiSamples/res/images/Dali/";
+ }
+ }
+ public class NaviListItemData
+ {
+ private string str;
+
+ public NaviListItemData(string s)
+ {
+ str = s;
+ }
+
+ public string TextString
+ {
+ get
+ {
+ return str;
+ }
+ }
+ }
+
+ public class NaviListItemView : View
+ {
+ private TextLabel mText;
+
+ public NaviListItemView()
+ {
+ mText = new TextLabel();
+ mText.WidthResizePolicy = ResizePolicyType.FillToParent;
+ mText.HeightResizePolicy = ResizePolicyType.FillToParent;
+ mText.PointSize = 40;
+ mText.HorizontalAlignment = HorizontalAlignment.Begin;
+ mText.VerticalAlignment = VerticalAlignment.Center;
+ Add(mText);
+ }
+
+ public string MainText
+ {
+ get
+ {
+ return mText.Text;
+ }
+ set
+ {
+ mText.Text = value;
+ }
+ }
+ }
+
+ public class NaviListBridge : Tizen.NUI.CommonUI.FlexibleView.Adapter
+ {
+ private List<NaviListItemData> mDatas;
+
+ public NaviListBridge(List<NaviListItemData> datas)
+ {
+ mDatas = datas;
+ }
+
+ public void InsertData(int position)
+ {
+ mDatas.Insert(position, new NaviListItemData((1000 + position).ToString()));
+ NotifyItemInserted(position);
+ }
+
+ public void RemoveData(int position)
+ {
+ mDatas.RemoveAt(position);
+ NotifyItemRemoved(position);
+ }
+
+ public override Tizen.NUI.CommonUI.FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
+ {
+ Tizen.NUI.CommonUI.FlexibleView.ViewHolder viewHolder = new Tizen.NUI.CommonUI.FlexibleView.ViewHolder(new NaviListItemView());
+
+ return viewHolder;
+ }
+
+ public override void OnBindViewHolder(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder, int position)
+ {
+ NaviListItemData listItemData = mDatas[position];
+ NaviListItemView listItemView = holder.ItemView as NaviListItemView;
+
+ listItemView.Name = "Item" + position;
+ listItemView.SizeWidth = 1000;
+ listItemView.SizeHeight = 163;
+
+ if (listItemView != null)
+ {
+ listItemView.MainText = listItemData.TextString;
+ }
+ listItemView.Margin = new Extents(0, 0, 1, 0);
+ listItemView.BackgroundColor = new Color(1f, 1f, 1f, 1f);
+ }
+
+ public override void OnDestroyViewHolder(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder)
+ {
+ if (holder.ItemView != null)
+ {
+ holder.ItemView.Dispose();
+ }
+ }
+
+ public override int GetItemCount()
+ {
+ return mDatas.Count;
+ }
+
+ public override void OnFocusChange(Tizen.NUI.CommonUI.FlexibleView flexibleView, int previousFocus, int currentFocus)
+ {
+ Tizen.NUI.CommonUI.FlexibleView.ViewHolder previousFocusView = flexibleView.FindViewHolderForAdapterPosition(previousFocus);
+ if (previousFocusView != null)
+ {
+
+ }
+ Tizen.NUI.CommonUI.FlexibleView.ViewHolder currentFocusView = flexibleView.FindViewHolderForAdapterPosition(currentFocus);
+ if (currentFocusView != null)
+ {
+
+ }
+ }
+
+ public override void OnViewAttachedToWindow(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder)
+ {
+
+ }
+
+ public override void OnViewDetachedFromWindow(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder)
+ {
+
+ }
+
+ }
+}
+
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Tizen.FH.NUI;
+using Tizen.FH.NUI.Controls;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using StyleManager = Tizen.NUI.CommonUI.StyleManager;
+
+namespace NuiCommonUiSamples
+{
+ public class CommonResource2
+ {
+ public static string GetFHResourcePath()
+ {
+ return @"/opt/usr/globalapps/NuiCommonUiSamples/res/images/nui/";
+ }
+ }
+ public class NaviListItemData2
+ {
+ private string str;
+
+ public NaviListItemData2(string s)
+ {
+ str = s;
+ }
+
+ public string TextString
+ {
+ get
+ {
+ return str;
+ }
+ }
+ }
+
+ public class NaviListItemView2 : View
+ {
+ private TextLabel mText;
+
+ public NaviListItemView2()
+ {
+ mText = new TextLabel();
+ mText.WidthResizePolicy = ResizePolicyType.FillToParent;
+ mText.HeightResizePolicy = ResizePolicyType.FillToParent;
+ mText.PointSize = 20;
+ mText.HorizontalAlignment = HorizontalAlignment.Begin;
+ mText.VerticalAlignment = VerticalAlignment.Center;
+ Add(mText);
+ }
+
+ public string MainText
+ {
+ get
+ {
+ return mText.Text;
+ }
+ set
+ {
+ mText.Text = value;
+ }
+ }
+ }
+
+ public class NaviListBridge2 : Tizen.NUI.CommonUI.FlexibleView.Adapter
+ {
+ private List<NaviListItemData2> mDatas;
+
+ public NaviListBridge2(List<NaviListItemData2> datas)
+ {
+ mDatas = datas;
+ }
+
+ public void InsertData(int position)
+ {
+ mDatas.Insert(position, new NaviListItemData2((1000 + position).ToString()));
+ NotifyItemInserted(position);
+ }
+
+ public void RemoveData(int position)
+ {
+ mDatas.RemoveAt(position);
+ NotifyItemRemoved(position);
+ }
+
+ public override Tizen.NUI.CommonUI.FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
+ {
+ Tizen.NUI.CommonUI.FlexibleView.ViewHolder viewHolder = new Tizen.NUI.CommonUI.FlexibleView.ViewHolder(new NaviListItemView2());
+
+ return viewHolder;
+ }
+
+ public override void OnBindViewHolder(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder, int position)
+ {
+ NaviListItemData2 listItemData = mDatas[position];
+ NaviListItemView2 listItemView = holder.ItemView as NaviListItemView2;
+
+ listItemView.Name = "Item" + position;
+ listItemView.SizeWidth = 1000;
+ listItemView.SizeHeight = 163;
+
+ if (listItemView != null)
+ {
+ listItemView.MainText = listItemData.TextString;
+ }
+ listItemView.Margin = new Extents(0, 0, 1, 0);
+ listItemView.BackgroundColor = new Color(1f, 1f, 1f, 1f);
+ }
+
+ public override void OnDestroyViewHolder(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder)
+ {
+ if (holder.ItemView != null)
+ {
+ holder.ItemView.Dispose();
+ }
+ }
+
+ public override int GetItemCount()
+ {
+ return mDatas.Count;
+ }
+
+ public override void OnFocusChange(Tizen.NUI.CommonUI.FlexibleView flexibleView, int previousFocus, int currentFocus)
+ {
+ Tizen.NUI.CommonUI.FlexibleView.ViewHolder previousFocusView = flexibleView.FindViewHolderForAdapterPosition(previousFocus);
+ if (previousFocusView != null)
+ {
+
+ }
+ Tizen.NUI.CommonUI.FlexibleView.ViewHolder currentFocusView = flexibleView.FindViewHolderForAdapterPosition(currentFocus);
+ if (currentFocusView != null)
+ {
+
+ }
+ }
+
+ public override void OnViewAttachedToWindow(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder)
+ {
+
+ }
+
+ public override void OnViewDetachedFromWindow(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder)
+ {
+
+ }
+
+ }
+ public class SampleMain : FHNUIApplication, IExample
+ {
+ public static Tizen.FH.NUI.Controls.NaviFrame SampleNaviFrame
+ {
+ get
+ {
+ Console.WriteLine("test naviFrame!!");
+ if (naviFrame == null)
+ {
+ Console.WriteLine("test naviFrame null!!");
+ }
+ return naviFrame;
+ }
+ }
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 1.0f);
+ Window.Instance.GetDefaultLayer().Add(naviFrame);
+ Window.Instance.GetDefaultLayer().Add(backNavigation);
+ }
+
+ public void Deactivate()
+ {
+ if (backNavigation != null)
+ {
+ Window.Instance.GetDefaultLayer().Remove(backNavigation);
+ backNavigation.Dispose();
+ backNavigation = null;
+ }
+
+ if (naviFrame != null)
+ {
+ Window.Instance.GetDefaultLayer().Remove(naviFrame);
+ naviFrame.Dispose();
+ naviFrame = null;
+ }
+ }
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ var examples = from type in Assembly.GetEntryAssembly().GetTypes()
+ where typeof(IExample).GetTypeInfo().IsAssignableFrom(type) && type.Namespace == this.GetType().Namespace
+ && type != this.GetType() && type.GetTypeInfo().IsClass
+ orderby type.Name ascending
+ select type.Name;
+ //RunSample("NuiCommonUiSamples", "ContactCardsSample");
+
+ naviFrame = new Tizen.FH.NUI.Controls.NaviFrame("DefaultNaviFrame");
+ Tizen.FH.NUI.Controls.Header head = new Tizen.FH.NUI.Controls.Header("DefaultHeader");
+ head.BackgroundColor = Color.Yellow;
+ head.HeaderText = "CommonUI Samples";
+
+ contentList = new Tizen.NUI.CommonUI.FlexibleView();
+ contentList.Name = "Sample List";
+ contentList.Position2D = new Position2D(0, 1);
+ contentList.Size2D = new Size2D(1080, 1790);
+ //contentList.Size2D = new Size2D(1080, 896);
+ contentList.Padding = new Extents(0, 8, 0, 0);
+ contentList.BackgroundColor = new Color(0, 0, 0, 0.2f);
+ contentList.ItemClickEvent += OnListItemClickEvent;
+
+ List<NaviListItemData2> dataList = new List<NaviListItemData2>();
+ for (int i = 0; i < examples.Count(); ++i)
+ {
+ dataList.Add(new NaviListItemData2(examples.ElementAt(i)));
+ }
+ adapter = new NaviListBridge2(dataList);
+ contentList.SetAdapter(adapter);
+
+ LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL);
+ contentList.SetLayoutManager(layoutManager);
+
+ scrollBar = new ScrollBar("DAScrollbar");
+ scrollBar.Direction = ScrollBar.DirectionType.Vertical;
+ scrollBar.Position2D = new Position2D(1074, 2);
+ scrollBar.Size2D = new Size2D(4, 1786);
+ //scrollBar.Size2D = new Size2D(4, 894);
+ scrollBar.ThumbSize = new Size2D(4, 30);
+ contentList.AttachScrollBar(scrollBar);
+
+ naviFrame.NaviFrameItemPush(head, contentList);
+
+ backNavigation = new Tizen.FH.NUI.Controls.Navigation("Back");
+ backNavigation.Position2D = new Position2D(0, 950);
+ backNavigation.ItemTouchEvent += OnBackNaviTouchEvent;
+
+ Tizen.FH.NUI.Controls.Navigation.NavigationItemData backItem = new Tizen.FH.NUI.Controls.Navigation.NavigationItemData("WhiteBackItem");
+ backNavigation.AddItem(backItem);
+
+ Window.Instance.KeyEvent += Instance_Key;
+
+ Activate();
+ sampleStack.Push(this);
+ }
+
+ private void OnListItemClickEvent(object sender, Tizen.NUI.CommonUI.FlexibleView.ItemClickEventArgs e)
+ {
+ if (e.ClickedView != null)
+ {
+ int index = e.ClickedView.AdapterPosition;
+ string sampleName = (e.ClickedView.ItemView as NaviListItemView2)?.MainText;
+ RunSample("NuiCommonUiSamples", sampleName);
+ }
+ }
+
+ private void OnBackNaviTouchEvent(object source, View.TouchEventArgs e)
+ {
+ Tizen.Log.Debug("NUI", $"OnNaviTouchEvent! touch position=({e.Touch.GetScreenPosition(0).X}, {e.Touch.GetScreenPosition(0).Y}), {e.Touch.GetState(0)}");
+ if (e.Touch.GetState(0) == PointStateType.Up)
+ {
+ ExitSample();
+ }
+ return;
+ }
+
+ public void ExitSample()
+ {
+ if (naviFrame.Count == 1)
+ {
+ if (sampleStack.Count() == 2)
+ {
+ IExample lastSample = sampleStack.Pop();
+ lastSample.Deactivate();
+ FullGC();
+ }
+ Deactivate();
+ Exit();
+ Environment.Exit(0);
+ return;
+ }
+ else
+ {
+ naviFrame.NaviFrameItemPop();
+ }
+ }
+
+ private void Instance_Key(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "BackSpace" || e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
+ {
+ ExitSample();
+ }
+ }
+ public void RunSample(string @namespace, string sampleName)
+ {
+ object item = Activator.CreateInstance(global::System.Type.GetType(@namespace + "." + sampleName));
+ if (item is IExample)
+ {
+ if (sampleStack.Count() > 1)
+ {
+ IExample lastSample = sampleStack.Pop();
+ lastSample.Deactivate();
+ FullGC();
+ }
+ example = item as IExample;
+ sampleStack.Push(example);
+ example.Activate();
+ }
+ }
+
+ private void FullGC()
+ {
+ global::System.GC.Collect();
+ global::System.GC.WaitForPendingFinalizers();
+ global::System.GC.Collect();
+ }
+
+ private bool SampleMain_KeyEvent(object source, View.KeyEventArgs e)
+ {
+ TextLabel textLabel = source as TextLabel;
+
+ if (e.Key.State == Key.StateType.Down)
+ {
+ if (e.Key.KeyPressedName == "Return")
+ {
+ string sampleName = textLabel.Text;
+
+ RunSample("NuiCommonUiSamples", sampleName);
+
+ return true;
+ }
+ switch (e.Key.KeyPressedName)
+ {
+ case "1":
+ StyleManager.Instance.Theme = "Utility";
+ break;
+ case "2":
+ StyleManager.Instance.Theme = "Food";
+ break;
+ case "3":
+ StyleManager.Instance.Theme = "Family";
+ break;
+ case "4":
+ StyleManager.Instance.Theme = "Kitchen";
+ break;
+ }
+ }
+
+ return false;
+ }
+
+ private static Tizen.FH.NUI.Controls.NaviFrame naviFrame;
+ private Tizen.FH.NUI.Controls.Header header;
+ private Tizen.NUI.CommonUI.FlexibleView contentList;
+ private NaviListBridge2 adapter;
+ private Tizen.NUI.CommonUI.ScrollBar scrollBar;
+ private Tizen.FH.NUI.Controls.Navigation backNavigation;
+ IExample example;
+
+ int currentIndex = 0;
+ Stack<IExample> sampleStack = new Stack<IExample>();
+ }
+}
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+ public class Button : IExample
+ {
+ private SampleLayout root;
+
+ private Tizen.NUI.CommonUI.Button BasicButtonNormal;
+ private Tizen.NUI.CommonUI.Button BasicButtonDisabled;
+
+ private Tizen.NUI.CommonUI.Button ServiceButtonNormal;
+ private Tizen.NUI.CommonUI.Button ServiceButtonDisabled;
+
+ private Tizen.NUI.CommonUI.Button ToggleButtonNormal;
+ private Tizen.NUI.CommonUI.Button ToggleButtonDisabled;
+
+ private Tizen.NUI.CommonUI.Button OvalButtonNormal;
+ private Tizen.NUI.CommonUI.Button OvalButtonDisabled;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "Button";
+
+ BasicButtonNormal = new Tizen.NUI.CommonUI.Button("BasicButton");
+ BasicButtonNormal.Size2D = new Size2D(300, 80);
+ BasicButtonNormal.Position2D = new Position2D(156, 50);
+ BasicButtonNormal.Text = "BasicButton";
+ root.Add(BasicButtonNormal);
+
+ BasicButtonDisabled = new Tizen.NUI.CommonUI.Button("BasicButton");
+ BasicButtonDisabled.Size2D = new Size2D(300, 80);
+ BasicButtonDisabled.Position2D = new Position2D(624, 50);
+ BasicButtonDisabled.Text = "BasicButton";
+ BasicButtonDisabled.IsEnabled = false;
+ root.Add(BasicButtonDisabled);
+
+ ServiceButtonNormal = new Tizen.NUI.CommonUI.Button("ServiceButton");
+ ServiceButtonNormal.Size2D = new Size2D(300, 80);
+ ServiceButtonNormal.Position2D = new Position2D(156, 200);
+ ServiceButtonNormal.Text = "ServiceButton";
+ root.Add(ServiceButtonNormal);
+
+ ServiceButtonDisabled = new Tizen.NUI.CommonUI.Button("ServiceButton");
+ ServiceButtonDisabled.Size2D = new Size2D(300, 80);
+ ServiceButtonDisabled.Position2D = new Position2D(624, 200);
+ ServiceButtonDisabled.Text = "ServiceButton";
+ ServiceButtonDisabled.IsEnabled = false;
+ root.Add(ServiceButtonDisabled);
+
+ ToggleButtonNormal = new Tizen.NUI.CommonUI.Button("ToggleButton");
+ ToggleButtonNormal.Size2D = new Size2D(300, 80);
+ ToggleButtonNormal.Position2D = new Position2D(156, 350);
+ ToggleButtonNormal.Text = "ToggleButton";
+ root.Add(ToggleButtonNormal);
+
+ ToggleButtonDisabled = new Tizen.NUI.CommonUI.Button("ToggleButton");
+ ToggleButtonDisabled.Size2D = new Size2D(300, 80);
+ ToggleButtonDisabled.Position2D = new Position2D(624, 350);
+ ToggleButtonDisabled.Text = "ToggleButton";
+ root.Add(ToggleButtonDisabled);
+
+ OvalButtonNormal = new Tizen.NUI.CommonUI.Button("OvalButton");
+ OvalButtonNormal.Size2D = new Size2D(100, 100);
+ OvalButtonNormal.Position2D = new Position2D(156, 500);
+ root.Add(OvalButtonNormal);
+
+ OvalButtonDisabled = new Tizen.NUI.CommonUI.Button("OvalButton");
+ OvalButtonDisabled.Size2D = new Size2D(100, 100);
+ OvalButtonDisabled.Position2D = new Position2D(624, 500);
+ OvalButtonDisabled.IsEnabled = false;
+ root.Add(OvalButtonDisabled);
+ }
+
+ public void Deactivate()
+ {
+ root.Remove(BasicButtonNormal);
+ BasicButtonNormal.Dispose();
+
+ root.Remove(BasicButtonDisabled);
+ BasicButtonDisabled.Dispose();
+
+ root.Remove(ServiceButtonNormal);
+ ServiceButtonNormal.Dispose();
+
+ root.Remove(ServiceButtonDisabled);
+ ServiceButtonDisabled.Dispose();
+
+ root.Remove(ToggleButtonNormal);
+ ToggleButtonNormal.Dispose();
+
+ root.Remove(ToggleButtonDisabled);
+ ToggleButtonDisabled.Dispose();
+
+ root.Remove(OvalButtonNormal);
+ OvalButtonNormal.Dispose();
+ root.Remove(OvalButtonDisabled);
+ OvalButtonDisabled.Dispose();
+
+ root.Dispose();
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+
+ public class CheckBox : IExample
+ {
+ private SampleLayout root;
+
+ private static readonly int Height = 150;
+ private static readonly int Width = 216;
+
+ private uint colNum;
+ private uint rowNum;
+
+ private Tizen.NUI.CommonUI.CheckBoxGroup[] group;
+
+ private static string[] styles = new string[]
+ {
+ "enabled",
+ "enabled",
+ "disabled",
+ "disabledSelected",
+ };
+
+ private static string[] applications = new string[]
+ {
+ "Group1",
+ "Group2",
+ "Group3",
+ "Group4",
+ };
+
+ private TableView table;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "CheckBox";
+
+ if (styles.Length == 0 || applications.Length == 0)
+ {
+ return;
+ }
+ colNum = (uint)applications.Length + 1;
+ rowNum = (uint)styles.Length + 1;
+
+ table = new TableView(rowNum, colNum)
+ {
+ Size2D = new Size2D(1080, 1920),
+ };
+ for (uint i = 1; i < rowNum; i++)
+ {
+ TextLabel text = new TextLabel();
+ text.Size2D = new Size2D(Width, Height);
+ text.PointSize = 12;
+ text.Focusable = true;
+ text.HorizontalAlignment = HorizontalAlignment.Center;
+ text.VerticalAlignment = VerticalAlignment.Center;
+ text.Text = styles[i - 1];
+ table.AddChild(text, new TableView.CellPosition(i, 0));
+ }
+
+ for (uint i = 1; i < colNum; i++)
+ {
+ TextLabel text = new TextLabel();
+ text.Size2D = new Size2D(Width, Height);
+ text.PointSize = 12;
+ text.HorizontalAlignment = HorizontalAlignment.Center;
+ text.VerticalAlignment = VerticalAlignment.Center;
+ text.Text = applications[i - 1];
+ text.Focusable = true;
+ table.AddChild(text, new TableView.CellPosition(0, i));
+ }
+ group = new CheckBoxGroup[4];
+ for (uint j = 1; j < colNum; j++)
+ {
+ group[j - 1] = new CheckBoxGroup();
+ for (uint i = 1; i < rowNum; i++)
+ {
+ Tizen.NUI.CommonUI.CheckBox checkBox = new Tizen.NUI.CommonUI.CheckBox("CheckBox");
+ checkBox.Size2D = new Size2D(48, 48);
+ if (i == 3)
+ {
+ checkBox.IsEnabled = false;
+ }
+ else if (i == 4)
+ {
+ checkBox.IsEnabled = false;
+ checkBox.IsSelected = true;
+ }
+ else
+ {
+ group[j - 1].Add(checkBox);
+ }
+ checkBox.Focusable = true;
+ //checkBox.Text = checkBox.IsSelected.ToString();
+ checkBox.SelectedEvent += CheckBoxSelectedEvent;
+ table.AddChild(checkBox, new TableView.CellPosition(i, j));
+ }
+ }
+
+ for (uint i = 0; i < rowNum; i++)
+ {
+ table.SetFixedHeight(i, Height);
+ for (uint j = 0; j < colNum; j++)
+ {
+ table.SetFixedWidth(j, Width);
+ table.SetCellAlignment(new TableView.CellPosition(i, j), HorizontalAlignmentType.Center, VerticalAlignmentType.Center);
+ }
+ }
+
+ root.Add(table);
+ }
+
+ private void CheckBoxSelectedEvent(object sender, SelectButton.SelectEventArgs e)
+ {
+ Tizen.NUI.CommonUI.CheckBox obj = sender as Tizen.NUI.CommonUI.CheckBox;
+ for (uint i = 0; i < rowNum; i++)
+ {
+ for (uint j = 0; j < colNum; j++)
+ {
+ Tizen.NUI.CommonUI.CheckBox child = table.GetChildAt(new TableView.CellPosition(i, j)) as Tizen.NUI.CommonUI.CheckBox;
+ if (child != null)
+ {
+ //child.Text = child.IsSelected.ToString();
+ }
+ }
+ }
+ }
+
+ public void Deactivate()
+ {
+ for (uint i = 0; i < rowNum; i++)
+ {
+ for (uint j = 0; j < colNum; j++)
+ {
+ View child = table.GetChildAt(new TableView.CellPosition(i, j));
+ if (child != null)
+ {
+ table.RemoveChildAt(new TableView.CellPosition(i, j));
+ child.Dispose();
+ }
+ }
+ }
+
+ if (root != null)
+ {
+ if (table != null)
+ {
+ root.Remove(table);
+ table.Dispose();
+ }
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using Tizen.NUI;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.NUI.UIComponents;
+using Tizen.NUI.BaseComponents;
+using System.Runtime.InteropServices;
+
+namespace NuiCommonUiSamples
+{
+ public class ClippedImage
+ {
+ public static float QUAD_GEOMETRY = 1.0f;
+ public static float CIRCLE_GEOMETRY = 0.0f;
+ static float[] circleArray;
+ static float[] quadArray;
+
+ static Geometry geometry = null;
+
+ private static readonly string VERTEX_SHADER =
+ "attribute vec2 aPositionCircle;\n" +
+ "attribute vec2 aPositionQuad;\n" +
+ "uniform float uDelta;\n" +
+ "uniform mat4 uMvpMatrix;\n" +
+ "uniform vec3 uSize;\n" +
+ "\n" +
+ "void main()\n" +
+ "{\n" +
+ " vec4 vertexPosition = vec4(mix(aPositionCircle, aPositionQuad, uDelta), 0.0, 1.0);\n" +
+ " vertexPosition.xyz *= uSize;\n" +
+ " gl_Position = uMvpMatrix * vertexPosition;\n" +
+ "}\n";
+
+ private static readonly string FRAGMENT_SHADER =
+ "precision mediump float;\n" +
+ "void main()\n" +
+ "{\n" +
+ " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n" +
+ "}\n";
+
+ public static View Create(string imagePath )
+ {
+ // Create a view which whose geometry will be morphed between a circle and a quad
+ View clippedImage = new View();
+ clippedImage.ClippingMode = ClippingModeType.ClipChildren;
+
+ // Create the required renderer and add to the clipped image view
+ Shader shader = CreateShader();
+ CreateGeometry();
+ Renderer renderer = new Renderer(geometry, shader);
+ renderer.BlendMode = 2;
+ clippedImage.AddRenderer(renderer);
+
+ // Register the property on the clipped image view which will allow animations between a circle and a quad
+ int propertyIndex = clippedImage.RegisterProperty("uDelta", new PropertyValue(0.0f));
+
+ // Add the actual image to the control
+ View image = new ImageView(imagePath);
+ image.WidthResizePolicy = ResizePolicyType.FillToParent;
+ image.HeightResizePolicy = ResizePolicyType.FillToParent;
+ image.ParentOrigin = ParentOrigin.Center;
+ image.PivotPoint = PivotPoint.Center;
+ image.PositionUsesPivotPoint = true;
+ clippedImage.Add(image);
+
+ return clippedImage;
+ }
+
+ private static Shader CreateShader()
+ {
+ Shader shader = new Shader(VERTEX_SHADER, FRAGMENT_SHADER);
+
+ return shader;
+ }
+
+ private static void CreateGeometry()
+ {
+ if(geometry == null)
+ {
+ geometry = new Geometry();
+
+ const int vertexCount = 34;
+
+ circleArray = new float[vertexCount * 2];
+ quadArray = new float[vertexCount * 2];
+
+ // Create the circle geometry
+
+ // Radius is bound to actor's dimensions so this should not be increased.
+ // If a bigger circle is required then the actor size should be increased.
+ const float radius = 0.5f;
+ Vector2 center = new Vector2(0.0f, 0.0f);
+
+ // Create a buffer for vertex data
+ Vector2[] circleBuffer = new Vector2[vertexCount];
+ int idx = 0;
+
+ // Center vertex for triangle fan
+ circleBuffer[idx++] = center;
+
+ // Outer vertices of the circle
+ const int outerVertexCount = vertexCount - 1;
+
+ for (int i = 0; i < outerVertexCount; ++i)
+ {
+ float percent = (i / (float)(outerVertexCount - 1));
+ float rad = percent * 2.0f * (float)Math.PI;
+
+ // Vertex position
+ Vector2 tmpvec = new Vector2(0, 0);
+ tmpvec.X = (float)(center.X + radius * Math.Cos(rad));
+ tmpvec.Y = (float)(center.Y + radius * Math.Sin(rad));
+
+ circleBuffer[idx++] = tmpvec;
+ }
+
+ for(int i = 0; i < idx; i++)
+ {
+ circleArray[i * 2] = circleBuffer[i].X;
+ circleArray[i * 2 + 1] = circleBuffer[i].Y;
+ }
+
+ PropertyMap circleVertexFormat = new PropertyMap();
+ circleVertexFormat.Add("aPositionCircle", new PropertyValue((int)PropertyType.Vector2));
+ PropertyBuffer circleVertices = new PropertyBuffer(circleVertexFormat);
+
+ unsafe
+ {
+ float* pc = (float*)Marshal.UnsafeAddrOfPinnedArrayElement(circleArray, 0);
+ IntPtr pA = new IntPtr(pc);
+ circleVertices.SetData(pA, vertexCount);
+ }
+
+
+ // Create the Quad Geometry
+ Vector2[] quadBuffer = new Vector2[vertexCount];
+ idx = 0;
+ quadBuffer[idx++] = new Vector2(center.X, center.Y);
+
+ const int vertsPerSide = (vertexCount - 2) / 4;
+ Vector2 outer = new Vector2(0.5f, 0.0f);
+ quadBuffer[idx++] = new Vector2(outer.X, outer.Y);
+ float incrementPerBuffer = 1.0f / (float)(vertsPerSide);
+
+ for (int i = 0; i < vertsPerSide && outer.Y < 0.5f; ++i)
+ {
+ outer.Y += incrementPerBuffer;
+ quadBuffer[idx++] = new Vector2(outer.X, outer.Y);
+ }
+
+ for (int i = 0; i < vertsPerSide && outer.X > -0.5f; ++i)
+ {
+ outer.X -= incrementPerBuffer;
+ quadBuffer[idx++] = new Vector2(outer.X, outer.Y);
+ }
+
+ for (int i = 0; i < vertsPerSide && outer.Y > -0.5f; ++i)
+ {
+ outer.Y -= incrementPerBuffer;
+ quadBuffer[idx++] = new Vector2(outer.X, outer.Y);
+ }
+
+ for (int i = 0; i < vertsPerSide && outer.X < 0.5f; ++i)
+ {
+ outer.X += incrementPerBuffer;
+ quadBuffer[idx++] = new Vector2(outer.X, outer.Y);
+ }
+
+ for (int i = 0; i < vertsPerSide && outer.Y < 0.0f; ++i)
+ {
+ outer.Y += incrementPerBuffer;
+ quadBuffer[idx++] = new Vector2(outer.X, outer.Y);
+ }
+
+ for(int i = 0; i < idx; i++)
+ {
+ quadArray[i * 2] = quadBuffer[i].X;
+ quadArray[i * 2 + 1] = quadBuffer[i].Y;
+ }
+
+ PropertyMap vertexFormat = new PropertyMap();
+ vertexFormat.Add("aPositionQuad", new PropertyValue((int)PropertyType.Vector2));
+ PropertyBuffer quadVertices2 = new PropertyBuffer(vertexFormat);
+ unsafe
+ {
+ float* pc = (float*)Marshal.UnsafeAddrOfPinnedArrayElement(quadArray, 0);
+ IntPtr pA = new IntPtr(pc);
+ quadVertices2.SetData(pA, vertexCount);
+ }
+ //int length2 = Marshal.SizeOf(quadBuffer[0]);
+ //IntPtr p2 = Marshal.AllocHGlobal(length2 * vertexCount);
+ //quadVertices2.SetData(p2, vertexCount);
+
+ // Create the geometry object itself
+ geometry.AddVertexBuffer(circleVertices);
+ geometry.AddVertexBuffer(quadVertices2);
+ geometry.SetType(Geometry.Type.TRIANGLE_FAN);
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.UIComponents;
+
+namespace NuiCommonUiSamples
+{
+ public class ContactCard
+ {
+ private TapGestureDetector mTapDetector;
+ private View mContactCard;
+ private View mHeader;
+ private View mClippedImage;
+ private View mMaskedImage;
+ private TextLabel mNameText;
+ private TextLabel mDetailText;
+
+ private Animation mAnimation;
+ private ContactCardLayoutInfo mContactCardLayoutInfo;
+ private Vector2 foldedPosition;
+ private int mClippedImagePropertyIndex;
+ private bool mFolded;
+
+
+ private readonly TimePeriod TIME_PERIOD_UNFOLD_X = new TimePeriod(0, 360); ///< Start at 0ms, duration 360ms
+ private readonly TimePeriod TIME_PERIOD_UNFOLD_Y = new TimePeriod(40, 360); ///< Start at 40ms, duration 360ms
+ private readonly TimePeriod TIME_PERIOD_UNFOLD_WIDTH = new TimePeriod(0, 360); ///< Start at 0ms, duration 360ms
+ private readonly TimePeriod TIME_PERIOD_UNFOLD_HEIGHT = new TimePeriod(40, 360); ///< Start at 40ms, duration 360ms
+ private readonly TimePeriod TIME_PERIOD_UNFOLD_NAME_OPACITY = new TimePeriod(0, 80); ///< Start at 0ms, duration 80ms
+ private readonly TimePeriod TIME_PERIOD_UNFOLD_DETAIL_OPACITY = new TimePeriod( 80, 80 ); ///< Start at 80ms, duration 80ms
+ private readonly TimePeriod TIME_PERIOD_UNFOLD_SIBLING_OPACITY = new TimePeriod( 0, 80 ); ///< Start at 0ms, duration 80ms
+ private readonly TimePeriod TIME_PERIOD_UNFOLD_MESH_MORPH = new TimePeriod( 0, 400 ); ///< Start at 0ms, duration 400ms
+
+ private readonly TimePeriod TIME_PERIOD_FOLD_X = new TimePeriod( 64, 336 ); ///< Start at 64ms, duration 336ms
+ private readonly TimePeriod TIME_PERIOD_FOLD_Y = new TimePeriod( 0, 336 ); ///< Start at 0ms, duration 336ms
+ private readonly TimePeriod TIME_PERIOD_FOLD_WIDTH = new TimePeriod( 64, 336 ); ///< Start at 64ms, duration 336ms
+ private readonly TimePeriod TIME_PERIOD_FOLD_HEIGHT = new TimePeriod( 0, 336 ); ///< Start at 0ms, duration 336ms
+ private readonly TimePeriod TIME_PERIOD_FOLD_NAME_OPACITY = new TimePeriod( 80, 80 ); ///< Start at 80ms, duration 80ms
+ private readonly TimePeriod TIME_PERIOD_FOLD_DETAIL_OPACITY = new TimePeriod( 0, 80 ); ///< Start at 0ms, duration 80ms
+ private readonly TimePeriod TIME_PERIOD_FOLD_SIBLING_OPACITY = new TimePeriod( 320, 80 ); ///< Start at 320ms, duration 80ms
+ private readonly TimePeriod TIME_PERIOD_FOLD_MESH_MORPH = new TimePeriod( 0, 400 ); ///< Start at 0ms, duration 400ms
+
+ private AlphaFunction.BuiltinFunctions ALPHA_FUNCTION_UNFOLD = AlphaFunction.BuiltinFunctions.Default;
+ private AlphaFunction.BuiltinFunctions ALPHA_FUNCTION_FOLD = AlphaFunction.BuiltinFunctions.EaseInOut;
+
+ private readonly Color HEADER_COLOR = new Color( 231.0f / 255.0f, 231.0f / 255.0f, 231.0f / 255.0f, 1.0f );
+
+
+ public ContactCard(ContactCardLayoutInfo contactCardLayoutInfo, string contactName, string contactAddress, string imagePath, Vector2 position, View rootView)
+ {
+ mContactCardLayoutInfo = contactCardLayoutInfo;
+ foldedPosition = new Vector2(position.X, position.Y);
+ mClippedImagePropertyIndex = -1;
+ mFolded = true;
+
+ //Window.Instance.KeyEvent += OnKeyEvent;
+
+ // Create a View which will be used for the background and to clip the contents
+ mContactCard = new View();
+ mContactCard.BackgroundColor = Color.White;
+ mContactCard.ClippingMode = ClippingModeType.ClipChildren;
+ mContactCard.ParentOrigin = ParentOrigin.TopLeft;
+ mContactCard.PivotPoint = PivotPoint.TopLeft;
+ mContactCard.PositionUsesPivotPoint = true;
+ mContactCard.Position2D = new Position2D((int)foldedPosition.X, (int)foldedPosition.Y);
+ mContactCard.Size2D = new Size2D((int)mContactCardLayoutInfo.foldedSize.Width, (int)mContactCardLayoutInfo.foldedSize.Height);
+ mContactCard.KeyEvent += OnKeyEvent;
+
+ Window.Instance.GetDefaultLayer().Add(mContactCard);
+ rootView.Add(mContactCard);
+
+ // Create the header which will be shown only when the contact is unfolded
+ mHeader = new View();
+ mHeader.Size2D = new Size2D((int)mContactCardLayoutInfo.headerSize.Width, (int)mContactCardLayoutInfo.headerSize.Height);
+ mHeader.BackgroundColor = HEADER_COLOR;
+ mHeader.ParentOrigin = ParentOrigin.TopLeft;
+ mHeader.PivotPoint = PivotPoint.TopLeft;
+ mHeader.PositionUsesPivotPoint = true;
+ mHeader.Position2D = new Position2D((int)mContactCardLayoutInfo.headerFoldedPosition.X, (int)mContactCardLayoutInfo.headerFoldedPosition.Y);
+
+ // Create a clipped image (whose clipping can be animated)
+ mClippedImage = ClippedImage.Create(imagePath);
+ mClippedImage.Size2D = new Size2D((int)mContactCardLayoutInfo.imageSize.Width, (int)mContactCardLayoutInfo.imageSize.Height);
+ mClippedImage.ParentOrigin = ParentOrigin.TopLeft;
+ mClippedImage.PivotPoint = PivotPoint.TopLeft;
+ mClippedImage.PositionUsesPivotPoint = true;
+ mClippedImage.Position2D = new Position2D((int)mContactCardLayoutInfo.imageFoldedPosition.X, (int)mContactCardLayoutInfo.imageFoldedPosition.Y);
+ mClippedImage.Hide();
+ mContactCard.Add(mClippedImage);
+
+ // Create an image with a mask which is to be used when the contact is folded
+ mMaskedImage = MaskedImage.Create(imagePath);
+ mMaskedImage.Size2D = new Size2D((int)mContactCardLayoutInfo.imageSize.Width, (int)mContactCardLayoutInfo.imageSize.Height);
+ mMaskedImage.ParentOrigin = ParentOrigin.TopLeft;
+ mMaskedImage.PivotPoint = PivotPoint.TopLeft;
+ mMaskedImage.PositionUsesPivotPoint = true;
+ mMaskedImage.Position2D = new Position2D((int)mContactCardLayoutInfo.imageFoldedPosition.X, (int)mContactCardLayoutInfo.imageFoldedPosition.Y);
+ mContactCard.Add(mMaskedImage);
+
+ // Add the text label for just the name
+ mNameText = new TextLabel(contactName);
+ //mNameText.StyleName = "ContactNameTextLabel";
+ mNameText.TextColor = new Color(0, 0, 0, 1);
+ mNameText.HorizontalAlignment = HorizontalAlignment.Center;
+ mNameText.PointSize = 14;
+ mNameText.ParentOrigin = ParentOrigin.TopLeft;
+ mNameText.PivotPoint = PivotPoint.TopLeft;
+ mNameText.PositionUsesPivotPoint = true;
+ mNameText.WidthResizePolicy = ResizePolicyType.FillToParent;
+ mNameText.Position2D = new Position2D((int)mContactCardLayoutInfo.textFoldedPosition.X, (int)mContactCardLayoutInfo.textFoldedPosition.Y);
+ mContactCard.Add(mNameText);
+
+ // Create the detail text-label
+ string detailString = contactName;
+ detailString += "\n\n";
+ detailString += contactAddress;
+
+ mDetailText = new TextLabel(detailString);
+ //mDetailText.StyleName = "ContactDetailTextLabel";
+ mDetailText.TextColor = new Color(0, 0, 0, 1);
+ mDetailText.MultiLine = true;
+ mDetailText.PointSize = 20;
+ mDetailText.ParentOrigin = ParentOrigin.TopLeft;
+ mDetailText.PivotPoint = PivotPoint.TopLeft;
+ mDetailText.PositionUsesPivotPoint = true;
+ mDetailText.Position2D = new Position2D((int)mContactCardLayoutInfo.textFoldedPosition.X, (int)mContactCardLayoutInfo.textFoldedPosition.Y);
+ mDetailText.Size2D = new Size2D((int)(mContactCardLayoutInfo.unfoldedSize.Width - mContactCardLayoutInfo.textFoldedPosition.X * 2.0f), 0);
+ mDetailText.Opacity = 0.0f;
+
+ // Attach tap detection to the overall clip control
+ mTapDetector = new TapGestureDetector();
+ mTapDetector.Attach(mContactCard);
+ mTapDetector.Detected += OnTap;
+ }
+
+ private void Animate()
+ {
+ FocusManager focusManager = FocusManager.Instance;
+ mAnimation = new Animation(0);
+
+ if(mFolded)
+ {
+ mContactCard.Focusable = true;
+ focusManager.SetCurrentFocusView(mContactCard);
+
+ mContactCard.Add(mHeader);
+ mContactCard.Add(mDetailText);
+
+ // Show clipped-image to animate geometry and hide the masked-image
+ mClippedImage.Show();
+ mMaskedImage.Hide();
+
+ // Animate the size of the control (and clipping area)
+ mAnimation.AnimateTo(mContactCard, "PositionX", mContactCardLayoutInfo.unfoldedPosition.X, TIME_PERIOD_UNFOLD_X.start, TIME_PERIOD_UNFOLD_X.start + TIME_PERIOD_UNFOLD_X.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ mAnimation.AnimateTo(mContactCard, "PositionY", mContactCardLayoutInfo.unfoldedPosition.Y, TIME_PERIOD_UNFOLD_Y.start, TIME_PERIOD_UNFOLD_Y.start + TIME_PERIOD_UNFOLD_Y.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ mAnimation.AnimateTo(mContactCard, "SizeWidth", mContactCardLayoutInfo.unfoldedSize.Width, TIME_PERIOD_UNFOLD_WIDTH.start, TIME_PERIOD_UNFOLD_WIDTH.start + TIME_PERIOD_UNFOLD_WIDTH.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ mAnimation.AnimateTo(mContactCard, "SizeHeight", mContactCardLayoutInfo.unfoldedSize.Height, TIME_PERIOD_UNFOLD_HEIGHT.start, TIME_PERIOD_UNFOLD_HEIGHT.start + TIME_PERIOD_UNFOLD_HEIGHT.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+
+ // Animate the header area into position
+ mAnimation.AnimateTo(mHeader, "PositionX", mContactCardLayoutInfo.headerUnfoldedPosition.X, TIME_PERIOD_UNFOLD_X.start, TIME_PERIOD_UNFOLD_X.start + TIME_PERIOD_UNFOLD_X.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ mAnimation.AnimateTo(mHeader, "PositionY", mContactCardLayoutInfo.headerUnfoldedPosition.Y, TIME_PERIOD_UNFOLD_Y.start, TIME_PERIOD_UNFOLD_Y.start + TIME_PERIOD_UNFOLD_Y.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+
+ // Animate the clipped image into the unfolded position and into a quad
+ mAnimation.AnimateTo(mClippedImage, "PositionX", mContactCardLayoutInfo.imageUnfoldedPosition.X, TIME_PERIOD_UNFOLD_X.start, TIME_PERIOD_UNFOLD_X.start + TIME_PERIOD_UNFOLD_X.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ mAnimation.AnimateTo(mClippedImage, "PositionY", mContactCardLayoutInfo.imageUnfoldedPosition.Y, TIME_PERIOD_UNFOLD_Y.start, TIME_PERIOD_UNFOLD_Y.start + TIME_PERIOD_UNFOLD_Y.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ mAnimation.AnimateTo(mClippedImage, "uDelta", ClippedImage.QUAD_GEOMETRY, TIME_PERIOD_UNFOLD_MESH_MORPH.start , TIME_PERIOD_UNFOLD_MESH_MORPH.start + TIME_PERIOD_UNFOLD_MESH_MORPH.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+
+ // Fade out the opacity of the name, and animate into the unfolded position
+ mAnimation.AnimateTo(mNameText, "ColorAlpha", 0.0f, TIME_PERIOD_UNFOLD_NAME_OPACITY.start, TIME_PERIOD_UNFOLD_NAME_OPACITY.start + TIME_PERIOD_UNFOLD_NAME_OPACITY.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ mAnimation.AnimateTo(mNameText, "PositionX", mContactCardLayoutInfo.textUnfoldedPosition.X, TIME_PERIOD_UNFOLD_X.start, TIME_PERIOD_UNFOLD_X.start + TIME_PERIOD_UNFOLD_X.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ mAnimation.AnimateTo(mNameText, "PositionY", mContactCardLayoutInfo.textUnfoldedPosition.Y, TIME_PERIOD_UNFOLD_Y.start, TIME_PERIOD_UNFOLD_Y.start + TIME_PERIOD_UNFOLD_Y.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+
+ // Fade in the opacity of the detail, and animate into the unfolded position
+ mAnimation.AnimateTo(mDetailText, "ColorAlpha", 1.0f, TIME_PERIOD_UNFOLD_NAME_OPACITY.start, TIME_PERIOD_UNFOLD_NAME_OPACITY.start + TIME_PERIOD_UNFOLD_NAME_OPACITY.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ mAnimation.AnimateTo(mDetailText, "PositionX", mContactCardLayoutInfo.textUnfoldedPosition.X, TIME_PERIOD_UNFOLD_X.start, TIME_PERIOD_UNFOLD_X.start + TIME_PERIOD_UNFOLD_X.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ mAnimation.AnimateTo(mDetailText, "PositionY", mContactCardLayoutInfo.textUnfoldedPosition.Y, TIME_PERIOD_UNFOLD_Y.start, TIME_PERIOD_UNFOLD_Y.start + TIME_PERIOD_UNFOLD_Y.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+
+ // Fade out all the siblings
+ View parent = mContactCard.GetParent() as View;
+ for (uint i = 0; i < parent.GetChildCount(); ++i)
+ {
+ View sibling = parent.GetChildAt(i);
+ if (sibling != mContactCard)
+ {
+ mAnimation.AnimateTo(sibling, "ColorAlpha", 0.0f, TIME_PERIOD_UNFOLD_SIBLING_OPACITY.start, TIME_PERIOD_UNFOLD_SIBLING_OPACITY.start + TIME_PERIOD_UNFOLD_SIBLING_OPACITY.duration, new AlphaFunction(ALPHA_FUNCTION_UNFOLD));
+ sibling.Sensitive = false;
+ }
+ }
+
+ mAnimation.Finished += OnAnimationFinished;
+ mAnimation.Play();
+ }
+ else
+ {
+ // Remove key-input-focus from our contact-card when we are folded
+ FocusManager.Instance.ClearFocus();
+
+ mContactCard.Add(mNameText);
+
+ // Animate the size of the control (and clipping area)
+ mAnimation.AnimateTo(mContactCard, "PositionX", foldedPosition.X, TIME_PERIOD_FOLD_X.start, TIME_PERIOD_FOLD_X.start + TIME_PERIOD_FOLD_X.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ mAnimation.AnimateTo(mContactCard, "PositionY", foldedPosition.Y, TIME_PERIOD_FOLD_Y.start, TIME_PERIOD_FOLD_Y.start + TIME_PERIOD_FOLD_Y.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ mAnimation.AnimateTo(mContactCard, "SizeWidth", mContactCardLayoutInfo.foldedSize.Width, TIME_PERIOD_FOLD_WIDTH.start, TIME_PERIOD_FOLD_WIDTH.start + TIME_PERIOD_FOLD_WIDTH.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ mAnimation.AnimateTo(mContactCard, "SizeHeight", mContactCardLayoutInfo.foldedSize.Height, TIME_PERIOD_FOLD_HEIGHT.start, TIME_PERIOD_FOLD_HEIGHT.start + TIME_PERIOD_FOLD_HEIGHT.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+
+ // Animate the header area out of position
+ mAnimation.AnimateTo(mHeader, "PositionX", mContactCardLayoutInfo.headerFoldedPosition.X, TIME_PERIOD_FOLD_X.start, TIME_PERIOD_FOLD_X.start + TIME_PERIOD_FOLD_X.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ mAnimation.AnimateTo(mHeader, "PositionY", mContactCardLayoutInfo.headerFoldedPosition.Y, TIME_PERIOD_FOLD_Y.start, TIME_PERIOD_FOLD_Y.start + TIME_PERIOD_FOLD_Y.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+
+ // Animate the clipped image into the folded position and into a circle
+ mAnimation.AnimateTo(mClippedImage, "PositionX", mContactCardLayoutInfo.imageFoldedPosition.X, TIME_PERIOD_FOLD_X.start, TIME_PERIOD_FOLD_X.start + TIME_PERIOD_FOLD_X.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ mAnimation.AnimateTo(mClippedImage, "PositionY", mContactCardLayoutInfo.imageFoldedPosition.Y, TIME_PERIOD_FOLD_Y.start, TIME_PERIOD_FOLD_Y.start + TIME_PERIOD_FOLD_Y.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ mAnimation.AnimateTo(mClippedImage, "uDelta", 0.0f, TIME_PERIOD_FOLD_MESH_MORPH.start, TIME_PERIOD_FOLD_MESH_MORPH.start + TIME_PERIOD_FOLD_MESH_MORPH.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+
+ // Fade in the opacity of the name, and animate into the folded position
+ mAnimation.AnimateTo(mNameText, "ColorAlpha", 1.0f, TIME_PERIOD_FOLD_NAME_OPACITY.start, TIME_PERIOD_FOLD_NAME_OPACITY.start + TIME_PERIOD_FOLD_NAME_OPACITY.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ mAnimation.AnimateTo(mNameText, "PositionX", mContactCardLayoutInfo.textFoldedPosition.X, TIME_PERIOD_FOLD_X.start, TIME_PERIOD_FOLD_X.start + TIME_PERIOD_FOLD_X.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ mAnimation.AnimateTo(mNameText, "PositionY", mContactCardLayoutInfo.textFoldedPosition.Y, TIME_PERIOD_FOLD_Y.start, TIME_PERIOD_FOLD_Y.start + TIME_PERIOD_FOLD_Y.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+
+ // Fade out the opacity of the detail, and animate into the folded position
+ mAnimation.AnimateTo(mDetailText, "ColorAlpha", 0.0f, TIME_PERIOD_FOLD_DETAIL_OPACITY.start, TIME_PERIOD_FOLD_DETAIL_OPACITY.start + TIME_PERIOD_FOLD_DETAIL_OPACITY.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ mAnimation.AnimateTo(mDetailText, "PositionX", mContactCardLayoutInfo.textFoldedPosition.X, TIME_PERIOD_FOLD_X.start, TIME_PERIOD_FOLD_X.start + TIME_PERIOD_FOLD_X.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ mAnimation.AnimateTo(mDetailText, "PositionY", mContactCardLayoutInfo.textFoldedPosition.Y, TIME_PERIOD_FOLD_Y.start, TIME_PERIOD_FOLD_Y.start + TIME_PERIOD_FOLD_Y.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+
+ // Slowly fade in all the siblings
+ View parent = mContactCard.GetParent() as View;
+ for (uint i = 0; i < parent.GetChildCount(); ++i)
+ {
+ View sibling = parent.GetChildAt(i);
+ if (sibling != mContactCard)
+ {
+ mAnimation.AnimateTo(sibling, "ColorAlpha", 1.0f, TIME_PERIOD_FOLD_SIBLING_OPACITY.start, TIME_PERIOD_FOLD_SIBLING_OPACITY.start + TIME_PERIOD_FOLD_SIBLING_OPACITY.duration, new AlphaFunction(ALPHA_FUNCTION_FOLD));
+ sibling.Sensitive = true;
+ }
+ }
+
+ mAnimation.Finished += OnAnimationFinished;
+ mAnimation.Play();
+ }
+
+ mFolded = !mFolded;
+ }
+
+ private void OnAnimationFinished(object sender, EventArgs e)
+ {
+ Animation animation = sender as Animation;
+
+ // Ensure the finishing animation is the latest as we do not want to change state if a previous animation has finished
+ if (mAnimation == animation)
+ {
+ if(mFolded)
+ {
+ mHeader.Unparent();
+ mDetailText.Unparent();
+
+ // Hide the clipped-image as we have finished animating the geometry and show the masked-image again
+ mClippedImage.Hide();
+ mMaskedImage.Show();
+ }
+ }
+ }
+
+ private bool OnKeyEvent(object sender, View.KeyEventArgs e)
+ {
+ if((!mFolded) && (e.Key.State == Key.StateType.Down))
+ {
+ if(e.Key.KeyPressedName == "Escape" || e.Key.KeyPressedName == "BackSpace")
+ {
+ FocusManager focusManager = FocusManager.Instance;
+ if(focusManager.GetCurrentFocusView() == mContactCard)
+ {
+ // Our contact - card is set to receive focus and we're unfolded so animate back to the folded state
+ Animate();
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private void OnTap(object sender, TapGestureDetector.DetectedEventArgs e)
+ {
+ View view = sender as View;
+ if(view = mContactCard)
+ {
+ Animate();
+ }
+ }
+
+ public class TimePeriod
+ {
+ public int start;
+ public int duration;
+
+ public TimePeriod(int _start, int _duration)
+ {
+ start = _start;
+ duration = _duration;
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ public class ContactCardLayoutInfo
+ {
+ public Vector2 unfoldedPosition = new Vector2(0, 0);
+ public Vector2 unfoldedSize = new Vector2(0, 0);
+ public Vector2 foldedSize = new Vector2(0, 0);
+
+ public Vector2 padding = new Vector2(0, 0);
+
+ public Vector2 headerSize = new Vector2(0, 0);
+ public Vector2 headerFoldedPosition = new Vector2(0, 0);
+ public Vector2 headerUnfoldedPosition = new Vector2(0, 0);
+
+ public Vector2 imageSize = new Vector2(0, 0);
+ public Vector2 imageFoldedPosition = new Vector2(0, 0);
+ public Vector2 imageUnfoldedPosition = new Vector2(0, 0);
+
+ public Vector2 textFoldedPosition = new Vector2(0, 0);
+ public Vector2 textUnfoldedPosition = new Vector2(0, 0);
+
+
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace NuiCommonUiSamples
+{
+ public class ContactCardLayouter
+ {
+ private const float DEFAULT_PADDING = 25.0f;
+
+ private const float MINIMUM_ITEMS_PER_ROW_OR_COLUMN = 3.0f;
+
+ private const float HEADER_HEIGHT_TO_UNFOLDED_SIZE_RATIO = 0.1f;
+ private readonly Vector2 HEADER_FOLDED_POSITION_AS_RATIO_OF_SIZE = new Vector2(-0.05f, -1.5f);
+ private readonly Vector2 HEADER_UNFOLDED_POSITION = new Vector2(0.0f, 0.0f);
+
+ const float IMAGE_SIZE_AS_RATIO_TO_FOLDED_SIZE = 0.5f;
+ private readonly Vector2 IMAGE_FOLDED_POSITION_AS_RATIO_OF_SIZE = new Vector2(0.5f, 0.25f);
+
+ const float FOLDED_TEXT_POSITION_AS_RATIO_OF_IMAGE_SIZE = 1.01f;
+
+ private readonly Vector4 ROOTVIEW_COLOR = new Vector4(211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f);
+
+
+ private ContactCardLayoutInfo mContactCardLayoutInfo;
+ private List<ContactCard> mContactCards;
+
+ private Vector2 mLastPosition;
+ private Vector2 mPositionIncrementer;
+ private int mItemsPerRow;
+
+ private bool mInitialized;
+
+ private View rootView;
+
+ public ContactCardLayouter()
+ {
+ Initialize();
+ }
+
+ public void Clear()
+ {
+ Window.Instance.Remove(rootView);
+ rootView.Dispose();
+ }
+
+ private void Initialize()
+ {
+ mContactCardLayoutInfo = new ContactCardLayoutInfo();
+ mContactCards = new List<ContactCard>();
+ mLastPosition = new Vector2();
+ mPositionIncrementer = new Vector2();
+ mItemsPerRow = 0;
+ mInitialized = false;
+
+ rootView = new View()
+ {
+ Size2D = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height),
+ BackgroundColor = ROOTVIEW_COLOR,
+ PositionUsesPivotPoint = false,
+ };
+
+ Window.Instance.Add(rootView);
+
+ }
+
+ public void AddContact(string contactName, string contactAddress, string imagePath)
+ {
+ if(!mInitialized)
+ {
+ // Set up the common layouting info shared between all contact cards when first called
+ mContactCardLayoutInfo.unfoldedPosition = mContactCardLayoutInfo.padding = new Vector2(DEFAULT_PADDING, DEFAULT_PADDING);
+ Vector2 windowSize = new Vector2(Window.Instance.Size.Width, Window.Instance.Size.Height);
+ mContactCardLayoutInfo.unfoldedSize = windowSize - mContactCardLayoutInfo.padding * (MINIMUM_ITEMS_PER_ROW_OR_COLUMN - 1.0f);
+
+ // Calculate the size of the folded card (use the minimum of width/height as size)
+ mContactCardLayoutInfo.foldedSize = (mContactCardLayoutInfo.unfoldedSize - (mContactCardLayoutInfo.padding * (MINIMUM_ITEMS_PER_ROW_OR_COLUMN - 1.0f))) / MINIMUM_ITEMS_PER_ROW_OR_COLUMN;
+ mContactCardLayoutInfo.foldedSize.Width = mContactCardLayoutInfo.foldedSize.Height = Math.Min(mContactCardLayoutInfo.foldedSize.Width, mContactCardLayoutInfo.foldedSize.Height);
+
+ // Set the size and positions of the header
+ mContactCardLayoutInfo.headerSize.Width = mContactCardLayoutInfo.unfoldedSize.Width;
+ mContactCardLayoutInfo.headerSize.Height = mContactCardLayoutInfo.unfoldedSize.Height * HEADER_HEIGHT_TO_UNFOLDED_SIZE_RATIO;
+ mContactCardLayoutInfo.headerFoldedPosition = mContactCardLayoutInfo.headerSize * HEADER_FOLDED_POSITION_AS_RATIO_OF_SIZE;
+ mContactCardLayoutInfo.headerUnfoldedPosition = HEADER_UNFOLDED_POSITION;
+
+ // Set the image size and positions
+ mContactCardLayoutInfo.imageSize = mContactCardLayoutInfo.foldedSize * IMAGE_SIZE_AS_RATIO_TO_FOLDED_SIZE;
+ mContactCardLayoutInfo.imageFoldedPosition = mContactCardLayoutInfo.imageSize * IMAGE_FOLDED_POSITION_AS_RATIO_OF_SIZE;
+ mContactCardLayoutInfo.imageUnfoldedPosition.X = mContactCardLayoutInfo.padding.Width;
+ mContactCardLayoutInfo.imageUnfoldedPosition.Y = mContactCardLayoutInfo.headerSize.Height + mContactCardLayoutInfo.padding.Height;
+
+ // Set the positions of the contact name
+ mContactCardLayoutInfo.textFoldedPosition.X = 0.0f;
+ mContactCardLayoutInfo.textFoldedPosition.Y = mContactCardLayoutInfo.imageFoldedPosition.X + mContactCardLayoutInfo.imageSize.Height * FOLDED_TEXT_POSITION_AS_RATIO_OF_IMAGE_SIZE;
+ mContactCardLayoutInfo.textUnfoldedPosition.X = mContactCardLayoutInfo.padding.Width;
+ mContactCardLayoutInfo.textUnfoldedPosition.Y = mContactCardLayoutInfo.imageUnfoldedPosition.Y + mContactCardLayoutInfo.imageSize.Height + mContactCardLayoutInfo.padding.Height;
+
+ // Figure out the positions of the contact cards
+ mItemsPerRow = (int)((mContactCardLayoutInfo.unfoldedSize.Width + mContactCardLayoutInfo.padding.Width) / (mContactCardLayoutInfo.foldedSize.Width + mContactCardLayoutInfo.padding.Width));
+ mLastPosition = new Vector2(mContactCardLayoutInfo.unfoldedPosition.X, mContactCardLayoutInfo.unfoldedPosition.Y);
+ mPositionIncrementer.X = mContactCardLayoutInfo.foldedSize.Width + mContactCardLayoutInfo.padding.Width;
+ mPositionIncrementer.Y = mContactCardLayoutInfo.foldedSize.Height + mContactCardLayoutInfo.padding.Height;
+
+ mInitialized = true;
+ }
+
+ mContactCards.Add(new ContactCard(mContactCardLayoutInfo, contactName, contactAddress, imagePath, NextCardPosition(), rootView));
+
+ }
+
+ private Vector2 NextCardPosition()
+ {
+ int currentNumOfCards = mContactCards.Count();
+
+ if(currentNumOfCards > 0)
+ {
+ if(currentNumOfCards % mItemsPerRow != 0)
+ {
+ mLastPosition.X += mPositionIncrementer.X;
+ }
+ else
+ {
+ mLastPosition.X = mContactCardLayoutInfo.unfoldedPosition.X;
+ mLastPosition.Y += mPositionIncrementer.Y;
+ }
+ }
+
+ return mLastPosition;
+ }
+
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace NuiCommonUiSamples
+{
+ public class ContactCards : IExample
+ {
+ private readonly Vector4 WINDOW_COLOR = new Vector4( 211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f );
+ private ContactCardLayouter mContactCardLayouter;
+
+ //protected override void OnCreate()
+ //{
+ // base.OnCreate();
+ // Activate();
+ //}
+
+ public void Activate()
+ {
+ View view = new View();
+ FocusManager.Instance.FocusIndicator = view;
+
+ Window.Instance.BackgroundColor = WINDOW_COLOR;
+ //Window.Instance.KeyEvent += OnKeyEvent;
+
+ mContactCardLayouter = new ContactCardLayouter();
+
+ for (int i = 0; i < ContactData.itemSize; i++)
+ {
+ mContactCardLayouter.AddContact(ContactData.itmes[i].name, ContactData.itmes[i].address, ContactData.itmes[i].imagePath);
+ }
+ }
+
+ public void Deactivate()
+ {
+ mContactCardLayouter.Clear();
+ }
+
+ //private void OnKeyEvent(object sender, Window.KeyEventArgs e)
+ //{
+ // if(e.Key.State == Key.StateType.Down)
+ // {
+ // FocusManager focusManager = FocusManager.Instance;
+ // if(!focusManager.GetCurrentFocusView())
+ // {
+ // if (e.Key.KeyPressedName == "Escape" || e.Key.KeyPressedName == "BackSpace")
+ // {
+
+ // }
+ // }
+ // }
+ //}
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NuiCommonUiSamples
+{
+ public class ContactData
+ {
+ public const int itemSize = 15;
+ public static readonly string floder = CommonResource.GetDaliResourcePath() + "ContactCard/";
+ public class Item
+ {
+ public string name;
+ public string address;
+ public string imagePath;
+
+ public Item(string _name, string _address, string _imagePath)
+ {
+ name = _name;
+ address = _address;
+ imagePath = _imagePath;
+ }
+ }
+
+ public static Item[] itmes = new Item[itemSize]
+ {
+ new Item("Shelia Ramos", "19 Wormley Ct\nWinters Way\nWaltham Abbey\nEN9 3HW", floder +"gallery-small-19.jpg"),
+ new Item("Walter Jensen", "32 Upper Fant Rd\nMaidstone\nME16 8DN", floder + "gallery-small-2.jpg"),
+ new Item("Randal Parks", "8 Rymill St\nLondon\nE16 2JF", floder + "gallery-small-3.jpg"),
+ new Item("Tasha Cooper", "2 Kyles View\nColintraive\nPA22 3AS", floder + "gallery-small-4.jpg"),
+ new Item("Domingo Lynch", "Red Lion Farm\nWatlington\nOX49 5LG", floder + "gallery-small-5.jpg"),
+ new Item("Dan Haynes", "239 Whitefield Dr\nLiverpool\nL32 0RD", floder + "gallery-small-6.jpg"),
+ new Item("Leslie Wong", "1 Tullyvar Rd\nAughnacloy\nBT69 6BQ", floder + "gallery-small-7.jpg"),
+ new Item("Mable Hodges", "5 Mortimer Rd\nGrazeley\nReading\nRG7 1LA", floder + "gallery-small-8.jpg"),
+ new Item("Kristi Riley", "10 Jura Dr\nOld Kilpatrick\nGlasgow\nG60 5EH", floder + "gallery-small-17.jpg"),
+ new Item("Terry Clark", "142 Raeberry St\nGlasgow\nG20 6EA", floder + "gallery-small-18.jpg"),
+ new Item("Horace Bailey", "11 Assembly St\nNormanton\nWF6 2DB", floder + "gallery-small-11.jpg"),
+ new Item("Suzanne Delgado", "6 Grange Rd\nDownpatrick\nBT30 7DB", floder + "gallery-small-12.jpg"),
+ new Item("Jamie Bennett", "117 Potter St\nNorthwood\nHA6 1QF", floder + "gallery-small-13.jpg"),
+ new Item("Emmett Yates", "18 Renfrew Way\nBletchley\nMilton Keynes\nMK3 7NY", floder + "gallery-small-14.jpg"),
+ new Item("Glen Vaughn", "5 Hasman Terrace\nCove Bay\nAberdeen\nAB12 3GD", floder + "gallery-small-15.jpg")
+ };
+
+ }
+
+
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.UIComponents;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ public class MaskedImage
+ {
+ private static readonly string IMAGE_MASK = CommonResource.GetDaliResourcePath() + "ContactCard/contact-cards-mask.png";
+
+ public static View Create(string imagePath)
+ {
+ View maskedImage = new ImageView();
+ ImageVisual imageVisual = new ImageVisual();
+ imageVisual.URL = imagePath;
+ imageVisual.AlphaMaskURL = IMAGE_MASK;
+ maskedImage.Background = imageVisual.OutputVisualMap;
+
+ return maskedImage;
+ }
+ }
+}
--- /dev/null
+
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.UIComponents;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ public class CubeTransitionEffect : IExample
+ {
+ static string DEMO_IMAGE_DIR = CommonResource.GetDaliResourcePath() + "CubeTransitionEffect/";
+
+ string TOOLBAR_IMAGE = DEMO_IMAGE_DIR + "top-bar.png";
+ string APPLICATION_TITLE_WAVE = "Cube Transition: Wave";
+ string APPLICATION_TITLE_CROSS = "Cube Transition: Cross";
+ string APPLICATION_TITLE_FOLD = "Cube Transition: Fold";
+ string EFFECT_WAVE_IMAGE = DEMO_IMAGE_DIR + "icon-effect-wave.png";
+ string EFFECT_WAVE_IMAGE_SELECTED = DEMO_IMAGE_DIR + "icon-effect-wave-selected.png";
+ string EFFECT_CROSS_IMAGE = DEMO_IMAGE_DIR + "icon-effect-cross.png";
+ string EFFECT_CROSS_IMAGE_SELECTED = DEMO_IMAGE_DIR + "icon-effect-cross-selected.png";
+ string EFFECT_FOLD_IMAGE = DEMO_IMAGE_DIR + "icon-effect-fold.png";
+ string EFFECT_FOLD_IMAGE_SELECTED = DEMO_IMAGE_DIR + "icon-effect-fold-selected.png";
+ string SLIDE_SHOW_START_ICON = DEMO_IMAGE_DIR + "icon-play.png";
+ string SLIDE_SHOW_START_ICON_SELECTED = DEMO_IMAGE_DIR + "icon-play-selected.png";
+ string SLIDE_SHOW_STOP_ICON = DEMO_IMAGE_DIR + "icon-stop.png";
+ string SLIDE_SHOW_STOP_ICON_SELECTED = DEMO_IMAGE_DIR + "icon-stop-selected.png";
+
+ string[] IMAGES = new string[] {
+ DEMO_IMAGE_DIR + "gallery-large-1.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-2.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-3.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-4.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-5.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-6.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-7.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-8.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-9.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-10.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-11.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-12.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-13.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-14.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-15.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-16.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-17.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-18.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-19.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-20.jpg",
+ DEMO_IMAGE_DIR + "gallery-large-21.jpg",
+ };
+
+ const int NUM_IMAGES = 21;
+
+ // the number of cubes: NUM_COLUMNS*NUM_ROWS
+ // better choose the numbers that can divide viewAreaSize.x
+ const int NUM_COLUMNS_WAVE = 16;
+ const int NUM_COLUMNS_CROSS = 8;
+ const int NUM_COLUMNS_FOLD = 8;
+ // better choose the numbers that can divide viewAreaSize.y
+ const int NUM_ROWS_WAVE = 20;
+ const int NUM_ROWS_CROSS = 10;
+ const int NUM_ROWS_FOLD = 10;
+ //transition effect duration
+ const float ANIMATION_DURATION_WAVE = 1.5f;
+ const float ANIMATION_DURATION_CROSS = 1.0f;
+ const float ANIMATION_DURATION_FOLD = 1.0f;
+ //transition effect displacement
+ const float CUBE_DISPLACEMENT_WAVE = 70.0f;
+ const float CUBE_DISPLACEMENT_CROSS = 30.0f;
+
+ // The duration of the current image staying on screen when slideshow is on
+ const int VIEWINGTIME = 2000; // 2 seconds
+
+ private View tool_bar;
+ private TextLabel mTitle;
+ private Layer content_layer;
+ private View mContent;
+ private ToggleButton toggle_button;
+ private PushButton mSlideshowButton;
+
+ private Texture mCurrentTexture;
+ private Texture mNextTexture;
+ private uint mIndex = 0;
+ private bool mIsImageLoading = false;
+
+ private PanGestureDetector mPanGestureDetector;
+
+ private Tizen.NUI.CubeTransitionEffect mCubeWaveEffect;
+ private Tizen.NUI.CubeTransitionEffect mCubeCrossEffect;
+ private Tizen.NUI.CubeTransitionEffect mCubeFoldEffect;
+ private Tizen.NUI.CubeTransitionEffect mCurrentEffect;
+
+ private Timer mViewTimer;
+ private bool mSlideshow = false;
+
+ private Vector2 mPanPosition;
+ private Vector2 mPanDisplacement;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.Black;
+ // tool bar
+ tool_bar = new View();
+ tool_bar.BackgroundColor = Color.White;
+ tool_bar.Size2D = new Size2D(Window.Instance.WindowSize.Width, 100);
+ tool_bar.PositionUsesPivotPoint = true;
+ tool_bar.ParentOrigin = ParentOrigin.TopLeft;
+ tool_bar.PivotPoint = PivotPoint.TopLeft;
+
+ Window.Instance.GetDefaultLayer().Add(tool_bar);
+ Window.Instance.GetDefaultLayer().RaiseToTop();
+
+ // title of tool bar
+ mTitle = new TextLabel();
+ mTitle.Text = APPLICATION_TITLE_WAVE;
+ mTitle.FontFamily = "SamsungOneUI 400C";
+ mTitle.PointSize = 20;
+ mTitle.Position2D = new Position2D(400, 42);
+ mTitle.ParentOrigin = ParentOrigin.TopLeft;
+ mTitle.PositionUsesPivotPoint = true;
+ mTitle.PivotPoint = PivotPoint.TopLeft;
+ tool_bar.Add(mTitle);
+
+ // push button of tool bar
+ mSlideshowButton = new PushButton();
+ PropertyMap unselected_bg_map = new PropertyMap();
+ unselected_bg_map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
+ unselected_bg_map.Add(ImageVisualProperty.URL, new PropertyValue(SLIDE_SHOW_START_ICON));
+ mSlideshowButton.UnselectedBackgroundVisual = unselected_bg_map;
+
+ PropertyMap selected_bg_map = new PropertyMap();
+ selected_bg_map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
+ selected_bg_map.Add(ImageVisualProperty.URL, new PropertyValue(SLIDE_SHOW_START_ICON_SELECTED));
+ mSlideshowButton.SelectedBackgroundVisual = selected_bg_map;
+
+ mSlideshowButton.ParentOrigin = ParentOrigin.TopLeft;
+ mSlideshowButton.PivotPoint = PivotPoint.TopLeft;
+ mSlideshowButton.Position2D = new Position2D(800, 32);
+ mSlideshowButton.Clicked += OnPushButtonClicked;
+
+ mSlideshowButton.RaiseToTop();
+
+ tool_bar.Add(mSlideshowButton);
+
+ // toggle button of tool bar
+ toggle_button = new ToggleButton();
+ PropertyArray array = new PropertyArray();
+ array.Add(new PropertyValue(EFFECT_WAVE_IMAGE));
+ array.Add(new PropertyValue(EFFECT_CROSS_IMAGE));
+ array.Add(new PropertyValue(EFFECT_FOLD_IMAGE));
+ toggle_button.StateVisuals = array;
+
+ toggle_button.ParentOrigin = ParentOrigin.TopLeft;
+ toggle_button.PivotPoint = PivotPoint.TopLeft;
+ toggle_button.CellHorizontalAlignment = HorizontalAlignmentType.Right;
+ toggle_button.Position2D = new Position2D(900, 42);
+
+ toggle_button.Clicked += OnToggleButtonClicked;
+
+ tool_bar.Add(toggle_button);
+
+ // load image
+ mCurrentTexture = LoadStageFillingTexture(IMAGES[mIndex]);
+
+ // content layer is 3D.
+ content_layer = new Layer();
+ content_layer.Behavior = Layer.LayerBehavior.Layer3D;
+ Window.Instance.AddLayer(content_layer);
+
+ //use small cubes
+ mCubeWaveEffect = new CubeTransitionWaveEffect(NUM_ROWS_WAVE, NUM_COLUMNS_WAVE);
+ mCubeWaveEffect.SetTransitionDuration(ANIMATION_DURATION_WAVE);
+ mCubeWaveEffect.SetCubeDisplacement(CUBE_DISPLACEMENT_WAVE);
+ mCubeWaveEffect.TransitionCompleted += OnCubeEffectCompleted;
+
+ mCubeWaveEffect.Position2D = new Position2D(0, tool_bar.Size2D.Height);
+ mCubeWaveEffect.Size2D = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height - tool_bar.Size2D.Height);
+ mCubeWaveEffect.PivotPoint = PivotPoint.TopLeft;
+ mCubeWaveEffect.ParentOrigin = ParentOrigin.TopLeft;
+ mCubeWaveEffect.SetCurrentTexture(mCurrentTexture);
+
+ // use big cubes
+ mCubeCrossEffect = new CubeTransitionCrossEffect(NUM_ROWS_CROSS, NUM_COLUMNS_CROSS);
+ mCubeCrossEffect.SetTransitionDuration(ANIMATION_DURATION_CROSS);
+ mCubeCrossEffect.SetCubeDisplacement(CUBE_DISPLACEMENT_CROSS);
+ mCubeCrossEffect.TransitionCompleted += OnCubeEffectCompleted;
+
+ mCubeCrossEffect.Position2D = new Position2D(0, tool_bar.Size2D.Height);
+ mCubeCrossEffect.Size2D = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height - tool_bar.Size2D.Height);
+ mCubeCrossEffect.PivotPoint = PivotPoint.TopLeft;
+ mCubeCrossEffect.ParentOrigin = ParentOrigin.TopLeft;
+ mCubeCrossEffect.SetCurrentTexture(mCurrentTexture);
+
+ mCubeFoldEffect = new CubeTransitionFoldEffect(NUM_ROWS_FOLD, NUM_COLUMNS_FOLD);
+ mCubeFoldEffect.SetTransitionDuration(ANIMATION_DURATION_FOLD);
+ mCubeFoldEffect.TransitionCompleted += OnCubeEffectCompleted;
+
+ mCubeFoldEffect.Position2D = new Position2D(0, tool_bar.Size2D.Height);
+ mCubeFoldEffect.Size2D = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height - tool_bar.Size2D.Height);
+ mCubeFoldEffect.PivotPoint = PivotPoint.TopLeft;
+ mCubeFoldEffect.ParentOrigin = ParentOrigin.TopLeft;
+ mCubeFoldEffect.SetCurrentTexture(mCurrentTexture);
+
+ mViewTimer = new Timer(VIEWINGTIME);
+ mViewTimer.Tick += OnTimerTick;
+
+ // content
+ mCurrentEffect = mCubeWaveEffect;
+
+ mContent = new View();
+ mContent.Size2D = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height - tool_bar.Size2D.Height);
+ mContent.ParentOrigin = ParentOrigin.TopLeft;
+ mContent.PositionUsesPivotPoint = true;
+ mContent.PivotPoint = PivotPoint.TopLeft;
+
+ mContent.Add(mCurrentEffect);
+
+ content_layer.Add(mContent);
+
+ mPanGestureDetector = new PanGestureDetector();
+ mPanGestureDetector.Detected += OnPanGesture;
+ mPanGestureDetector.Attach(mContent);
+ }
+
+ public void Deactivate()
+ {
+ if (mTitle)
+ {
+ tool_bar.Remove(mTitle);
+ mTitle.Dispose();
+ mTitle = null;
+ }
+
+ if (mSlideshowButton)
+ {
+ tool_bar.Remove(mSlideshowButton);
+ mSlideshowButton.Clicked -= OnPushButtonClicked;
+ mSlideshowButton.Dispose();
+ mSlideshowButton = null;
+ }
+
+ if (toggle_button)
+ {
+ tool_bar.Remove(toggle_button);
+ toggle_button.Clicked -= OnToggleButtonClicked;
+ toggle_button.Dispose();
+ toggle_button = null;
+ }
+
+ if (tool_bar)
+ {
+ Window.Instance.GetDefaultLayer().Remove(tool_bar);
+ tool_bar.Dispose();
+ tool_bar = null;
+ }
+
+ if (mCubeWaveEffect)
+ {
+ mCubeWaveEffect.TransitionCompleted -= OnCubeEffectCompleted;
+ mCubeWaveEffect.Dispose();
+ mCubeWaveEffect = null;
+ }
+
+ if (mCubeCrossEffect)
+ {
+ mCubeCrossEffect.TransitionCompleted -= OnCubeEffectCompleted;
+ mCubeCrossEffect.Dispose();
+ mCubeCrossEffect = null;
+ }
+
+ if (mCubeFoldEffect)
+ {
+ mCubeFoldEffect.TransitionCompleted -= OnCubeEffectCompleted;
+ mCubeFoldEffect.Dispose();
+ mCubeFoldEffect = null;
+ }
+
+ if (mPanGestureDetector)
+ {
+ mPanGestureDetector.Detected -= OnPanGesture;
+ mPanGestureDetector.Dispose();
+ mPanGestureDetector = null;
+ }
+
+ if (mContent)
+ {
+ if (null != mCurrentEffect)
+ {
+ mContent.Remove(mCurrentEffect);
+ }
+
+ content_layer.Remove(mContent);
+ mContent.Dispose();
+ mContent = null;
+ }
+
+ if (content_layer)
+ {
+ Window.Instance.RemoveLayer(content_layer);
+ content_layer.Dispose();
+ content_layer = null;
+ }
+ }
+
+ private void OnPanGesture(object sender, PanGestureDetector.DetectedEventArgs gesture)
+ {
+ // does not response when the transition has not finished
+ if (mIsImageLoading || mCubeWaveEffect.IsTransitioning() || mCubeCrossEffect.IsTransitioning() || mCubeFoldEffect.IsTransitioning() || mSlideshow)
+ {
+ return;
+ }
+
+ if (gesture.PanGesture.State == Gesture.StateType.Continuing)
+ {
+ if (gesture.PanGesture.Displacement.X < 0)
+ {
+ mIndex = (mIndex + 1) % NUM_IMAGES;
+ }
+ else
+ {
+ mIndex = (mIndex + NUM_IMAGES - 1) % NUM_IMAGES;
+ }
+
+ mPanPosition = gesture.PanGesture.Position;
+ mPanDisplacement = gesture.PanGesture.Displacement;
+ GoToNextImage();
+ }
+ }
+
+ private void GoToNextImage()
+ {
+ mNextTexture = LoadStageFillingTexture(IMAGES[mIndex]);
+
+ mCurrentEffect.SetTargetTexture(mNextTexture);
+ mIsImageLoading = false;
+
+ mCurrentEffect.StartTransition(mPanPosition, mPanDisplacement);
+
+ mCurrentTexture = mNextTexture;
+ }
+
+
+ private bool OnTimerTick(object sender, Timer.TickEventArgs args)
+ {
+ if (mSlideshow)
+ {
+ mIndex = (mIndex + 1) % NUM_IMAGES;
+ GoToNextImage();
+ }
+
+ return false;
+ }
+
+ private void OnCubeEffectCompleted(object sender, Tizen.NUI.CubeTransitionEffect.TransitionCompletedEventArgs args)
+ {
+ if (mSlideshow)
+ {
+ mViewTimer.Start();
+ }
+ }
+
+ private Texture LoadStageFillingTexture(string filepath)
+ {
+ Size2D dimensions = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height);
+ PixelBuffer pb = ImageLoading.LoadImageFromFile(filepath, dimensions, FittingModeType.ScaleToFill);
+ PixelData pd = PixelBuffer.Convert(pb);
+
+ Texture texture = new Texture(TextureType.TEXTURE_2D, pd.GetPixelFormat(), pd.GetWidth(), pd.GetHeight());
+ texture.Upload(pd);
+
+ return texture;
+ }
+
+ private bool OnToggleButtonClicked(object sender, global::System.EventArgs args)
+ {
+ mContent.Remove(mCurrentEffect);
+ if (mCurrentEffect == mCubeWaveEffect)
+ {
+ mCurrentEffect = mCubeCrossEffect;
+ mTitle.Text = APPLICATION_TITLE_CROSS;
+ }
+ else if (mCurrentEffect == mCubeCrossEffect)
+ {
+ mCurrentEffect = mCubeFoldEffect;
+ mTitle.Text = APPLICATION_TITLE_FOLD;
+ }
+ else
+ {
+ mCurrentEffect = mCubeWaveEffect;
+ mTitle.Text = APPLICATION_TITLE_WAVE;
+ }
+ mContent.Add(mCurrentEffect);
+
+ // Set the current image to cube transition effect
+ // only need to set at beginning or change from another effect
+ mCurrentEffect.SetCurrentTexture(mCurrentTexture);
+ return true;
+ }
+
+ private bool OnPushButtonClicked(object sender, global::System.EventArgs args)
+ {
+ mSlideshow = !mSlideshow;
+ if (mSlideshow)
+ {
+ mPanGestureDetector.Detach(mContent);
+
+ PropertyMap unselected_bg_map = new PropertyMap();
+ unselected_bg_map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
+ unselected_bg_map.Add(ImageVisualProperty.URL, new PropertyValue(SLIDE_SHOW_STOP_ICON));
+ mSlideshowButton.UnselectedBackgroundVisual = unselected_bg_map;
+
+ PropertyMap selected_bg_map = new PropertyMap();
+ selected_bg_map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
+ selected_bg_map.Add(ImageVisualProperty.URL, new PropertyValue(SLIDE_SHOW_STOP_ICON_SELECTED));
+ mSlideshowButton.SelectedBackgroundVisual = selected_bg_map;
+
+ mPanPosition = new Vector2(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Width * 0.5f);
+ mPanDisplacement = new Vector2(-10.0f, 0.0f);
+
+ mViewTimer.Start();
+ }
+ else
+ {
+ mPanGestureDetector.Attach(mContent);
+
+ PropertyMap unselected_bg_map = new PropertyMap();
+ unselected_bg_map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
+ unselected_bg_map.Add(ImageVisualProperty.URL, new PropertyValue(SLIDE_SHOW_START_ICON));
+ mSlideshowButton.UnselectedBackgroundVisual = unselected_bg_map;
+
+ PropertyMap selected_bg_map = new PropertyMap();
+ selected_bg_map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
+ selected_bg_map.Add(ImageVisualProperty.URL, new PropertyValue(SLIDE_SHOW_START_ICON_SELECTED));
+ mSlideshowButton.SelectedBackgroundVisual = selected_bg_map;
+
+ mViewTimer.Stop();
+ }
+ return true;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace NuiCommonUiSamples
+{
+ public class DaliDemo : Tizen.FH.NUI.FHNUIApplication
+ {
+ public DaliDemo() : base()
+ {
+ }
+
+ public DaliDemo(string styleSheet) : base(styleSheet)
+ {
+ }
+
+ private IExample curExample = null;
+
+ private void FullGC()
+ {
+ global::System.GC.Collect();
+ global::System.GC.WaitForPendingFinalizers();
+ global::System.GC.Collect();
+ }
+
+ private void DeleteDaliDemo()
+ {
+ Window.Instance.Remove(demo.mRootActor);
+ demo.mRootActor.Dispose();
+ demo = null;
+
+ FullGC();
+ }
+
+ private void CreateDaliDemo()
+ {
+ demo = new DaliTableView((string name) =>
+ {
+ RunSample(name);
+ });
+
+ Assembly assembly = this.GetType().Assembly;
+
+ Type exampleType = assembly.GetType("NuiCommonUiSamples.IExample");
+
+ foreach (Type type in assembly.GetTypes())
+ {
+ if (exampleType.IsAssignableFrom(type) && type.Name != "SampleMain" && this.GetType() != type && true == type.IsClass)
+ {
+ demo.AddExample(new Example(type.FullName, type.Name));
+ }
+ }
+ demo.SortAlphabetically(true);
+
+ demo.Initialize();
+
+ Window.Instance.GetDefaultLayer().Add(demo.mRootActor);
+ }
+
+ private void OnBackNaviTouchEvent(object source, View.TouchEventArgs e)
+ {
+ if (e.Touch.GetState(0) == PointStateType.Up)
+ {
+ if (null != curExample)
+ {
+ ExitSample();
+ }
+ else
+ {
+ if (backNavigation != null)
+ {
+ Window.Instance.GetDefaultLayer().Remove(backNavigation);
+ backNavigation.Dispose();
+ backNavigation = null;
+ }
+
+ Exit();
+ }
+ }
+
+ return;
+ }
+
+ private void RunSample(string name)
+ {
+ Assembly assembly = typeof(DaliDemo).Assembly;
+
+ Type exampleType = assembly?.GetType(name);
+ IExample example = assembly?.CreateInstance(name) as IExample;
+
+ curPageIndex = demo.GetCurrentPageIndex();
+
+ if (null != example)
+ {
+ DeleteDaliDemo();
+
+ example.Activate();
+ }
+
+ curExample = example;
+
+ backNavigation.Show();
+ backNavigation.RaiseToTop();
+ }
+
+ private int curPageIndex = -1;
+
+ private void ExitSample()
+ {
+ curExample?.Deactivate();
+ curExample = null;
+
+ FullGC();
+
+ CreateDaliDemo();
+
+ backNavigation.Hide();
+
+ if (0 <= curPageIndex)
+ {
+ demo.ScrollTo((uint)curPageIndex);
+ }
+ }
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ CreateDaliDemo();
+
+ backNavigation = new Tizen.FH.NUI.Controls.Navigation("Back");
+ backNavigation.PositionUsesPivotPoint = true;
+ backNavigation.PivotPoint = PivotPoint.BottomLeft;
+ backNavigation.ParentOrigin = ParentOrigin.BottomLeft;
+ backNavigation.ItemTouchEvent += OnBackNaviTouchEvent;
+ backNavigation.Hide();
+
+ Tizen.FH.NUI.Controls.Navigation.NavigationItemData backItem = new Tizen.FH.NUI.Controls.Navigation.NavigationItemData("WhiteBackItem");
+ backNavigation.AddItem(backItem);
+
+ Window.Instance.GetDefaultLayer().Add(backNavigation);
+
+ Window.Instance.KeyEvent += Instance_KeyEvent;
+
+ int id = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
+
+ timerForExit.Tick += TimerForExit_Tick;
+ }
+
+ private bool TimerForExit_Tick(object source, Timer.TickEventArgs e)
+ {
+ int id = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
+ backNavigation?.Dispose();
+ backNavigation = null;
+
+ DeleteDaliDemo();
+ Exit();
+
+ timerForExit.Dispose();
+ return true;
+ }
+
+ private void Instance_KeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Up)
+ {
+ if (e.Key.KeyPressedName == "Escape" || e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "BackSpace")
+ {
+ if (null != curExample)
+ {
+ ExitSample();
+ }
+ else
+ {
+ timerForExit.Start();
+ }
+ }
+ else if (e.Key.KeyPressedName == "1")
+ {
+ FullGC();
+ }
+ }
+ }
+
+ public void Deactivate()
+ {
+ demo = null;
+ }
+
+ private Tizen.NUI.Timer timerForExit = new Tizen.NUI.Timer(10);
+ private DaliTableView demo;
+ private Tizen.FH.NUI.Controls.Navigation backNavigation;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.UIComponents;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ public class Example
+ {
+ // Constructors
+
+ /**
+ * @param[in] name unique name of example
+ * @param[in] title The caption for the example to appear on a tile button.
+ */
+ public Example(string name, string title)
+ {
+ this.name = name;
+ this.title = title;
+ }
+
+ public Example()
+ {
+ }
+
+ private string name;
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+ }
+
+ private string title;
+ public string Title
+ {
+ get
+ {
+ return title;
+ }
+ }
+
+ static public int CompareByTitle(Example lhs, Example rhs)
+ {
+ return String.Compare(lhs.title, lhs.title);
+ }
+ };
+
+ public class DaliTableView
+ {
+ static public string DEMO_IMAGE_DIR = CommonResource.GetDaliResourcePath() + "DaliDemo/";
+ static public string LOGO_PATH = DEMO_IMAGE_DIR + "Logo-for-demo.png";
+
+ const float KEYBOARD_FOCUS_ANIMATION_DURATION = 1.0f; ///< The total duration of the keyboard focus animation
+ const float KEYBOARD_FOCUS_START_SCALE = 1.05f; ///< The starting scale of the focus highlight
+ const float KEYBOARD_FOCUS_END_SCALE = 1.18f; ///< The end scale of the focus highlight
+ const float KEYBOARD_FOCUS_END_ALPHA = 0.7f; ///< The end alpha of the focus highlight
+ const float KEYBOARD_FOCUS_INITIAL_FADE_PERCENTAGE = 0.16f; ///< The duration of the initial fade (from translucent to the end-alpha) as a percentage of the overal animation duration.
+ Vector3 startScale = new Vector3(KEYBOARD_FOCUS_START_SCALE, KEYBOARD_FOCUS_START_SCALE, KEYBOARD_FOCUS_START_SCALE); ///< @see KEYBOARD_FOCUS_START_SCALE
+ Vector3 endScale = new Vector3(KEYBOARD_FOCUS_END_SCALE, KEYBOARD_FOCUS_END_SCALE, KEYBOARD_FOCUS_END_SCALE); ///< @see KEYBOARD_FOCUS_END_SCALE
+ const float initialFadeDuration = KEYBOARD_FOCUS_ANIMATION_DURATION * KEYBOARD_FOCUS_INITIAL_FADE_PERCENTAGE; ///< @see KEYBOARD_FOCUS_INITIAL_FADE_PERCENTAGE
+
+ const float TILE_LABEL_PADDING = 8.0f; ///< Border between edge of tile and the example text
+ const float BUTTON_PRESS_ANIMATION_TIME = 0.35f; ///< Time to perform button scale effect.
+ const float ROTATE_ANIMATION_TIME = 0.5f; ///< Time to perform rotate effect.
+ const int MAX_PAGES = 256; ///< Maximum pages (arbitrary safety limit)
+ const int EXAMPLES_PER_ROW = 3;
+ const int ROWS_PER_PAGE = 3;
+ const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE;
+ const float LOGO_MARGIN_RATIO = 0.1f / 0.3f;
+ const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f;
+ Vector3 SCROLLVIEW_RELATIVE_SIZE = new Vector3(0.9f, 1.0f, 0.8f); ///< ScrollView's relative size to its parent
+ Vector3 TABLE_RELATIVE_SIZE = new Vector3(0.95f, 0.9f, 0.8f); ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights.
+ const float STENCIL_RELATIVE_SIZE = 1.0f;
+
+ const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap Duration for Effects
+ const float EFFECT_FLICK_DURATION = 0.5f; ///< Scroll Flick Duration for Effects
+ Vector3 ANGLE_CUBE_PAGE_ROTATE = new Vector3((float)Math.PI * 0.5f, (float)Math.PI * 0.5f, 0.0f);
+
+ Vector4[] BUBBLE_COLOR =
+ {
+ new Vector4( 0.3255f, 0.3412f, 0.6353f, 0.32f ),
+ new Vector4( 0.3647f, 0.7569f, 0.8157f, 0.32f ),
+ new Vector4( 0.3804f, 0.7412f, 0.6510f, 0.32f ),
+ new Vector4( 1.0f, 1.0f, 1.0f, 0.13f )
+ };
+
+ const int NUMBER_OF_BUBBLE_COLOR = 4;
+
+ string[] SHAPE_IMAGE_TABLE =
+ {
+ DEMO_IMAGE_DIR + "shape-circle.png",
+ DEMO_IMAGE_DIR + "shape-bubble.png"
+ };
+
+ const int NUMBER_OF_SHAPE_IMAGES = 2;
+
+ const int NUM_BACKGROUND_IMAGES = 18;
+ const float BACKGROUND_SWIPE_SCALE = 0.025f;
+ const float BACKGROUND_SPREAD_SCALE = 1.5f;
+ const float SCALE_MOD = 1000.0f * (float)Math.PI * 2.0f;
+ const float SCALE_SPEED = 10.0f;
+ const float SCALE_SPEED_SIN = 0.1f;
+
+ const uint BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs
+
+ Vector4 BACKGROUND_COLOR = new Vector4(0.3569f, 0.5451f, 0.7294f, 1.0f);
+
+ const float BUBBLE_MIN_Z = -1.0f;
+ const float BUBBLE_MAX_Z = 0.0f;
+
+ const uint CORE_MAJOR_VERSION = 1;
+ const uint CORE_MINOR_VERSION = 4;
+ const uint CORE_MICRO_VERSION = 27;
+
+ const uint ADAPTOR_MAJOR_VERSION = 1;
+ const uint ADAPTOR_MINOR_VERSION = 4;
+ const uint ADAPTOR_MICRO_VERSION = 27;
+
+ const uint TOOLKIT_MAJOR_VERSION = 1;
+ const uint TOOLKIT_MINOR_VERSION = 4;
+ const uint TOOLKIT_MICRO_VERSION = 27;
+
+ public void AddExample(Example example)
+ {
+ mExampleList.Add(example);
+ }
+
+ public void SortAlphabetically(bool sortAlphabetically)
+ {
+ mSortAlphabetically = sortAlphabetically;
+ }
+
+ private const uint FOCUS_ANIMATION_ACTOR_NUMBER = 2;
+
+ public delegate void ExampleClicked(string name);
+
+ private ExampleClicked onClicked;
+
+ public DaliTableView(ExampleClicked onClicked)
+ {
+ this.onClicked = onClicked;
+ }
+
+ public int GetCurrentPageIndex()
+ {
+ if (null != mScrollView)
+ {
+ return (int)mScrollView.GetCurrentPage();
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+ public void ScrollTo(uint pageIndex)
+ {
+ mScrollView.ScrollTo(pageIndex, 0.0f);
+ }
+
+ public void Initialize()
+ {
+ Window.Instance.KeyEvent += OnKeyEvent;
+
+ Size2D stageSize = Window.Instance.WindowSize;
+
+ // Background
+ mRootActor = CreateBackground("LauncherBackground");
+
+ // Add logo
+ ImageView logo = new ImageView(LOGO_PATH);
+ logo.Name = "LOGO_IMAGE";
+ //logo.SetAnchorPoint(AnchorPoint::TOP_CENTER);
+ logo.PositionUsesPivotPoint = true;
+ logo.PivotPoint = PivotPoint.TopCenter;
+ logo.ParentOrigin = new Position(0.5f, 0.1f, 0.5f);
+ logo.WidthResizePolicy = ResizePolicyType.UseNaturalSize;
+ logo.HeightResizePolicy = ResizePolicyType.UseNaturalSize;
+
+ //// The logo should appear on top of everything.
+ //logo.DrawMode = DrawModeType.Overlay2D;
+ mRootActor.Add(logo);
+
+ // Show version in a popup when log is tapped
+ mLogoTapDetector = new TapGestureDetector();
+ mLogoTapDetector.Attach(logo);
+ mLogoTapDetector.Detected += OnLogoTapped;
+
+ // Scrollview occupying the majority of the screen
+ mScrollView = new ScrollView();
+ mScrollView.PositionUsesPivotPoint = true;
+ mScrollView.PivotPoint = PivotPoint.BottomCenter;
+ mScrollView.ParentOrigin = new Vector3(0.5f, 1.0f - 0.05f, 0.5f);
+ mScrollView.WidthResizePolicy = ResizePolicyType.FillToParent;
+ mScrollView.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent;
+ mScrollView.SetSizeModeFactor(new Vector3(0.0f, 0.6f, 0.0f));
+
+ ushort buttonsPageMargin = (ushort)((1.0f - TABLE_RELATIVE_SIZE.X) * 0.5f * stageSize.Width);
+ mScrollView.SetPadding(new PaddingType(buttonsPageMargin, buttonsPageMargin, 0, 0));
+
+ //mScrollView.SetAxisAutoLock(true);
+ mScrollView.ScrollCompleted += OnScrollComplete;
+ mScrollView.ScrollStarted += OnScrollStart;
+
+ mPageWidth = stageSize.Width * TABLE_RELATIVE_SIZE.X * 0.5f;
+
+ // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show
+ View bubbleContainer = new View();
+ bubbleContainer.WidthResizePolicy = bubbleContainer.HeightResizePolicy = ResizePolicyType.FillToParent;
+ bubbleContainer.PositionUsesPivotPoint = true;
+ bubbleContainer.PivotPoint = PivotPoint.Center;
+ bubbleContainer.ParentOrigin = ParentOrigin.Center;
+ SetupBackground(bubbleContainer);
+
+ mRootActor.Add(bubbleContainer);
+ mRootActor.Add(mScrollView);
+
+ // Add scroll view effect and setup constraints on pages
+ ApplyScrollViewEffect();
+
+ // Add pages and tiles
+ Populate();
+
+ // Remove constraints for inner cube effect
+ ApplyCubeEffectToPages();
+
+ // Set initial orientation
+ uint degrees = 0;
+ Rotate(degrees);
+
+ // Background animation
+ mAnimationTimer = new Timer(BACKGROUND_ANIMATION_DURATION);
+ mAnimationTimer.Tick += PauseBackgroundAnimation;
+ mAnimationTimer.Start();
+ mBackgroundAnimsPlaying = true;
+ }
+
+ private bool PauseBackgroundAnimation(object source, Timer.TickEventArgs e)
+ {
+ PauseAnimation();
+ return false;
+ }
+
+ private void PauseAnimation()
+ {
+ if (mBackgroundAnimsPlaying)
+ {
+ foreach (Animation anim in mBackgroundAnimations)
+ {
+ anim.Stop();
+ }
+
+ mBackgroundAnimsPlaying = false;
+ }
+ }
+
+ private void PlayAnimation()
+ {
+ if (!mBackgroundAnimsPlaying)
+ {
+ foreach (Animation anim in mBackgroundAnimations)
+ {
+ anim.Play();
+ }
+
+ mBackgroundAnimsPlaying = true;
+ }
+
+ mAnimationTimer.Interval = BACKGROUND_ANIMATION_DURATION;
+ }
+
+ private void OnKeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+
+ }
+ }
+
+ private void OnScrollStart(object source, Scrollable.StartedEventArgs e)
+ {
+ mScrolling = true;
+ //PlayAnimation();
+ }
+
+ private void OnScrollComplete(object source, Scrollable.CompletedEventArgs e)
+ {
+ // move focus to 1st item of new page
+ mScrolling = false;
+ //FocusManager.Instance.SetCurrentFocusView(mPages[mScrollView.GetCurrentPage()].GetChildAt(0));
+ }
+
+ private void OnLogoTapped(object source, TapGestureDetector.DetectedEventArgs e)
+ {
+ // Only show if currently fully hidden. If transitioning-out, the transition will not be interrupted.
+ if (!mVersionPopup || (mVersionPopup.DisplayState == Tizen.NUI.UIComponents.Popup.DisplayStateType.Hidden))
+ {
+ if (!mVersionPopup)
+ {
+ string stream = "";
+ stream += "DALi Core: " + CORE_MAJOR_VERSION + "." + CORE_MINOR_VERSION + "." + CORE_MICRO_VERSION + "\n";
+ stream += "DALi Adaptor: " + ADAPTOR_MAJOR_VERSION + "." + ADAPTOR_MINOR_VERSION + "." + ADAPTOR_MICRO_VERSION + "\n";
+ stream += "DALi Toolkit: " + TOOLKIT_MAJOR_VERSION + "." + TOOLKIT_MINOR_VERSION + "." + TOOLKIT_MICRO_VERSION + "\n";
+
+ mVersionPopup = new Tizen.NUI.UIComponents.Popup();
+ mVersionPopup.PositionUsesPivotPoint = true;
+ mVersionPopup.PivotPoint = PivotPoint.Center;
+ mVersionPopup.ParentOrigin = ParentOrigin.Center;
+
+ TextLabel titleActor = new TextLabel("Version information");
+ titleActor.Name = "titleActor";
+ titleActor.HorizontalAlignment = HorizontalAlignment.Center;
+
+ TextLabel contentActor = new TextLabel(stream);
+ contentActor.Name = "contentActor";
+ contentActor.MultiLine = true;
+ contentActor.HorizontalAlignment = HorizontalAlignment.Center;
+ contentActor.SetPadding(new PaddingType(0, 0, 20, 0));
+
+ mVersionPopup.SetTitle(titleActor);
+ mVersionPopup.SetContent(contentActor);
+
+ mVersionPopup.WidthResizePolicy = ResizePolicyType.SizeRelativeToParent;
+ mVersionPopup.SetSizeModeFactor(new Vector3(0.75f, 1.0f, 1.0f));
+ mVersionPopup.HeightResizePolicy = ResizePolicyType.FitToChildren;
+
+ mVersionPopup.TouchedOutside += HideVersionPopup;
+ Window.Instance.Add(mVersionPopup);
+ }
+
+ mVersionPopup.SetDisplayState(Tizen.NUI.UIComponents.Popup.DisplayStateType.Shown);
+ }
+ }
+
+ private void HideVersionPopup(object sender, Tizen.NUI.UIComponents.Popup.TouchedOutsideEventArgs e)
+ {
+ // Only hide if currently fully shown. If transitioning-in, the transition will not be interrupted.
+ if (null != mVersionPopup && (mVersionPopup.DisplayState == Tizen.NUI.UIComponents.Popup.DisplayStateType.Shown))
+ {
+ mVersionPopup.SetDisplayState(Tizen.NUI.UIComponents.Popup.DisplayStateType.Hidden);
+ }
+ }
+
+ /**
+ * Creates the background image
+ */
+ private View CreateBackground(string stylename)
+ {
+ View background = new View();
+ Window.Instance.Add(background);
+ background.SetStyleName(stylename);
+ background.Name = "BACKGROUND";
+ background.PositionUsesPivotPoint = true;
+ background.PivotPoint = PivotPoint.Center;
+ background.ParentOrigin = ParentOrigin.Center;
+ background.WidthResizePolicy = ResizePolicyType.FillToParent;
+ background.HeightResizePolicy = ResizePolicyType.FillToParent;
+ return background;
+ }
+
+ private View CreateTile(string name, string title, Vector3 sizeMultiplier, Vector2 position)
+ {
+ ImageView focusableTile = new ImageView();
+
+ focusableTile.SetStyleName("DemoTile");
+ focusableTile.ResourceUrl = CommonResource.GetDaliResourcePath() + "DaliDemo/demo-tile-texture.9.png";
+ focusableTile.PositionUsesPivotPoint = true;
+ focusableTile.ParentOrigin = ParentOrigin.Center;
+ focusableTile.WidthResizePolicy = focusableTile.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent;
+ focusableTile.SetSizeModeFactor(sizeMultiplier);
+ focusableTile.Name = name;
+
+ // Set the tile to be keyboard focusable
+ focusableTile.Focusable = true;
+
+ // Register a property with the ImageView. This allows us to inject the scroll-view position into the shader.
+ PropertyValue value = new PropertyValue(new Vector3(0.0f, 0.0f, 0.0f));
+ int propertyIndex = focusableTile.RegisterProperty("uCustomPosition", value);
+
+ // We create a constraint to perform a precalculation on the scroll-view X offset
+ // and pass it to the shader uniform, along with the tile's position.
+ //Constraint shaderPosition = Constraint::New<Vector3>(focusableTile, propertyIndex, TileShaderPositionConstraint(mPageWidth, position.x));
+ //shaderPosition.AddSource(Source(mScrollView, ScrollView::Property::SCROLL_POSITION) );
+ //shaderPosition.SetRemoveAction(Constraint::Discard );
+ //shaderPosition.Apply();
+ //focusableTile.Add( tileContent );
+
+ // Create an ImageView for the 9-patch border around the tile.
+ ImageView borderImage = new ImageView();
+ borderImage.SetStyleName("DemoTileBorder");
+ borderImage.ResourceUrl = CommonResource.GetDaliResourcePath() + "DaliDemo/item-background.9.png";
+ borderImage.PositionUsesPivotPoint = true;
+ borderImage.PivotPoint = PivotPoint.Center;
+ borderImage.ParentOrigin = ParentOrigin.Center;
+ borderImage.WidthResizePolicy = borderImage.HeightResizePolicy = ResizePolicyType.FillToParent;
+ borderImage.Opacity = 0.8f;
+ focusableTile.Add(borderImage);
+
+ TextLabel label = new TextLabel();
+ label.PositionUsesPivotPoint = true;
+ label.PivotPoint = PivotPoint.Center;
+ label.ParentOrigin = ParentOrigin.Center;
+ label.SetStyleName("LauncherLabel");
+ label.MultiLine = true;
+ label.Text = title;
+ label.HorizontalAlignment = HorizontalAlignment.Center;
+ label.VerticalAlignment = VerticalAlignment.Center;
+ label.HeightResizePolicy = ResizePolicyType.FillToParent;
+
+ // Pad around the label as its size is the same as the 9-patch border. It will overlap it without padding.
+ label.SetPadding(new PaddingType((int)TILE_LABEL_PADDING, (int)TILE_LABEL_PADDING, (int)TILE_LABEL_PADDING, (int)TILE_LABEL_PADDING));
+ focusableTile.Add(label);
+
+ // Connect to the touch events
+ focusableTile.TouchEvent += OnTilePressed;
+ //focusableTile.HoverEvent += OnTileHovered;
+
+ return focusableTile;
+ }
+
+ private bool DoTilePress(View actor, PointStateType pointState)
+ {
+ bool consumed = false;
+
+ if (PointStateType.Down == pointState)
+ {
+ mPressedActor = actor;
+ consumed = true;
+ }
+
+ // A button press is only valid if the Down & Up events
+ // both occurred within the button.
+ if ((PointStateType.Up == pointState) &&
+ (mPressedActor == actor))
+ {
+ // ignore Example button presses when scrolling or button animating.
+ if ((!mScrolling) && (!mPressedAnimation))
+ {
+ string name = actor.Name;
+ foreach (Example example in mExampleList)
+ {
+ if (example.Name == name)
+ {
+ consumed = true;
+ break;
+ }
+ }
+ }
+
+ if (consumed)
+ {
+ mPressedAnimation = new Animation((int)(BUTTON_PRESS_ANIMATION_TIME * 1000.0));
+ mPressedAnimation.EndAction = Animation.EndActions.Discard;
+
+ // scale the content actor within the Tile, as to not affect the placement within the Table.
+ View content = actor.GetChildAt(0);
+ mPressedAnimation.AnimateTo(content, "Scale", new Vector3(0.7f, 0.7f, 1.0f), 0, (int)((BUTTON_PRESS_ANIMATION_TIME * 0.5f) * 1000.0), new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut));
+ mPressedAnimation.AnimateTo(content, "Scale", Vector3.One, (int)((BUTTON_PRESS_ANIMATION_TIME * 0.5f) * 1000.0), (int)((BUTTON_PRESS_ANIMATION_TIME * 0.5f) * 1000.0), new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut));
+ mPressedAnimation.AnimateTo(content, "Orientation", new Rotation(new Radian(new Degree(180)), new Vector3(0, 1, 0)));
+ mPressedAnimation.Play();
+ mPressedAnimation.Finished += OnPressedAnimationFinished;
+ }
+ }
+ return consumed;
+ }
+
+ private void OnPressedAnimationFinished(object sender, EventArgs e)
+ {
+ string name = mPressedActor?.Name;
+
+ mPressedAnimation = null;
+ mPressedActor = null;
+
+ onClicked(name);
+ }
+
+ private bool OnTilePressed(object source, View.TouchEventArgs e)
+ {
+ return DoTilePress(source as View, e.Touch.GetState(0));
+ }
+
+ private List<View> tiles = new List<View>();
+
+ private void Populate()
+ {
+ Vector2 stageSize = Window.Instance.WindowSize;
+
+ mTotalPages = (uint)((mExampleList.Count() + EXAMPLES_PER_PAGE - 1) / EXAMPLES_PER_PAGE);
+
+ // Populate ScrollView.
+ if (mExampleList.Count() > 0)
+ {
+ if (mSortAlphabetically)
+ {
+ mExampleList.Sort(Example.CompareByTitle);
+ }
+
+ int pageCount = mExampleList.Count / (ROWS_PER_PAGE * EXAMPLES_PER_ROW) + ((0 == mExampleList.Count % (ROWS_PER_PAGE * EXAMPLES_PER_ROW)) ? 0 : 1);
+ mPages = new View[pageCount];
+
+ int pageIndex = 0;
+
+ uint exampleCount = 0;
+
+ for (int t = 0; t < mTotalPages; t++)
+ {
+ // Create Table
+ TableView page = new TableView(ROWS_PER_PAGE, EXAMPLES_PER_ROW);
+ page.PositionUsesPivotPoint = true;
+ page.PivotPoint = PivotPoint.Center;
+ page.ParentOrigin = ParentOrigin.Center;
+ page.WidthResizePolicy = page.HeightResizePolicy = ResizePolicyType.FillToParent;
+ mScrollView.Add(page);
+
+ // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi.
+ const float margin = 2.0f;
+ const float tileParentMultiplier = 1.0f / EXAMPLES_PER_ROW;
+
+ for (uint row = 0; row < ROWS_PER_PAGE; row++)
+ {
+ for (uint column = 0; column < EXAMPLES_PER_ROW; column++)
+ {
+ Example example = mExampleList.ElementAt((int)exampleCount++);
+
+ // Calculate the tiles relative position on the page (between 0 & 1 in each dimension).
+ Vector2 position = new Vector2((float)(column) / (EXAMPLES_PER_ROW - 1.0f), (float)(row) / (EXAMPLES_PER_ROW - 1.0f));
+ View tile = CreateTile(example.Name, example.Title, new Vector3(tileParentMultiplier, tileParentMultiplier, 1.0f), position);
+
+ tile.SetPadding(new PaddingType((int)margin, (int)margin, (int)margin, (int)margin));
+ page.AddChild(tile, new TableView.CellPosition(row, column));
+ //page.Add(tile);
+
+ tiles.Add(tile);
+
+ if (exampleCount == mExampleList.Count)
+ {
+ break;
+ }
+ }
+
+ if (exampleCount == mExampleList.Count)
+ {
+ break;
+ }
+ }
+
+ mPages[pageIndex++] = page;
+
+ if (exampleCount == mExampleList.Count)
+ {
+ break;
+ }
+ }
+ }
+
+ // Update Ruler info.
+ mScrollRulerX = new RulerPtr(new FixedRuler(mPageWidth));
+ mScrollRulerY = new RulerPtr(new DefaultRuler());
+ mScrollRulerX.SetDomain(new RulerDomain(0.0f, (mTotalPages + 1) * stageSize.Width * TABLE_RELATIVE_SIZE.X * 0.5f, true));
+ mScrollRulerY.Disable();
+ mScrollView.SetRulerX(mScrollRulerX);
+ mScrollView.SetRulerY(mScrollRulerY);
+ }
+
+ private void SetupBackground(View bubbleContainer)
+ {
+ // Add bubbles to the bubbleContainer.
+ // Note: The bubbleContainer is parented externally to this function.
+ AddBackgroundActors(bubbleContainer, NUM_BACKGROUND_IMAGES);
+ }
+
+ private void AddBackgroundActors(View layer, int count)
+ {
+ int shapeType = 0;
+ Random sizeRandom = new Random(DateTime.Now.Millisecond);
+ Random shapeRandom = new Random(DateTime.Now.Millisecond);
+
+ for (int i = 0; i < count; ++i)
+ {
+ int randSize = sizeRandom.Next(10, 400);
+ shapeType = shapeRandom.Next(0, NUMBER_OF_SHAPE_IMAGES);
+ //shapeType = (shapeType + 1) % 2;
+
+ Console.WriteLine("randSize is {0}, shapeType is {1}", randSize, shapeType);
+
+ ImageView dfActor = new ImageView();
+ dfActor.Size2D = new Vector2(randSize, randSize);
+ dfActor.PositionUsesPivotPoint = true;
+ dfActor.ParentOrigin = ParentOrigin.Center;
+
+ // Set the Image URL and the custom shader at the same time
+ PropertyMap effect = CreateDistanceFieldEffect();
+ PropertyMap imageMap = new PropertyMap();
+ imageMap.Insert(ImageVisualProperty.URL, new PropertyValue(SHAPE_IMAGE_TABLE[shapeType]));
+ imageMap.Insert(Visual.Property.Shader, new PropertyValue(effect));
+ imageMap.Insert(Visual.Property.MixColor, new PropertyValue(BUBBLE_COLOR[i % NUMBER_OF_BUBBLE_COLOR]));
+ dfActor.ImageMap = imageMap;
+
+ layer.Add(dfActor);
+ }
+
+ // Positioning will occur when the layer is relaid out
+ layer.Relayout += InitialiseBackgroundActors;
+ }
+
+ private void InitialiseBackgroundActors(object sender, EventArgs e)
+ {
+ // Delete current animations
+ mBackgroundAnimations.Clear();
+ View actor = sender as View;
+
+ // Create new animations
+ Size2D size = actor.Size2D;
+
+ Random childPosRandom = new Random(DateTime.Now.Millisecond);
+ Random animationDurationRandom = new Random(DateTime.Now.Millisecond);
+
+ for (uint i = 0, childCount = actor.GetChildCount(); i < childCount; ++i)
+ {
+ View child = actor.GetChildAt(i);
+
+ // Calculate a random position
+ Vector3 childPos = new Vector3(childPosRandom.Next((int)(-size.Width * 0.5f * BACKGROUND_SPREAD_SCALE), (int)(size.Width * 0.85f * BACKGROUND_SPREAD_SCALE)),
+ childPosRandom.Next((int)(-size.Height), (int)(size.Height)),
+ childPosRandom.Next((int)BUBBLE_MIN_Z, (int)BUBBLE_MAX_Z));
+
+ child.Position = childPos;
+
+ // Define bubble horizontal parallax and vertical wrapping
+ //Constraint animConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, AnimateBubbleConstraint(childPos, Random::Range(-0.85f, 0.25f)));
+ //animConstraint.AddSource(Source(mScrollView, ScrollView::Property::SCROLL_POSITION));
+ //animConstraint.AddSource(Dali::ParentSource(Dali::Actor::Property::SIZE));
+ //animConstraint.AddSource(Dali::LocalSource(Dali::Actor::Property::SIZE));
+ //animConstraint.SetRemoveAction(Constraint::Discard);
+ //animConstraint.Apply();
+
+ // Kickoff animation
+ Animation animation = new Animation(animationDurationRandom.Next(30, 160) * 1000);
+ animation.AnimateBy(child, "Position", new Vector3(0.0f, -2000.0f, 0.0f), new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear));
+ animation.Looping = true;
+ animation.Play();
+ mBackgroundAnimations.Add(animation);
+ }
+ }
+
+ private PropertyMap CreateDistanceFieldEffect()
+ {
+ string fragmentShaderPrefix = "#extension GL_OES_standard_derivatives : enable\n";
+
+ string fragmentShader = "varying mediump vec2 vTexCoord;\n" +
+ "\n" +
+ "uniform mediump float uGlowBoundary;\n" +
+ "uniform mediump vec2 uOutlineParams;\n" +
+ "uniform lowp vec4 uOutlineColor;\n" +
+ "uniform lowp vec4 uShadowColor;\n" +
+"uniform mediump vec2 uShadowOffset;\n" +
+"uniform lowp vec4 uGlowColor;\n" +
+"uniform lowp float uDoOutline;\n" +
+"uniform lowp float uDoShadow;\n" +
+"uniform lowp float uDoGlow;\n" +
+ "\n" +
+ "uniform sampler2D sTexture;\n" +
+ "uniform lowp vec4 uColor;\n" +
+ "\n" +
+ "void main()\n" +
+ "{\n" +
+ "// sample distance field\n" +
+ "mediump float smoothing = 0.5;\n" +
+
+ "mediump float distance = texture2D(sTexture, vTexCoord).a;\n" +
+ "mediump float smoothWidth = fwidth(distance);\n" +
+ "mediump float alphaFactor = smoothstep(smoothing - smoothWidth, smoothing + smoothWidth, distance);\n" +
+ "lowp vec4 color;\n" +
+ "if (uDoShadow == 0.0)\n" +
+ "{\n" +
+ "mediump float alpha = uColor.a * alphaFactor;\n" +
+ "lowp vec4 rgb = uColor;\n" +
+ "\n" +
+ "if (uDoOutline > 0.0)\n" +
+ "{\n" +
+ "mediump float outlineWidth = uOutlineParams[1] + smoothWidth;\n" +
+ "mediump float outlineBlend = smoothstep(uOutlineParams[0] - outlineWidth, uOutlineParams[0] + outlineWidth, distance);\n" +
+ "alpha = smoothstep(smoothing - smoothWidth, smoothing + smoothWidth, distance);\n" +
+ "rgb = mix(uOutlineColor, uColor, outlineBlend);\n" +
+ "}\n" +
+ "\n" +
+ "if (uDoGlow > 0.0)\n" +
+ "{\n" +
+ "rgb = mix(uGlowColor, rgb, alphaFactor);\n" +
+ "alpha = smoothstep(uGlowBoundary, smoothing, distance);\n" +
+ "}\n" +
+ "\n" +
+ "// set fragment color\n" +
+ "color = vec4(rgb.rgb, alpha);\n" +
+ "}\n" +
+ "\n" +
+ "else // (uDoShadow > 0.0)\n" +
+ "{\n" +
+ "mediump float shadowDistance = texture2D(sTexture, vTexCoord - uShadowOffset).a;\n" +
+ "mediump float inText = alphaFactor;\n" +
+ "mediump float inShadow = smoothstep(smoothing - smoothWidth, smoothing + smoothWidth, shadowDistance);\n" +
+ "\n" +
+ "// inside object, outside shadow\n" +
+ "if (inText == 1.0)\n" +
+ "{\n" +
+ "color = uColor;\n" +
+ "}\n" +
+ "// inside object, outside shadow\n" +
+ "else if ((inText != 0.0) && (inShadow == 0.0))\n" +
+ "{\n" +
+ "color = uColor;\n" +
+ "color.a *= inText;\n" +
+ "}\n" +
+ "// outside object, completely inside shadow\n" +
+ "else if ((inText == 0.0) && (inShadow == 1.0))\n" +
+ "{\n" +
+ "color = uShadowColor;\n" +
+ "}\n" +
+ "// inside object, completely inside shadow\n" +
+ "else if ((inText != 0.0) && (inShadow == 1.0))\n" +
+ "{\n" +
+ "color = mix(uShadowColor, uColor, inText);\n" +
+ "color.a = uShadowColor.a;\n" +
+ "}\n" +
+ "// inside object, inside shadow's border\n" +
+ "else if ((inText != 0.0) && (inShadow != 0.0))\n" +
+ "{\n" +
+ "color = mix(uShadowColor, uColor, inText);\n" +
+ "color.a *= max(inText, inShadow);\n" +
+ "}\n" +
+ "// inside shadow's border\n" +
+ "else if (inShadow != 0.0)\n" +
+ "{\n" +
+ "color = uShadowColor;\n" +
+ "color.a *= inShadow;\n" +
+ "}\n" +
+ "// outside shadow and object\n" +
+ "else \n" +
+ "{\n" +
+ "color.a = 0.0;\n" +
+ "}\n" +
+ "\n" +
+ "}\n" +
+ "\n" +
+ "gl_FragColor = color;\n" +
+ "\n" +
+ "}";
+
+ PropertyMap map = new PropertyMap();
+
+ PropertyMap customShader = new PropertyMap();
+
+ string fragmentShaderString;
+ fragmentShaderString = fragmentShaderPrefix + fragmentShader;
+
+ customShader.Insert(Visual.ShaderProperty.FragmentShader, new PropertyValue(fragmentShaderString));
+ customShader.Insert(Visual.ShaderProperty.ShaderHints, new PropertyValue((int)Shader.Hint.Value.OUTPUT_IS_TRANSPARENT));
+
+ map.Insert(Visual.Property.Shader, new PropertyValue(customShader));
+ return map;
+ }
+
+ private void ApplyScrollViewEffect()
+ {
+ // Remove old effect if exists.
+
+ if (mScrollViewEffect)
+ {
+ mScrollView.RemoveEffect(mScrollViewEffect);
+ }
+
+ // Just one effect for now
+ SetupInnerPageCubeEffect();
+
+ mScrollView.ApplyEffect(mScrollViewEffect);
+ }
+
+ private void SetupInnerPageCubeEffect()
+ {
+ Vector2 stageSize = Window.Instance.WindowSize;
+
+ Path path = new Path();
+ PropertyArray points = new PropertyArray();
+ points.PushBack(new PropertyValue(new Vector3(stageSize.X * 0.5f, 0.0f, stageSize.X * 0.5f)));
+ points.PushBack(new PropertyValue(new Vector3(0.0f, 0.0f, 0.0f)));
+ points.PushBack(new PropertyValue(new Vector3(-stageSize.X * 0.5f, 0.0f, stageSize.X * 0.5f)));
+ path.Points = points;
+
+ PropertyArray controlPoints = new PropertyArray();
+ controlPoints.PushBack(new PropertyValue(new Vector3(stageSize.X * 0.5f, 0.0f, stageSize.X * 0.3f)));
+ controlPoints.PushBack(new PropertyValue(new Vector3(stageSize.X * 0.3f, 0.0f, 0.0f)));
+ controlPoints.PushBack(new PropertyValue(new Vector3(-stageSize.X * 0.3f, 0.0f, 0.0f)));
+ controlPoints.PushBack(new PropertyValue(new Vector3(-stageSize.X * 0.5f, 0.0f, stageSize.X * 0.3f)));
+ path.ControlPoints = controlPoints;
+
+ mScrollViewEffect = new ScrollViewPagePathEffect(path,
+ new Vector3(-1.0f, 0.0f, 0.0f),
+ ScrollView.Property.SCROLL_FINAL_X,
+ new Vector3(stageSize.X * TABLE_RELATIVE_SIZE.X, stageSize.Y * TABLE_RELATIVE_SIZE.Y, 0.0f), mTotalPages);
+ }
+
+ void ApplyCubeEffectToPages()
+ {
+ uint pageCount = 0;
+
+ for (int i = 0; i < mPages.Count(); i++)
+ {
+ View page = mPages[i];
+ mScrollViewEffect.ApplyToPage(page, pageCount++);
+ }
+ }
+
+ void Rotate(uint degrees)
+ {
+ // Resize the root actor
+ Vector2 stageSize = Window.Instance.WindowSize;
+ Vector3 targetSize = new Vector3(stageSize.X, stageSize.Y, 1.0f);
+
+ if (degrees == 90 || degrees == 270)
+ {
+ targetSize = new Vector3(stageSize.Y, stageSize.X, 1.0f);
+ }
+
+ if (mRotateAnimation)
+ {
+ mRotateAnimation.Stop();
+ mRotateAnimation.Clear();
+ }
+
+ mRotateAnimation = new Animation((int)(ROTATE_ANIMATION_TIME * 1000.0));
+ mRotateAnimation.AnimateTo(mRootActor, "Orientation", new Rotation(new Radian(new Degree(360 - degrees)), new Vector3(0, 0, 1)), new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut));
+ mRotateAnimation.AnimateTo(mRootActor, "Size", targetSize, new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut));
+ mRotateAnimation.Play();
+ }
+
+ internal View mRootActor; ///< All content (excluding background is anchored to this Actor)
+ private Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor.
+ private Animation mPressedAnimation; ///< Button press scaling animation.
+ private ScrollView mScrollView; ///< ScrollView container (for all Examples)
+ private ScrollViewPagePathEffect mScrollViewEffect; ///< Effect to be applied to the scroll view
+ private RulerPtr mScrollRulerX; ///< ScrollView X (horizontal) ruler
+ private RulerPtr mScrollRulerY; ///< ScrollView Y (vertical) ruler
+ private View mPressedActor; ///< The currently pressed actor.
+ private Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period
+ private TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo
+ private Tizen.NUI.UIComponents.Popup mVersionPopup; ///< Displays DALi library version information
+
+ /**
+ * This struct encapsulates all data relevant to each of the elements used within the custom keyboard focus effect.
+ */
+ private struct FocusEffect
+ {
+ public ImageView actor; ///< The parent keyboard focus highlight actor
+ public Animation animation; ///< The animation for the parent keyboard focus highlight actor
+ };
+ FocusEffect[] mFocusEffect = new FocusEffect[FOCUS_ANIMATION_ACTOR_NUMBER]; ///< The elements used to create the custom focus effect
+
+ private View[] mPages; ///< List of pages.
+ private List<Animation> mBackgroundAnimations = new List<Animation>(); ///< List of background bubble animations
+ private List<Example> mExampleList = new List<Example>(); ///< List of examples.
+
+ private float mPageWidth; ///< The width of a page within the scroll-view, used to calculate the domain
+ private uint mTotalPages; ///< Total pages within scrollview.
+
+ private bool mScrolling; ///< Flag indicating whether view is currently being scrolled
+ private bool mSortAlphabetically; ///< Sort examples alphabetically.
+ private bool mBackgroundAnimsPlaying; ///< Are background animations playing
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using Tizen.FH.NUI.Controls;
+
+namespace NuiCommonUiSamples
+{
+ public class DatePicker : IExample
+ {
+ private SampleLayout root;
+ private Tizen.NUI.CommonUI.Popup popup = null;
+ private Picker datePicker = null;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "Date Picker";
+
+ CreateDatePicker();
+ }
+
+ private void CreateDatePicker()
+ {
+ popup = new Tizen.NUI.CommonUI.Popup("Popup");
+ popup.Size2D = new Size2D(1032, 982);
+ popup.Position2D = new Position2D(24, 50);
+ popup.TitleText = "Set Date";
+ popup.ButtonCount = 2;
+ popup.SetButtonText(0, "Cancel");
+ popup.SetButtonText(1, "OK");
+ popup.PopupButtonClickedEvent += PopupButtonClickedEvent;
+ root.Add(popup);
+
+ datePicker = new Picker("DAPicker");
+ datePicker.Size2D = new Size2D(1032, 724);
+ datePicker.Position2D = new Position2D(0, 0);
+ datePicker.CurDate = new DateTime(2012, 12, 12);
+ popup.ContentView.Add(datePicker);
+ }
+
+ private void PopupButtonClickedEvent(object sender, Tizen.NUI.CommonUI.Popup.ButtonClickEventArgs e)
+ {
+
+ }
+
+ private void DestoryDatePicker()
+ {
+ if (popup != null)
+ {
+ if (datePicker != null)
+ {
+ popup.ContentView.Remove(datePicker);
+ datePicker.Dispose();
+ datePicker = null;
+ }
+
+ root.Remove(popup);
+ popup.Dispose();
+ popup = null;
+ }
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ DestoryDatePicker();
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+ public class DropDown : IExample
+ {
+ private SampleLayout root;
+ private Tizen.NUI.CommonUI.DropDown dropDown = null;
+ private Tizen.NUI.CommonUI.DropDown dropDown2 = null;
+ private ScrollBar scrollBar = null;
+ private TextLabel text = null;
+
+ private static string[] iconImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "10. Drop Down/img_dropdown_fahrenheit.png",
+ CommonResource.GetResourcePath() + "10. Drop Down/img_dropdown_celsius.png",
+ };
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "DropDown";
+
+ text = new TextLabel();
+ text.Text = "DropDown Clicked item string is ";
+ text.PointSize = 14;
+ text.Size2D = new Size2D(880, 50);
+ text.Position2D = new Position2D(100, 10);
+ text.HorizontalAlignment = HorizontalAlignment.Center;
+ text.MultiLine = true;
+ root.Add(text);
+
+ dropDown = new Tizen.NUI.CommonUI.DropDown("HeaderDropDown");
+ dropDown.Size2D = new Size2D(1080, 108);
+ dropDown.Position2D = new Position2D(0, 100);
+ dropDown.ListSize2D = new Size2D(360, 500);
+ dropDown.HeaderText = "Header area";
+ dropDown.ButtonText = "Normal list 1";
+ dropDown.ItemClickEvent += DropDownItemClickEvent;
+ root.Add(dropDown);
+
+ for (int i = 0; i < 8; i++)
+ {
+ Tizen.NUI.CommonUI.DropDown.DropDownItemData item = new Tizen.NUI.CommonUI.DropDown.DropDownItemData("TextListItem");
+ item.Size2D = new Size2D(360, 96);
+ item.Text = "Normal list " + i;
+ dropDown.AddItem(item);
+ }
+
+ dropDown.SelectedItemIndex = 1;
+ ////////Attach scrollbar///////////
+ scrollBar = new ScrollBar();
+ scrollBar.Direction = ScrollBar.DirectionType.Vertical;
+ scrollBar.Position2D = new Position2D(394, 2);
+ scrollBar.Size2D = new Size2D(4, 446);
+ scrollBar.TrackColor = Color.Green;
+ scrollBar.ThumbSize = new Size2D(4, 30);
+ scrollBar.ThumbColor = Color.Yellow;
+ scrollBar.TrackImageURL = CommonResource.GetResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
+ dropDown.AttachScrollBar(scrollBar);
+
+ //////////////////ListSpinner DropDown////////////////////////
+ dropDown2 = new Tizen.NUI.CommonUI.DropDown("ListDropDown");
+ dropDown2.Size2D = new Size2D(1080, 108);
+ dropDown2.Position2D = new Position2D(0, 300);
+ dropDown2.ListSize2D = new Size2D(360, 192);
+ dropDown2.HeaderText = "List area";
+ dropDown2.ButtonText = "Menu";
+ root.Add(dropDown2);
+
+ for (int i = 0; i < 2; i++)
+ {
+ Tizen.NUI.CommonUI.DropDown.DropDownItemData item = new Tizen.NUI.CommonUI.DropDown.DropDownItemData("IconListItem");
+ item.Size2D = new Size2D(360, 96);
+ item.IconResourceUrl = iconImage[i];
+ dropDown2.AddItem(item);
+ }
+
+ dropDown2.SelectedItemIndex = 0;
+
+ dropDown.RaiseToTop();
+ }
+
+ private void DropDownItemClickEvent(object sender, Tizen.NUI.CommonUI.DropDown.ItemClickEventArgs e)
+ {
+ text.Text = "DropDown Clicked item string is " + e.Text;
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ if (text != null)
+ {
+ root.Remove(text);
+ text.Dispose();
+ text = null;
+ }
+
+ if (dropDown != null)
+ {
+ if (scrollBar != null)
+ {
+ dropDown.DetachScrollBar();
+ scrollBar.Dispose();
+ scrollBar = null;
+ }
+
+ root.Remove(dropDown);
+ dropDown.Dispose();
+ dropDown = null;
+ }
+
+ if (dropDown2 != null)
+ {
+ root.Remove(dropDown2);
+ dropDown2.Dispose();
+ dropDown2 = null;
+ }
+
+ root.Dispose();
+ }
+ }
+
+ private void ButtonClickEvent(object sender, Tizen.NUI.CommonUI.Button.ClickEventArgs e)
+ {
+ Tizen.NUI.CommonUI.Button btn = sender as Tizen.NUI.CommonUI.Button;
+
+ }
+ }
+}
--- /dev/null
+using System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using System.Collections.Generic;
+
+namespace NuiCommonUiSamples
+{
+ public class ListItemData
+ {
+ private string str;
+
+ public ListItemData(int i)
+ {
+ str = "Text" + i.ToString();
+ }
+
+ public string TextString
+ {
+ get
+ {
+ return str;
+ }
+ }
+ }
+
+ public class ListItemView : View
+ {
+ private TextLabel mText;
+
+ public ListItemView()
+ {
+ mText = new TextLabel();
+ mText.WidthResizePolicy = ResizePolicyType.FillToParent;
+ mText.HeightResizePolicy = ResizePolicyType.FillToParent;
+ mText.PointSize = 22;
+ mText.HorizontalAlignment = HorizontalAlignment.Center;
+ mText.VerticalAlignment = VerticalAlignment.Center;
+ Add(mText);
+ }
+
+ public string MainText
+ {
+ get
+ {
+ return mText.Text;
+ }
+ set
+ {
+ mText.Text = value;
+ }
+ }
+ }
+
+ public class ListBridge : Tizen.NUI.CommonUI.FlexibleView.Adapter
+ {
+ private List<ListItemData> mDatas;
+
+ public ListBridge(List<ListItemData> datas)
+ {
+ mDatas = datas;
+ }
+
+ public void InsertData(int position)
+ {
+ mDatas.Insert(position, new ListItemData(1000 + position));
+ NotifyItemInserted(position);
+ }
+
+ public void RemoveData(int position)
+ {
+ mDatas.RemoveAt(position);
+ NotifyItemRemoved(position);
+ }
+
+ public override Tizen.NUI.CommonUI.FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
+ {
+ Tizen.NUI.CommonUI.FlexibleView.ViewHolder viewHolder = new Tizen.NUI.CommonUI.FlexibleView.ViewHolder(new ListItemView());
+ //Console.WriteLine($"OnCreateViewHolder... viewType: {viewType} viewID: {viewHolder.ItemView.ID}");
+
+ return viewHolder;
+ }
+
+ public override void OnBindViewHolder(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder, int position)
+ {
+ //Console.WriteLine($"OnBindItemView... position: {position}");
+ ListItemData listItemData = mDatas[position];
+
+ ListItemView listItemView = holder.ItemView as ListItemView;
+ listItemView.Name = "Item" + position;
+ //Random rd = new Random();
+ listItemView.SizeWidth = 150;
+ listItemView.SizeHeight = 60;
+ if (listItemView != null)
+ {
+ listItemView.MainText = String.Format("{0:D2}", position) + " : " + listItemData.TextString;
+ }
+ listItemView.Margin = new Extents(2, 2, 2, 2);
+ if (position % 2 == 0)
+ listItemView.BackgroundColor = Color.Cyan;
+ else
+ listItemView.BackgroundColor = Color.Yellow;
+ }
+
+ public override void OnDestroyViewHolder(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder)
+ {
+ //Console.WriteLine($"OnDestroyViewHolder... viewID: {holder.ItemView?.ID}");
+ if (holder.ItemView != null)
+ {
+ holder.ItemView.Dispose();
+ }
+ }
+
+ public override int GetItemCount()
+ {
+ return mDatas.Count;
+ }
+
+ public override void OnFocusChange(Tizen.NUI.CommonUI.FlexibleView flexibleView, int previousFocus, int currentFocus)
+ {
+ Tizen.NUI.CommonUI.FlexibleView.ViewHolder previousFocusView = flexibleView.FindViewHolderForAdapterPosition(previousFocus);
+ if (previousFocusView != null)
+ {
+ //Console.WriteLine($"previousFocus {previousFocus.AdapterPosition}");
+ if (previousFocusView.AdapterPosition % 2 == 0)
+ previousFocusView.ItemView.BackgroundColor = Color.Cyan;
+ else
+ previousFocusView.ItemView.BackgroundColor = Color.Yellow;
+ //previousFocus.SizeWidth = 150;
+ //previousFocus.SizeHeight = 60;
+ //NotifyItemChanged(previousFocus.AdapterPosition);
+ }
+ Tizen.NUI.CommonUI.FlexibleView.ViewHolder currentFocusView = flexibleView.FindViewHolderForAdapterPosition(currentFocus);
+ if (currentFocusView != null)
+ {
+ //Console.WriteLine($"currentFocus {currentFocus.AdapterPosition}");
+ currentFocusView.ItemView.BackgroundColor = Color.Magenta;
+ //currentFocus.SizeWidth = 200;
+ //currentFocus.SizeHeight = 100;
+ //NotifyItemChanged(currentFocus.AdapterPosition);
+ }
+ }
+
+ public override void OnViewAttachedToWindow(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder)
+ {
+ //Console.WriteLine($"+Attached: {holder.AdapterPosition}");
+ }
+
+ public override void OnViewDetachedFromWindow(Tizen.NUI.CommonUI.FlexibleView.ViewHolder holder)
+ {
+ //Console.WriteLine($" --Detached: {holder.AdapterPosition}");
+ }
+
+ }
+
+ public class FlexibleView : IExample
+ {
+ private SampleLayout root;
+ private Tizen.NUI.CommonUI.FlexibleView flexibleView1;
+ private Tizen.NUI.CommonUI.FlexibleView flexibleView2;
+ private ListBridge adapter;
+
+ private ScrollBar scrollBar1;
+ private ScrollBar scrollBar2;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout(false);
+ root.HeaderText = "FlexibleView";
+
+ flexibleView1 = new Tizen.NUI.CommonUI.FlexibleView();
+ flexibleView1.Name = "FlexibleView1";
+ flexibleView1.Position2D = new Position2D(300, 20);
+ flexibleView1.Size2D = new Size2D(400, 450);
+ flexibleView1.Padding = new Extents(10, 10, 10, 10);
+ flexibleView1.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f);
+
+ List<ListItemData> dataList = new List<ListItemData>();
+ for (int i = 0; i < 131; ++i)
+ {
+ dataList.Add(new ListItemData(i));
+ }
+ adapter = new ListBridge(dataList);
+ flexibleView1.SetAdapter(adapter);
+
+ LinearLayoutManager layoutManager1 = new LinearLayoutManager(LinearLayoutManager.VERTICAL);
+ //GridLayoutManager layoutManager1 = new GridLayoutManager(3, LinearLayoutManager.VERTICAL);
+ flexibleView1.SetLayoutManager(layoutManager1);
+
+ root.Add(flexibleView1);
+
+ scrollBar1 = new ScrollBar("DAScrollbar");
+ scrollBar1.Direction = ScrollBar.DirectionType.Vertical;
+ scrollBar1.Position2D = new Position2D(394, 2);
+ scrollBar1.Size2D = new Size2D(4, 446);
+ scrollBar1.ThumbSize = new Size2D(4, 30);
+ flexibleView1.AttachScrollBar(scrollBar1);
+
+
+ flexibleView2 = new Tizen.NUI.CommonUI.FlexibleView();
+ flexibleView2.Name = "FlexibleView2";
+ flexibleView2.Position2D = new Position2D(150, 520);
+ flexibleView2.Size2D = new Size2D(700, 200);
+ flexibleView2.Padding = new Extents(10, 10, 10, 10);
+ flexibleView2.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f);
+
+ flexibleView2.SetAdapter(adapter);
+
+ GridLayoutManager layoutManager2 = new GridLayoutManager(3, LinearLayoutManager.HORIZONTAL);
+ flexibleView2.SetLayoutManager(layoutManager2);
+
+ root.Add(flexibleView2);
+
+ scrollBar2 = new ScrollBar("DAScrollbar");
+ scrollBar2.Position2D = new Position2D(2, 194);
+ scrollBar2.Size2D = new Size2D(696, 4);
+ scrollBar2.ThumbSize = new Size2D(30, 4);
+ flexibleView2.AttachScrollBar(scrollBar2);
+
+ }
+
+
+ public void Deactivate()
+ {
+ flexibleView1.DetachScrollBar();
+ scrollBar1.Dispose();
+ flexibleView2.DetachScrollBar();
+ scrollBar2.Dispose();
+
+ root.Remove(flexibleView1);
+ flexibleView1.Dispose();
+ root.Remove(flexibleView2);
+ flexibleView2.Dispose();
+
+ root.Dispose();
+ }
+ }
+}
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace NuiCommonUiSamples
+{
+ using Controls = Tizen.FH.NUI.Controls;
+ public class Header : IExample
+ {
+ private SampleLayout root;
+ private View root1;
+ private View root2;
+ private View root3;
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout(false);
+ root.HeaderText = "Header";
+
+ root1 = new View()
+ {
+ SizeWidth = 1080,
+ Position2D = new Position2D(0, 0),
+ BackgroundColor = new Color(1.0f, 1.0f, 0, 0.7f),
+ SizeHeight = 200,
+
+ };
+
+ Controls.Header header1 = new Tizen.FH.NUI.Controls.Header();
+ header1.Position2D = new Position2D(0, 0);
+ header1.BackgroundColor = new Color(255, 255, 255, 1);
+ header1.Size2D = new Size2D(1080, 128);
+ header1.HeaderText = "Title Area Default";
+ header1.HeaderTextColor = new Color(0, 0, 0, 1); //black
+ header1.LinebackgroundColor = new Color(0, 0, 0, 0.2f);//white
+
+ root1.Add(header1);
+ root.Add(root1);
+
+ root2 = new View()
+ {
+ SizeWidth = 1080,
+ Position2D = new Position2D(0, 210),
+ BackgroundColor = new Color(1.0f, 1.0f, 0, 0.7f),
+ SizeHeight = 200,
+ };
+
+ Controls.Header header2 = new Tizen.FH.NUI.Controls.Header();
+ header2.Position2D = new Position2D(0, 0);
+ header2.Size2D = new Size2D(1080, 128);
+ header1.BackgroundColor = new Color(255, 255, 255, 0.7f);
+ header2.HeaderText = "Title Area Opqaue";
+ header2.HeaderTextColor = new Color(0, 0, 0, 1); //black
+ header2.LinebackgroundColor = new Color(0, 0, 0, 0.2f); //black
+
+
+ root2.Add(header2);
+ root.Add(root2);
+
+ root3 = new View()
+ {
+ SizeWidth = 1080,
+ Position2D = new Position2D(0, 420),
+ BackgroundColor = new Color(0, 0, 0, 1),
+ SizeHeight = 200,
+ };
+
+ Controls.Header header3 = new Controls.Header();
+ header3.Position2D = new Position2D(0, 0);
+ header3.Size2D = new Size2D(1080, 128);
+ header3.HeaderText = "Title Area Transparency";
+ header3.HeaderTextColor = new Color(255, 255, 255, 1); //white
+ header3.LinebackgroundColor = new Color(255, 255, 255, 0.2f);//white
+
+
+ root3.Add(header3);
+ root.Add(root3);
+ }
+
+ public void Deactivate()
+ {
+ if (root1 != null)
+ {
+ root.Remove(root1);
+ root1.Dispose();
+ }
+ if (root2 != null)
+ {
+ root.Remove(root2);
+ root2.Dispose();
+ }
+ if (root3 != null)
+ {
+ root.Remove(root3);
+ root3.Dispose();
+ }
+
+ root.Dispose();
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using System;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ public class InputField : IExample
+ {
+ private const int COUNT = 2;
+ private Tizen.FH.NUI.Controls.InputField[] inputFieldArr;
+ private TextLabel guideText;
+ private SampleLayout rootView;
+ private int posY;
+ private Tizen.NUI.CommonUI.Button button;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ posY = 100;
+ inputFieldArr = new Tizen.FH.NUI.Controls.InputField[COUNT];
+ CreateRootView();
+ CreateFamily();
+ CreateGuideText();
+ button = new Tizen.NUI.CommonUI.Button();
+ button.PointSize = 14;
+ button.Size2D = new Size2D(300, 80);
+ button.BackgroundColor = Color.Green;
+ button.Position2D = new Position2D(200, 0);
+ button.Text = "LTR/RTL";
+ button.ClickEvent += OnLayoutChanged;
+ rootView.Add(button);
+ Window.Instance.KeyEvent += OnWindowsKeyEvent;
+ }
+ private void OnLayoutChanged(object sender, global::System.EventArgs e)
+ {
+ for (int i = 0; i < COUNT; i++)
+ {
+ if (inputFieldArr[i].LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ inputFieldArr[i].LayoutDirection = ViewLayoutDirectionType.RTL;
+ }
+ else
+ {
+ inputFieldArr[i].LayoutDirection = ViewLayoutDirectionType.LTR;
+ }
+ }
+ }
+ private void CreateRootView()
+ {
+ rootView = new SampleLayout();
+ rootView.HeaderText = "InputField";
+ rootView.Focusable = true;
+ rootView.TouchEvent += OnRootViewTouchEvent;
+ }
+
+ private void CreateFamily()
+ {
+ inputFieldArr[0] = new Tizen.FH.NUI.Controls.InputField("DefaultInputField");
+ inputFieldArr[0].Name = "DefaultInputField";
+ inputFieldArr[0].Size2D = new Size2D(1080, 95);
+ inputFieldArr[0].Position2D = new Position2D(0, posY);
+ rootView.Add(inputFieldArr[0]);
+ inputFieldArr[0].HintText = "DefaultInputField";
+ inputFieldArr[0].CancelButtonClickEvent += OnCancelBtnClickEvent;
+ inputFieldArr[0].KeyEvent += OnKeyEvent;
+
+ inputFieldArr[0].FocusGained += (object sender, EventArgs e) =>
+ {
+ Tizen.Log.Fatal("NUI", "Field0 get focus");
+ };
+
+ inputFieldArr[0].FocusLost += (object sender, EventArgs e) =>
+ {
+ Tizen.Log.Fatal("NUI", "Field0 lost focus");
+ };
+
+ posY += 100;
+ inputFieldArr[1] = new Tizen.FH.NUI.Controls.InputField("StyleBInputField");
+ inputFieldArr[1].Name = "StyleBInputField";
+ inputFieldArr[1].Size2D = new Size2D(1080, 95);
+ inputFieldArr[1].Position2D = new Position2D(0, posY);
+ rootView.Add(inputFieldArr[1]);
+ inputFieldArr[1].HintText = "StyleBInputField";
+ inputFieldArr[1].DeleteButtonClickEvent += OnDeleteBtnClickEvent;
+ inputFieldArr[1].AddButtonClickEvent += OnAddBtnClickEvent;
+ inputFieldArr[1].KeyEvent += OnKeyEvent;
+ }
+
+ private void CreateGuideText()
+ {
+ guideText = new TextLabel();
+ guideText.Size2D = new Size2D(1080, 200);
+ guideText.Position2D = new Position2D(0, 600);
+ guideText.TextColor = Color.Blue;
+ guideText.BackgroundColor = Color.White;
+ guideText.PointSize = 15;
+ guideText.MultiLine = true;
+ rootView.Add(guideText);
+ guideText.Text =
+ "Tips: \n" +
+ "User can input text after press on the InputBox; \n" +
+ "User can press Cancel, Add and Delete button, do what they want in these button click callbacks; \n" +
+ "User can do what they want in the key event; \n " +
+ "In this sample, text color will change when inputted text's length change between 5~10, 10~15. \n" +
+ "User can exit the sample by press \"Esc\" key after touch on any area except the InputField.";
+ }
+
+ private void OnWindowsKeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ if (e.Key.KeyPressedName == "Left")
+ {
+ //inputField1.Text = "test";
+ for (int i = 0; i < COUNT; ++i)
+ {
+ inputFieldArr[i].StateEnabled = false;
+ }
+ }
+ else if (e.Key.KeyPressedName == "Right")
+ {
+ //inputField1.Text = "";
+ for (int i = 0; i < COUNT; ++i)
+ {
+ inputFieldArr[i].StateEnabled = true;
+ }
+ }
+ else if (e.Key.KeyPressedName == "Up")
+ {
+ for (int i = 0; i < COUNT; ++i)
+ {
+ inputFieldArr[i].Text = "abcdef";
+ }
+ }
+ else if (e.Key.KeyPressedName == "Down")
+ {
+ for (int i = 0; i < COUNT; ++i)
+ {
+ inputFieldArr[i].Text = "";
+ }
+ }
+ }
+ }
+
+ private bool OnRootViewTouchEvent(object sender, View.TouchEventArgs e)
+ {
+ FocusManager.Instance.SetCurrentFocusView(rootView);
+ return false;
+ }
+
+ private void OnKeyEvent(object sender, View.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ Tizen.Log.Fatal("NUI", "OnKeyEvent Key is " + e.Key.KeyPressedName);
+
+ Tizen.FH.NUI.Controls.InputField inputField = sender as Tizen.FH.NUI.Controls.InputField;
+ if (inputField != null)
+ {
+ if (inputField.Text.Length > 5 && inputField.Text.Length <= 10)
+ {
+ inputField.TextColor = Color.Yellow;
+ }
+ else if (inputField.Text.Length > 10 && inputField.Text.Length <= 15)
+ {
+ inputField.TextColor = Color.Red;
+ }
+ else
+ {
+ inputField.TextColor = Color.Black;
+ }
+ }
+ }
+ }
+
+ public void Deactivate()
+ {
+ Window window = Window.Instance;
+ window.KeyEvent -= OnWindowsKeyEvent;
+
+ for (int i = 0; i < COUNT; ++i)
+ {
+ if (inputFieldArr[i] != null)
+ {
+ if (i % 2 == 0)
+ {
+ inputFieldArr[i].CancelButtonClickEvent -= OnCancelBtnClickEvent;
+ }
+ else
+ {
+ inputFieldArr[i].DeleteButtonClickEvent -= OnDeleteBtnClickEvent;
+ inputFieldArr[i].AddButtonClickEvent -= OnAddBtnClickEvent;
+ }
+ inputFieldArr[i].KeyEvent -= OnKeyEvent;
+ rootView.Remove(inputFieldArr[i]);
+ inputFieldArr[i].Dispose();
+ inputFieldArr[i] = null;
+ }
+ }
+ inputFieldArr = null;
+
+ if (guideText != null)
+ {
+ rootView.Remove(guideText);
+ guideText.Dispose();
+ guideText = null;
+ }
+
+ if (button != null)
+ {
+ rootView.Remove(button);
+ button.Dispose();
+ button = null;
+ }
+
+ if (rootView != null)
+ {
+ rootView.TouchEvent -= OnRootViewTouchEvent;
+ rootView.Dispose();
+ rootView = null;
+ }
+ }
+
+ private void OnCancelBtnClickEvent(object sender, Tizen.FH.NUI.Controls.InputField.ButtonClickArgs args)
+ {
+ if (sender is Tizen.FH.NUI.Controls.InputField)
+ {
+ Tizen.FH.NUI.Controls.InputField inputfield = sender as Tizen.FH.NUI.Controls.InputField;
+ Console.WriteLine("-------, name: " + inputfield.Name + ", args.State = " + args.State);
+ inputfield.TextColor = Color.Black;
+ inputfield.Text = "Click on the cancel button";
+ }
+ }
+
+ private void OnDeleteBtnClickEvent(object sender, Tizen.FH.NUI.Controls.InputField.ButtonClickArgs args)
+ {
+ if (sender is Tizen.FH.NUI.Controls.InputField)
+ {
+ Tizen.FH.NUI.Controls.InputField inputfield = sender as Tizen.FH.NUI.Controls.InputField;
+ Console.WriteLine("-------, name: " + inputfield.Name + ", args.State = " + args.State);
+ inputfield.Text = "Click on the delete button";
+ }
+ }
+
+ private void OnAddBtnClickEvent(object sender, Tizen.FH.NUI.Controls.InputField.ButtonClickArgs args)
+ {
+ if (sender is Tizen.FH.NUI.Controls.InputField)
+ {
+ Tizen.FH.NUI.Controls.InputField inputfield = sender as Tizen.FH.NUI.Controls.InputField;
+ Console.WriteLine("-------, name: " + inputfield.Name + ", args.State = " + args.State);
+ inputfield.Text = "Click on the add button";
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ public delegate uint GetNumberOfItems();
+ public delegate View NewItem(uint itemId);
+
+ public class ItemFactoryWrapper : ItemFactory
+ {
+ public GetNumberOfItems GetNumberDelegate { get; set; }
+
+ public NewItem NewItemDelegate { get; set; }
+
+ public ItemFactoryWrapper()
+ {
+ GetNumberDelegate = null;
+ NewItemDelegate = null;
+ }
+ public override uint GetNumberOfItems()
+ {
+ if (GetNumberDelegate != null)
+ {
+ return GetNumberDelegate();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public override View NewItem(uint itemId)
+ {
+ if (NewItemDelegate != null)
+ {
+ return NewItemDelegate(itemId);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using Tizen.NUI.UIComponents;
+
+namespace NuiCommonUiSamples
+{
+ public class ItemView : IExample
+ {
+ private const float MIN_SWIPE_DISTANCE = 15.0f;
+ private const float MIN_SWIPE_SPEED = 5.0f;
+ private const float SCROLL_TO_ITEM_ANIMATION_TIME = 5.0f;
+ private const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT = 1.0f;
+ private const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE = 0.8f;
+ private const float DEPTH_LAYOUT_COLUMNS = 3.0f;
+ private const int BUTTON_BORDER = -10;
+ private const float ITEM_BORDER_SIZE = 2.0f;
+ private const int ITEM_COUNT = 300;
+
+ private string APPLICATION_TITLE = "ItemView";
+ private string SPIRAL_LABEL = "Spiral";
+ private string GRID_LABEL = "Grid";
+ private string DEPTH_LABEL = "Depth";
+
+ private string TOOLBAR_IMAGE = CommonResource.GetDaliResourcePath() + "ItemViewDemo/top-bar.png";
+ private string EDIT_IMAGE = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-edit.png";
+ private string EDIT_IMAGE_SELECTED = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-edit-selected.png";
+ private string DELETE_IMAGE = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-delete.png";
+ private string DELETE_IMAGE_SELECTED = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-delete-selected.png";
+ private string REPLACE_IMAGE = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-replace.png";
+ private string REPLACE_IMAGE_SELECTED = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-replace-selected.png";
+ private string INSERT_IMAGE = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-insert.png";
+ private string INSERT_IMAGE_SELECTED = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-insert-selected.png.png";
+ private string SELECTED_IMAGE = CommonResource.GetDaliResourcePath() + "ItemViewDemo/item-select-check.png";
+
+ private string SPIRAL_LAYOUT_IMAGE = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-item-view-layout-spiral.png";
+ private string SPIRAL_LAYOUT_IMAGE_SELECTED = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-item-view-layout-spiral-selected.png";
+ private string GRID_LAYOUT_IMAGE = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-item-view-layout-grid.png";
+ private string GRID_LAYOUT_IMAGE_SELECTED = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-item-view-layout-grid-selected.png";
+ private string DEPTH_LAYOUT_IMAGE = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-item-view-layout-depth.png";
+ private string DEPTH_LAYOUT_IMAGE_SELECTED = CommonResource.GetDaliResourcePath() + "ItemViewDemo/icon-item-view-layout-depth-selected.png";
+
+
+ private Tizen.NUI.ItemView mItemView;
+ private ItemFactoryWrapper mItemFactoryWrapper;
+ private PropertyMap mGridLayout;
+ private PropertyMap mDepthLayout;
+ private PropertyMap mSpiralLayout;
+ private PropertyArray mLayout;
+ private int mCurrentLayout = (int)AllImagesLayouts.SPIRAL_LAYOUT;
+ private Mode mMode = Mode.MODE_NORMAL;
+
+ private LongPressGestureDetector mLongPressGestureDetector;
+ private TapGestureDetector mTapDetector;
+
+ private PushButton mLayoutButton;
+ private PushButton mEditButton;
+ private PushButton mDeleteButton;
+ private PushButton mInsertButton;
+ private PushButton mReplaceButton;
+ private TextLabel mTitle;
+ private ImageView mToolBarBackground;
+
+ private Layer mToolBarLayer;
+ //private Layer mContentLayer;
+ private View mContentView;
+ //private View mToolBarView;
+
+ private int mDurationSeconds = 250;
+
+ public static Vector3 DepthLayoutItemSizeFunctionPortrait(float layoutWidth)
+ {
+ float width = (layoutWidth / (DEPTH_LAYOUT_COLUMNS + 1.0f)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT;
+
+ // 1x1 aspect ratio
+ return new Vector3(width, width, width);
+ }
+
+ public static Vector3 DepthLayoutItemSizeFunctionLandscape(float layoutWidth)
+ {
+ float width = (layoutWidth / (DEPTH_LAYOUT_COLUMNS + 1.0f)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE;
+
+ // 1x1 aspect ratio
+ return new Vector3(width, width, width);
+ }
+
+ private void SetTitle(string title)
+ {
+ if(mTitle != null)
+ {
+ mTitle.Text = title;
+ }
+ }
+
+ public void CreateGridLayout()
+ {
+ mGridLayout = new PropertyMap();
+ mGridLayout.Insert((int)DefaultItemLayoutProperty.TYPE, new PropertyValue((int)DefaultItemLayoutType.GRID));
+ //mGridLayout.Add((int)DefaultItemLayoutProperty.GRID_COLUMN_NUMBER, new Dali.Property.Value(_columnNumber))
+ // .Add((int)DefaultItemLayoutProperty.GRID_ROW_SPACING, new Dali.Property.Value(_rowSpacing))
+ // .Add((int)DefaultItemLayoutProperty.GRID_COLUMN_SPACING, new Dali.Property.Value(_columnSpacing))
+ // .Add((int)DefaultItemLayoutProperty.GRID_TOP_MARGIN, new Dali.Property.Value(TopMargin))
+ // .Add((int)DefaultItemLayoutProperty.GRID_BOTTOM_MARGIN, new Dali.Property.Value(BottomMargin))
+ // .Add((int)DefaultItemLayoutProperty.GRID_BOTTOM_MARGIN, new Dali.Property.Value(SideMargin));
+ }
+
+ public void CreateDepthLayout()
+ {
+ mDepthLayout = new PropertyMap();
+ mDepthLayout.Insert((int)DefaultItemLayoutProperty.TYPE, new PropertyValue((int)DefaultItemLayoutType.DEPTH));
+ }
+
+ public void CreateSpiralLayout()
+ {
+ mSpiralLayout = new PropertyMap();
+ mSpiralLayout.Insert((int)DefaultItemLayoutProperty.TYPE, new PropertyValue((int)DefaultItemLayoutType.SPIRAL));
+ }
+
+ void SetLayoutImage()
+ {
+ if (mLayoutButton)
+ {
+ switch (mCurrentLayout)
+ {
+ case (int)AllImagesLayouts.SPIRAL_LAYOUT:
+ {
+ mLayoutButton.UnselectedBackgroundVisual = CreateImageVisual(SPIRAL_LAYOUT_IMAGE);
+ mLayoutButton.SelectedBackgroundVisual = CreateImageVisual(SPIRAL_LAYOUT_IMAGE_SELECTED);
+ break;
+ }
+
+ case (int)AllImagesLayouts.GRID_LAYOUT:
+ {
+ mLayoutButton.UnselectedBackgroundVisual = CreateImageVisual(GRID_LAYOUT_IMAGE);
+ mLayoutButton.SelectedBackgroundVisual = CreateImageVisual(GRID_LAYOUT_IMAGE_SELECTED);
+ break;
+ }
+
+ case (int)AllImagesLayouts.DEPTH_LAYOUT:
+ {
+ mLayoutButton.UnselectedBackgroundVisual = CreateImageVisual(DEPTH_LAYOUT_IMAGE);
+ mLayoutButton.SelectedBackgroundVisual = CreateImageVisual(DEPTH_LAYOUT_IMAGE_SELECTED);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+ void ChangeLayout()
+ {
+ Animation animation = new Animation(mDurationSeconds);
+ animation.Finished += AnimationFinished;
+ animation.AnimateTo(mItemView, "Opacity", 0.0f);
+ animation.Play();
+ }
+
+ void AnimationFinished(object sender, EventArgs e)
+ {
+ SetLayout(mCurrentLayout);
+ Animation animation = new Animation(mDurationSeconds);
+ animation.AnimateTo(mItemView, "Opacity", 1.0f);
+ animation.Play();
+ }
+
+ private PropertyMap CreateImageVisual(string url)
+ {
+ PropertyMap temp = new PropertyMap();
+ temp.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
+ temp.Insert(ImageVisualProperty.URL, new PropertyValue(url));
+ return temp;
+ }
+
+ public void Activate()
+ {
+ Window window = Window.Instance;
+ window.GetDefaultLayer().Behavior = Layer.LayerBehavior.Layer3D;
+ window.BackgroundColor = Color.Black;
+ CreateContentView();
+ //CreateToolBarView();
+ CreateToolBarLayer();
+
+ CreateLayoutButton();
+ CreateEditButton();
+ CreateInsertButton();
+ CreateReplaceButton();
+ CreateDeleteButton();
+
+ CreateGridLayout();
+ CreateDepthLayout();
+ CreateSpiralLayout();
+
+ mLayout = new PropertyArray();
+ mLayout.PushBack(new PropertyValue(mSpiralLayout));
+ mLayout.PushBack(new PropertyValue(mDepthLayout));
+ mLayout.PushBack(new PropertyValue(mGridLayout));
+
+
+ mItemFactoryWrapper = new ItemFactoryWrapper();
+ mItemFactoryWrapper.GetNumberDelegate = GetNumberOfItems;
+ mItemFactoryWrapper.NewItemDelegate = NewItemView;
+
+ mItemView = new Tizen.NUI.ItemView(mItemFactoryWrapper);
+ //mItemView.BackgroundColor = Color.Blue;
+ mItemView.ParentOrigin = Position.ParentOriginCenter;
+ mItemView.PivotPoint = Position.PivotPointCenter;
+ mItemView.Position2D = new Position2D(-100, 0);
+ mItemView.PositionUsesPivotPoint = true;
+ window.Add(mItemView);
+
+ window.GetDefaultLayer().Behavior = Layer.LayerBehavior.Layer3D;
+
+ mItemView.Layout = mLayout;
+ mItemView.SetMinimumSwipeDistance(MIN_SWIPE_DISTANCE);
+ mItemView.SetMinimumSwipeSpeed(MIN_SWIPE_SPEED);
+
+ SetLayout((int)mCurrentLayout);
+ SetLayoutTitle();
+ SetLayoutImage();
+
+ mLongPressGestureDetector = new LongPressGestureDetector();
+ mLongPressGestureDetector.Attach(mItemView);
+ mLongPressGestureDetector.Detected += OnLongPressGestureDetected;
+ }
+
+ private void OnLongPressGestureDetected(object source, LongPressGestureDetector.DetectedEventArgs e)
+ {
+ switch (e.LongPressGesture.State)
+ {
+ case Gesture.StateType.Started:
+ {
+ Size2D windowSize = Window.Instance.Size;
+ ItemRange range = new ItemRange(0, 0);
+ mItemView.GetItemsRange(range);
+
+ uint item = (e.LongPressGesture.ScreenPoint.Y < 0.5f * (float)windowSize.Height) ? range.begin : range.end;
+
+ mItemView.ScrollToItem(item, SCROLL_TO_ITEM_ANIMATION_TIME);
+
+ break;
+ }
+ case Gesture.StateType.Finished:
+ {
+ PropertyMap attributes = new PropertyMap();
+ mItemView.DoAction("stopScrolling", attributes);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+
+ void SetLayout(int layoutId)
+ {
+ Window window = Window.Instance;
+ switch (mCurrentLayout)
+ {
+ case (int)AllImagesLayouts.SPIRAL_LAYOUT:
+ case (int)AllImagesLayouts.DEPTH_LAYOUT:
+ {
+ Window.Instance.GetDefaultLayer().Behavior = Layer.LayerBehavior.Layer3D;
+ break;
+ }
+ case (int)AllImagesLayouts.GRID_LAYOUT:
+ {
+ Window.Instance.GetDefaultLayer().Behavior = Layer.LayerBehavior.LayerUI;
+ break;
+ }
+ }
+
+ // Set the new orientation to the layout
+ //Issue
+ //mItemView.GetLayout(layoutId)->SetOrientation(static_cast<ControlOrientation::Type>(mOrientation / 90));
+
+ Size2D windowSize = Window.Instance.Size;
+
+ if (layoutId == (int)AllImagesLayouts.DEPTH_LAYOUT)
+ {
+ mDepthLayout.Insert((int)DefaultItemLayoutProperty.ITEM_SIZE, new PropertyValue(DepthLayoutItemSizeFunctionPortrait(800)));
+ mLayout.Clear();
+ mLayout.PushBack(new PropertyValue(mSpiralLayout));
+ mLayout.PushBack(new PropertyValue(mDepthLayout));
+ mLayout.PushBack(new PropertyValue(mGridLayout));
+ mItemView.Layout = mLayout;
+
+ // Set up the depth layout according to the new orientation
+ // issue
+ //if (Toolkit::IsVertical(mDepthLayout->GetOrientation()))
+ //{
+ // mDepthLayout->SetItemSize(DepthLayoutItemSizeFunctionPortrait(stageSize.width));
+ //}
+ //else
+ //{
+ // mDepthLayout->SetItemSize(DepthLayoutItemSizeFunctionLandscape(stageSize.height));
+ //}
+ }
+
+ // Enable anchoring for depth layout only
+ mItemView.SetAnchoring(layoutId == (int)AllImagesLayouts.DEPTH_LAYOUT);
+
+ // Activate the layout
+ mItemView.ActivateLayout((uint)layoutId, new Vector3(800, 1920, 800), 0.0f);
+ //mItemView.ActivateLayout((uint)layoutId, new Vector3(windowSize.Width, windowSize.Height, windowSize.Width), 0.0f);
+ }
+
+
+
+ public uint GetNumberOfItems()
+ {
+ return ITEM_COUNT;
+ }
+
+ public View NewItemView(uint itemId)
+ {
+ // Create an image view for this item
+ string imagePath = CommonResource.GetDaliResourcePath() + "ItemViewDemo/gallery/gallery-medium-";
+ uint id = itemId % 53;
+ imagePath += id.ToString();
+ imagePath += ".jpg";
+ PropertyMap propertyMap = new PropertyMap();
+ propertyMap.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
+ propertyMap.Insert(ImageVisualProperty.URL, new PropertyValue(imagePath));
+ propertyMap.Insert(ImageVisualProperty.FittingMode, new PropertyValue((int)VisualFittingModeType.FitKeepAspectRatio));
+ ImageView actor = new ImageView();
+ actor.Image = propertyMap;
+ actor.PositionZ = 0.0f;
+ actor.Position = new Position(1000.0f, 0, -1000.0f);
+
+ // Add a border image child actor
+ ImageView borderActor = new ImageView();
+ borderActor.ParentOrigin = ParentOrigin.Center;
+ borderActor.PivotPoint = PivotPoint.Center;
+ borderActor.PositionUsesPivotPoint = true;
+ borderActor.HeightResizePolicy = ResizePolicyType.SizeFixedOffsetFromParent;
+ borderActor.WidthResizePolicy = ResizePolicyType.SizeFixedOffsetFromParent;
+ borderActor.SetSizeModeFactor(new Vector3(2.0f * ITEM_BORDER_SIZE, 2.0f * ITEM_BORDER_SIZE, 0.0f));
+ borderActor.SetColorMode(ColorMode.UseParentColor);
+
+ PropertyMap borderProperty = new PropertyMap();
+ borderProperty.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
+ borderProperty.Insert(BorderVisualProperty.Color, new PropertyValue(Color.White));
+ borderProperty.Insert(BorderVisualProperty.Size, new PropertyValue(ITEM_BORDER_SIZE));
+ borderProperty.Insert(BorderVisualProperty.AntiAliasing, new PropertyValue(true));
+ borderActor.Image = borderProperty;
+
+ actor.Add(borderActor);
+
+ Size spiralItemSize = new Size(30, 30, 0);
+ //static_cast < ItemLayout &> (*mSpiralLayout).GetItemSize(0u, Vector3(Stage::GetCurrent().GetSize()), spiralItemSize);
+ // Add a checkbox child actor; invisible until edit-mode is enabled
+ ImageView checkBox = new ImageView();
+ checkBox.Name = "CheckBox";
+ checkBox.SetColorMode(ColorMode.UseParentColor);
+ checkBox.ParentOrigin = ParentOrigin.TopRight;
+ checkBox.PivotPoint = PivotPoint.TopRight;
+ checkBox.Size = spiralItemSize;
+ checkBox.PositionZ = 0.1f;
+
+ PropertyMap solidColorProperty = new PropertyMap();
+ solidColorProperty.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
+ solidColorProperty.Insert(ColorVisualProperty.MixColor, new PropertyValue(new Color(0.0f, 0.0f, 0.0f, 0.6f)));
+ checkBox.Image = solidColorProperty;
+
+ if (Mode.MODE_REMOVE_MANY != mMode &&
+ Mode.MODE_INSERT_MANY != mMode &&
+ Mode.MODE_REPLACE_MANY != mMode)
+ {
+ checkBox.Hide();
+ }
+ borderActor.Add(checkBox);
+
+ ImageView tick = new ImageView(SELECTED_IMAGE);
+ tick.Name = "Tick";
+ tick.SetColorMode(ColorMode.UseParentColor);
+ tick.ParentOrigin = ParentOrigin.TopRight;
+ tick.PivotPoint = PivotPoint.TopRight;
+ tick.Size = spiralItemSize;
+ tick.Hide();
+ checkBox.Add(tick);
+
+ if(mTapDetector)
+ {
+ mTapDetector.Attach(actor);
+ }
+ return actor;
+ }
+
+ public void Deactivate()
+ {
+ if(mLayoutButton != null)
+ {
+ mLayoutButton.GetParent().Remove(mLayoutButton);
+ mLayoutButton.Dispose();
+ }
+
+ if (mEditButton != null)
+ {
+ mEditButton.GetParent().Remove(mEditButton);
+ mEditButton.Dispose();
+ }
+
+ if (mReplaceButton != null)
+ {
+ mReplaceButton.GetParent().Remove(mReplaceButton);
+ mReplaceButton.Dispose();
+ }
+
+ if (mInsertButton != null)
+ {
+ mInsertButton.GetParent().Remove(mInsertButton);
+ mInsertButton.Dispose();
+ }
+
+ if (mDeleteButton != null)
+ {
+ mDeleteButton.GetParent().Remove(mDeleteButton);
+ mDeleteButton.Dispose();
+ }
+
+ if (mTitle != null)
+ {
+ mTitle.GetParent().Remove(mTitle);
+ mTitle.Dispose();
+ }
+
+ if (mToolBarBackground != null)
+ {
+ mToolBarBackground.GetParent().Remove(mToolBarBackground);
+ mToolBarBackground.Dispose();
+ }
+
+ if(mItemView != null)
+ {
+ mItemView.GetParent().Remove(mItemView);
+ mItemView.Dispose();
+ }
+
+ if (mContentView != null)
+ {
+ Window.Instance.Remove(mContentView);
+ mContentView.Dispose();
+ }
+
+ if(mToolBarLayer != null)
+ {
+ Window.Instance.RemoveLayer(mToolBarLayer);
+ mToolBarLayer.Dispose();
+ }
+
+ Window.Instance.GetDefaultLayer().Behavior = Layer.LayerBehavior.Layer2D;
+ }
+
+ public void CreateContentView()
+ {
+ mContentView = new View();
+ mContentView.ParentOrigin = ParentOrigin.Center;
+ mContentView.PivotPoint = PivotPoint.Center;
+ mContentView.PositionUsesPivotPoint = true;
+ mContentView.WidthResizePolicy = ResizePolicyType.FillToParent;
+ mContentView.HeightResizePolicy = ResizePolicyType.FillToParent;
+ Window.Instance.Add(mContentView);
+
+ mContentView.LowerToBottom();
+ }
+
+
+ //public void CreateToolBarView()
+ //{
+ // mToolBarView = new View();
+ // mToolBarView.Name = "TOOLBAR";
+ // mToolBarView.BackgroundImage = TOOLBAR_IMAGE;
+ // mToolBarView.ParentOrigin = ParentOrigin.TopCenter;
+ // mToolBarView.PivotPoint = PivotPoint.TopCenter;
+ // mToolBarView.PositionUsesPivotPoint = true;
+ // mToolBarView.WidthResizePolicy = ResizePolicyType.FillToParent;
+ // mToolBarView.Size2D = new Size2D(0, 80);
+ // Window.Instance.Add(mToolBarView);
+
+ // mToolBarView.RaiseToTop();
+
+ // mTitle = new TextLabel();
+ // mTitle.ParentOrigin = ParentOrigin.TopLeft;
+ // mTitle.PivotPoint = PivotPoint.TopLeft;
+ // mTitle.PositionUsesPivotPoint = true;
+ // mTitle.PointSize = 10.0f;
+ // mTitle.WidthResizePolicy = ResizePolicyType.FillToParent;
+ // mTitle.HeightResizePolicy = ResizePolicyType.FillToParent;
+ // mTitle.Text = APPLICATION_TITLE;
+ // mTitle.VerticalAlignment = VerticalAlignment.Center;
+ // mTitle.HorizontalAlignment = HorizontalAlignment.Center;
+ // mToolBarView.Add(mTitle);
+ //}
+
+ private void CreateToolBarLayer()
+ {
+ mToolBarLayer = new Layer();
+ mToolBarLayer.Name = "TOOLBAR";
+ //mToolBarLayer.BackgroundImage = TOOLBAR_IMAGE;
+ //mToolBarLayer.PositionUsesPivotPoint = true;
+ mToolBarLayer.SetAnchorPoint(PivotPoint.TopCenter);
+ mToolBarLayer.SetParentOrigin(ParentOrigin.TopCenter);
+ mToolBarLayer.SetResizePolicy(ResizePolicyType.FillToParent, DimensionType.Width);
+ mToolBarLayer.SetSize(0, 80);
+ Window.Instance.AddLayer(mToolBarLayer);
+
+ mToolBarLayer.RaiseToTop();
+
+ mToolBarBackground = new ImageView();
+ mToolBarBackground.ParentOrigin = ParentOrigin.TopLeft;
+ mToolBarBackground.PivotPoint = PivotPoint.TopLeft;
+ mToolBarBackground.PositionUsesPivotPoint = true;
+ mToolBarBackground.WidthResizePolicy = ResizePolicyType.FillToParent;
+ mToolBarBackground.HeightResizePolicy = ResizePolicyType.FillToParent;
+ mToolBarBackground.ResourceUrl = TOOLBAR_IMAGE;
+ mToolBarLayer.Add(mToolBarBackground);
+
+ mTitle = new TextLabel();
+ mTitle.ParentOrigin = ParentOrigin.TopLeft;
+ mTitle.PivotPoint = PivotPoint.TopLeft;
+ mTitle.PositionUsesPivotPoint = true;
+ mTitle.PointSize = 10.0f;
+ mTitle.WidthResizePolicy = ResizePolicyType.FillToParent;
+ mTitle.HeightResizePolicy = ResizePolicyType.FillToParent;
+ mTitle.Text = APPLICATION_TITLE;
+ mTitle.VerticalAlignment = VerticalAlignment.Center;
+ mTitle.HorizontalAlignment = HorizontalAlignment.Center;
+ mToolBarLayer.Add(mTitle);
+ }
+
+ private void CreateLayoutButton()
+ {
+ mLayoutButton = new PushButton();
+ mLayoutButton.UnselectedBackgroundVisual = CreateImageVisual(SPIRAL_LAYOUT_IMAGE);
+ mLayoutButton.SelectedBackgroundVisual = CreateImageVisual(SPIRAL_LAYOUT_IMAGE_SELECTED);
+ mLayoutButton.Size2D = new Size2D(34, 34);
+ mLayoutButton.ParentOrigin = ParentOrigin.TopRight;
+ mLayoutButton.PivotPoint = PivotPoint.TopRight;
+ mLayoutButton.Position2D = new Position2D(0, 25);
+ mLayoutButton.PositionUsesPivotPoint = true;
+ mLayoutButton.LeaveRequired = true;
+ mLayoutButton.Clicked += (obj, e) =>
+ {
+ mCurrentLayout = (mCurrentLayout + 1) % (int)mItemView.GetLayoutCount();
+ ChangeLayout();
+
+ SetLayoutTitle();
+ SetLayoutImage();
+ return true;
+ };
+ //mToolBarView.Add(mLayoutButton);
+ mToolBarLayer.Add(mLayoutButton);
+ }
+
+ public void CreateEditButton()
+ {
+ mEditButton = new PushButton();
+ mEditButton.UnselectedBackgroundVisual = CreateImageVisual(EDIT_IMAGE);
+ mEditButton.SelectedBackgroundVisual = CreateImageVisual(EDIT_IMAGE_SELECTED);
+ mEditButton.Size2D = new Size2D(34, 34);
+ mEditButton.ParentOrigin = ParentOrigin.TopLeft;
+ mEditButton.PivotPoint = PivotPoint.TopLeft;
+ mEditButton.Position2D = new Position2D(5, 25);
+ mEditButton.PositionUsesPivotPoint = true;
+ mEditButton.LeaveRequired = true;
+ mEditButton.Clicked += (obj, e) =>
+ {
+ SwitchToNextMode();
+ return true;
+ };
+ //mToolBarView.Add(mEditButton);
+ mToolBarLayer.Add(mEditButton);
+ }
+
+ private void SetLayoutTitle()
+ {
+ if (Mode.MODE_NORMAL == mMode)
+ {
+ string title = APPLICATION_TITLE;
+ switch (mCurrentLayout)
+ {
+ case (int)AllImagesLayouts.SPIRAL_LAYOUT:
+ title = title + ": " + SPIRAL_LABEL;
+ break;
+ case (int)AllImagesLayouts.GRID_LAYOUT:
+ title = title + ": " + GRID_LABEL;
+ break;
+ case (int)AllImagesLayouts.DEPTH_LAYOUT:
+ title = title + ": " + DEPTH_LABEL;
+ break;
+ default:
+ break;
+ }
+ SetTitle(title);
+ }
+ }
+
+ private void CreateDeleteButton()
+ {
+ mDeleteButton = new PushButton();
+ //mDeleteButton.BackgroundColor = Color.Red;
+ mDeleteButton.ParentOrigin = ParentOrigin.BottomRight;
+ mDeleteButton.PivotPoint = PivotPoint.BottomRight;
+ mDeleteButton.PositionUsesPivotPoint = true;
+ mDeleteButton.Position2D = new Position2D(BUTTON_BORDER, BUTTON_BORDER);
+ mDeleteButton.DrawMode = DrawModeType.Overlay2D;
+ mDeleteButton.UnselectedBackgroundVisual = CreateImageVisual(DELETE_IMAGE);
+ mDeleteButton.SelectedBackgroundVisual = CreateImageVisual(DELETE_IMAGE_SELECTED);
+ mDeleteButton.Size2D = new Size2D(50, 50);
+ mDeleteButton.LeaveRequired = true;
+ mDeleteButton.Hide();
+ mDeleteButton.Clicked += (obj, e) =>
+ {
+ ItemIdContainer removeList = new ItemIdContainer();
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ View child = mItemView.GetChildAt(i);
+ if(child != null)
+ {
+ View tick = child.FindChildByName("Tick");
+
+ if (tick != null && tick.Visibility)
+ {
+ removeList.Add(mItemView.GetItemId(child));
+ }
+ }
+ }
+
+ if (removeList.Count != 0)
+ {
+ mItemView.RemoveItems(removeList, 0.5f);
+ }
+ return true;
+ };
+ Window.Instance.Add(mDeleteButton);
+ }
+
+ private void CreateInsertButton()
+ {
+ mInsertButton = new PushButton();
+ //mInsertButton.BackgroundColor = Color.Red;
+ mInsertButton.ParentOrigin = ParentOrigin.BottomRight;
+ mInsertButton.PivotPoint = PivotPoint.BottomRight;
+ mInsertButton.PositionUsesPivotPoint = true;
+ mInsertButton.Position2D = new Position2D(BUTTON_BORDER, BUTTON_BORDER);
+ mInsertButton.DrawMode = DrawModeType.Overlay2D;
+ mInsertButton.UnselectedBackgroundVisual = CreateImageVisual(INSERT_IMAGE);
+ mInsertButton.SelectedBackgroundVisual = CreateImageVisual(INSERT_IMAGE_SELECTED);
+ mInsertButton.Size2D = new Size2D(50, 50);
+ mInsertButton.LeaveRequired = true;
+ mInsertButton.Hide();
+ mInsertButton.Clicked += (obj, e) =>
+ {
+ ItemContainer insertList = new ItemContainer();
+ Random random = new Random();
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ View child = mItemView.GetChildAt(i);
+ if(child != null)
+ {
+ View tick = child.FindChildByName("Tick");
+
+ if (tick != null && tick.Visibility)
+ {
+ insertList.Add(new Item(mItemView.GetItemId(child), NewItemView((uint)random.Next(52))));
+ }
+ }
+ }
+ if (insertList.Count != 0)
+ {
+ mItemView.InsertItems(insertList, 0.5f);
+ }
+ return true;
+ };
+ Window.Instance.Add(mInsertButton);
+ }
+
+ private void CreateReplaceButton()
+ {
+ mReplaceButton = new PushButton();
+ //mReplaceButton.BackgroundColor = Color.Red;
+ mReplaceButton.ParentOrigin = ParentOrigin.BottomRight;
+ mReplaceButton.PivotPoint = PivotPoint.BottomRight;
+ mReplaceButton.PositionUsesPivotPoint = true;
+ mReplaceButton.Position2D = new Position2D(BUTTON_BORDER, BUTTON_BORDER);
+ mReplaceButton.DrawMode = DrawModeType.Overlay2D;
+ mReplaceButton.UnselectedBackgroundVisual = CreateImageVisual(REPLACE_IMAGE);
+ mReplaceButton.SelectedBackgroundVisual = CreateImageVisual(REPLACE_IMAGE_SELECTED);
+ mReplaceButton.Size2D = new Size2D(50, 50);
+ mReplaceButton.LeaveRequired = true;
+ mReplaceButton.Hide();
+ mReplaceButton.Clicked += (obj, e) =>
+ {
+ ItemContainer replaceList = new ItemContainer();
+ Random random = new Random();
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ View child = mItemView.GetChildAt(i);
+ if(child != null)
+ {
+ View tick = child.FindChildByName("Tick");
+
+ if (tick != null && tick.Visibility)
+ {
+ replaceList.Add(new Item(mItemView.GetItemId(child), NewItemView((uint)random.Next(52))));
+ }
+ }
+ }
+
+ if (replaceList.Count != 0)
+ {
+ mItemView.ReplaceItems(replaceList, 0.5f);
+ }
+ return true;
+ };
+ Window.Instance.Add(mReplaceButton);
+ }
+
+ void SwitchToNextMode()
+ {
+ switch (mMode)
+ {
+ case Mode.MODE_REMOVE:
+ {
+ ExitRemoveMode();
+ mMode = Mode.MODE_REMOVE_MANY;
+ EnterRemoveManyMode();
+ break;
+ }
+
+ case Mode.MODE_REMOVE_MANY:
+ {
+ ExitRemoveManyMode();
+ mMode = Mode.MODE_INSERT;
+ EnterInsertMode();
+ break;
+ }
+
+ case Mode.MODE_INSERT:
+ {
+ ExitInsertMode();
+ mMode = Mode.MODE_INSERT_MANY;
+ EnterInsertManyMode();
+ break;
+ }
+
+ case Mode.MODE_INSERT_MANY:
+ {
+ ExitInsertManyMode();
+ mMode = Mode.MODE_REPLACE;
+ EnterReplaceMode();
+ break;
+ }
+
+ case Mode.MODE_REPLACE:
+ {
+ ExitReplaceMode();
+ mMode = Mode.MODE_REPLACE_MANY;
+ EnterReplaceManyMode();
+ break;
+ }
+
+ case Mode.MODE_REPLACE_MANY:
+ {
+ ExitReplaceManyMode();
+ mMode = Mode.MODE_NORMAL;
+ SetLayoutTitle();
+ break;
+ }
+
+ case Mode.MODE_NORMAL:
+ default:
+ {
+ mMode = Mode.MODE_REMOVE;
+ EnterRemoveMode();
+ break;
+ }
+ }
+ }
+
+ void EnterRemoveMode()
+ {
+ SetTitle("Edit: Remove");
+ mTapDetector = new TapGestureDetector();
+
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ if(mItemView.GetChildAt(i) != null)
+ {
+ mTapDetector.Attach(mItemView.GetChildAt(i));
+ }
+ }
+
+ mTapDetector.Detected += (obj, e) =>
+ {
+ View item = e.View;
+ if(item != null)
+ {
+ mItemView.RemoveItem(mItemView.GetItemId(item), 0.5f);
+ }
+ };
+ }
+
+ void ExitRemoveMode()
+ {
+ mTapDetector.DetachAll();
+ mTapDetector.Reset();
+ }
+
+ void EnterRemoveManyMode()
+ {
+ SetTitle("Edit: Remove Many");
+ mDeleteButton.Show();
+
+ mTapDetector = new TapGestureDetector();
+
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ View child = mItemView.GetChildAt(i);
+ if(child != null)
+ {
+ View box = child.FindChildByName("CheckBox");
+ if (box)
+ {
+ mTapDetector.Attach(child);
+ box.Show();
+ }
+ }
+ }
+
+ mTapDetector.Detected += (obj, e) =>
+ {
+ View view = e.View;
+ if(view != null)
+ {
+ Console.WriteLine("haha");
+ View tick = view.FindChildByName("Tick");
+ if (tick != null)
+ {
+ if (tick.Visibility)
+ {
+ tick.Hide();
+ }
+ else
+ {
+ tick.Show();
+ }
+ }
+ }
+ else
+ {
+ Tizen.Log.Fatal("NUI", "e.View is null when EnterRemoveManyMode!");
+ }
+
+ };
+ }
+
+ void ExitRemoveManyMode()
+ {
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ View child = mItemView.GetChildAt(i);
+ if(child != null)
+ {
+ View box = child.FindChildByName("CheckBox");
+
+ if (box)
+ {
+ box.Hide();
+
+ View tick = box.FindChildByName("Tick");
+ if (tick)
+ {
+ tick.Hide();
+ }
+ }
+ }
+ }
+ mTapDetector.Reset();
+ mDeleteButton.Hide();
+ }
+
+ void EnterInsertMode()
+ {
+ SetTitle("Edit: Insert");
+ mTapDetector = new TapGestureDetector();
+
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ if(mItemView.GetChildAt(i) != null)
+ {
+ mTapDetector.Attach(mItemView.GetChildAt(i));
+ }
+
+ }
+ mTapDetector.Detected += (obj, e) =>
+ {
+ if(e.View != null)
+ {
+ uint id = mItemView.GetItemId(e.View);
+ Random random = new Random();
+
+ View newActor = NewItemView((uint)random.Next(52));
+
+ mItemView.InsertItem(new Item(id, newActor), 0.5f);
+ }
+ else
+ {
+ Tizen.Log.Fatal("NUI", "e.View is null when EnterInsertMode!");
+ }
+ };
+ }
+
+ void ExitInsertMode()
+ {
+ mTapDetector.DetachAll();
+ mTapDetector.Reset();
+ }
+ void EnterInsertManyMode()
+ {
+ SetTitle("Edit: Insert Many");
+ mInsertButton.Show();
+
+ mTapDetector = new TapGestureDetector();
+
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ View child = mItemView.GetChildAt(i);
+ if(child != null)
+ {
+ View box = child.FindChildByName("CheckBox");
+
+ if (box)
+ {
+ mTapDetector.Attach(child);
+ box.Show();
+ }
+ }
+ }
+ mTapDetector.Detected += (obj, e) =>
+ {
+ if(e.View != null)
+ {
+ View tick = (e.View).FindChildByName("Tick");
+ if (tick)
+ {
+ if (tick.Visibility)
+ {
+ tick.Hide();
+ }
+ else
+ {
+ tick.Show();
+ }
+ }
+
+ }
+ else
+ {
+ Tizen.Log.Fatal("NUI", "e.View is null when EnterInsertManyMode!");
+ }
+ };
+ }
+
+ void ExitInsertManyMode()
+ {
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ View child = mItemView.GetChildAt(i);
+ if(child != null)
+ {
+ View box = child.FindChildByName("CheckBox");
+
+ if (box)
+ {
+ box.Hide();
+
+ View tick = box.FindChildByName("Tick");
+ if (tick)
+ {
+ tick.Hide();
+ }
+ }
+ }
+ }
+ mTapDetector.Reset();
+ mInsertButton.Hide();
+ }
+
+ void EnterReplaceMode()
+ {
+ SetTitle("Edit: Replace");
+ mTapDetector = new TapGestureDetector();
+
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ if(mItemView.GetChildAt(i) != null)
+ {
+ mTapDetector.Attach(mItemView.GetChildAt(i));
+ }
+ }
+
+ mTapDetector.Detected += (obj, e) =>
+ {
+ Random random = new Random();
+ if(e.View != null)
+ {
+ mItemView.ReplaceItem(new Item(mItemView.GetItemId(e.View), NewItemView((uint)random.Next(52))), 0.5f);
+ }
+ else
+ {
+ Tizen.Log.Fatal("NUI", "e.View is null when EnterReplaceMode!");
+ }
+ };
+ }
+
+ void ExitReplaceMode()
+ {
+ mTapDetector.DetachAll();
+ mTapDetector.Reset();
+ }
+
+
+ void EnterReplaceManyMode()
+ {
+ SetTitle("Edit: Replace Many");
+ mReplaceButton.Show();
+
+ mTapDetector = new TapGestureDetector();
+
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ View child = mItemView.GetChildAt(i);
+ View box = child.FindChildByName("CheckBox");
+
+ if (box)
+ {
+ mTapDetector.Attach(child);
+ box.Show();
+ }
+ }
+
+ mTapDetector.Detected += (obj, e) =>
+ {
+ if(e.View != null)
+ {
+ View tick = (e.View).FindChildByName("Tick");
+ if (tick != null)
+ {
+ if (tick.Visibility)
+ {
+ tick.Hide();
+ }
+ else
+ {
+ tick.Show();
+ }
+ }
+ }
+ else
+ {
+ Tizen.Log.Fatal("NUI", "e.View is null when EnterReplaceManyMode!");
+ }
+
+ };
+ }
+ void ExitReplaceManyMode()
+ {
+ for (uint i = 0; i < mItemView.GetChildCount(); ++i)
+ //for (uint i = 0; i < ITEM_COUNT; ++i)
+ {
+ View child = mItemView.GetChildAt(i);
+ View box = child.FindChildByName("CheckBox");
+
+ if (box)
+ {
+ box.Hide();
+
+ View tick = box.FindChildByName("Tick");
+ if (tick)
+ {
+ tick.Hide();
+ }
+ }
+ }
+ mTapDetector.Reset();
+ mReplaceButton.Hide();
+ }
+
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NuiCommonUiSamples
+{
+ public enum AllImagesLayouts
+ {
+ SPIRAL_LAYOUT = 0,
+ DEPTH_LAYOUT,
+ GRID_LAYOUT,
+
+ NUMBER_OF_LAYOUTS
+ };
+
+ public enum Mode
+ {
+ MODE_NORMAL,
+ MODE_REMOVE,
+ MODE_REMOVE_MANY,
+ MODE_INSERT,
+ MODE_INSERT_MANY,
+ MODE_REPLACE,
+ MODE_REPLACE_MANY,
+ MODE_LAST
+ };
+}
--- /dev/null
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using System;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ using Controls = Tizen.FH.NUI.Controls;
+ public class ListItem : IExample
+ {
+ private SampleLayout root;
+ private const int COUNT = 12;
+ private View rootView = null;
+ private Tizen.FH.NUI.Controls.ListItem[] listItemArray = null;
+ private int itemPosY, itemPosX;
+ private int itemPosYOffset;
+ private uint index;
+ private Tizen.NUI.CommonUI.Button button;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ CreateRootView();
+
+ itemPosX = 100;
+ itemPosY = -80;
+ itemPosYOffset = 20;
+ listItemArray = new Tizen.FH.NUI.Controls.ListItem[COUNT];
+
+ index = 0;
+ CreateListItem(index, "DefaultListItem", 90, 0, "default");
+
+ index++;
+ CreateListItem(index, "MultiSubTextListItem", 150, 1, "sub text 1line");
+
+ index++;
+ CreateListItem(index, "MultiSubTextListItem", 220, 2, "sub text 2line");
+ listItemArray[index].StateDividerEnabled = false;
+
+ index++;
+ // checkBox + text
+ CreateListItem(index, "ItemAlignListItem", 90, 0, "item align");
+ listItemArray[index].LeftItemRootViewSize = new Size2D(48, 48);
+ listItemArray[index].ItemAlignType = Tizen.FH.NUI.Controls.ListItem.ItemAlignTypes.CheckIcon;
+ listItemArray[index].RightItemRootViewSize = new Size2D(200, 90);
+ listItemArray[index].RightText = "Sub text";
+
+ index++;
+ // icon
+ CreateListItem(index, "ItemAlignListItem", 90, 0, "item align, icon");
+ listItemArray[index].LeftItemRootViewSize = new Size2D(48, 48);
+ listItemArray[index].ItemAlignType = Tizen.FH.NUI.Controls.ListItem.ItemAlignTypes.Icon;
+ listItemArray[index].LeftIconURL = CommonResource.GetResourcePath() + "0. Softkey/softkey_ic_home.png";
+
+ index++;
+ CreateListItem(index, "EffectListItem", 90, 0, "effect");
+
+ index++;
+ //itemPosX = 100 + 800 + 100;
+ //itemPosY = 50;
+ CreateListItem(index, "NextDepthListItem", 90, 0, "next depth");
+
+ index++;
+ CreateListItem(index, "GroupIndexListItem", 90, 0, "group index, default");
+ listItemArray[index].GroupIndexType = Tizen.FH.NUI.Controls.ListItem.GroupIndexTypes.None;
+
+ index++;
+ CreateListItem(index, "GroupIndexListItem", 90, 0, "group index, next button");
+ listItemArray[index].GroupIndexType = Tizen.FH.NUI.Controls.ListItem.GroupIndexTypes.Next;
+ listItemArray[index].RightItemRootViewSize = new Size2D(48, 48);
+
+ index++;
+ CreateListItem(index, "GroupIndexListItem", 90, 0, "group index, switch");
+ listItemArray[index].GroupIndexType = Tizen.FH.NUI.Controls.ListItem.GroupIndexTypes.Switch;
+ listItemArray[index].RightItemRootViewSize = new Size2D(72, 48);
+
+ index++;
+ CreateListItem(index, "GroupIndexListItem", 90, 0, "group index, drop down");
+ listItemArray[index].GroupIndexType = Tizen.FH.NUI.Controls.ListItem.GroupIndexTypes.DropDown;
+ listItemArray[index].RightItemRootViewSize = new Size2D(48, 48);
+
+ button = new Tizen.NUI.CommonUI.Button();
+ button.PointSize = 14;
+ button.Size2D = new Size2D(300, 80);
+ button.BackgroundColor = Color.Green;
+ button.Position2D = new Position2D(itemPosX + 10, itemPosY);
+ button.Text = "LTR/RTL";
+ button.ClickEvent += OnLayoutChanged;
+ rootView.Add(button);
+ Window.Instance.KeyEvent += OnWindowsKeyEvent;
+ }
+ private void OnLayoutChanged(object sender, global::System.EventArgs e)
+ {
+ for (int i = 0; i < COUNT; ++i)
+ {
+ if (listItemArray[i])
+ {
+ if (listItemArray[i].LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ listItemArray[i].LayoutDirection = ViewLayoutDirectionType.RTL;
+ }
+ else
+ {
+ listItemArray[i].LayoutDirection = ViewLayoutDirectionType.LTR;
+
+ }
+ }
+ }
+ }
+
+ private void CreateRootView()
+ {
+ root = new SampleLayout(false);
+ root.HeaderText = "List Item";
+ rootView = new View();
+ rootView.WidthResizePolicy = ResizePolicyType.FillToParent;
+ rootView.HeightResizePolicy = ResizePolicyType.FillToParent;
+ rootView.BackgroundColor = Color.White;// new Color(78.0f / 255.0f, 216.0f / 255.0f, 231.0f / 255.0f, 1.0f);
+ rootView.Focusable = true;
+ root.Add(rootView);
+ }
+
+ private void CreateListItem(uint idx, string str, int height, uint subTextCount, string mainTextStr)
+ {
+ listItemArray[idx] = new Controls.ListItem(str);
+ rootView.Add(listItemArray[idx]);
+ listItemArray[idx].MainText = mainTextStr;
+ listItemArray[idx].Size2D = new Size2D(800, height);
+ listItemArray[idx].Position2D = new Position2D(itemPosX, itemPosY);
+ itemPosY += height;
+ itemPosY += itemPosYOffset;
+ Random randomGenerator = new Random();
+ float r = (float)randomGenerator.NextDouble();
+ float g = (float)randomGenerator.NextDouble();
+ float b = (float)randomGenerator.NextDouble();
+ listItemArray[idx].BackgroundColor = new Color(r, g, b, 0.2f);
+ listItemArray[idx].SubTextCount = subTextCount;
+ string[] strArray = new string[subTextCount];
+ for (int i = 0; i < subTextCount; ++i)
+ {
+ strArray[i] = "sub text" + (i + 1).ToString();
+ }
+ listItemArray[idx].SubTextContentArray = strArray;
+ }
+
+ private void OnWindowsKeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ if (e.Key.KeyPressedName == "Right")
+ {
+ listItemArray[5].StateSelectedEnabled = !listItemArray[5].StateSelectedEnabled;
+ }
+ else if (e.Key.KeyPressedName == "Left")
+ {
+ listItemArray[5].StateEnabled = !listItemArray[5].StateEnabled;
+ }
+ }
+ }
+
+ public void Deactivate()
+ {
+ Window.Instance.KeyEvent -= OnWindowsKeyEvent;
+ if (listItemArray != null)
+ {
+ for (int i = 0; i < COUNT; ++i)
+ {
+ if (listItemArray[i] != null)
+ {
+ rootView.Remove(listItemArray[i]);
+ listItemArray[i].Dispose();
+ listItemArray[i] = null;
+ }
+ }
+ listItemArray = null;
+ }
+ if (button != null)
+ {
+ rootView.Remove(button);
+ button.Dispose();
+ button = null;
+ }
+ if (rootView != null)
+ {
+ root.Remove(rootView);
+ rootView.Dispose();
+ rootView = null;
+ }
+
+ root.Dispose();
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+ public class Loading : IExample
+ {
+ private TextLabel board1, board2, board;
+ private Tizen.NUI.CommonUI.Button button1, button2;
+ private Tizen.NUI.CommonUI.Loading loading1_1, loading2_1; //1-style para 2-attributes;
+ private SampleLayout root;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ Window window = Window.Instance;
+
+ root = new SampleLayout(false);
+ root.HeaderText = "Loading";
+
+ CreateBoardAndButtons();
+ string[] imageArray = new string[36];
+ for (int i = 0; i < 36; i++)
+ {
+ if (i < 10)
+ {
+ imageArray[i] = CommonResource.GetResourcePath() + "9. Controller/Loading Sequence_Native/loading_0" + i + ".png";
+ }
+ else
+ {
+ imageArray[i] = CommonResource.GetResourcePath() + "9. Controller/Loading Sequence_Native/loading_" + i + ".png";
+ }
+ }
+
+ loading1_1 = new Tizen.NUI.CommonUI.Loading("DefaultLoading");
+ loading1_1.Position2D = new Position2D(100, 350);
+ loading1_1.Size2D = new Size2D(100, 100);
+
+ root.Add(loading1_1);
+
+ LoadingAttributes attr = new LoadingAttributes
+ {
+ ImageArray = imageArray,
+ };
+
+ loading2_1 = new Tizen.NUI.CommonUI.Loading(attr);
+ loading2_1.Position2D = new Position2D(500, 350);
+ loading2_1.Size2D = new Size2D(100, 100);
+ root.Add(loading2_1);
+
+ board.UpFocusableView = button1;
+
+ window.Add(root);
+
+ FocusManager.Instance.SetCurrentFocusView(button1);
+ }
+
+ void CreateBoardAndButtons()
+ {
+ board = new TextLabel();
+ board.Size2D = new Size2D(1000, 100);
+ board.Position2D = new Position2D(80, 600);
+ board.PointSize = 30;
+ board.HorizontalAlignment = HorizontalAlignment.Center;
+ board.VerticalAlignment = VerticalAlignment.Center;
+ board.BackgroundColor = Color.Magenta;
+ board.Text = "log pad";
+ root.Add(board);
+ board.Focusable = true;
+ board.FocusGained += Board_FocusGained;
+ board.FocusLost += Board_FocusLost;
+
+ board1 = new TextLabel();
+ board1.Size2D = new Size2D(300, 70);
+ board1.Position2D = new Position2D(50, 100);
+ board1.PointSize = 20;
+ board1.HorizontalAlignment = HorizontalAlignment.Center;
+ board1.VerticalAlignment = VerticalAlignment.Center;
+ board1.BackgroundColor = Color.Magenta;
+ board1.Text = "style construction";
+ root.Add(board1);
+ board1.Focusable = true;
+ board1.FocusGained += Board_FocusGained;
+ board1.FocusLost += Board_FocusLost;
+
+ board2 = new TextLabel();
+ board2.Size2D = new Size2D(300, 70);
+ board2.Position2D = new Position2D(400, 100);
+ board2.PointSize = 20;
+ board2.HorizontalAlignment = HorizontalAlignment.Center;
+ board2.VerticalAlignment = VerticalAlignment.Center;
+ board2.BackgroundColor = Color.Magenta;
+ board2.Text = "Attribute construction";
+ root.Add(board2);
+ board2.Focusable = true;
+ board2.FocusGained += Board_FocusGained;
+ board2.FocusLost += Board_FocusLost;
+
+ button1 = new Tizen.NUI.CommonUI.Button();
+ button1.PointSize = 14;
+ button1.BackgroundColor = Color.Green;
+ button1.Position2D = new Position2D(80, 500);
+ button1.Size2D = new Size2D(100, 80);
+ button1.Text = "FPS++";
+ root.Add(button1);
+ button1.Focusable = true;
+ button1.ClickEvent += loading1FPSAdd;
+
+ button2 = new Tizen.NUI.CommonUI.Button();
+ button2.PointSize = 14;
+ button2.BackgroundColor = Color.Green;
+ button2.Position2D = new Position2D(200, 500);
+ button2.Size2D = new Size2D(100, 80);
+ button2.Text = "FPS--";
+ root.Add(button2);
+ button2.Focusable = true;
+ button2.ClickEvent += loading1FPSMinus;
+ }
+
+ private void Board_FocusLost(object sender, global::System.EventArgs e)
+ {
+ board.BackgroundColor = Color.Magenta;
+ }
+
+ private void Board_FocusGained(object sender, global::System.EventArgs e)
+ {
+ board.BackgroundColor = Color.Cyan;
+ }
+
+ private void loading1FPSAdd(object sender, global::System.EventArgs e)
+ {
+ board.Text = "loading1_1 FPS: " + loading1_1.FPS.ToString();
+ loading1_1.FPS += 1;
+ }
+ private void loading1FPSMinus(object sender, global::System.EventArgs e)
+ {
+ board.Text = "loading1_1 FPS: " + loading1_1.FPS.ToString();
+ loading1_1.FPS -= 1;
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ Window.Instance.Remove(root);
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace NuiCommonUiSamples
+{
+ using Controls = Tizen.FH.NUI.Controls;
+ public class NaviFrame : IExample
+ {
+ private SampleLayout root;
+ private Tizen.NUI.CommonUI.Button NextButton;
+ private Tizen.NUI.CommonUI.Button BackButton;
+ private Controls.NaviFrame navi;
+ private Controls.Header h;
+ private TextLabel c;
+ private int i;
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ i = 1;
+ root = new SampleLayout(false);
+ root.HeaderText = "NaviFrame";
+
+ navi = new Controls.NaviFrame("DefaultNaviFrame");
+ root.Add(navi);
+
+ BackButton = new Tizen.NUI.CommonUI.Button()
+ {
+ Size2D = new Size2D(90, 60),
+ BackgroundColor = Color.Cyan,
+ Text = "Push",
+ PointSize = 14,
+ };
+ BackButton.PositionUsesPivotPoint = true;
+ BackButton.ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft;
+ BackButton.PivotPoint = Tizen.NUI.PivotPoint.CenterLeft;
+ BackButton.ClickEvent += ClickPush;
+
+ root.Add(BackButton);
+ BackButton.RaiseToTop();
+ NextButton = new Tizen.NUI.CommonUI.Button()
+ {
+ Text = "Pop",
+ Size2D = new Size2D(90, 60),
+ BackgroundColor = Color.Cyan,
+ PointSize = 14,
+ };
+ NextButton.PositionUsesPivotPoint = true;
+ NextButton.ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight;
+ NextButton.PivotPoint = Tizen.NUI.PivotPoint.CenterRight;
+ NextButton.ClickEvent += ClickPop;
+
+ root.Add(NextButton);
+ NextButton.RaiseToTop();
+
+ ClickPush(null, null);
+ }
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+
+ if (navi != null)
+ {
+ root.Remove(navi);
+ navi.Dispose();
+ }
+ if (BackButton != null)
+ {
+ root.Remove(BackButton);
+ BackButton.Dispose();
+ }
+ if (NextButton != null)
+ {
+ root.Remove(NextButton);
+ NextButton.Dispose();
+ }
+
+ root.Dispose();
+ }
+ }
+ private Tizen.FH.NUI.Controls.Header MakeHeader(string txt)
+ {
+ Controls.Header head = new Controls.Header("DefaultHeader");
+ head.BackgroundColor = new Color(255, 255, 255, 0.7f);
+ head.HeaderText = "Title " + txt;
+ return head;
+ }
+ private TextLabel MakeLabel(string txt)
+ {
+ TextLabel content = new TextLabel()
+ {
+ Text = txt,
+ PointSize = 90,
+ BackgroundColor = new Color(255, 255, 255, 0.7f),
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ };
+
+ return content;
+ }
+
+ private void ClickPush(object sender, Tizen.NUI.CommonUI.Button.ClickEventArgs e)
+ {
+ string head = "header" + i;
+ string lable = "lable" + i;
+ h = MakeHeader(head);
+ c = MakeLabel(lable);
+ i++;
+ if (navi != null)
+ {
+ navi.NaviFrameItemPush(h, c);
+ }
+
+ }
+ private void ClickPop(object sender, Tizen.NUI.CommonUI.Button.ClickEventArgs e)
+ {
+ if (navi != null)
+ {
+ navi.NaviFrameItemPop();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using System;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ using Controls = Tizen.FH.NUI.Controls;
+ public class NavigationAttributes : IExample
+ {
+ private View root;
+
+ private TextLabel[] createText = new TextLabel[2];
+
+ private Controls.Navigation whiteNavigation = null;
+ private Controls.Navigation blackNavigation = null;
+ private Controls.Navigation conditionNavigation = null;
+ private Controls.Navigation blackConditionNavigation = null;
+ private Controls.Navigation whiteEditNavigation = null;
+ private Controls.Navigation blackEditNavigation = null;
+
+ private Controls.Navigation whiteNavigation2 = null;
+ private Controls.Navigation blackNavigation2 = null;
+ private Controls.Navigation conditionNavigation2 = null;
+ private Controls.Navigation blackConditionNavigation2 = null;
+ private Controls.Navigation whiteEditNavigation2 = null;
+ private Controls.Navigation blackEditNavigation2 = null;
+ private static string[] itemPressImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_slideshow_press.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_calendar_press.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_copy_press.png",
+ };
+ private static string[] itemNormalImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_slideshow.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_calendar.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_copy.png",
+ };
+ private static string[] itemDimImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_slideshow_dim.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_calendar_dim.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_copy_dim.png",
+ };
+
+ private static string[] itemBlackPressImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_copy_b_press.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_play_b_press.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_search_b_press.png",
+ };
+ private static string[] itemBlackNormalImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_copy_b.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_play_b.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_search_b.png",
+ };
+ private static string[] itemBlackDimImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_copy_b_dim.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_play_b_dim.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_search_b_dim.png",
+ };
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ Window window = Window.Instance;
+
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ };
+ window.Add(root);
+
+ ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
+ #region CreateByProperty
+ createText[0] = new TextLabel();
+ createText[0].PointSize = 14;
+ createText[0].Text = "Create Navigation just by properties";
+ createText[0].Size2D = new Size2D(450, 100);
+ createText[0].Position2D = new Position2D(200, 60);
+ createText[0].MultiLine = true;
+ root.Add(createText[0]);
+
+ ////////white navigation//////////
+ #region WhiteNaviagtion
+ whiteNavigation = new Controls.Navigation();
+ whiteNavigation.Position2D = new Position2D(100, 150);
+ whiteNavigation.IsFitWithItems = true;
+
+ root.Add(whiteNavigation);
+ Controls.Navigation.NavigationItemData backItem = new Controls.Navigation.NavigationItemData();
+ backItem.Size2D = new Size2D(120, 140);
+ backItem.IconURL = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_back.png";
+ backItem.BackgroundImageURL = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_back_bg.png";
+ backItem.OverlayImageURLSelector = new StringSelector
+ {
+ Pressed = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_back_bg_press_overlay.png",
+ Other = "",
+ };
+ backItem.IconSize2D = new Size2D(56, 56);
+ backItem.EnableIconCenter = true;
+ whiteNavigation.AddItem(backItem);
+ #endregion
+ ////////black navigation//////////
+ #region BlackNavigation
+ blackNavigation = new Controls.Navigation();
+ blackNavigation.Position2D = new Position2D(300, 150);
+ blackNavigation.IsFitWithItems = true;
+
+ root.Add(blackNavigation);
+
+ Tizen.FH.NUI.Controls.Navigation.NavigationItemData blackBackItem = new Tizen.FH.NUI.Controls.Navigation.NavigationItemData();
+ blackBackItem.Size2D = new Size2D(120, 140);
+ blackBackItem.BackgroundImageURL = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_back_bg_b.png";
+ blackBackItem.IconURLSelector = new StringSelector
+ {
+ Pressed = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_back_b_press.png",
+ Other = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_back_b.png"
+ };
+ blackBackItem.IconSize2D = new Size2D(56, 56);
+ blackBackItem.EnableIconCenter = true;
+ blackNavigation.AddItem(blackBackItem);
+ #endregion
+ //////condition navigation//////////
+ #region WhiteConditionNavigation
+ conditionNavigation = new Controls.Navigation();
+ conditionNavigation.Position2D = new Position2D(100, 300);
+ conditionNavigation.BackgroundImageURL = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_bg.png";
+ conditionNavigation.BackgroundImageBorder = new Rectangle(0, 0, 103, 103);
+ conditionNavigation.LeftSpace = 8;
+ conditionNavigation.RightSpace = 0;
+ conditionNavigation.TopSpace = 40;
+ conditionNavigation.BottomSpace = 40;
+ conditionNavigation.ItemGap = 2;
+ conditionNavigation.DividerLineColor = new Color(0, 0, 0, 0.1f);
+ conditionNavigation.IsFitWithItems = true;
+ conditionNavigation.ItemChangedEvent += NavigationItemChangedEvent;
+
+ root.Add(conditionNavigation);
+ for (int i = 0; i < 3; i++)
+ {
+ Controls.Navigation.NavigationItemData conditionItem = new Controls.Navigation.NavigationItemData();
+ conditionItem.Size2D = new Size2D(116, 128);
+ conditionItem.Text = "Text " + i;
+ conditionItem.SubText = "SubText " + i;
+ conditionItem.TextColorSelector = new ColorSelector
+ {
+ Pressed = new Color(0, 0, 0, 1),
+ Disabled = new Color(0, 0, 0, 0.4f),
+ Other = new Color(0, 0, 0, 1),
+ };
+ conditionItem.PointSize = 8;
+ conditionItem.FontFamily = "SamsungOneUI 500C";
+ conditionItem.SubTextColorSelector = new ColorSelector
+ {
+ Pressed = new Color(0, 0, 0, 1),
+ Disabled = new Color(0, 0, 0, 0.4f),
+ Other = new Color(0, 0, 0, 1),
+ };
+ conditionItem.SubTextPointSize = 8;
+ conditionItem.SubTextFontFamily = "SamsungOneUI 500C";
+ conditionItem.IconURLSelector = new StringSelector
+ {
+ Pressed = itemPressImage[i],
+ Disabled = itemDimImage[i],
+ DisabledFocused = itemDimImage[i],
+ DisabledSelected = itemDimImage[i],
+ Other = itemNormalImage[i]
+ };
+ conditionItem.LeftSpace = 4;
+ conditionItem.RightSpace = 4;
+ conditionItem.TopSpace = 8;
+ conditionItem.BottomSpace = 16;
+ conditionItem.IconSize2D = new Size2D(56, 56);
+ conditionItem.TextSize2D = new Size2D(108, 24);
+ conditionItem.SubTextSize2D = new Size2D(108, 24);
+
+ conditionNavigation.AddItem(conditionItem);
+ }
+ #endregion
+ //////black condition navigation//////////
+ #region BlackConditionNavigation
+ blackConditionNavigation = new Controls.Navigation();
+ blackConditionNavigation.Position2D = new Position2D(300, 300);
+ blackConditionNavigation.BackgroundImageURL = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_bg_b.png";
+ blackConditionNavigation.BackgroundImageBorder = new Rectangle(0, 0, 103, 103);
+ blackConditionNavigation.LeftSpace = 8;
+ blackConditionNavigation.RightSpace = 0;
+ blackConditionNavigation.TopSpace = 40;
+ blackConditionNavigation.BottomSpace = 40;
+ blackConditionNavigation.ItemGap = 2;
+ blackConditionNavigation.DividerLineColor = new Color(1, 1, 1, 0.1f);
+ blackConditionNavigation.IsFitWithItems = true;
+ blackConditionNavigation.ItemChangedEvent += NavigationItemChangedEvent;
+
+ root.Add(blackConditionNavigation);
+ for (int i = 0; i < 3; i++)
+ {
+ Controls.Navigation.NavigationItemData blackConditionItem = new Controls.Navigation.NavigationItemData();
+ blackConditionItem.Size2D = new Size2D(116, 128);
+ blackConditionItem.Text = "Text " + i;
+ blackConditionItem.SubText = "SubText " + i;
+ blackConditionItem.TextColorSelector = new ColorSelector
+ {
+ Pressed = new Color(1, 1, 1, 0.85f),
+ Disabled = new Color(1, 1, 1, 0.4f),
+ Other = new Color(1, 1, 1, 0.85f),
+ };
+ blackConditionItem.PointSize = 8;
+ blackConditionItem.FontFamily = "SamsungOneUI 500C";
+ blackConditionItem.SubTextColorSelector = new ColorSelector
+ {
+ Pressed = new Color(1, 1, 1, 0.85f),
+ Disabled = new Color(1, 1, 1, 0.4f),
+ Other = new Color(1, 1, 1, 0.85f),
+ };
+ blackConditionItem.SubTextPointSize = 8;
+ blackConditionItem.SubTextFontFamily = "SamsungOneUI 500C";
+ blackConditionItem.IconURLSelector = new StringSelector
+ {
+ Pressed = itemBlackPressImage[i],
+ Disabled = itemBlackDimImage[i],
+ DisabledFocused = itemBlackDimImage[i],
+ DisabledSelected = itemBlackDimImage[i],
+ Other = itemBlackNormalImage[i]
+ };
+ blackConditionItem.LeftSpace = 4;
+ blackConditionItem.RightSpace = 4;
+ blackConditionItem.TopSpace = 8;
+ blackConditionItem.BottomSpace = 16;
+ blackConditionItem.IconSize2D = new Size2D(56, 56);
+ blackConditionItem.TextSize2D = new Size2D(108, 24);
+ blackConditionItem.SubTextSize2D = new Size2D(108, 24);
+
+ blackConditionNavigation.AddItem(blackConditionItem);
+ }
+ #endregion
+ //////////White Edit Mode///////////////
+ #region WhiteEditModeNavigation
+ whiteEditNavigation = new Controls.Navigation();
+ whiteEditNavigation.Size2D = new Size2D(178, 800);
+ whiteEditNavigation.ShadowImageSize2D = new Size2D(6, 800);
+ whiteEditNavigation.Position2D = new Position2D(500, 150);
+ whiteEditNavigation.ShadowImageURL = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_editmode_shadow.png";
+ whiteEditNavigation.BackgroundImageURL = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_editmode_bg.png";
+ whiteEditNavigation.BackgroundColor = new Color(1, 1, 1, 0.9f);
+ whiteEditNavigation.IsFitWithItems = false;
+
+ root.Add(whiteEditNavigation);
+
+ Controls.Navigation.NavigationItemData firstEditItem = new Controls.Navigation.NavigationItemData();
+ firstEditItem.Size2D = new Size2D(178, 184);
+ firstEditItem.LeftSpace = 24;
+ firstEditItem.RightSpace = 24;
+ firstEditItem.TopSpace = 0;
+ firstEditItem.BottomSpace = 0;
+ firstEditItem.TextSize2D = new Size2D(130, 76);
+ firstEditItem.Text = "1";
+ firstEditItem.TextColor = new Color(14.0f / 255.0f, 14.0f / 255.0f, 230.0f / 255.0f, 1);
+ firstEditItem.PointSize = 32;
+ firstEditItem.FontFamily = "SamsungOneUI 300C";
+
+ firstEditItem.SubTextSize2D = new Size2D(130, 42);
+ firstEditItem.SubText = "SELECTED";
+ firstEditItem.SubTextColor = new Color(0, 0, 0, 1);
+ firstEditItem.SubTextPointSize = 16;
+ firstEditItem.SubTextFontFamily = "SamsungOneUI 600";
+
+ firstEditItem.DividerLineSize2D = new Size2D(178, 2);
+ firstEditItem.DividerLineColor = new Color(0, 0, 0, 0.1f);
+ firstEditItem.DividerLinePosition2D = new Position2D(0, 166);
+
+ whiteEditNavigation.AddItem(firstEditItem);
+
+ for (int i = 0; i < 2; i++)
+ {
+ Controls.Navigation.NavigationItemData editItem = new Controls.Navigation.NavigationItemData();
+ editItem.Size2D = new Size2D(178, 108);
+ editItem.Text = "Text " + i;
+ editItem.TextColorSelector = new ColorSelector
+ {
+ Pressed = new Color(0, 0, 0, 1),
+ Disabled = new Color(0, 0, 0, 0.4f),
+ Other = new Color(0, 0, 0, 1),
+ };
+ editItem.PointSize = 8;
+ editItem.FontFamily = "SamsungOneUI 500C";
+
+ editItem.IconURLSelector = new StringSelector
+ {
+ Pressed = itemPressImage[i],
+ Disabled = itemDimImage[i],
+ DisabledFocused = itemDimImage[i],
+ DisabledSelected = itemDimImage[i],
+ Other = itemNormalImage[i]
+ };
+ editItem.LeftSpace = 24;
+ editItem.RightSpace = 24;
+ editItem.TopSpace = 24;
+ editItem.BottomSpace = 24;
+ editItem.IconSize2D = new Size2D(56, 56);
+ editItem.TextSize2D = new Size2D(130, 52);
+
+ whiteEditNavigation.AddItem(editItem);
+ }
+
+ Controls.Navigation.NavigationItemData lastEditItem = new Controls.Navigation.NavigationItemData();
+ lastEditItem.Size2D = new Size2D(178, 166);
+ lastEditItem.LeftSpace = 24;
+ lastEditItem.RightSpace = 24;
+ lastEditItem.TopSpace = 58;
+ lastEditItem.BottomSpace = 0;
+ lastEditItem.TextSize2D = new Size2D(130, 52);
+ lastEditItem.Text = "Cancel";
+ lastEditItem.TextColor = new Color(0, 0, 0, 0.85f);
+ lastEditItem.PointSize = 8;
+ lastEditItem.FontFamily = "SamsungOneUI 500C";
+
+ lastEditItem.IconURLSelector = new StringSelector
+ {
+ Pressed = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_press.png",
+ Disabled = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_dim.png",
+ DisabledFocused = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_dim.png",
+ DisabledSelected = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_dim.png",
+ Other = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel.png"
+ };
+ lastEditItem.IconSize2D = new Size2D(56, 56);
+
+ lastEditItem.DividerLineSize2D = new Size2D(178, 2);
+ lastEditItem.DividerLineColor = new Color(0, 0, 0, 0.1f);
+ lastEditItem.DividerLinePosition2D = new Position2D(0, 16);
+
+ whiteEditNavigation.AddItem(lastEditItem);
+ #endregion
+ //////////Black Edit Mode///////////////
+ #region BlackEditModeNavigation
+ blackEditNavigation = new Controls.Navigation();
+ blackEditNavigation.Size2D = new Size2D(178, 800);
+ blackEditNavigation.ShadowImageSize2D = new Size2D(6, 800);
+ blackEditNavigation.Position2D = new Position2D(750, 150);
+ blackEditNavigation.ShadowImageURL = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_editmode_shadow_b.png";
+ blackEditNavigation.BackgroundImageURL = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_editmode_bg_b.png";
+ blackEditNavigation.BackgroundColor = new Color(1, 1, 1, 0.9f);
+ blackEditNavigation.IsFitWithItems = false;
+
+ root.Add(blackEditNavigation);
+
+ Controls.Navigation.NavigationItemData bFirstEditItem = new Controls.Navigation.NavigationItemData();
+ bFirstEditItem.Size2D = new Size2D(178, 184);
+ bFirstEditItem.LeftSpace = 24;
+ bFirstEditItem.RightSpace = 24;
+ bFirstEditItem.TopSpace = 0;
+ bFirstEditItem.BottomSpace = 0;
+ bFirstEditItem.TextSize2D = new Size2D(130, 76);
+ bFirstEditItem.Text = "1";
+ bFirstEditItem.TextColor = new Color(14.0f / 255.0f, 14.0f / 255.0f, 230.0f / 255.0f, 1);
+ bFirstEditItem.PointSize = 32;
+ bFirstEditItem.FontFamily = "SamsungOneUI 300C";
+
+ bFirstEditItem.SubTextSize2D = new Size2D(130, 42);
+ bFirstEditItem.SubText = "SELECTED";
+ bFirstEditItem.SubTextColor = new Color(1, 1, 1, 1);
+ bFirstEditItem.SubTextPointSize = 16;
+ bFirstEditItem.SubTextFontFamily = "SamsungOneUI 600";
+
+ bFirstEditItem.DividerLineSize2D = new Size2D(178, 2);
+ bFirstEditItem.DividerLineColor = new Color(1, 1, 1, 0.1f);
+ bFirstEditItem.DividerLinePosition2D = new Position2D(0, 166);
+
+ blackEditNavigation.AddItem(bFirstEditItem);
+
+ for (int i = 0; i < 2; i++)
+ {
+ Controls.Navigation.NavigationItemData bEditItem = new Controls.Navigation.NavigationItemData();
+ bEditItem.Size2D = new Size2D(178, 108);
+ bEditItem.Text = "Text " + i;
+ bEditItem.TextColorSelector = new ColorSelector
+ {
+ Pressed = new Color(1, 1, 1, 0.85f),
+ Disabled = new Color(0, 0, 0, 0.4f),
+ Other = new Color(1, 1, 1, 0.85f),
+ };
+ bEditItem.PointSize = 8;
+ bEditItem.FontFamily = "SamsungOneUI 500C";
+
+ bEditItem.IconURLSelector = new StringSelector
+ {
+ Pressed = itemBlackPressImage[i],
+ Disabled = itemBlackDimImage[i],
+ DisabledFocused = itemBlackDimImage[i],
+ DisabledSelected = itemBlackDimImage[i],
+ Other = itemBlackNormalImage[i]
+ };
+ bEditItem.Space = new Vector4(24, 24, 24, 24);
+ bEditItem.IconSize2D = new Size2D(56, 56);
+ bEditItem.TextSize2D = new Size2D(130, 52);
+
+ blackEditNavigation.AddItem(bEditItem);
+ }
+
+ Controls.Navigation.NavigationItemData bLastEditItem = new Controls.Navigation.NavigationItemData();
+ bLastEditItem.Size2D = new Size2D(178, 166);
+ bLastEditItem.LeftSpace = 24;
+ bLastEditItem.RightSpace = 24;
+ bLastEditItem.TopSpace = 58;
+ bLastEditItem.BottomSpace = 0;
+ bLastEditItem.TextSize2D = new Size2D(130, 52);
+ bLastEditItem.Text = "Cancel";
+ bLastEditItem.TextColor = new Color(1, 1, 1, 0.85f);
+ bLastEditItem.PointSize = 8;
+ bLastEditItem.FontFamily = "SamsungOneUI 500C";
+
+ bLastEditItem.IconURLSelector = new StringSelector
+ {
+ Pressed = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_press.png",
+ Disabled = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_dim.png",
+ DisabledFocused = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_dim.png",
+ DisabledSelected = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_dim.png",
+ Other = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b.png"
+ };
+ bLastEditItem.IconSize2D = new Size2D(56, 56);
+
+ bLastEditItem.DividerLineSize2D = new Size2D(178, 2);
+ bLastEditItem.DividerLineColor = new Color(1, 1, 1, 0.1f);
+ bLastEditItem.DividerLinePosition2D = new Position2D(0, 16);
+
+ blackEditNavigation.AddItem(bLastEditItem);
+ #endregion
+ #endregion
+ ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
+ #region CreateByAttributes
+ createText[1] = new TextLabel();
+ createText[1].PointSize = 14;
+ createText[1].Text = "Create Navigation just by Attributes";
+ createText[1].Size2D = new Size2D(450, 100);
+ createText[1].Position2D = new Position2D(1000, 60);
+ createText[1].MultiLine = true;
+ root.Add(createText[1]);
+
+ ////////white navigation//////////
+ #region WhiteNavigation
+ Controls.NavigationAttributes whiteNavAttrs = new Controls.NavigationAttributes
+ {
+ IsFitWithItems = true,
+ };
+ whiteNavigation2 = new Controls.Navigation(whiteNavAttrs);
+ whiteNavigation2.Position2D = new Position2D(1000, 150);
+
+ root.Add(whiteNavigation2);
+
+ Tizen.FH.NUI.Controls.NavigationItemAttributes attrs = new Tizen.FH.NUI.Controls.NavigationItemAttributes
+ {
+ Size2D = new Size2D(120, 140),
+ IconAttributes = new ImageAttributes()
+ {
+ Size2D = new Size2D(56, 56),
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_back.png" },
+ },
+ BackgroundImageAttributes = new ImageAttributes()
+ {
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_back_bg.png" },
+ },
+ OverlayImageAttributes = new ImageAttributes()
+ {
+ ResourceURL = new StringSelector
+ {
+ Pressed = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_back_bg_press_overlay.png",
+ Other = "",
+ },
+ },
+ EnableIconCenter = true
+ };
+ Controls.Navigation.NavigationItemData backItem2 = new Controls.Navigation.NavigationItemData(attrs);
+ whiteNavigation2.AddItem(backItem2);
+ #endregion
+
+ ////////black navigation//////////
+ #region BlackNavigation
+ Controls.NavigationAttributes blackNavAttrs = new Controls.NavigationAttributes
+ {
+ IsFitWithItems = true,
+ };
+ blackNavigation2 = new Controls.Navigation(blackNavAttrs);
+ blackNavigation2.Position2D = new Position2D(1200, 150);
+
+ root.Add(blackNavigation2);
+
+ Tizen.FH.NUI.Controls.NavigationItemAttributes blackItemAttrs = new Tizen.FH.NUI.Controls.NavigationItemAttributes
+ {
+ Size2D = new Size2D(120, 140),
+ IconAttributes = new ImageAttributes()
+ {
+ Size2D = new Size2D(56, 56),
+ ResourceURL = new StringSelector
+ {
+ Pressed = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_back_b_press.png",
+ Other = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_back_b.png"
+ },
+ },
+ BackgroundImageAttributes = new ImageAttributes()
+ {
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_back_bg_b.png" },
+ },
+ EnableIconCenter = true
+ };
+ Controls.Navigation.NavigationItemData blackBackItem2 = new Controls.Navigation.NavigationItemData(blackItemAttrs);
+ blackNavigation2.AddItem(blackBackItem2);
+ #endregion
+ //////condition navigation//////////
+ #region WhiteConditionNavigation
+ Controls.NavigationAttributes whiteNavAttrs2 = new Controls.NavigationAttributes
+ {
+ BackgroundImageAttributes = new ImageAttributes
+ {
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_bg.png" },
+ Border = new RectangleSelector { All = new Rectangle(0, 0, 103, 103) },
+ },
+ Space = new Vector4(8, 0, 40, 40),
+ ItemGap = 2,
+ DividerLineColor = new Color(0, 0, 0, 0.1f),
+ IsFitWithItems = true,
+ };
+ conditionNavigation2 = new Controls.Navigation(whiteNavAttrs2);
+ conditionNavigation2.Position2D = new Position2D(1000, 300);
+ conditionNavigation2.ItemChangedEvent += NavigationItemChangedEvent2;
+
+ root.Add(conditionNavigation2);
+
+ Tizen.FH.NUI.Controls.NavigationItemAttributes conditionItemAttr2 = new Tizen.FH.NUI.Controls.NavigationItemAttributes
+ {
+ TextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(108, 24),
+ TextColor = new ColorSelector
+ {
+ Pressed = new Color(0, 0, 0, 1),
+ Disabled = new Color(0, 0, 0, 0.4f),
+ Other = new Color(0, 0, 0, 1),
+ },
+ PointSize = new FloatSelector { All = 8 },
+ FontFamily = "SamsungOneUI 500C",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Top,
+ },
+ SubTextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(108, 24),
+ TextColor = new ColorSelector
+ {
+ Pressed = new Color(0, 0, 0, 1),
+ Disabled = new Color(0, 0, 0, 0.4f),
+ Other = new Color(0, 0, 0, 1),
+ },
+ PointSize = new FloatSelector { All = 8 },
+ FontFamily = "SamsungOneUI 500C",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ },
+ IconAttributes = new ImageAttributes
+ {
+ Size2D = new Size2D(56, 56),
+ },
+ Space = new Vector4(4, 4, 8, 16),
+ };
+ for (int i = 0; i < 3; i++)
+ {
+ Controls.Navigation.NavigationItemData conditionItem2 = new Controls.Navigation.NavigationItemData(conditionItemAttr2);
+ conditionItem2.Size2D = new Size2D(116, 128);
+ conditionItem2.Text = "Text " + i;
+ conditionItem2.SubText = "SubText " + i;
+ conditionItem2.IconURLSelector = new StringSelector
+ {
+ Pressed = itemPressImage[i],
+ Disabled = itemDimImage[i],
+ DisabledFocused = itemDimImage[i],
+ DisabledSelected = itemDimImage[i],
+ Other = itemNormalImage[i]
+ };
+ conditionNavigation2.AddItem(conditionItem2);
+ }
+ #endregion
+ //////black condition navigation//////////
+ #region BlackConditionNavigation
+ Controls.NavigationAttributes blackNavAttrs2 = new Controls.NavigationAttributes
+ {
+ BackgroundImageAttributes = new ImageAttributes
+ {
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_bg_b.png" },
+ Border = new RectangleSelector { All = new Rectangle(0, 0, 103, 103) },
+ },
+ Space = new Vector4(8, 0, 40, 40),
+ ItemGap = 2,
+ DividerLineColor = new Color(1, 1, 1, 0.1f),
+ IsFitWithItems = true,
+ };
+ blackConditionNavigation2 = new Controls.Navigation(blackNavAttrs2);
+ blackConditionNavigation2.Position2D = new Position2D(1200, 300);
+ blackConditionNavigation2.ItemChangedEvent += NavigationItemChangedEvent2;
+
+ root.Add(blackConditionNavigation2);
+
+ Tizen.FH.NUI.Controls.NavigationItemAttributes blackConditionItemAttr2 = new Tizen.FH.NUI.Controls.NavigationItemAttributes
+ {
+ TextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(108, 24),
+ TextColor = new ColorSelector
+ {
+ Pressed = new Color(1, 1, 1, 0.85f),
+ Disabled = new Color(1, 1, 1, 0.4f),
+ Other = new Color(1, 1, 1, 0.85f),
+ },
+ PointSize = new FloatSelector { All = 8 },
+ FontFamily = "SamsungOneUI 500C",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Top,
+ },
+ SubTextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(108, 24),
+ TextColor = new ColorSelector
+ {
+ Pressed = new Color(1, 1, 1, 0.85f),
+ Disabled = new Color(1, 1, 1, 0.4f),
+ Other = new Color(1, 1, 1, 0.85f),
+ },
+ PointSize = new FloatSelector { All = 8 },
+ FontFamily = "SamsungOneUI 500C",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ },
+ IconAttributes = new ImageAttributes
+ {
+ Size2D = new Size2D(56, 56),
+ },
+ Space = new Vector4(4, 4, 8, 16),
+ };
+ for (int i = 0; i < 3; i++)
+ {
+ Controls.Navigation.NavigationItemData conditionItem2 = new Controls.Navigation.NavigationItemData(blackConditionItemAttr2);
+ conditionItem2.Size2D = new Size2D(116, 128);
+ conditionItem2.Text = "Text " + i;
+ conditionItem2.SubText = "SubText " + i;
+ conditionItem2.IconURLSelector = new StringSelector
+ {
+ Pressed = itemBlackPressImage[i],
+ Disabled = itemBlackDimImage[i],
+ DisabledFocused = itemBlackDimImage[i],
+ DisabledSelected = itemBlackDimImage[i],
+ Other = itemBlackNormalImage[i]
+ };
+ blackConditionNavigation2.AddItem(conditionItem2);
+ }
+ #endregion
+ //////////White Edit Mode///////////////
+ #region WhiteEditModeNavigation
+ Controls.NavigationAttributes editAttrs = new Controls.NavigationAttributes
+ {
+ ShadowImageAttributes = new ImageAttributes
+ {
+ Size2D = new Size2D(6, 800),
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_editmode_shadow.png" },
+ },
+ BackgroundImageAttributes = new ImageAttributes
+ {
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_editmode_bg.png" },
+ },
+ BackgroundColor = new ColorSelector { All = new Color(1, 1, 1, 0.9f) },
+ IsFitWithItems = false,
+ };
+ whiteEditNavigation2 = new Controls.Navigation(editAttrs);
+ whiteEditNavigation2.Size2D = new Size2D(178, 800);
+ whiteEditNavigation2.Position2D = new Position2D(1400, 150);
+
+ root.Add(whiteEditNavigation2);
+
+ Tizen.FH.NUI.Controls.NavigationItemAttributes firstItemAttrs = new Tizen.FH.NUI.Controls.NavigationItemAttributes
+ {
+ Space = new Vector4(24, 24, 0, 0),
+ TextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(130, 76),
+ Text = new StringSelector { All = "1" },
+ TextColor = new ColorSelector { All = new Color(14.0f / 255.0f, 14.0f / 255.0f, 230.0f / 255.0f, 1) },
+ PointSize = new FloatSelector { All = 32 },
+ FontFamily = "SamsungOneUI 300C",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Top,
+ },
+ SubTextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(130, 42),
+ Text = new StringSelector { All = "SELECTED" },
+ TextColor = new ColorSelector { All = new Color(0, 0, 0, 1) },
+ PointSize = new FloatSelector { All = 16 },
+ FontFamily = "SamsungOneUI 600",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ },
+ DividerLineAttributes = new ViewAttributes
+ {
+ Size2D = new Size2D(178, 2),
+ BackgroundColor = new ColorSelector { All = new Color(0, 0, 0, 0.1f) },
+ Position2D = new Position2D(0, 166),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ },
+ };
+ Controls.Navigation.NavigationItemData firstEditItem2 = new Controls.Navigation.NavigationItemData(firstItemAttrs);
+ firstEditItem2.Size2D = new Size2D(178, 184);
+ whiteEditNavigation2.AddItem(firstEditItem2);
+
+ Tizen.FH.NUI.Controls.NavigationItemAttributes itemAttributes2 = new Tizen.FH.NUI.Controls.NavigationItemAttributes
+ {
+ TextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(130, 52),
+ TextColor = new ColorSelector
+ {
+ Pressed = new Color(0, 0, 0, 1),
+ Disabled = new Color(0, 0, 0, 0.4f),
+ Other = new Color(0, 0, 0, 1),
+ },
+ PointSize = new FloatSelector { All = 8 },
+ FontFamily = "SamsungOneUI 500C",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Top,
+ },
+ IconAttributes = new ImageAttributes
+ {
+ Size2D = new Size2D(56, 56),
+ },
+ Space = new Vector4(24, 24, 24, 24),
+ };
+ for (int i = 0; i < 2; i++)
+ {
+ Controls.Navigation.NavigationItemData editItem = new Controls.Navigation.NavigationItemData(itemAttributes2);
+ editItem.Size2D = new Size2D(178, 108);
+ editItem.Text = "Text " + i;
+ editItem.IconURLSelector = new StringSelector
+ {
+ Pressed = itemPressImage[i],
+ Disabled = itemDimImage[i],
+ DisabledFocused = itemDimImage[i],
+ DisabledSelected = itemDimImage[i],
+ Other = itemNormalImage[i]
+ };
+ whiteEditNavigation2.AddItem(editItem);
+ }
+
+ Tizen.FH.NUI.Controls.NavigationItemAttributes lastItemAttrs = new Tizen.FH.NUI.Controls.NavigationItemAttributes
+ {
+ Space = new Vector4(24, 24, 58, 0),
+ TextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(130, 52),
+ TextColor = new ColorSelector { All = new Color(0, 0, 0, 0.85f) },
+ PointSize = new FloatSelector { All = 8 },
+ FontFamily = "SamsungOneUI 500C",
+ Text = new StringSelector { All = "Cancel" },
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Top,
+ },
+ IconAttributes = new ImageAttributes
+ {
+ Size2D = new Size2D(56, 56),
+ ResourceURL = new StringSelector
+ {
+ Pressed = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_press.png",
+ Disabled = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_dim.png",
+ DisabledFocused = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_dim.png",
+ DisabledSelected = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_dim.png",
+ Other = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel.png"
+ },
+ },
+ DividerLineAttributes = new ViewAttributes
+ {
+ Size2D = new Size2D(178, 2),
+ BackgroundColor = new ColorSelector { All = new Color(0, 0, 0, 0.1f) },
+ Position2D = new Position2D(0, 16),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ },
+ };
+
+ Controls.Navigation.NavigationItemData lastEditItem2 = new Controls.Navigation.NavigationItemData(lastItemAttrs);
+ lastEditItem2.Size2D = new Size2D(178, 166);
+ whiteEditNavigation2.AddItem(lastEditItem2);
+ #endregion
+ //////////Black Edit Mode///////////////
+ #region BlackEditModeNavigation
+ Controls.NavigationAttributes blackEditAttrs = new Controls.NavigationAttributes
+ {
+ ShadowImageAttributes = new ImageAttributes
+ {
+ Size2D = new Size2D(6, 800),
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_editmode_shadow_b.png" },
+ },
+ BackgroundImageAttributes = new ImageAttributes
+ {
+ ResourceURL = new StringSelector { All = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_editmode_bg_b.png" },
+ },
+ BackgroundColor = new ColorSelector { All = new Color(1, 1, 1, 0.9f) },
+ IsFitWithItems = false,
+ };
+ blackEditNavigation2 = new Controls.Navigation(blackEditAttrs);
+ blackEditNavigation2.Size2D = new Size2D(178, 800);
+ blackEditNavigation2.Position2D = new Position2D(1650, 150);
+
+ root.Add(blackEditNavigation2);
+
+ Tizen.FH.NUI.Controls.NavigationItemAttributes blackFirstItemAttrs = new Tizen.FH.NUI.Controls.NavigationItemAttributes
+ {
+ Space = new Vector4(24, 24, 0, 0),
+ TextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(130, 76),
+ Text = new StringSelector { All = "1" },
+ TextColor = new ColorSelector { All = new Color(14.0f / 255.0f, 14.0f / 255.0f, 230.0f / 255.0f, 1) },
+ PointSize = new FloatSelector { All = 32 },
+ FontFamily = "SamsungOneUI 300C",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Top,
+ },
+ SubTextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(130, 42),
+ Text = new StringSelector { All = "SELECTED" },
+ TextColor = new ColorSelector { All = new Color(1, 1, 1, 1) },
+ PointSize = new FloatSelector { All = 16 },
+ FontFamily = "SamsungOneUI 600",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ },
+ DividerLineAttributes = new ViewAttributes
+ {
+ Size2D = new Size2D(178, 2),
+ BackgroundColor = new ColorSelector { All = new Color(1, 1, 1, 0.1f) },
+ Position2D = new Position2D(0, 166),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ },
+ };
+ Controls.Navigation.NavigationItemData blackFirstEditItem = new Controls.Navigation.NavigationItemData(blackFirstItemAttrs);
+ blackFirstEditItem.Size2D = new Size2D(178, 184);
+ blackEditNavigation2.AddItem(blackFirstEditItem);
+
+ Tizen.FH.NUI.Controls.NavigationItemAttributes blackItemAttributes = new Tizen.FH.NUI.Controls.NavigationItemAttributes
+ {
+ TextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(130, 52),
+ TextColor = new ColorSelector
+ {
+ Pressed = new Color(1, 1, 1, 0.85f),
+ Disabled = new Color(0, 0, 0, 0.4f),
+ Other = new Color(1, 1, 1, 0.85f),
+ },
+ PointSize = new FloatSelector { All = 8 },
+ FontFamily = "SamsungOneUI 500C",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Top,
+ },
+ IconAttributes = new ImageAttributes
+ {
+ Size2D = new Size2D(56, 56),
+ },
+ Space = new Vector4(24, 24, 24, 24),
+ };
+ for (int i = 0; i < 2; i++)
+ {
+ Controls.Navigation.NavigationItemData editItem = new Controls.Navigation.NavigationItemData(blackItemAttributes);
+ editItem.Size2D = new Size2D(178, 108);
+ editItem.Text = "Text " + i;
+ editItem.IconURLSelector = new StringSelector
+ {
+ Pressed = itemBlackPressImage[i],
+ Disabled = itemBlackDimImage[i],
+ DisabledFocused = itemBlackDimImage[i],
+ DisabledSelected = itemBlackDimImage[i],
+ Other = itemBlackNormalImage[i]
+ };
+ blackEditNavigation2.AddItem(editItem);
+ }
+
+ Tizen.FH.NUI.Controls.NavigationItemAttributes blackLastItemAttrs = new Tizen.FH.NUI.Controls.NavigationItemAttributes
+ {
+ Space = new Vector4(24, 24, 58, 0),
+ TextAttributes = new TextAttributes
+ {
+ Size2D = new Size2D(130, 52),
+ TextColor = new ColorSelector { All = new Color(1, 1, 1, 0.85f) },
+ PointSize = new FloatSelector { All = 8 },
+ FontFamily = "SamsungOneUI 500C",
+ Text = new StringSelector { All = "Cancel" },
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Top,
+ },
+ IconAttributes = new ImageAttributes
+ {
+ Size2D = new Size2D(56, 56),
+ ResourceURL = new StringSelector
+ {
+ Pressed = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_press.png",
+ Disabled = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_dim.png",
+ DisabledFocused = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_dim.png",
+ DisabledSelected = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_dim.png",
+ Other = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b.png"
+ },
+ },
+ DividerLineAttributes = new ViewAttributes
+ {
+ Size2D = new Size2D(178, 2),
+ BackgroundColor = new ColorSelector { All = new Color(1, 1, 1, 0.1f) },
+ Position2D = new Position2D(0, 16),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ },
+ };
+
+ Controls.Navigation.NavigationItemData blackLastEditItem = new Controls.Navigation.NavigationItemData(blackLastItemAttrs);
+ blackLastEditItem.Size2D = new Size2D(178, 166);
+ blackEditNavigation2.AddItem(blackLastEditItem);
+ #endregion
+ #endregion
+ }
+
+ private void NavigationItemChangedEvent(object sender, Controls.Navigation.ItemChangeEventArgs e)
+ {
+ createText[0].Text = "Create Navigation just by properties, Selected index from " + e.PreviousIndex + " to " + e.CurrentIndex;
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ if (whiteNavigation != null)
+ {
+ root.Remove(whiteNavigation);
+ whiteNavigation.Dispose();
+ whiteNavigation = null;
+ }
+ if (blackNavigation != null)
+ {
+ root.Remove(blackNavigation);
+ blackNavigation.Dispose();
+ blackNavigation = null;
+ }
+ if (conditionNavigation != null)
+ {
+ root.Remove(conditionNavigation);
+ conditionNavigation.Dispose();
+ conditionNavigation = null;
+ }
+ if (blackConditionNavigation != null)
+ {
+ root.Remove(blackConditionNavigation);
+ blackConditionNavigation.Dispose();
+ blackConditionNavigation = null;
+ }
+
+ if (whiteEditNavigation != null)
+ {
+ root.Remove(whiteEditNavigation);
+ whiteEditNavigation.Dispose();
+ whiteEditNavigation = null;
+ }
+
+ if (blackEditNavigation != null)
+ {
+ root.Remove(blackEditNavigation);
+ blackEditNavigation.Dispose();
+ blackEditNavigation = null;
+ }
+
+ if (whiteNavigation2 != null)
+ {
+ root.Remove(whiteNavigation2);
+ whiteNavigation2.Dispose();
+ whiteNavigation2 = null;
+ }
+
+ if (blackNavigation2 != null)
+ {
+ root.Remove(blackNavigation2);
+ blackNavigation2.Dispose();
+ blackNavigation2 = null;
+ }
+ if (conditionNavigation2 != null)
+ {
+ root.Remove(conditionNavigation2);
+ conditionNavigation2.Dispose();
+ conditionNavigation2 = null;
+ }
+ if (blackConditionNavigation2 != null)
+ {
+ root.Remove(blackConditionNavigation2);
+ blackConditionNavigation2.Dispose();
+ blackConditionNavigation2 = null;
+ }
+
+ if (whiteEditNavigation2 != null)
+ {
+ root.Remove(whiteEditNavigation2);
+ whiteEditNavigation2.Dispose();
+ whiteEditNavigation2 = null;
+ }
+
+ if (blackEditNavigation2 != null)
+ {
+ root.Remove(blackEditNavigation2);
+ blackEditNavigation2.Dispose();
+ blackEditNavigation2 = null;
+ }
+ if (createText[0] != null)
+ {
+ root.Remove(createText[0]);
+ createText[0].Dispose();
+ createText[0] = null;
+ }
+ if (createText[1] != null)
+ {
+ root.Remove(createText[1]);
+ createText[1].Dispose();
+ createText[1] = null;
+ }
+
+ Window.Instance.Remove(root);
+ root.Dispose();
+ root = null;
+ }
+ }
+
+ private void NavigationItemChangedEvent2(object sender, Tizen.FH.NUI.Controls.Navigation.ItemChangeEventArgs e)
+ {
+ createText[1].Text = "Create Navigation just by Attributes, Selected index from " + e.PreviousIndex + " to " + e.CurrentIndex;
+ }
+ }
+}
--- /dev/null
+using Tizen.FH.NUI.Controls;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+ using Controls = Tizen.FH.NUI.Controls;
+ public class Navigation : IExample
+ {
+ private SampleLayout root;
+
+ private TextLabel text = null;
+ private Tizen.FH.NUI.Controls.Navigation whiteNavigation = null;
+ private Tizen.FH.NUI.Controls.Navigation blackNavigation = null;
+ private Tizen.FH.NUI.Controls.Navigation conditionNavigation = null;
+ private Tizen.FH.NUI.Controls.Navigation blackConditionNavigation = null;
+ private Tizen.FH.NUI.Controls.Navigation whiteEditNavigation = null;
+ private Tizen.FH.NUI.Controls.Navigation blackEditNavigation = null;
+
+ private static string[] itemPressImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_slideshow_press.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_calendar_press.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_copy_press.png",
+ };
+ private static string[] itemNormalImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_slideshow.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_calendar.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_copy.png",
+ };
+ private static string[] itemDimImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_slideshow_dim.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_calendar_dim.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_copy_dim.png",
+ };
+
+ private static string[] itemBlackPressImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_copy_b_press.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_play_b_press.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_search_b_press.png",
+ };
+ private static string[] itemBlackNormalImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_copy_b.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_play_b.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_search_b.png",
+ };
+ private static string[] itemBlackDimImage = new string[]
+ {
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_copy_b_dim.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_play_b_dim.png",
+ CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_search_b_dim.png",
+ };
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "Navigation";
+
+ text = new TextLabel();
+ text.PointSize = 14;
+ text.Text = "Create Navigation by style";
+ text.Size2D = new Size2D(480, 100);
+ text.Position2D = new Position2D(300, 10);
+ text.MultiLine = true;
+ root.Add(text);
+
+ ////////white navigation//////////
+ #region WhiteNaviagtion
+ whiteNavigation = new Controls.Navigation("Back");
+ whiteNavigation.Position2D = new Position2D(100, 150);
+
+ root.Add(whiteNavigation);
+
+ Controls.Navigation.NavigationItemData backItem = new Controls.Navigation.NavigationItemData("WhiteBackItem");
+ whiteNavigation.AddItem(backItem);
+ #endregion
+
+ ////////black navigation//////////
+ #region BlackNavigation
+ blackNavigation = new Controls.Navigation("Back");
+ blackNavigation.Position2D = new Position2D(300, 150);
+
+ root.Add(blackNavigation);
+
+ Controls.Navigation.NavigationItemData blackBackItem = new Controls.Navigation.NavigationItemData("BlackBackItem");
+ blackNavigation.AddItem(blackBackItem);
+ #endregion
+
+ //////condition navigation//////////
+ #region WhiteConditionNavigation
+ conditionNavigation = new Controls.Navigation("WhiteCondition");
+ conditionNavigation.Position2D = new Position2D(100, 400);
+ conditionNavigation.ItemChangedEvent += NavigationItemChangedEvent;
+ root.Add(conditionNavigation);
+
+ for (int i = 0; i < 3; i++)
+ {
+ Controls.Navigation.NavigationItemData conditionItem = new Controls.Navigation.NavigationItemData("WhiteConditionItem");
+ conditionItem.Size2D = new Size2D(116, 128);
+ conditionItem.Text = "Text " + i;
+ conditionItem.SubText = "SubText " + i;
+ conditionItem.IconURLSelector = new StringSelector
+ {
+ Pressed = itemPressImage[i],
+ Disabled = itemDimImage[i],
+ DisabledFocused = itemDimImage[i],
+ DisabledSelected = itemDimImage[i],
+ Other = itemNormalImage[i]
+ };
+ conditionNavigation.AddItem(conditionItem);
+ }
+ #endregion
+
+ //////black condition navigation//////////
+ #region BlackConditionNavigation
+ blackConditionNavigation = new Controls.Navigation("BlackCondition");
+ blackConditionNavigation.Position2D = new Position2D(300, 400);
+ blackConditionNavigation.ItemChangedEvent += NavigationItemChangedEvent;
+ root.Add(blackConditionNavigation);
+
+ for (int i = 0; i < 3; i++)
+ {
+ Controls.Navigation.NavigationItemData conditionItem = new Controls.Navigation.NavigationItemData("BlackConditionItem");
+ conditionItem.Size2D = new Size2D(116, 128);
+ conditionItem.Text = "Text " + i;
+ conditionItem.SubText = "SubText " + i;
+ conditionItem.IconURLSelector = new StringSelector
+ {
+ Pressed = itemBlackPressImage[i],
+ Disabled = itemBlackDimImage[i],
+ DisabledFocused = itemBlackDimImage[i],
+ DisabledSelected = itemBlackDimImage[i],
+ Other = itemBlackNormalImage[i]
+ };
+ blackConditionNavigation.AddItem(conditionItem);
+ }
+ #endregion
+
+ //////////White Edit Mode///////////////
+ #region WhiteEditModeNavigation
+ whiteEditNavigation = new Controls.Navigation("WhiteEditMode");
+ whiteEditNavigation.Size2D = new Size2D(178, 800);
+ whiteEditNavigation.Position2D = new Position2D(500, 150);
+ whiteEditNavigation.ItemChangedEvent += NavigationItemChangedEvent;
+ root.Add(whiteEditNavigation);
+
+ Controls.Navigation.NavigationItemData firstEditItem = new Controls.Navigation.NavigationItemData("WhiteEditModeFirstItem");
+ firstEditItem.Size2D = new Size2D(178, 184);
+ firstEditItem.Text = "1";
+ firstEditItem.SubText = "SELECTED";
+ whiteEditNavigation.AddItem(firstEditItem);
+
+ for (int i = 0; i < 2; i++)
+ {
+ Controls.Navigation.NavigationItemData editItem = new Controls.Navigation.NavigationItemData("WhiteEditModeItem");
+ editItem.Size2D = new Size2D(178, 108);
+ editItem.Text = "Text " + i;
+ editItem.IconURLSelector = new StringSelector
+ {
+ Pressed = itemPressImage[i],
+ Disabled = itemDimImage[i],
+ DisabledFocused = itemDimImage[i],
+ DisabledSelected = itemDimImage[i],
+ Other = itemNormalImage[i]
+ };
+ whiteEditNavigation.AddItem(editItem);
+ }
+ Controls.Navigation.NavigationItemData editLastItem = new Controls.Navigation.NavigationItemData("WhiteEditModeLastItem");
+ editLastItem.Size2D = new Size2D(178, 166);
+ editLastItem.Text = "Cancel";
+ editLastItem.IconURLSelector = new StringSelector
+ {
+ Pressed = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_press.png",
+ Disabled = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_dim.png",
+ DisabledFocused = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_dim.png",
+ DisabledSelected = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel_dim.png",
+ Other = CommonResource.GetResourcePath() + "2. Side Navigation/sidenavi_btn_cancel.png"
+ };
+ whiteEditNavigation.AddItem(editLastItem);
+ #endregion
+
+ //////////Black Edit Mode///////////////
+ #region BlackEditModeNavigation
+ blackEditNavigation = new Controls.Navigation("BlackEditMode");
+ blackEditNavigation.Size2D = new Size2D(178, 800);
+ blackEditNavigation.Position2D = new Position2D(700, 150);
+ blackEditNavigation.ItemChangedEvent += NavigationItemChangedEvent;
+ root.Add(blackEditNavigation);
+
+ Controls.Navigation.NavigationItemData firstEditItem2 = new Tizen.FH.NUI.Controls.Navigation.NavigationItemData("BlackEditModeFirstItem");
+ firstEditItem2.Size2D = new Size2D(178, 184);
+ firstEditItem2.Text = "1";
+ firstEditItem2.SubText = "SELECTED";
+ blackEditNavigation.AddItem(firstEditItem2);
+
+ for (int i = 0; i < 2; i++)
+ {
+ Controls.Navigation.NavigationItemData editItem = new Tizen.FH.NUI.Controls.Navigation.NavigationItemData("BlackEditModeItem");
+ editItem.Size2D = new Size2D(178, 108);
+ editItem.Text = "Text " + i;
+ editItem.IconURLSelector = new StringSelector
+ {
+ Pressed = itemBlackPressImage[i],
+ Disabled = itemBlackDimImage[i],
+ DisabledFocused = itemBlackDimImage[i],
+ DisabledSelected = itemBlackDimImage[i],
+ Other = itemBlackNormalImage[i]
+ };
+ blackEditNavigation.AddItem(editItem);
+ }
+ Controls.Navigation.NavigationItemData editLastItem2 = new Tizen.FH.NUI.Controls.Navigation.NavigationItemData("BlackEditModeLastItem");
+ editLastItem2.Size2D = new Size2D(178, 166);
+ editLastItem2.Text = "Cancel";
+ editLastItem2.IconURLSelector = new StringSelector
+ {
+ Pressed = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_press.png",
+ Disabled = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_dim.png",
+ DisabledFocused = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_dim.png",
+ DisabledSelected = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b_dim.png",
+ Other = CommonResource.GetResourcePath() + "2. Side Navigation/[Black ver.]/sidenavi_btn_cancel_b.png"
+ };
+ blackEditNavigation.AddItem(editLastItem2);
+ #endregion
+ }
+
+ private void NavigationItemChangedEvent(object sender, Controls.Navigation.ItemChangeEventArgs e)
+ {
+ //conditionNavigation.DeleteItem(0);
+ text.Text = "Create Navigation by style, Selected index from " + e.PreviousIndex + " to " + e.CurrentIndex;
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ if (text != null)
+ {
+ root.Remove(text);
+ text.Dispose();
+ text = null;
+ }
+
+ if (whiteNavigation != null)
+ {
+ root.Remove(whiteNavigation);
+ whiteNavigation.Dispose();
+ whiteNavigation = null;
+ }
+ if (blackNavigation != null)
+ {
+ root.Remove(blackNavigation);
+ blackNavigation.Dispose();
+ blackNavigation = null;
+ }
+ if (conditionNavigation != null)
+ {
+ root.Remove(conditionNavigation);
+ conditionNavigation.Dispose();
+ conditionNavigation = null;
+ }
+ if (blackConditionNavigation != null)
+ {
+ root.Remove(blackConditionNavigation);
+ blackConditionNavigation.Dispose();
+ blackConditionNavigation = null;
+ }
+
+ if (whiteEditNavigation != null)
+ {
+ root.Remove(whiteEditNavigation);
+ whiteEditNavigation.Dispose();
+ whiteEditNavigation = null;
+ }
+
+ if (blackEditNavigation != null)
+ {
+ root.Remove(blackEditNavigation);
+ blackEditNavigation.Dispose();
+ blackEditNavigation = null;
+ }
+
+ root.Dispose();
+ root = null;
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ using Controls = Tizen.FH.NUI.Controls;
+ public class Pagination : IExample
+ {
+ private SampleLayout root;
+
+ private Tizen.FH.NUI.Controls.Pagination DAPagination1;
+ private Tizen.FH.NUI.Controls.Pagination DAPagination2;
+ private Tizen.FH.NUI.Controls.Pagination DAPagination3;
+
+ private readonly int PAGE_COUNT = 14;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout(false);
+ root.HeaderText = "Pagination";
+
+ ///////////////////////////////////////////////Create by Style//////////////////////////////////////////////////////////
+ DAPagination1 = new Tizen.FH.NUI.Controls.Pagination("DefaultPagination");
+ DAPagination1.Name = "DAAppPagination1";
+ DAPagination1.Position2D = new Position2D(200, 50);
+ DAPagination1.Size2D = new Size2D(400, 30);
+ DAPagination1.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
+ DAPagination1.IndicatorCount = PAGE_COUNT;
+ DAPagination1.SelectedIndex = 0;
+ DAPagination1.Focusable = true;
+ root.Add(DAPagination1);
+
+ DAPagination1.SelectChangeEvent += DAPagination_SelectChangeEvent;
+
+ DAPagination2 = new Controls.Pagination("DefaultPagination");
+ DAPagination2.Name = "DAAppPagination2";
+ DAPagination2.Position2D = new Position2D(200, 150);
+ DAPagination2.Size2D = new Size2D(230, 30);
+ DAPagination2.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
+ DAPagination2.IndicatorCount = PAGE_COUNT;
+ DAPagination2.SelectedIndex = 1;
+ DAPagination2.Focusable = true;
+ root.Add(DAPagination2);
+
+ DAPagination2.SelectChangeEvent += DAPagination_SelectChangeEvent;
+
+
+ ///////////////////////////////////////////////Create by Properties//////////////////////////////////////////////////////////
+ DAPagination3 = new Tizen.FH.NUI.Controls.Pagination();
+ DAPagination3.Name = "DAAppPagination3";
+ DAPagination3.Position2D = new Position2D(200, 250);
+ DAPagination3.Size2D = new Size2D(400, 30);
+ DAPagination3.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
+ DAPagination3.IndicatorSize = new Size2D(26, 26);
+ DAPagination3.IndicatorBackgroundURL = CommonResource.GetResourcePath() + "9. Controller/pagination_ic_nor.png";
+ DAPagination3.IndicatorSelectURL = CommonResource.GetResourcePath() + "9. Controller/pagination_ic_sel.png";
+ DAPagination3.IndicatorSpacing = 8;
+ DAPagination3.ReturnArrowURLs = new Tizen.NUI.CommonUI.StringSelector
+ {
+ All = CommonResource.GetResourcePath() + "9. Controller/pagination_ic_return.png"
+ };
+ DAPagination3.ReturnArrowSize = new Size2D(26, 26);
+ DAPagination3.NextArrowURLs = new Tizen.NUI.CommonUI.StringSelector
+ {
+ All = CommonResource.GetResourcePath() + "9. Controller/pagination_ic_next.png"
+ };
+ DAPagination3.NextArrowSize = new Size2D(26, 26);
+ DAPagination3.IndicatorCount = PAGE_COUNT;
+ DAPagination3.SelectedIndex = 0;
+ DAPagination3.Focusable = true;
+ root.Add(DAPagination3);
+
+ DAPagination3.SelectChangeEvent += DAPagination_SelectChangeEvent;
+
+ }
+
+ private void DAPagination_SelectChangeEvent(object sender, Tizen.FH.NUI.Controls.Pagination.SelectChangeEventArgs e)
+ {
+ Tizen.FH.NUI.Controls.Pagination pagination = sender as Tizen.FH.NUI.Controls.Pagination;
+
+ Console.WriteLine($"{pagination?.Name} Select index changed from {e.PreviousIndex} to {e.CurrentIndex}");
+ }
+
+ //private void Window_KeyEvent(object sender, Window.KeyEventArgs e)
+ //{
+ // if (e.Key.State == Key.StateType.Down)
+ // {
+ // if (e.Key.KeyPressedName == "Left")
+ // {
+ // if (DAPagination1.SelectedIndex > 0)
+ // {
+ // DAPagination1.SelectedIndex = DAPagination1.SelectedIndex - 1;
+ // }
+ // if (DAPagination2.SelectedIndex > 0)
+ // {
+ // DAPagination2.SelectedIndex = DAPagination2.SelectedIndex - 1;
+ // }
+ // if (DAPagination3.SelectedIndex > 0)
+ // {
+ // DAPagination3.SelectedIndex = DAPagination3.SelectedIndex - 1;
+ // }
+ // }
+ // else if (e.Key.KeyPressedName == "Right")
+ // {
+ // if (DAPagination1.SelectedIndex < DAPagination1.IndicatorCount - 1)
+ // {
+ // DAPagination1.SelectedIndex = DAPagination1.SelectedIndex + 1;
+ // }
+ // if (DAPagination2.SelectedIndex < DAPagination2.IndicatorCount - 1)
+ // {
+ // DAPagination2.SelectedIndex = DAPagination2.SelectedIndex + 1;
+ // }
+ // if (DAPagination3.SelectedIndex < DAPagination3.IndicatorCount - 1)
+ // {
+ // DAPagination3.SelectedIndex = DAPagination3.SelectedIndex + 1;
+ // }
+ // }
+ // }
+ //}
+
+ public void Deactivate()
+ {
+ root.Remove(DAPagination1);
+ root.Remove(DAPagination2);
+ root.Remove(DAPagination3);
+
+ DAPagination1.Dispose();
+ DAPagination2.Dispose();
+ DAPagination3.Dispose();
+
+ root.Dispose();
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+ public class Popup : IExample
+ {
+ private SampleLayout root;
+ private static readonly Size2D Padding = new Size2D(50, 50);
+
+ private Tizen.NUI.CommonUI.Popup popup = null;
+ private TextLabel contentText = null;
+ private Tizen.NUI.CommonUI.Button[] button = new Tizen.NUI.CommonUI.Button[3];
+ private int num = 3;
+
+ private static string[] mode = new string[]
+ {
+ "No Title",
+ "No title with No button",
+ "Title with button",
+ };
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "Popup";
+
+ CreateBasePopup();
+
+ for (int i = 0; i < num; i++)
+ {
+ button[i] = new Tizen.NUI.CommonUI.Button("ServiceButton");
+ button[i].Size2D = new Size2D(240, 80);
+ button[i].Position2D = new Position2D(160 + i * 260, 700);
+ button[i].Text = mode[i];
+ button[i].PointSize = 11;
+ button[i].ClickEvent += ButtonClickEvent;
+ root.Add(button[i]);
+ }
+ }
+
+ private void CreateBasePopup()
+ {
+ DestoryPopup();
+
+ popup = new Tizen.NUI.CommonUI.Popup("Popup");
+ popup.Size2D = new Size2D(1032, 500);
+ popup.Position2D = new Position2D(24, 50);
+ popup.TitleText = "Popup Title";
+ popup.ButtonCount = 2;
+ popup.SetButtonText(0, "Yes");
+ popup.SetButtonText(1, "Exit");
+ popup.PopupButtonClickedEvent += PopupButtonClickedEvent;
+
+ contentText = new TextLabel();
+ contentText.Size2D = new Size2D(800, 200);
+ contentText.PointSize = 20;
+ contentText.Text = "Content area";
+ contentText.HorizontalAlignment = HorizontalAlignment.Begin;
+ contentText.VerticalAlignment = VerticalAlignment.Center;
+ popup.ContentView.Add(contentText);
+ popup.ContentView.BackgroundColor = new Color(0, 0, 0, 0.1f);
+ root.Add(popup);
+ }
+
+ private void CreatePopupWithoutTitle()
+ {
+ DestoryPopup();
+
+ popup = new Tizen.NUI.CommonUI.Popup("Popup");
+ popup.Size2D = new Size2D(1032, 500);
+ popup.Position2D = new Position2D(24, 50);
+ popup.ButtonCount = 2;
+ popup.SetButtonText(0, "Yes");
+ popup.SetButtonText(1, "Exit");
+ popup.PopupButtonClickedEvent += PopupButtonClickedEvent;
+
+ contentText = new TextLabel();
+ contentText.WidthResizePolicy = ResizePolicyType.FillToParent;
+ contentText.HeightResizePolicy = ResizePolicyType.FillToParent;
+ contentText.PointSize = 20;
+ contentText.Text = "Content area in center";
+ contentText.HorizontalAlignment = HorizontalAlignment.Center;
+ contentText.VerticalAlignment = VerticalAlignment.Center;
+ popup.ContentView.Add(contentText);
+ popup.ContentView.BackgroundColor = new Color(0, 0, 0, 0.1f);
+ root.Add(popup);
+ }
+
+ private void CreatePopupWithoutTitleAndButton()
+ {
+ DestoryPopup();
+
+ popup = new Tizen.NUI.CommonUI.Popup("Popup");
+ popup.Size2D = new Size2D(1032, 200);
+ popup.Position2D = new Position2D(24, 50);
+
+ contentText = new TextLabel();
+ contentText.WidthResizePolicy = ResizePolicyType.FillToParent;
+ contentText.HeightResizePolicy = ResizePolicyType.FillToParent;
+ contentText.PointSize = 20;
+ contentText.Text = "Content area in center";
+ contentText.HorizontalAlignment = HorizontalAlignment.Center;
+ contentText.VerticalAlignment = VerticalAlignment.Center;
+ popup.ContentView.Add(contentText);
+ popup.ContentView.BackgroundColor = new Color(0, 0, 0, 0.1f);
+ root.Add(popup);
+ }
+
+ private void PopupButtonClickedEvent(object sender, Tizen.NUI.CommonUI.Popup.ButtonClickEventArgs e)
+ {
+ contentText.Text = "Button index " + e.ButtonIndex + " is clicked";
+ }
+
+ private void ButtonClickEvent(object sender, Tizen.NUI.CommonUI.Button.ClickEventArgs e)
+ {
+ Tizen.NUI.CommonUI.Button btn = sender as Tizen.NUI.CommonUI.Button;
+ if (button[0] == btn)
+ {
+ CreatePopupWithoutTitle();
+ }
+ else if (button[1] == btn)
+ {
+ CreatePopupWithoutTitleAndButton();
+ }
+ else if (button[2] == btn)
+ {
+ CreateBasePopup();
+ }
+ }
+
+ private void DestoryPopup()
+ {
+ if (popup != null)
+ {
+ if (contentText != null)
+ {
+ popup.ContentView.Remove(contentText);
+ contentText.Dispose();
+ contentText = null;
+ }
+
+ root.Remove(popup);
+ popup.Dispose();
+ popup = null;
+ }
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ DestoryPopup();
+
+ for (int i = 0; i < num; i++)
+ {
+ if (button[i] != null)
+ {
+ root.Remove(button[i]);
+ button[i].Dispose();
+ button[i] = null;
+ }
+ }
+
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using Tizen.FH.NUI.Controls;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ public class Progress : IExample
+ {
+ private Tizen.NUI.CommonUI.Button button1, button2;
+ private Tizen.NUI.CommonUI.Progress progressBar1;
+ private SampleLayout root;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ Window window = Window.Instance;
+ root = new SampleLayout();
+ root.HeaderText = "Progress";
+
+ button1 = new Tizen.NUI.CommonUI.Button("BasicButton");
+ button1.BackgroundColor = Color.Green;
+ button1.Position2D = new Position2D(300, 200);
+ button1.Size2D = new Size2D(80, 80);
+ button1.Text = "+";
+ root.Add(button1);
+ button1.Focusable = true;
+ button1.ClickEvent += bar1Add;
+
+ button2 = new Tizen.NUI.CommonUI.Button("BasicButton");
+ button2.BackgroundColor = Color.Green;
+ button2.Position2D = new Position2D(700, 200);
+ button2.Size2D = new Size2D(80, 80);
+ button2.Text = "-";
+ root.Add(button2);
+ button2.Focusable = true;
+ button2.ClickEvent += bar1Minus;
+
+ progressBar1 = new Tizen.NUI.CommonUI.Progress("Progressbar");
+ progressBar1.Position2D = new Position2D(300, 100);
+ progressBar1.Size2D = new Size2D(500, 4);
+ progressBar1.MaxValue = 100;
+ progressBar1.MinValue = 0;
+ progressBar1.CurrentValue = 45;
+ root.Add(progressBar1);
+
+ window.Add(root);
+ FocusManager.Instance.SetCurrentFocusView(button1);
+
+ }
+
+ private void bar1Add(object sender, global::System.EventArgs e)
+ {
+ progressBar1.CurrentValue++;
+ }
+ private void bar1Minus(object sender, global::System.EventArgs e)
+ {
+ progressBar1.CurrentValue--;
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ Window.Instance.Remove(root);
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+ public class RadioButton : IExample
+ {
+ private SampleLayout root;
+
+ private static readonly int Height = 150;
+ private static readonly int Width = 216;
+
+ private uint colNum;
+ private uint rowNum;
+
+ private Tizen.NUI.CommonUI.RadioButtonGroup[] group;
+
+ private static string[] styles = new string[]
+ {
+ "enabled",
+ "enabled",
+ "disabled",
+ "disabledSelected",
+ };
+
+ private static string[] applications = new string[]
+ {
+ "Group1",
+ "Group2",
+ "Group3",
+ "Group4",
+ };
+
+ private TableView table;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "RadioButton";
+
+ if (styles.Length == 0 || applications.Length == 0)
+ {
+ return;
+ }
+ colNum = (uint)applications.Length + 1;
+ rowNum = (uint)styles.Length + 1;
+
+ table = new TableView(rowNum, colNum)
+ {
+ Size2D = new Size2D(1920, 1080),
+ };
+ for (uint i = 1; i < rowNum; i++)
+ {
+ TextLabel text = new TextLabel();
+ text.Size2D = new Size2D(Width, Height);
+ text.PointSize = 12;
+ text.Focusable = true;
+ text.HorizontalAlignment = HorizontalAlignment.Center;
+ text.VerticalAlignment = VerticalAlignment.Center;
+ text.Text = styles[i - 1];
+ table.AddChild(text, new TableView.CellPosition(i, 0));
+ }
+
+ for (uint i = 1; i < colNum; i++)
+ {
+ TextLabel text = new TextLabel();
+ text.Size2D = new Size2D(Width, Height);
+ text.PointSize = 12;
+ text.HorizontalAlignment = HorizontalAlignment.Center;
+ text.VerticalAlignment = VerticalAlignment.Center;
+ text.Text = applications[i - 1];
+ text.Focusable = true;
+ table.AddChild(text, new TableView.CellPosition(0, i));
+ }
+
+ group = new RadioButtonGroup[4];
+ for (uint j = 1; j < colNum; j++)
+ {
+ group[j - 1] = new RadioButtonGroup();
+ for (uint i = 1; i < rowNum; i++)
+ {
+ Tizen.NUI.CommonUI.RadioButton radioButton = new Tizen.NUI.CommonUI.RadioButton("RadioButton");
+ radioButton.Size2D = new Size2D(48, 48);
+ if (i == 3)
+ {
+ radioButton.IsEnabled = false;
+ }
+ else if (i == 4)
+ {
+ radioButton.IsEnabled = false;
+ radioButton.IsSelected = true;
+ }
+ else
+ {
+ group[j - 1].Add(radioButton);
+ }
+ radioButton.Focusable = true;
+ //radioButton.Text = radioButton.IsSelected.ToString();
+ radioButton.SelectedEvent += RadioButtonSelectedEvent;
+ table.AddChild(radioButton, new TableView.CellPosition(i, j));
+ }
+ }
+
+ for (uint i = 0; i < rowNum; i++)
+ {
+ table.SetFixedHeight(i, Height);
+ for (uint j = 0; j < colNum; j++)
+ {
+ table.SetFixedWidth(j, Width);
+ table.SetCellAlignment(new TableView.CellPosition(i, j), HorizontalAlignmentType.Center, VerticalAlignmentType.Center);
+ }
+ }
+ root.Add(table);
+ }
+
+ private void RadioButtonSelectedEvent(object sender, SelectButton.SelectEventArgs e)
+ {
+ Tizen.NUI.CommonUI.RadioButton obj = sender as Tizen.NUI.CommonUI.RadioButton;
+ for (uint i = 0; i < rowNum; i++)
+ {
+ for (uint j = 0; j < colNum; j++)
+ {
+ Tizen.NUI.CommonUI.RadioButton child = table.GetChildAt(new TableView.CellPosition(i, j)) as Tizen.NUI.CommonUI.RadioButton;
+ if (child != null)
+ {
+ //child.Text = child.IsSelected.ToString();
+ }
+ }
+ }
+ }
+
+ public void Deactivate()
+ {
+ for (uint i = 0; i < rowNum; i++)
+ {
+ for (uint j = 0; j < colNum; j++)
+ {
+ View child = table.GetChildAt(new TableView.CellPosition(i, j));
+ if (child != null)
+ {
+ table.RemoveChildAt(new TableView.CellPosition(i, j));
+ child.Dispose();
+ }
+ }
+ }
+
+ if (root != null)
+ {
+ if (table != null)
+ {
+ root.Remove(table);
+ table.Dispose();
+ }
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+ public class Scrollbar : IExample
+ {
+ private TextLabel board1, board2;
+ private Tizen.NUI.CommonUI.Button button1, button2, button3, button4;
+ private ScrollBar scrollBar1, scrollBar2;
+ private ScrollBar daScrollBar1, daScrollBar2;
+ private SampleLayout root;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ Window window = Window.Instance;
+
+ root = new SampleLayout(false);
+ root.HeaderText = "Scrollbar";
+
+ CreateBoardAndButtons();
+
+ daScrollBar1 = new ScrollBar("DAScrollbar");
+ daScrollBar1.Position2D = new Position2D(100, 200);
+ daScrollBar1.Size2D = new Size2D(300, 4);
+ daScrollBar1.MaxValue = (int)daScrollBar1.SizeWidth / 10;
+ daScrollBar1.MinValue = 0;
+ daScrollBar1.ThumbSize = new Size2D(30, 4);
+ daScrollBar1.CurrentValue = 0;
+ daScrollBar1.Direction = ScrollBar.DirectionType.Horizontal;
+ root.Add(daScrollBar1);
+
+ daScrollBar2 = new ScrollBar("DAScrollbar");
+ daScrollBar2.Position2D = new Position2D(500, 100);
+ daScrollBar2.Size2D = new Size2D(4, 300);
+ daScrollBar2.MaxValue = (int)daScrollBar1.SizeWidth / 10;
+ daScrollBar2.MinValue = 0;
+ daScrollBar2.ThumbSize = new Size2D(4, 30);
+ daScrollBar2.CurrentValue = 0;
+ daScrollBar2.Direction = ScrollBar.DirectionType.Vertical;
+ root.Add(daScrollBar2);
+
+ scrollBar1 = new ScrollBar();
+ scrollBar1.Position2D = new Position2D(100, 300);
+ scrollBar1.Size2D = new Size2D(300, 4);
+ scrollBar1.TrackColor = Color.Green;
+ scrollBar1.MaxValue = (int)scrollBar1.SizeWidth / 10;
+ scrollBar1.MinValue = 0;
+ scrollBar1.ThumbSize = new Size2D(30, 4);
+ scrollBar1.CurrentValue = 0;
+ scrollBar1.ThumbColor = Color.Black;
+ root.Add(scrollBar1);
+
+ ScrollBarAttributes attr = new ScrollBarAttributes
+ {
+ TrackImageAttributes = new ImageAttributes
+ {
+ BackgroundColor = new ColorSelector
+ {
+ All = new Color(0.43f, 0.43f, 0.43f, 0.1f),
+ }
+ },
+ ThumbImageAttributes = new ImageAttributes
+ {
+ BackgroundColor = new ColorSelector
+ {
+ All = new Color(0.0f, 0.0f, 0.0f, 0.2f),
+ }
+ },
+
+ };
+
+ scrollBar2 = new ScrollBar(attr);
+ scrollBar2.Position2D = new Position2D(100, 400);
+ scrollBar2.Size2D = new Size2D(300, 4);
+ scrollBar2.MaxValue = (int)scrollBar2.SizeWidth / 10;
+ scrollBar2.MinValue = 0;
+ scrollBar2.ThumbSize = new Size2D(30, 4);
+ scrollBar2.CurrentValue = 0;
+
+ root.Add(scrollBar2);
+
+ window.Add(root);
+
+ FocusManager.Instance.SetCurrentFocusView(button1);
+ }
+
+ private void CreateBoardAndButtons()
+ {
+ board1 = new TextLabel();
+ board1.Size2D = new Size2D(200, 70);
+ board1.Position2D = new Position2D(100, 0);
+ board1.PointSize = 14;
+ board1.HorizontalAlignment = HorizontalAlignment.Center;
+ board1.VerticalAlignment = VerticalAlignment.Center;
+ board1.BackgroundColor = Color.Magenta;
+ board1.Text = "Honrizal";
+ root.Add(board1);
+ board1.Focusable = true;
+
+ board2 = new TextLabel();
+ board2.Size2D = new Size2D(200, 70);
+ board2.Position2D = new Position2D(450, 0);
+ board2.PointSize = 30;
+ board2.HorizontalAlignment = HorizontalAlignment.Center;
+ board2.VerticalAlignment = VerticalAlignment.Center;
+ board2.BackgroundColor = Color.Magenta;
+ board2.Text = "vertical";
+ root.Add(board2);
+ board2.Focusable = true;
+
+ button1 = new Tizen.NUI.CommonUI.Button();
+ button1.PointSize = 14;
+ button1.BackgroundColor = Color.Green;
+ button1.Position2D = new Position2D(100, 500);
+ button1.Size2D = new Size2D(80, 80);
+ button1.Text = "+";
+ root.Add(button1);
+ button1.Focusable = true;
+ button1.ClickEvent += Scroll1Add;
+
+ button2 = new Tizen.NUI.CommonUI.Button();
+ button2.PointSize = 14;
+ button2.BackgroundColor = Color.Green;
+ button2.Position2D = new Position2D(200, 500);
+ button2.Size2D = new Size2D(80, 80);
+ button2.Text = "-";
+ root.Add(button2);
+ button2.Focusable = true;
+ button2.ClickEvent += Scroll1Minus;
+
+ button3 = new Tizen.NUI.CommonUI.Button();
+ button3.PointSize = 14;
+ button3.BackgroundColor = Color.Green;
+ button3.Position2D = new Position2D(450, 500);
+ button3.Size2D = new Size2D(80, 80);
+ button3.Text = "+";
+ root.Add(button3);
+ button3.Focusable = true;
+ button3.ClickEvent += Scroll2Add;
+
+ button4 = new Tizen.NUI.CommonUI.Button();
+ button4.PointSize = 14;
+ button4.BackgroundColor = Color.Green;
+ button4.Position2D = new Position2D(550, 500);
+ button4.Size2D = new Size2D(80, 80);
+ button4.Text = "-";
+ root.Add(button4);
+ button4.Focusable = true;
+ button4.ClickEvent += Scroll2Minus;
+ }
+
+ private void Scroll1Add(object sender, global::System.EventArgs e)
+ {
+ daScrollBar1.CurrentValue++;
+ }
+ private void Scroll1Minus(object sender, global::System.EventArgs e)
+ {
+ daScrollBar1.CurrentValue--;
+ }
+ private void Scroll2Add(object sender, global::System.EventArgs e)
+ {
+ daScrollBar2.CurrentValue++;
+ }
+ private void Scroll2Minus(object sender, global::System.EventArgs e)
+ {
+ daScrollBar2.CurrentValue--;
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ Window.Instance.Remove(root);
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using System;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ using FH = Tizen.FH;
+ public class SearchBar : IExample
+ {
+ private SampleLayout rootView = null;
+ private Tizen.FH.NUI.Controls.SearchBar searchBar = null;
+
+ private Tizen.NUI.CommonUI.Button button;
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ CreateRootView();
+ CreateSearchBar();
+ button = new Tizen.NUI.CommonUI.Button();
+ button.PointSize = 14;
+ button.Size2D = new Size2D(300, 80);
+ button.BackgroundColor = Color.Green;
+ button.Position2D = new Position2D(40, 400);
+ button.Text = "LTR/RTL";
+ button.ClickEvent += OnLayoutChanged;
+ rootView.Add(button);
+ Window.Instance.KeyEvent += OnWindowsKeyEvent;
+ }
+ private void OnLayoutChanged(object sender, global::System.EventArgs e)
+ {
+ if (searchBar.LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ searchBar.LayoutDirection = ViewLayoutDirectionType.RTL;
+ }
+ else
+ {
+ searchBar.LayoutDirection = ViewLayoutDirectionType.LTR;
+
+ }
+ }
+ private void CreateRootView()
+ {
+ rootView = new SampleLayout();
+ rootView.HeaderText = "SearchBar";
+ }
+
+ private void CreateSearchBar()
+ {
+ searchBar = new FH.NUI.Controls.SearchBar("DefaultSearchBar");
+ searchBar.HintText = "DefaultSearchBar";
+ searchBar.ResultListHeight = 536;
+ rootView.Add(searchBar);
+ searchBar.SearchButtonClickEvent += OnSearchButtonClickEvent;
+ searchBar.CancelButtonClickEvent += OnCancelButtonClickEvent;
+ rootView.AttachSearchBar(searchBar);
+ }
+
+ private void OnWindowsKeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ if (e.Key.KeyPressedName == "Left")
+ {
+ }
+ else if (e.Key.KeyPressedName == "Right")
+ {
+ }
+ }
+ }
+
+ private void OnCancelButtonClickEvent(object sender, Tizen.FH.NUI.Controls.InputField.ButtonClickArgs args)
+ {
+ if (sender is Tizen.FH.NUI.Controls.SearchBar)
+ {
+ Tizen.FH.NUI.Controls.SearchBar searchBarObj = sender as Tizen.FH.NUI.Controls.SearchBar;
+ Console.WriteLine("-------, name: " + searchBarObj.Name + ", args.State = " + args.State);
+ if (args.State == Tizen.FH.NUI.Controls.InputField.ButtonClickState.BounceUp)
+ {
+ //if (searchBarObj.Text == "ERROR")
+ //{
+ searchBarObj.TextColor = Color.Black;
+ //}
+ searchBarObj.Text = "";
+ searchBarObj.ShrinkSearchList();
+ }
+ }
+ }
+
+ private void OnSearchButtonClickEvent(object sender, Tizen.FH.NUI.Controls.InputField.ButtonClickArgs args)
+ {
+ if (sender is Tizen.FH.NUI.Controls.SearchBar)
+ {
+ Tizen.FH.NUI.Controls.SearchBar searchBarObj = sender as Tizen.FH.NUI.Controls.SearchBar;
+ Console.WriteLine("-------, name: " + searchBarObj.Name + ", args.State = " + args.State);
+ if (args.State == Tizen.FH.NUI.Controls.InputField.ButtonClickState.BounceUp)
+ {
+ if (searchBarObj.Text.Length > 10)
+ {
+ searchBarObj.TextColor = Color.Red;
+ }
+ else
+ {
+ searchBarObj.ExpandSearchList();
+ }
+ }
+
+ }
+ }
+
+ public void Deactivate()
+ {
+ Window window = Window.Instance;
+
+ if (searchBar != null)
+ {
+ searchBar.SearchButtonClickEvent -= OnSearchButtonClickEvent;
+ searchBar.CancelButtonClickEvent -= OnCancelButtonClickEvent;
+ rootView.Remove(searchBar);
+ searchBar.Dispose();
+ searchBar = null;
+ }
+
+ if (button != null)
+ {
+ rootView.Remove(button);
+ button.Dispose();
+ button = null;
+ }
+ if (rootView != null)
+ {
+ rootView.Dispose();
+ rootView = null;
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+using System;
+using Tizen.NUI;
+
+namespace NuiCommonUiSamples
+{
+ public class Slider : IExample
+ {
+ private SampleLayout root;
+ private TextLabel inforText;
+ private Tizen.NUI.CommonUI.Slider[] slider_da;
+ private const int MIN_VALUE = 0;
+ private const int MAX_VALUE = 100;
+ private const int SR_COUNT = 2;
+ private const int DA_COUNT = 4;
+
+ private static readonly string[] styleName = new string[2] {
+ "DefaultSlider",
+ "TextSlider" };
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "Slider";
+ CreateInforText();
+ CreateDA();
+ }
+
+ private void CreateInforText()
+ {
+ inforText = new TextLabel();
+ inforText.Size2D = new Size2D(1040, 60);
+ inforText.Position2D = new Position2D(20, 10);
+ inforText.PointSize = 20;
+ inforText.TextColor = Color.Blue;
+ inforText.BackgroundColor = new Color(0.8f, 0.8f, 0.8f, 1.0f);
+ inforText.HorizontalAlignment = HorizontalAlignment.Begin;
+ inforText.VerticalAlignment = VerticalAlignment.Center;
+ root.Add(inforText);
+ }
+
+ private void CreateDA()
+ {
+ if (slider_da == null)
+ {
+ slider_da = new Tizen.NUI.CommonUI.Slider[DA_COUNT];
+ }
+
+ slider_da[0] = CreateDA(styleName[0], 40, 100, 1000, 50, 20, Tizen.NUI.CommonUI.Slider.DirectionType.Horizontal);
+ slider_da[1] = CreateDA(styleName[0], 300, 250, 50, 400, 20, Tizen.NUI.CommonUI.Slider.DirectionType.Vertical);
+
+ slider_da[2] = CreateDA(styleName[1], 40, 200, 1000, 50, 30, Tizen.NUI.CommonUI.Slider.DirectionType.Horizontal);
+ slider_da[2].LowIndicatorTextContent = "SubText";
+ slider_da[2].LowIndicatorSize = new Size2D(200, 80);
+
+ slider_da[3] = CreateDA(styleName[1], 600, 250, 50, 400, 30, Tizen.NUI.CommonUI.Slider.DirectionType.Vertical);
+ slider_da[3].LowIndicatorTextContent = "SubText";
+ slider_da[3].LowIndicatorSize = new Size2D(200, 80);
+
+ }
+
+ private Tizen.NUI.CommonUI.Slider CreateDA(string style, int posX, int posY, int w, int h, int curValue, Tizen.NUI.CommonUI.Slider.DirectionType dir)
+ {
+ Tizen.NUI.CommonUI.Slider source = new Tizen.NUI.CommonUI.Slider(style);
+ source.Name = style;
+ source.Direction = dir;
+ root.Add(source);
+ source.Focusable = true;
+ source.MinValue = MIN_VALUE;
+ source.MaxValue = MAX_VALUE;
+ source.StateChangedEvent += OnStateChanged;
+ source.ValueChangedEvent += OnValueChanged;
+
+ source.Position2D = new Position2D(posX, posY);
+ source.Size2D = new Size2D(w, h);
+ source.CurrentValue = curValue;
+ return source;
+ }
+
+ public void Deactivate()
+ {
+ Window window = Window.Instance;
+
+ if (inforText != null)
+ {
+ root.Remove(inforText);
+ inforText.Dispose();
+ inforText = null;
+ }
+
+ DestroyDA();
+ root.Dispose();
+ }
+
+ private void DestroyDA()
+ {
+ if (slider_da != null)
+ {
+ for (int i = 0; i < DA_COUNT; ++i)
+ {
+ if (slider_da[i] != null)
+ {
+ slider_da[i].StateChangedEvent -= OnStateChanged;
+ slider_da[i].ValueChangedEvent -= OnValueChanged;
+ root.Remove(slider_da[i]);
+ slider_da[i].Dispose();
+ slider_da[i] = null;
+ }
+ }
+ slider_da = null;
+ }
+ }
+
+ private void OnValueChanged(object sender, Tizen.NUI.CommonUI.Slider.ValueChangedArgs args)
+ {
+ Console.WriteLine("args.CurrentValue = " + args.CurrentValue);
+ if (sender is Tizen.NUI.CommonUI.Slider)
+ {
+ Tizen.NUI.CommonUI.Slider slider = sender as Tizen.NUI.CommonUI.Slider;
+ if (slider != null)
+ {
+ inforText.Text = "name = " + slider.Name + ", currentValue = " + args.CurrentValue;
+ }
+ }
+ else if (sender is Tizen.NUI.CommonUI.Slider)
+ {
+ Tizen.NUI.CommonUI.Slider slider = sender as Tizen.NUI.CommonUI.Slider;
+ if (slider != null)
+ {
+ inforText.Text = "name = " + slider.Name + ", currentValue = " + args.CurrentValue;
+ }
+ }
+ }
+
+ private void OnStateChanged(object sender, Tizen.NUI.CommonUI.Slider.StateChangedArgs args)
+ {
+ Console.WriteLine("args.CurrentState = " + args.CurrentState);
+ if (sender is Tizen.NUI.CommonUI.Slider)
+ {
+ Tizen.NUI.CommonUI.Slider slider = sender as Tizen.NUI.CommonUI.Slider;
+ if (slider != null)
+ {
+ //if (args.CurrentState == States.Normal)
+ //{
+ // slider_sr[0].ThumbImageURL = "*DemoRes*/images/FH3/9. Controller/controller_btn_slide_handler_normal.png";
+ //}
+ //else if (args.CurrentState == States.Focused || args.CurrentState == States.Pressed)
+ //{
+ // slider_sr[0].ThumbImageURL = "*DemoRes*/images/FH3/9. Controller/controller_btn_slide_handler_press.png";
+ //}
+ }
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+ public class Switch : IExample
+ {
+ private SampleLayout root;
+
+ private static readonly int Height = 150;
+ private static readonly int Width = 216;
+
+ private uint colNum;
+ private uint rowNum;
+
+ private static string[] styles = new string[]
+ {
+ "enabled",
+ "enabled",
+ "disabled",
+ "disabledSelected",
+ };
+
+ private static string[] applications = new string[]
+ {
+ "Group1",
+ "Group2",
+ "Group3",
+ "Group4",
+ };
+
+ private TableView table;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "Switch";
+
+ if (styles.Length == 0 || applications.Length == 0)
+ {
+ return;
+ }
+ colNum = (uint)applications.Length + 1;
+ rowNum = (uint)styles.Length + 1;
+
+ table = new TableView(rowNum, colNum)
+ {
+ Size2D = new Size2D(1080, 1920),
+ };
+ for (uint i = 1; i < rowNum; i++)
+ {
+ TextLabel text = new TextLabel();
+ text.Size2D = new Size2D(Width, 150);
+ text.PointSize = 12;
+ text.Focusable = true;
+ text.HorizontalAlignment = HorizontalAlignment.Center;
+ text.VerticalAlignment = VerticalAlignment.Center;
+ text.Text = styles[i - 1];
+ table.AddChild(text, new TableView.CellPosition(i, 0));
+ }
+
+ for (uint i = 1; i < colNum; i++)
+ {
+ TextLabel text = new TextLabel();
+ text.Size2D = new Size2D(Width, 150);
+ text.PointSize = 12;
+ text.HorizontalAlignment = HorizontalAlignment.Center;
+ text.VerticalAlignment = VerticalAlignment.Center;
+ text.Text = applications[i - 1];
+ text.Focusable = true;
+ table.AddChild(text, new TableView.CellPosition(0, i));
+ }
+
+ for (uint j = 1; j < colNum; j++)
+ {
+ for (uint i = 1; i < rowNum; i++)
+ {
+ Tizen.NUI.CommonUI.Switch switchControl = new Tizen.NUI.CommonUI.Switch("Switch");
+ switchControl.Size2D = new Size2D(96, 60);
+ if (i == 3)
+ {
+ switchControl.IsEnabled = false;
+ }
+ else if (i == 4)
+ {
+ switchControl.IsEnabled = false;
+ switchControl.IsSelected = true;
+ }
+ table.AddChild(switchControl, new TableView.CellPosition(i, j));
+ }
+ }
+
+ for (uint i = 0; i < rowNum; i++)
+ {
+ table.SetFixedHeight(i, Height);
+ for (uint j = 0; j < colNum; j++)
+ {
+ table.SetFixedWidth(j, Width);
+ table.SetCellAlignment(new TableView.CellPosition(i, j), HorizontalAlignmentType.Center, VerticalAlignmentType.Center);
+ }
+ }
+
+ root.Add(table);
+ }
+
+ public void Deactivate()
+ {
+ for (uint i = 0; i < rowNum; i++)
+ {
+ for (uint j = 0; j < colNum; j++)
+ {
+ View child = table.GetChildAt(new TableView.CellPosition(i, j));
+ if (child != null)
+ {
+ table.RemoveChildAt(new TableView.CellPosition(i, j));
+ child.Dispose();
+ }
+ }
+ }
+
+ if (root != null)
+ {
+ if (table != null)
+ {
+ root.Remove(table);
+ table.Dispose();
+ }
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+ public class Tab : IExample
+ {
+ private SampleLayout root;
+ private Tizen.NUI.CommonUI.Tab tab = null;
+ private Tizen.NUI.CommonUI.Button[] button = new Tizen.NUI.CommonUI.Button[2];
+ private int num = 2;
+
+ private static string[] mode = new string[]
+ {
+ "LargeTab",
+ "Small Tab",
+ };
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "Tab";
+
+ tab = new Tizen.NUI.CommonUI.Tab("Tab");
+ tab.IsNatureTextWidth = false;
+ tab.Size2D = new Size2D(1080, 108);
+ tab.Position2D = new Position2D(0, 300);
+ tab.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.5f);
+ root.Add(tab);
+
+ for (int i = 0; i < 3; i++)
+ {
+ Tizen.NUI.CommonUI.Tab.TabItemData item = new Tizen.NUI.CommonUI.Tab.TabItemData();
+ item.Text = "Tab " + i;
+ if (i == 1)
+ {
+ item.Text = "Long long Tab " + i;
+ }
+ tab.AddItem(item);
+ }
+
+ for (int i = 0; i < num; i++)
+ {
+ button[i] = new Tizen.NUI.CommonUI.Button("ServiceButton");
+ button[i].Size2D = new Size2D(240, 80);
+ button[i].Position2D = new Position2D(280 + i * 260, 700);
+ button[i].Text = mode[i];
+ button[i].ClickEvent += ButtonClickEvent;
+ root.Add(button[i]);
+ }
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ if (tab != null)
+ {
+ root.Remove(tab);
+ tab.Dispose();
+ tab = null;
+ }
+
+ for (int i = 0; i < num; i++)
+ {
+ if (button[i] != null)
+ {
+ root.Remove(button[i]);
+ button[i].Dispose();
+ button[i] = null;
+ }
+ }
+
+ root.Dispose();
+ }
+ }
+
+ private void ButtonClickEvent(object sender, Tizen.NUI.CommonUI.Button.ClickEventArgs e)
+ {
+ Tizen.NUI.CommonUI.Button btn = sender as Tizen.NUI.CommonUI.Button;
+ if (button[0] == btn)
+ {
+ tab.IsNatureTextWidth = false;
+ }
+ else if (button[1] == btn)
+ {
+ tab.IsNatureTextWidth = true;
+ }
+
+ //tab.DeleteItem(0);
+
+ //Tab.TabItemData item = new Tab.TabItemData();
+ //item.Text = "insert Tab ";
+ //tab.InsertItem(item, 1);
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.CommonUI;
+
+namespace NuiCommonUiSamples
+{
+ using Controls = Tizen.FH.NUI.Controls;
+ public class TimePicker : IExample
+ {
+ private SampleLayout root;
+ private Tizen.NUI.CommonUI.Popup popup = null;
+ private Tizen.FH.NUI.Controls.TimePicker timePicker = null;
+ private Tizen.NUI.CommonUI.Button[] button = new Tizen.NUI.CommonUI.Button[3];
+ private int num = 3;
+
+ private static string[] mode = new string[]
+ {
+ "TimePicker",
+ "TimePicker with AMPM",
+ "TimePicker with Repeat",
+ };
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout();
+ root.HeaderText = "Time Picker";
+
+ CreateBaseTimePicker();
+
+ for (int i = 0; i < num; i++)
+ {
+ button[i] = new Tizen.NUI.CommonUI.Button("ServiceButton");
+ button[i].Size2D = new Size2D(240, 80);
+ button[i].Position2D = new Position2D(160 + i * 260, 1350);
+ button[i].Text = mode[i];
+ button[i].PointSize = 11;
+ button[i].ClickEvent += ButtonClickEvent;
+ root.Add(button[i]);
+ }
+ }
+
+ private void CreateBaseTimePicker()
+ {
+ DestoryTimePicker();
+ popup = new Tizen.NUI.CommonUI.Popup("Popup");
+ popup.Size2D = new Size2D(1032, 776);
+ popup.Position2D = new Position2D(24, 50);
+ popup.TitleText = "Timer 01";
+ popup.ButtonCount = 2;
+ popup.SetButtonText(0, "Cancel");
+ popup.SetButtonText(1, "OK");
+ popup.PopupButtonClickedEvent += PopupButtonClickedEvent;
+ root.Add(popup);
+
+ timePicker = new Tizen.FH.NUI.Controls.TimePicker("DATimePicker");
+ timePicker.Size2D = new Size2D(1032, 524);
+ timePicker.Position2D = new Position2D(0, 0);
+ popup.ContentView.Add(timePicker);
+ }
+
+ private void CreateAMPMTimePicker()
+ {
+ DestoryTimePicker();
+ popup = new Tizen.NUI.CommonUI.Popup("Popup");
+ popup.Size2D = new Size2D(1032, 776);
+ popup.Position2D = new Position2D(24, 50);
+ popup.TitleText = "Timer 02";
+ popup.ButtonCount = 2;
+ popup.SetButtonText(0, "Cancel");
+ popup.SetButtonText(1, "OK");
+ popup.PopupButtonClickedEvent += PopupButtonClickedEvent;
+ root.Add(popup);
+
+ timePicker = new Controls.TimePicker("DATimePickerAMPM");
+ timePicker.Size2D = new Size2D(1032, 524);
+ timePicker.Position2D = new Position2D(0, 0);
+ popup.ContentView.Add(timePicker);
+ }
+
+ private void CreateRepeatTimePicker()
+ {
+ DestoryTimePicker();
+ popup = new Tizen.NUI.CommonUI.Popup("Popup");
+ popup.Size2D = new Size2D(1032, 1064);
+ popup.Position2D = new Position2D(24, 50);
+ popup.TitleText = "Timer 02";
+ popup.ButtonCount = 2;
+ popup.SetButtonText(0, "Cancel");
+ popup.SetButtonText(1, "OK");
+ popup.PopupButtonClickedEvent += PopupButtonClickedEvent;
+ root.Add(popup);
+
+ timePicker = new Tizen.FH.NUI.Controls.TimePicker("DATimePickerRepeat");
+ timePicker.Size2D = new Size2D(1032, 812);
+ timePicker.Position2D = new Position2D(0, 0);
+ popup.ContentView.Add(timePicker);
+ }
+
+
+ private void PopupButtonClickedEvent(object sender, Tizen.NUI.CommonUI.Popup.ButtonClickEventArgs e)
+ {
+
+ }
+
+ private void ButtonClickEvent(object sender, Tizen.NUI.CommonUI.Button.ClickEventArgs e)
+ {
+ Tizen.NUI.CommonUI.Button btn = sender as Tizen.NUI.CommonUI.Button;
+ if (button[0] == btn)
+ {
+ CreateBaseTimePicker();
+ }
+ else if (button[1] == btn)
+ {
+ CreateAMPMTimePicker();
+ }
+ else if (button[2] == btn)
+ {
+ CreateRepeatTimePicker();
+ }
+ }
+
+ private void DestoryTimePicker()
+ {
+ if (popup != null)
+ {
+ if (timePicker != null)
+ {
+ popup.ContentView.Remove(timePicker);
+ timePicker.Dispose();
+ timePicker = null;
+ }
+
+ root.Remove(popup);
+ popup.Dispose();
+ popup = null;
+ }
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ DestoryTimePicker();
+
+ for (int i = 0; i < num; i++)
+ {
+ if (button[i] != null)
+ {
+ root.Remove(button[i]);
+ button[i].Dispose();
+ button[i] = null;
+ }
+ }
+
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace NuiCommonUiSamples
+{
+ using FH = Tizen.FH;
+ public class Toast : IExample
+ {
+ private TextLabel board1, board2, board;
+ private Tizen.NUI.CommonUI.Button button1, button2, button3, button4;
+ private FH.NUI.Controls.Toast toast1_1, toast1_2, toast2_1, toast2_2,/*;private Tizen.NUI.CommonUI.Toast */toast2_3; //1-no loading 2-have loading; X_1-long; X_2 short
+ private SampleLayout root;
+
+ public void Activate()
+ {
+ Window.Instance.BackgroundColor = Color.White;
+ root = new SampleLayout(false);
+ root.HeaderText = "Toast";
+
+ CreateBoardAndButtons();
+
+ toast1_1 = new FH.NUI.Controls.Toast("BasicShortToast");
+ toast1_1.Position2D = new Position2D(30, 0);
+ root.Add(toast1_1);
+ toast1_1.TextArray = new string[1] { "Basic Short Toast" };
+
+
+ toast2_1 = new FH.NUI.Controls.Toast("BasicLongToast");
+ toast2_1.Position2D = new Position2D(30, 200);
+ root.Add(toast2_1);
+ toast2_1.TextArray = new string[1] { "Long Toast, I can have a loading, I have a very long long long text, I have a very long long" };
+ toast2_1.LoadingEnable = true;
+ //toast2_1.TextPaddingLeft = 204;
+
+ toast2_3 = new Tizen.FH.NUI.Controls.Toast();
+ toast2_3.PointSize = 14;
+ toast2_3.BackgroundImageURL = CommonResource.GetResourcePath() + "12. Toast Popup/toast_background.png";
+ toast2_3.BackgroundImageBorder = new Rectangle(64, 64, 4, 4);
+ toast2_3.Position2D = new Position2D(30, 350);
+ toast2_3.Size2D = new Size2D(1000, 272);
+ toast2_3.TextPaddingLeft = 96;
+ toast2_3.TextPaddingTop = 48;
+ toast2_3.TextArray = new string[3] {
+ "I have a very long long text, I have a very long long text, I have a very long long text",
+ "This is my 2 line, I have a very long long text, I have a very long long text",
+ "This is my 3 line, I have a very long long text, I have a very long long text" };
+ root.Add(toast2_3);
+
+ board.UpFocusableView = button1;
+
+ FocusManager.Instance.SetCurrentFocusView(button1);
+ }
+
+ void CreateBoardAndButtons()
+ {
+ board = new TextLabel();
+ board.Size2D = new Size2D(800, 100);
+ board.Position2D = new Position2D(94, 650);
+ board.PointSize = 14;
+ board.HorizontalAlignment = HorizontalAlignment.Center;
+ board.VerticalAlignment = VerticalAlignment.Center;
+ board.BackgroundColor = Color.Magenta;
+ board.Text = "log pad";
+ root.Add(board);
+ board.Focusable = true;
+ board.FocusGained += Board_FocusGained;
+ board.FocusLost += Board_FocusLost;
+
+ button1 = new Tizen.NUI.CommonUI.Button();
+ button1.PointSize = 14;
+ button1.BackgroundColor = Color.Green;
+ button1.Position2D = new Position2D(30, 125);
+ button1.Size2D = new Size2D(220, 80);
+ button1.Text = "toast1_1 Show";
+ root.Add(button1);
+ button1.Focusable = true;
+ button1.ClickEvent += toast1_1Show;
+
+ button2 = new Tizen.NUI.CommonUI.Button();
+ button2.PointSize = 14;
+ button2.BackgroundColor = Color.Green;
+ button2.Position2D = new Position2D(270, 125);
+ button2.Size2D = new Size2D(220, 80);
+ button2.Text = "toast2_1 Show";
+ root.Add(button2);
+ button2.Focusable = true;
+ button2.ClickEvent += toast2_1Show;
+
+ button3 = new Tizen.NUI.CommonUI.Button();
+ button3.PointSize = 14;
+ button3.BackgroundColor = Color.Green;
+ button3.Position2D = new Position2D(510, 125);
+ button3.Size2D = new Size2D(270, 80);
+ button3.Text = "changed Direction";
+ root.Add(button3);
+ button3.Focusable = true;
+ button3.ClickEvent += toast2_1ChangeDirection;
+
+ button4 = new Tizen.NUI.CommonUI.Button();
+ button4.PointSize = 14;
+ button4.BackgroundColor = Color.Green;
+ button4.Position2D = new Position2D(800, 125);
+ button4.Size2D = new Size2D(220, 80);
+ button4.Text = "change loading";
+ root.Add(button4);
+ button4.Focusable = true;
+ button4.ClickEvent += toast2_1ChangeLoading;
+ }
+
+ private void Board_FocusLost(object sender, global::System.EventArgs e)
+ {
+ board.BackgroundColor = Color.Magenta;
+ }
+
+ private void Board_FocusGained(object sender, global::System.EventArgs e)
+ {
+ board.BackgroundColor = Color.Cyan;
+ }
+
+ private void toast1_1Show(object sender, global::System.EventArgs e)
+ {
+ board.Text = "toast1_1 show: ";
+ toast1_1.Show();
+ }
+
+ private void toast2_1Show(object sender, global::System.EventArgs e)
+ {
+ board.Text = "toast2_1 show: ";
+ toast2_1.Show();
+ }
+
+ private void toast2_1ChangeDirection(object sender, global::System.EventArgs e)
+ {
+ if (toast2_1.LayoutDirection == ViewLayoutDirectionType.LTR)
+ toast2_1.LayoutDirection = ViewLayoutDirectionType.RTL;
+ else
+ toast2_1.LayoutDirection = ViewLayoutDirectionType.LTR;
+ toast2_1.Show();
+ }
+
+ private void toast2_1ChangeLoading(object sender, global::System.EventArgs e)
+ {
+ board.Text = "toast2_1 remove loading ";
+ if (toast2_1.LoadingEnable == true)
+ toast2_1.LoadingEnable = false;
+ else
+ toast2_1.LoadingEnable = true;
+ toast2_1.Show();
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ root.Dispose();
+ }
+ }
+ }
+}
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Tizen.NUI.Xamarin" version="1.0.0" targetFramework="net461" />
+</packages>
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+{
+ "styles":
+ {
+ "ContactNameTextLabel":
+ {
+ "textColor": [ 0, 0, 0, 1 ],
+ "horizontalAlignment": "CENTER",
+ "pointSize": 14
+ },
+
+ "ContactDetailTextLabel":
+ {
+ "textColor": [ 0, 0, 0, 1 ],
+ "multiLine": true,
+ "pointSize": 20
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+{
+ "styles":
+ {
+ "ContactNameTextLabel":
+ {
+ "textColor": [ 0, 0, 0, 1 ],
+ "horizontalAlignment": "CENTER",
+ "pointSize": 14
+ },
+
+ "ContactDetailTextLabel":
+ {
+ "textColor": [ 0, 0, 0, 1 ],
+ "multiLine": true,
+ "pointSize": 20
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2000-2016 Samsung Electronics Co., Ltd
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+{
+ "styles":
+ {
+ "ConfirmationPopup":{
+ "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/00_popup_bg.9.png"
+ },
+
+ "CustomPopupStyle":{
+ "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/popup.9.png",
+ "popupBackgroundBorder":[0,4,4,0],
+ "tailUpImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-up.png",
+ "tailDownImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-down.png",
+ "tailLeftImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-left.png",
+ "tailRightImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-right.png"
+ },
+
+ "DemoTile":
+ {
+ "states":
+ {
+ "NORMAL":
+ {
+ "color":[0.4, 0.6, 0.9, 0.6],
+ "visuals":
+ {
+ "image":
+ {
+ "url":"{APPLICATION_RESOURCE_PATH}/images/demo-tile-texture.9.png",
+// TILE_BACKGROUND_ALPHA
+// This shader takes a texture.
+// An alpha discard is performed.
+// The shader uses the tiles position within the scroll-view page and the scroll-views rotation position to create a parallax effect.
+ "shader":
+ {
+ "fragmentShader":[
+ " varying mediump vec2 vTexCoord;",
+ " uniform lowp vec4 uColor;",
+ " uniform sampler2D sTexture;",
+ " uniform mediump vec3 uCustomPosition;",
+ "",
+ " void main()",
+ " {",
+ " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )",
+ " {",
+ " discard;",
+ " }",
+ "",
+ " mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );",
+ " mediump vec4 color = texture2D( sTexture, wrapTexCoord );",
+ " mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;",
+ "",
+ " gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );",
+ " }"
+ ]
+ }
+ }
+ }
+ },
+ "FOCUSED":
+ {
+ "color":[0.3, 0.5, 0.8, 0.5],
+ "visuals":
+ {
+ "image":
+ {
+ "url":"{APPLICATION_RESOURCE_PATH}/images/demo-tile-texture-focused.9.png",
+// TILE_BACKGROUND_ALPHA
+// This shader takes a texture.
+// An alpha discard is performed.
+// The shader uses the tiles position within the scroll-view page and the scroll-views rotation position to create a parallax effect.
+ "shader":
+ {
+ "fragmentShader":[
+ " varying mediump vec2 vTexCoord;",
+ " uniform lowp vec4 uColor;",
+ " uniform sampler2D sTexture;",
+ " uniform mediump vec3 uCustomPosition;",
+ "",
+ " void main()",
+ " {",
+ " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )",
+ " {",
+ " discard;",
+ " }",
+ "",
+ " mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );",
+ " mediump vec4 color = texture2D( sTexture, wrapTexCoord );",
+ " mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;",
+ "",
+ " gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );",
+ " }"
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "FocusActor":
+ {
+ "visuals":
+ {
+ "image":
+ {
+ "url":"{APPLICATION_RESOURCE_PATH}/images/tile-focus.9.png"
+ }
+ }
+ },
+ "DemoTileBorder":
+ {
+ "visuals":
+ {
+ "image":
+ {
+ "url":"{APPLICATION_RESOURCE_PATH}/images/item-background.9.png" // TILE_BACKGROUND
+ }
+ }
+ },
+ "TextLabelRosemary":
+ {
+ "fontFamily":"Rosemary"
+ },
+ "TextLabel":
+ {
+ "fontStyle":{"weight":"normal"},
+ "pointSize":18
+ },
+ "LauncherLabel":
+ {
+ "pointSize":18
+ },
+
+ "ToolbarLabel":
+ {
+ "pointSize":18
+ },
+
+ "BuilderLabel":
+ {
+ "pointSize":13
+ },
+
+ "ScrollView":
+ {
+ "overshootEffectColor":"B018"
+ },
+
+ "ImageScalingGroupLabel":
+ {
+ "pointSize":9
+ },
+
+ "ImageScalingButton":
+ {
+ "label":{
+ "pointSize":11
+ }
+ },
+
+ "LauncherBackground":
+ {
+ "background":
+ {
+ "visualType": "GRADIENT",
+ "center": [240, 400],
+ "radius": 932,
+ "units": "USER_SPACE",
+ "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]]
+ }
+ },
+//
+// Simple Visuals Application Style section
+//
+ "MyControl":
+ {
+ "states":
+ {
+ "NORMAL":
+ {
+ "visuals":
+ {
+ "iconVisual":
+ {
+ "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-13.png"
+ }
+ }
+ },
+ "FOCUSED":
+ {
+ "visuals":
+ {
+ "iconVisual":
+ {
+ "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-83.png"
+ }
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="NuiCommonUiSamples" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">
+ <profile name="common" />
+ <ui-application appid="NuiCommonUiSamples" exec="NuiCommonUiSamples.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" splash-screen-display="true" launch_mode="single">
+ <label>NuiCommonUiSamples</label>
+ <icon>NuiCommonUiSamples.png</icon>
+ <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="false" />
+ <splash-screens />
+ </ui-application>
+ <shortcut-list />
+ <provides-appdefined-privileges />
+</manifest>