--- /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 Tizen.NUI.Samples
+{
+ interface IExample
+ {
+ void Activate();
+ void Deactivate();
+ }
+}
+
--- /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 Tizen.NUI.Samples
+{
+ public class Application
+ {
+ /* public delegate string SWIGStringDelegate(string message);
+
+ [global::System.Runtime.InteropServices.DllImport("libcapi-appfw-app-common.so.0", EntryPoint = "RegisterCreateStringCallback")]
+ public static extern void RegisterCreateStringCallback(SWIGStringDelegate stringDelegate);*/
+
+ [STAThread]
+ static void Main(string[] args)
+ {
+ /*RegisterCreateStringCallback(new SWIGStringDelegate((string message) =>
+ {
+ return message;
+ }));*/
+
+ new DaliDemo(CommonResource.GetDaliResourcePath() + @"../../style/demo-theme.json").Run(args);
+ }
+ }
+}
+
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Samples
+{
+ public class CommonResource
+ {
+ public static string GetDaliResourcePath()
+ {
+ return @"/opt/usr/globalapps/Tizen.NUI.Samples/res/images/Dali/";
+ }
+
+ public static string GetFHResourcePath()
+ {
+ return @"/opt/usr/globalapps/Tizen.NUI.Samples/res/images/FH3/";
+ }
+
+ public static string GetTVResourcePath()
+ {
+ return @"/opt/usr/globalapps/Tizen.NUI.Samples/res/images/VD/";
+ }
+ }
+
+ public class SampleMain : NUIApplication, IExample
+ {
+ public void Activate()
+ {
+ defaultFocusIndicator = new View();
+ defaultFocusIndicator.BackgroundColor = Color.Transparent;
+ FocusManager.Instance.FocusIndicator = defaultFocusIndicator;
+
+ Window.Instance.BackgroundColor = new Color(1.0f, 0.92f, 0.80f, 1.0f);
+ Window.Instance.GetDefaultLayer().Add(container);
+ FocusManager.Instance.SetCurrentFocusView(label[currentIndex]);
+ }
+
+ public void Deactivate()
+ {
+ Window.Instance.BackgroundColor = new Color(0.96f, 0.96f, 0.86f, 1.0f);
+ View currentView = FocusManager.Instance.GetCurrentFocusView();
+ currentIndex = Array.FindIndex(label, x => x == currentView);
+
+ Window.Instance.GetDefaultLayer().Remove(container);
+ }
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+ container = new FlexContainer();
+ container.Size2D = new Size2D(Window.Instance.Size.Width, Window.Instance.Size.Height);
+ container.PivotPoint = PivotPoint.TopLeft;
+ container.FlexWrap = FlexContainer.WrapType.Wrap;
+ container.FlexDirection = (int)FlexContainer.FlexDirectionType.Column;
+
+ 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;
+
+ label = new MyTextView[examples.Count()];
+ for (int i = 0; i < label.Length; i++)
+ {
+ label[i] = new MyTextView();
+ label[i].Text = examples.ElementAt(i);
+ label[i].Size = new Size(300, 40, 0);
+ label[i].FlexMargin = new Vector4(20, 20, 40, 20);
+ label[i].PointSize = 10;
+ label[i].KeyEvent += SampleMain_KeyEvent;
+ label[i].TouchEvent += SampleMain_TouchEvent;
+ label[i].PivotPoint = PivotPoint.TopLeft;
+ container.Add(label[i]);
+ }
+
+ label.First().UpFocusableView = label.Last();
+ label.Last().DownFocusableView = label.First();
+
+ Window.Instance.KeyEvent += Instance_Key;
+
+ Activate();
+ sampleStack.Push(this);
+ }
+
+ private bool SampleMain_TouchEvent(object source, View.TouchEventArgs e)
+ {
+ TextLabel textLabel = source as TextLabel;
+ string sampleName = textLabel.Text;
+ RunSample("Tizen.NUI.Samples", sampleName);
+ return false; ;
+ }
+
+ public void ExitSample()
+ {
+ if (sampleStack.Count() == 1)
+ {
+ Exit();
+ Environment.Exit(0);
+ return;
+ }
+
+ IExample currentSample = sampleStack.Pop();
+
+ currentSample.Deactivate();
+ currentSample = null;
+
+ FullGC();
+
+ IExample nextSample = sampleStack.Peek();
+ nextSample.Activate();
+ }
+
+ 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)
+ {
+ IExample currentSample = sampleStack.Peek();
+ currentSample.Deactivate();
+
+ FullGC();
+
+ currentSample = item as IExample;
+ sampleStack.Push(currentSample);
+
+ currentSample.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("Tizen.NUI.Samples", sampleName);
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ MyTextView[] label;
+ FlexContainer container;
+ View defaultFocusIndicator;
+ int currentIndex = 0;
+ Stack<IExample> sampleStack = new Stack<IExample>();
+ }
+
+ public class MyTextView : TextLabel
+ {
+ Animation focusInAni;
+ Animation focusOutAni;
+
+ public MyTextView()
+ {
+ this.Focusable = true;
+ this.FocusGained += MyTextView_FocusGained;
+ this.FocusLost += MyTextView_FocusLost;
+
+ focusInAni = new Animation(400);
+ focusOutAni = new Animation(400);
+
+ focusInAni.AnimateTo(this, "Scale", new Vector3(1.2f, 1.2f, 1.0f));
+ focusOutAni.AnimateTo(this, "Scale", new Vector3(1.0f, 1.0f, 1.0f));
+ }
+
+ private void MyTextView_FocusLost(object sender, EventArgs e)
+ {
+ focusOutAni.Play();
+ this.BackgroundColor = Color.Transparent;
+ this.TextColor = Color.Black;
+ }
+
+ private void MyTextView_FocusGained(object sender, EventArgs e)
+ {
+ focusInAni.Play();
+ this.BackgroundColor = new Color(0.69f, 0.77f, 0.87f, 1.0f);
+ this.TextColor = Color.Red;
+ }
+ }
+}
+
{
Window window = Window.Instance;
+ //ImageView imageView1 = new ImageView();
+ //imageView1.Size2D = new Size2D(48, 48);
+ //imageView1.Position2D = new Position2D(200, 200);
+ //imageView1.ResourceUrl = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png";
+ //window.Add(imageView1);
+
+ //ImageView imageView2 = new ImageView();
+ //imageView2.Size2D = new Size2D(48, 48);
+ //imageView2.Position2D = new Position2D(500, 200);
+ //imageView2.ResourceUrl = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png";
+ //window.Add(imageView2);
+
root = new View()
{
Size2D = new Size2D(1920, 1080),
window.KeyEvent += Window_KeyEvent;
textButton = new Button();
- textButton.Style.Background.ResourceUrl = SampleResource.GetDaliResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
- textButton.Style.Background.Border = new Rectangle(4, 4, 5, 5);
+ textButton.Style.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
+ textButton.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
textButton.Size2D = new Size2D(300, 80);
textButton.Position2D = new Position2D(100, 100);
textButton.Style.Text.Text = "Button";
root.Add(textButton);
iconButton = new Button();
- iconButton.Style.Background.ResourceUrl = SampleResource.GetDaliResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
- iconButton.Style.Background.Border = new Rectangle(4, 4, 5, 5);
+ iconButton.Style.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
+ iconButton.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
iconButton.Size2D = new Size2D(100, 100);
iconButton.Position2D = new Position2D(600, 100);
- iconButton.Style.Icon.ResourceUrl = SampleResource.GetDaliResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
+ iconButton.Style.Icon.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
root.Add(iconButton);
iconTextButton = new Button();
- iconTextButton.Style.Background.ResourceUrl = SampleResource.GetDaliResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
- iconTextButton.Style.Background.Border = new Rectangle(4, 4, 5, 5);
+ iconTextButton.Style.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
+ iconTextButton.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
iconTextButton.IconRelativeOrientation = Button.IconOrientation.Left;
- iconTextButton.Style.Icon.ResourceUrl = SampleResource.GetDaliResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
- iconTextButton.Style.Icon.Padding.Top = 20;
- iconTextButton.Style.Icon.Padding.Bottom = 20;
- iconTextButton.Style.Icon.Padding.Start = 20;
- iconTextButton.Style.Icon.Padding.End = 20;
+ iconTextButton.Style.Icon.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
+ iconTextButton.Style.IconPadding.Top = 20;
+ iconTextButton.Style.IconPadding.Bottom = 20;
+ iconTextButton.Style.IconPadding.Start = 20;
+ iconTextButton.Style.IconPadding.End = 20;
iconTextButton.Style.Text.Text = "IconTextButton";
- iconTextButton.Style.Text.Padding.Top = 20;
- iconTextButton.Style.Text.Padding.Bottom = 20;
- iconTextButton.Style.Text.Padding.Start = 20;
- iconTextButton.Style.Text.Padding.End = 50;
+ iconTextButton.Style.TextPadding.Top = 20;
+ iconTextButton.Style.TextPadding.Bottom = 20;
+ iconTextButton.Style.TextPadding.Start = 20;
+ iconTextButton.Style.TextPadding.End = 50;
iconTextButton.Size2D = new Size2D(500, 300);
iconTextButton.Position2D = new Position2D(900, 100);
root.Add(iconTextButton);
///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
utilityBasicButton = new Button();
utilityBasicButton.IsSelectable = true;
- utilityBasicButton.Style.Background.ResourceUrl = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_normal.png";
- utilityBasicButton.Style.Background.Border = new Rectangle(5, 5, 5, 5);
- utilityBasicButton.Style.Shadow.ResourceUrl = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_shadow.png";
+ utilityBasicButton.Style.BackgroundImage = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png";
+ utilityBasicButton.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
+ utilityBasicButton.Style.Shadow.ResourceUrl = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png";
utilityBasicButton.Style.Shadow.Border = new Rectangle(5, 5, 5, 5);
utilityBasicButton.Style.Overlay.ResourceUrl = new Selector<string>
{
- Pressed = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
+ Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
Other = ""
};
utilityBasicButton.Style.Overlay.Border = new Rectangle(5, 5, 5, 5);
utilityBasicButton.Position2D = new Position2D(XBase, 300);
utilityBasicButton.Style.Text.PointSize = 20;
utilityBasicButton.Style.Text.Text = "UtilityBasicButton";
- //utilityBasicButton.IsEnabled = false;
+ utilityBasicButton.IsEnabled = false;
root.Add(utilityBasicButton);
/////////////////////////////////////////////////////////////////////////////////////////////////////////
utilityServiceButton = new Button();
- utilityServiceButton.Style.Background.ResourceUrl = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_point_btn_normal.png";
- utilityServiceButton.Style.Background.Border = new Rectangle(5, 5, 5, 5);
- utilityServiceButton.Style.Shadow.ResourceUrl = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_shadow.png";
+ utilityServiceButton.Style.BackgroundImage = CommonResource.GetFHResourcePath() + "3. Button/rectangle_point_btn_normal.png";
+ utilityServiceButton.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
+ utilityServiceButton.Style.Shadow.ResourceUrl = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png";
utilityServiceButton.Style.Shadow.Border = new Rectangle(5, 5, 5, 5);
utilityServiceButton.Style.Overlay.ResourceUrl = new Selector<string>
{
- Pressed = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
+ Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
Other = ""
};
utilityServiceButton.Style.Overlay.Border = new Rectangle(5, 5, 5, 5);
/////////////////////////////////////////////////////////////////////////////////////////////////////////
utilityToggleButton = new Button();
utilityToggleButton.IsSelectable = true;
- utilityToggleButton.Style.Background.ResourceUrl = new Selector<string>
+ utilityToggleButton.Style.BackgroundImage = new Selector<string>
{
- Normal = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_toggle_btn_normal.png",
- Selected = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_point_btn_normal.png",
+ Normal = CommonResource.GetFHResourcePath() + "3. Button/rectangle_toggle_btn_normal.png",
+ Selected = CommonResource.GetFHResourcePath() + "3. Button/rectangle_point_btn_normal.png",
};
- utilityToggleButton.Style.Background.Border = new Rectangle(5, 5, 5, 5);
- utilityToggleButton.Style.Shadow.ResourceUrl = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_shadow.png";
+ utilityToggleButton.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
+ utilityToggleButton.Style.Shadow.ResourceUrl = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png";
utilityToggleButton.Style.Shadow.Border = new Rectangle(5, 5, 5, 5);
utilityToggleButton.Style.Overlay.ResourceUrl = new Selector<string>
{
- Pressed = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
+ Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png",
Other = ""
};
utilityToggleButton.Style.Overlay.Border = new Rectangle(5, 5, 5, 5);
/////////////////////////////////////////////////////////////////////////////////////////////////////////
utilityOvalButton = new Button();
utilityOvalButton.IsSelectable = true;
- utilityOvalButton.Style.Background.ResourceUrl = new Selector<string>
+ utilityOvalButton.Style.BackgroundImage = new Selector<string>
{
- Normal = SampleResource.GetDaliResourcePath() + "3. Button/oval_toggle_btn_normal.png",
- Selected = SampleResource.GetDaliResourcePath() + "3. Button/oval_toggle_btn_select.png",
+ Normal = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_normal.png",
+ Selected = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_select.png",
};
- utilityOvalButton.Style.Background.Border = new Rectangle(5, 5, 5, 5);
- utilityOvalButton.Style.Shadow.ResourceUrl = SampleResource.GetDaliResourcePath() + "3. Button/oval_toggle_btn_shadow.png";
+ utilityOvalButton.Style.BackgroundImageBorder = new Rectangle(5, 5, 5, 5);
+ utilityOvalButton.Style.Shadow.ResourceUrl = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_shadow.png";
utilityOvalButton.Style.Shadow.Border = new Rectangle(5, 5, 5, 5);
utilityOvalButton.Style.Overlay.ResourceUrl = new Selector<string>
{
- Pressed = SampleResource.GetDaliResourcePath() + "3. Button/oval_toggle_btn_press_overlay.png",
+ Pressed = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_press_overlay.png",
Other = ""
};
utilityOvalButton.Style.Overlay.Border = new Rectangle(5, 5, 5, 5);
ButtonStyle familyBasicButtonAttributes = new ButtonStyle
{
IsSelectable = true,
- Background = new ImageViewStyle
- {
- ResourceUrl = new Selector<string> { All = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_normal.png" },
- Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) }
- },
-
+ BackgroundImage = new Selector<string> { All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png" },
+ BackgroundImageBorder = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) },
Shadow = new ImageViewStyle
{
- ResourceUrl = new Selector<string> { All = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_shadow.png" },
+ ResourceUrl = new Selector<string> { All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png" },
Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) }
},
Overlay = new ImageViewStyle
{
- ResourceUrl = new Selector<string> { Pressed = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" },
+ ResourceUrl = new Selector<string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" },
Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) },
},
ButtonStyle familyServiceButtonAttributes = new ButtonStyle
{
IsSelectable = false,
- Background = new ImageViewStyle
- {
- ResourceUrl = new Selector<string> { All = SampleResource.GetDaliResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_24c447.png" },
- Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) }
- },
+ BackgroundImage = new Selector<string> { All = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_24c447.png" },
+ BackgroundImageBorder = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) },
Shadow = new ImageViewStyle
{
- ResourceUrl = new Selector<string> { All = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_shadow.png" },
+ ResourceUrl = new Selector<string> { All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png" },
Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) }
},
Overlay = new ImageViewStyle
{
- ResourceUrl = new Selector<string> { Pressed = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" },
+ ResourceUrl = new Selector<string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" },
Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) },
},
ButtonStyle familyToggleButtonAttributes = new ButtonStyle
{
IsSelectable = true,
- Background = new ImageViewStyle
+ BackgroundImage = new Selector<string>
{
- ResourceUrl = new Selector<string>
- {
- Normal = SampleResource.GetDaliResourcePath() + "3. Button/[Button] App Primary Color/rectangle_toggle_btn_normal_24c447.png",
- Selected = SampleResource.GetDaliResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_24c447.png",
-
- },
- Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) }
+ Normal = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/rectangle_toggle_btn_normal_24c447.png",
+ Selected = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_24c447.png",
},
+ BackgroundImageBorder = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) },
Shadow = new ImageViewStyle
{
- ResourceUrl = new Selector<string> { All = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_shadow.png" },
+ ResourceUrl = new Selector<string> { All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png" },
Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) }
},
Overlay = new ImageViewStyle
{
- ResourceUrl = new Selector<string> { Pressed = SampleResource.GetDaliResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" },
+ ResourceUrl = new Selector<string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" },
Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) },
},
ButtonStyle familyOvalButtonAttributes = new ButtonStyle
{
IsSelectable = true,
- Background = new ImageViewStyle
+ BackgroundImage = new Selector<string>
{
- ResourceUrl = new Selector<string>
- {
- Normal = SampleResource.GetDaliResourcePath() + "3. Button/oval_toggle_btn_normal.png",
- Selected = SampleResource.GetDaliResourcePath() + "3. Button/[Button] App Primary Color/oval_toggle_btn_select_24c447.png",
-
- },
- Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) }
+ Normal = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_normal.png",
+ Selected = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/oval_toggle_btn_select_24c447.png",
},
+ BackgroundImageBorder = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) },
Shadow = new ImageViewStyle
{
- ResourceUrl = new Selector<string> { All = SampleResource.GetDaliResourcePath() + "3. Button/oval_toggle_btn_shadow.png" },
+ ResourceUrl = new Selector<string> { All = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_shadow.png" },
Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) }
},
Overlay = new ImageViewStyle
{
- ResourceUrl = new Selector<string> { Pressed = SampleResource.GetDaliResourcePath() + "3. Button/oval_toggle_btn_press_overlay.png", Other = "" },
+ ResourceUrl = new Selector<string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_press_overlay.png", Other = "" },
Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) },
},
};
private void Window_KeyEvent(object sender, Window.KeyEventArgs e)
{
- if (e.Key.State == Key.StateType.Up)
+ if(e.Key.State == Key.StateType.Up)
{
- switch (e.Key.KeyPressedName)
+ switch(e.Key.KeyPressedName)
{
case "1":
iconTextButton.IconRelativeOrientation = Button.IconOrientation.Right;
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class CheckBoxSample : IExample
+ {
+ private View root;
+
+ private TextLabel[] createText = new TextLabel[2];
+ private TextLabel[] modeText = new TextLabel[4];
+ private TextLabel[] modeText2 = new TextLabel[4];
+
+ private CheckBox[] utilityCheckBox = new CheckBox[4];
+ private CheckBox[] familyCheckBox = new CheckBox[4];
+ private CheckBox[] foodCheckBox = new CheckBox[4];
+ private CheckBox[] kitchenCheckBox = new CheckBox[4];
+ private CheckBoxGroup[] group = new CheckBoxGroup[4];
+
+ private CheckBox[] utilityCheckBox2 = new CheckBox[4];
+ private CheckBox[] familyCheckBox2 = new CheckBox[4];
+ private CheckBox[] foodCheckBox2 = new CheckBox[4];
+ private CheckBox[] kitchenCheckBox2 = new CheckBox[4];
+ private CheckBoxGroup[] group2 = new CheckBoxGroup[4];
+
+ private static string[] mode = new string[]
+ {
+ "Utility",
+ "Family",
+ "Food",
+ "Kitchen",
+ };
+ public void Activate()
+ {
+ Window window = Window.Instance;
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ BackgroundColor = Color.White,
+ };
+ window.Add(root);
+
+ ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
+ createText[0] = new TextLabel();
+ createText[0].Text = "Create CheckBox just by properties";
+ createText[0].TextColor = Color.White;
+ createText[0].Size2D = new Size2D(500, 100);
+ createText[0].Position2D = new Position2D(400, 100);
+ root.Add(createText[0]);
+
+ int num = 4;
+ for (int i = 0; i < num; i++)
+ {
+ group[i] = new CheckBoxGroup();
+ modeText[i] = new TextLabel();
+ modeText[i].Text = mode[i];
+ modeText[i].Size2D = new Size2D(200, 48);
+ modeText[i].Position2D = new Position2D(300 + 200 * i, 200);
+ root.Add(modeText[i]);
+ }
+
+ for (int i = 0; i < num; i++)
+ {
+ utilityCheckBox[i] = new CheckBox();
+ utilityCheckBox[i].Size2D = new Size2D(150, 48);
+ utilityCheckBox[i].Position2D = new Position2D(300, 300 + i * 100);
+ utilityCheckBox[i].Style.Icon.Size = new Size(48, 48);
+ utilityCheckBox[i].Style.Icon.Padding.Start = 0;
+ utilityCheckBox[i].Style.Icon.Padding.End = 0;
+ utilityCheckBox[i].Style.Icon.Padding.Top = 0;
+ utilityCheckBox[i].Style.Icon.Padding.Bottom = 0;
+ utilityCheckBox[i].Style.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ utilityCheckBox[i].Style.Icon.BackgroundImage = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
+ };
+ utilityCheckBox[i].Style.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = "",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
+ Disabled = "",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
+ };
+ utilityCheckBox[i].Style.Icon.Shadow.ResourceUrl = new Selector<string>
+ {
+ Normal = "",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
+ Disabled = "",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
+ };
+
+ //utilityCheckBox[i].Text = "Check" + i;
+ //utilityCheckBox[i].TextAlignment = HorizontalAlignment.Begin;
+ //utilityCheckBox[i].PointSize = 12;
+ //utilityCheckBox[i].TextPaddingLeft = 70;
+
+ group[0].Add(utilityCheckBox[i]);
+ //////
+ familyCheckBox[i] = new CheckBox();
+ familyCheckBox[i].Size2D = new Size2D(48, 48);
+ familyCheckBox[i].Position2D = new Position2D(500, 300 + i * 100);
+ familyCheckBox[i].Style.Icon.Size = new Size(48, 48);
+ familyCheckBox[i].Style.Icon.Padding.Start = 0;
+ familyCheckBox[i].Style.Icon.Padding.End = 0;
+ familyCheckBox[i].Style.Icon.Padding.Top = 0;
+ familyCheckBox[i].Style.Icon.Padding.Bottom = 0;
+ familyCheckBox[i].Style.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ familyCheckBox[i].Style.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
+ };
+
+ group[1].Add(familyCheckBox[i]);
+ /////////
+ foodCheckBox[i] = new CheckBox();
+ foodCheckBox[i].Size2D = new Size2D(48, 48);
+ foodCheckBox[i].Position2D = new Position2D(700, 300 + i * 100);
+ foodCheckBox[i].Style.Icon.Size = new Size(48, 48);
+ foodCheckBox[i].Style.Icon.Padding.Start = 0;
+ foodCheckBox[i].Style.Icon.Padding.End = 0;
+ foodCheckBox[i].Style.Icon.Padding.Top = 0;
+ foodCheckBox[i].Style.Icon.Padding.Bottom = 0;
+ foodCheckBox[i].Style.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ foodCheckBox[i].Style.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
+ };
+
+ group[2].Add(foodCheckBox[i]);
+ ////////
+ kitchenCheckBox[i] = new CheckBox();
+ kitchenCheckBox[i].Size2D = new Size2D(48, 48);
+ kitchenCheckBox[i].Position2D = new Position2D(900, 300 + i * 100);
+ kitchenCheckBox[i].Style.Icon.Size = new Size(48, 48);
+ kitchenCheckBox[i].Style.Icon.Padding.Start = 0;
+ kitchenCheckBox[i].Style.Icon.Padding.End = 0;
+ kitchenCheckBox[i].Style.Icon.Padding.Top = 0;
+ kitchenCheckBox[i].Style.Icon.Padding.Bottom = 0;
+
+ kitchenCheckBox[i].Style.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ kitchenCheckBox[i].Style.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
+ };
+
+ group[3].Add(kitchenCheckBox[i]);
+
+ root.Add(utilityCheckBox[i]);
+ root.Add(familyCheckBox[i]);
+ root.Add(foodCheckBox[i]);
+ root.Add(kitchenCheckBox[i]);
+ }
+ /////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
+ createText[1] = new TextLabel();
+ createText[1].Text = "Create CheckBox just by Attributes";
+ createText[1].TextColor = Color.White;
+ createText[1].Size2D = new Size2D(500, 100);
+ createText[1].Position2D = new Position2D(1200, 100);
+ root.Add(createText[1]);
+
+ for (int i = 0; i < num; i++)
+ {
+ group2[i] = new CheckBoxGroup();
+ modeText2[i] = new TextLabel();
+ modeText2[i].Text = mode[i];
+ modeText2[i].Size2D = new Size2D(200, 48);
+ modeText2[i].Position2D = new Position2D(1100 + 200 * i, 200);
+ root.Add(modeText2[i]);
+ }
+
+ ButtonStyle utilityAttrs = new ButtonStyle
+ {
+ Icon = new ImageControlStyle
+ {
+ Size = new Size(48, 48),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ BackgroundImage = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_on.png",
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = "",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
+ Disabled = "",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check.png",
+ },
+ Shadow = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string>
+ {
+ Normal = "",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
+ Disabled = "",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_shadow.png",
+ },
+ },
+ }
+ };
+ ButtonStyle familyAttrs = new ButtonStyle
+ {
+ Icon = new ImageControlStyle
+ {
+ Size = new Size(48, 48),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_24c447.png",
+ },
+ }
+ };
+ ButtonStyle foodAttrs = new ButtonStyle
+ {
+ Icon = new ImageControlStyle
+ {
+ Size = new Size(48, 48),
+ Position = new Position(0, 0),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_ec7510.png",
+ },
+ },
+ };
+ ButtonStyle kitchenAttrs = new ButtonStyle
+ {
+ Icon = new ImageControlStyle
+ {
+ Size = new Size(48, 48),
+ Position = new Position(0, 0),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_check_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_check_on_9762d9.png",
+ },
+ },
+ };
+ for (int i = 0; i < num; i++)
+ {
+ utilityCheckBox2[i] = new CheckBox(utilityAttrs);
+ utilityCheckBox2[i].Size2D = new Size2D(48, 48);
+ utilityCheckBox2[i].Position2D = new Position2D(1100, 300 + i * 100);
+ group2[0].Add(utilityCheckBox2[i]);
+
+ familyCheckBox2[i] = new CheckBox(familyAttrs);
+ familyCheckBox2[i].Size2D = new Size2D(48, 48);
+ familyCheckBox2[i].Position2D = new Position2D(1300, 300 + i * 100);
+ group2[1].Add(familyCheckBox2[i]);
+
+ foodCheckBox2[i] = new CheckBox(foodAttrs);
+ foodCheckBox2[i].Size2D = new Size2D(48, 48);
+ foodCheckBox2[i].Position2D = new Position2D(1500, 300 + i * 100);
+ group2[2].Add(foodCheckBox2[i]);
+
+ kitchenCheckBox2[i] = new CheckBox(kitchenAttrs);
+ kitchenCheckBox2[i].Size2D = new Size2D(48, 48);
+ kitchenCheckBox2[i].Position2D = new Position2D(1700, 300 + i * 100);
+ group2[3].Add(kitchenCheckBox2[i]);
+
+ root.Add(utilityCheckBox2[i]);
+ root.Add(familyCheckBox2[i]);
+ root.Add(foodCheckBox2[i]);
+ root.Add(kitchenCheckBox2[i]);
+ }
+
+ utilityCheckBox[2].IsEnabled = false;
+ familyCheckBox[2].IsEnabled = false;
+ foodCheckBox[2].IsEnabled = false;
+ kitchenCheckBox[2].IsEnabled = false;
+
+ utilityCheckBox2[2].IsEnabled = false;
+ familyCheckBox2[2].IsEnabled = false;
+ foodCheckBox2[2].IsEnabled = false;
+ kitchenCheckBox2[2].IsEnabled = false;
+
+ utilityCheckBox[3].IsEnabled = false;
+ familyCheckBox[3].IsEnabled = false;
+ foodCheckBox[3].IsEnabled = false;
+ kitchenCheckBox[3].IsEnabled = false;
+ utilityCheckBox[3].IsSelected = true;
+ familyCheckBox[3].IsSelected = true;
+ foodCheckBox[3].IsSelected = true;
+ kitchenCheckBox[3].IsSelected = true;
+
+ utilityCheckBox2[3].IsEnabled = false;
+ familyCheckBox2[3].IsEnabled = false;
+ foodCheckBox2[3].IsEnabled = false;
+ kitchenCheckBox2[3].IsEnabled = false;
+ utilityCheckBox2[3].IsSelected = true;
+ familyCheckBox2[3].IsSelected = true;
+ foodCheckBox2[3].IsSelected = true;
+ kitchenCheckBox2[3].IsSelected = true;
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ int num = 4;
+ for (int i = 0; i < num; i++)
+ {
+ root.Remove(utilityCheckBox[i]);
+ utilityCheckBox[i].Dispose();
+ utilityCheckBox[i] = null;
+
+ root.Remove(familyCheckBox[i]);
+ familyCheckBox[i].Dispose();
+ familyCheckBox[i] = null;
+
+ root.Remove(foodCheckBox[i]);
+ foodCheckBox[i].Dispose();
+ foodCheckBox[i] = null;
+
+ root.Remove(kitchenCheckBox[i]);
+ kitchenCheckBox[i].Dispose();
+ kitchenCheckBox[i] = null;
+
+ root.Remove(modeText[i]);
+ modeText[i].Dispose();
+ modeText[i] = null;
+
+ root.Remove(utilityCheckBox2[i]);
+ utilityCheckBox2[i].Dispose();
+ utilityCheckBox2[i] = null;
+
+ root.Remove(familyCheckBox2[i]);
+ familyCheckBox2[i].Dispose();
+ familyCheckBox2[i] = null;
+
+ root.Remove(foodCheckBox2[i]);
+ foodCheckBox2[i].Dispose();
+ foodCheckBox2[i] = null;
+
+ root.Remove(kitchenCheckBox2[i]);
+ kitchenCheckBox2[i].Dispose();
+ kitchenCheckBox2[i] = null;
+
+ root.Remove(modeText2[i]);
+ modeText2[i].Dispose();
+ modeText2[i] = null;
+ }
+
+ root.Remove(createText[0]);
+ createText[0].Dispose();
+ createText[0] = null;
+ root.Remove(createText[1]);
+ createText[1].Dispose();
+ createText[1] = null;
+
+ Window.Instance.Remove(root);
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+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 Tizen.NUI.Samples
+{
+ 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.BaseComponents;
+using Tizen.NUI.UIComponents;
+
+namespace Tizen.NUI.Samples
+{
+ 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 true;
+ }
+
+ 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;
+
+namespace Tizen.NUI.Samples
+{
+ 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.BaseComponents;
+
+namespace Tizen.NUI.Samples
+{
+ 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();
+ }
+
+ 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;
+
+namespace Tizen.NUI.Samples
+{
+ public class ContactCardsSample : 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()
+ {
+ 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()
+ {
+
+ }
+
+ //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 Tizen.NUI.Samples
+{
+ public class ContactData
+ {
+ public const int itemSize = 15;
+ public static readonly string floder = CommonResource.GetFHResourcePath() + "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;
+
+namespace Tizen.NUI.Samples
+{
+ public class MaskedImage
+ {
+ private static readonly string IMAGE_MASK = CommonResource.GetFHResourcePath() + "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;
+
+namespace Tizen.NUI.Samples
+{
+ public class CubeTransitionEffectSample : IExample
+ {
+ static string DEMO_IMAGE_DIR = CommonResource.GetFHResourcePath() + "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 CubeTransitionEffect mCubeWaveEffect;
+ private CubeTransitionEffect mCubeCrossEffect;
+ private CubeTransitionEffect mCubeFoldEffect;
+ private CubeTransitionEffect mCurrentEffect;
+
+ private Timer mViewTimer;
+ private bool mSlideshow = false;
+
+ private Vector2 mPanPosition;
+ private Vector2 mPanDisplacement;
+
+ public void Activate()
+ {
+ // 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 = "SamsungOne 400";
+ 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 (null != mViewTimer)
+ {
+ mViewTimer.Stop();
+ mViewTimer.Tick -= OnTimerTick;
+ mViewTimer.Dispose();
+ mViewTimer = null;
+ }
+
+ if (null != mCurrentEffect)
+ {
+ mCurrentEffect.StopTransition();
+ mContent.Remove(mCurrentEffect);
+ mCurrentEffect.Dispose();
+ mCurrentEffect = null;
+ }
+
+ if (mContent)
+ {
+ 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, 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.BaseComponents;
+
+namespace Tizen.NUI.Samples
+{
+ public class DaliDemo : NUIApplication
+ {
+ 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) =>
+ {
+ string fileName = global::System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
+
+ //global::System.Diagnostics.Process.Start(fileName, name);
+
+ RunSample(name);
+ });
+
+ Assembly assembly = this.GetType().Assembly;
+
+ Type exampleType = assembly.GetType("Tizen.NUI.Samples.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 RunSample(string name)
+ {
+ Assembly assembly = typeof(DaliDemo).Assembly;
+
+ Type exampleType = assembly?.GetType(name);
+ IExample example = assembly?.CreateInstance(name) as IExample;
+
+ if (null != example)
+ {
+ DeleteDaliDemo();
+
+ example.Activate();
+ }
+
+ curExample = example;
+ }
+
+ private void ExitSample()
+ {
+ curExample?.Deactivate();
+ curExample = null;
+
+ FullGC();
+
+ CreateDaliDemo();
+ }
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+ CreateDaliDemo();
+
+ Window.Instance.KeyEvent += Instance_KeyEvent;
+ }
+
+ 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
+ {
+ Dispose();
+ }
+ }
+ }
+ }
+
+ public void Deactivate()
+ {
+ demo = null;
+ }
+
+ private DaliTableView demo;
+ }
+}
{
static private uint mCurPage = 0;
- static public string DEMO_IMAGE_DIR = SampleResource.GetDaliResourcePath() + "DaliDemo/";
+ static public string DEMO_IMAGE_DIR = @"../../../demo/csharp-demo/res/images/FH3/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
ImageView focusableTile = new ImageView();
focusableTile.SetStyleName("DemoTile");
- focusableTile.ResourceUrl = SampleResource.GetDaliResourcePath() + "DaliDemo/demo-tile-texture.9.png";
+ focusableTile.ResourceUrl = CommonResource.GetFHResourcePath() + "DaliDemo/demo-tile-texture.9.png";
focusableTile.PositionUsesPivotPoint = true;
focusableTile.ParentOrigin = ParentOrigin.Center;
focusableTile.WidthResizePolicy = focusableTile.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent;
// Create an ImageView for the 9-patch border around the tile.
ImageView borderImage = new ImageView();
borderImage.SetStyleName("DemoTileBorder");
- borderImage.ResourceUrl = SampleResource.GetDaliResourcePath() + "DaliDemo/item-background.9.png";
+ borderImage.ResourceUrl = CommonResource.GetFHResourcePath() + "DaliDemo/item-background.9.png";
borderImage.PositionUsesPivotPoint = true;
borderImage.PivotPoint = PivotPoint.Center;
borderImage.ParentOrigin = ParentOrigin.Center;
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class DropDownSample : IExample
+ {
+ private View root;
+
+ private TextLabel[] createText = new TextLabel[2];
+
+ private DropDown dropDown = null;
+ private DropDown dropDown2 = null;
+ private ScrollBar scrollBar = null;
+ private ScrollBar scrollBar2 = null;
+
+ private static string[] mode = new string[]
+ {
+ "Utility DropDown",
+ "Family DropDown",
+ "Food DropDown",
+ "Kitchen DropDown",
+ };
+ private static Color[] color = new Color[]
+ {
+ new Color(0.05f, 0.63f, 0.9f, 1),//#ff0ea1e6 Utility
+ new Color(0.14f, 0.77f, 0.28f, 1),//#ff24c447 Family
+ new Color(0.75f, 0.46f, 0.06f, 1),//#ffec7510 Food
+ new Color(0.59f, 0.38f, 0.85f, 1),//#ff9762d9 Kitchen
+ };
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ BackgroundColor = Color.White,
+ };
+ window.Add(root);
+
+ ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
+ createText[0] = new TextLabel();
+ createText[0].Text = "Create DropDown just by properties";
+ createText[0].Size2D = new Size2D(450, 100);
+ createText[0].Position2D = new Position2D(200, 100);
+ createText[0].MultiLine = true;
+ root.Add(createText[0]);
+
+ #region CreateByProperty
+ dropDown = new DropDown();
+ dropDown.Size2D = new Size2D(900, 108);
+ dropDown.Position2D = new Position2D(50, 300);
+ dropDown.Style.HeaderText.Text = "TitleArea";
+ dropDown.Style.HeaderText.TextColor = new Color(0, 0, 0, 1);
+ dropDown.Style.HeaderText.PointSize = 28;
+ dropDown.Style.HeaderText.FontFamily = "SamsungOneUI 500C";
+ dropDown.Style.Button.Text.Text = "DropDown Text";
+ dropDown.Style.Button.Text.TextColor = new Color(0, 0, 0, 1);
+ dropDown.Style.Button.Text.PointSize = 20;
+ dropDown.Style.Button.Text.FontFamily = "SamsungOneUI 500";
+ dropDown.Style.Button.Icon.ResourceUrl = CommonResource.GetFHResourcePath() + "6. List/list_ic_dropdown.png";
+ dropDown.Style.Button.Icon.Size = new Size(48, 48);
+ dropDown.Style.Button.IconRelativeOrientation = Button.IconOrientation.Right;
+ dropDown.Style.Button.PositionX = 56;
+ dropDown.SpaceBetweenButtonTextAndIcon = 8;
+ dropDown.Style.ListBackgroundImage.ResourceUrl = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_bg.png";
+ dropDown.Style.ListBackgroundImage.Border = new Rectangle(51, 51, 51, 51);
+ dropDown.Style.ListBackgroundImage.Size = new Size(360, 500);
+ dropDown.ListMargin.Start = 20;
+ dropDown.ListMargin.Top = 20;
+ dropDown.ListPadding = new Extents(4, 4, 4, 4);
+ root.Add(dropDown);
+
+ for (int i = 0; i < 8; i++)
+ {
+ DropDown.DropDownDataItem item = new DropDown.DropDownDataItem();
+ item.Size = new Size(360, 96);
+ item.BackgroundColor= new Selector<Color>
+ {
+ Pressed = new Color(0, 0, 0, 0.4f),
+ Other = new Color(1, 1, 1, 0),
+ };
+ item.Text = "Normal list " + i;
+ item.PointSize = 18;
+ item.FontFamily = "SamsungOne 500";
+ item.TextPosition = new Position(28, 0);
+ item.CheckImageSize = new Size(40, 40);
+ item.CheckImageResourceUrl = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_checkbox_on.png";
+ item.CheckImageGapToBoundary = 16;
+ dropDown.AddItem(item);
+ }
+
+ dropDown.SelectedItemIndex = 3;
+ //dropDown.DeleteItem(1);
+
+ //DropDown.DropDownItemData insertItem = new DropDown.DropDownItemData();
+ //insertItem.Size2D = new Size2D(360, 96);
+ //insertItem.BackgroundColorSelector = new Selector<Color>
+ //{
+ // Pressed = new Color(0, 0, 0, 0.4f),
+ // Other = new Color(1, 1, 1, 0),
+ //};
+ //insertItem.Text = "Insert Normal list ";
+ //insertItem.PointSize = 18;
+ //insertItem.FontFamily = "SamsungOne 500";
+ //insertItem.TextPosition2D = new Position2D(28, 0);
+ //insertItem.CheckImageSize = new Size2D(40, 40);
+ //insertItem.CheckImageResourceUrl = CommonReosurce.GetFHResourcePath() + "10. Drop Down/dropdown_checkbox_on.png";
+ //insertItem.CheckImageRightSpace = 16;
+ //dropDown.InsertItem(insertItem, 1);
+ ////////Attach scrollbar///////////
+ scrollBar = new ScrollBar();
+ scrollBar.Direction = ScrollBar.DirectionType.Vertical;
+ scrollBar.Position2D = new Position2D(394, 2);
+ scrollBar.Size2D = new Size2D(4, 446);
+ scrollBar.Style.Track.BackgroundColor = Color.Green;
+ scrollBar.Style.Thumb.Size = new Size(4, 30);
+ scrollBar.Style.Thumb.BackgroundColor = Color.Yellow;
+ scrollBar.Style.Track.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
+ dropDown.AttachScrollBar(scrollBar);
+
+ #endregion
+ ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
+ createText[1] = new TextLabel();
+ createText[1].Text = "Create DropDown just by Attributes";
+ createText[1].Size2D = new Size2D(450, 100);
+ createText[1].Position2D = new Position2D(1000, 100);
+ createText[1].MultiLine = true;
+ root.Add(createText[1]);
+
+ #region CreateByAttributes
+
+ DropDownStyle attrs = new DropDownStyle
+ {
+ HeaderText = new TextLabelStyle
+ {
+ Text = new Selector<string> { All = "TitleArea" },
+ PointSize = new Selector<float?> { All = 28 },
+ TextColor = new Selector<Color> { All = new Color(0, 0, 0, 1) },
+ FontFamily = "SamsungOneUI 500C",
+ },
+
+ Button = new ButtonStyle
+ {
+ Text = new TextLabelStyle
+ {
+ Text = new Selector<string> { All = "DropDown Text" },
+ PointSize = new Selector<float?> { All = 20 },
+ TextColor = new Selector<Color> { All = new Color(0, 0, 0, 1) },
+ FontFamily = "SamsungOneUI 500",
+ },
+ Icon = new ImageControlStyle
+ {
+ Size = new Size(48, 48),
+ ResourceUrl = new Selector<string> { All = CommonResource.GetFHResourcePath() + "6. List/list_ic_dropdown.png" },
+ },
+ IconRelativeOrientation = Button.IconOrientation.Right,
+ PositionX = 56,
+ },
+ ListBackgroundImage = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string> { All = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_bg.png" },
+ Border = new Selector<Rectangle> { All = new Rectangle(51, 51, 51, 51) },
+ Size = new Size(360, 500),
+ },
+ SpaceBetweenButtonTextAndIcon = 8,
+ ListMargin = new Extents(20, 0, 20, 0),
+ BackgroundColor = new Selector<Color> { All = new Color(1, 1, 1, 1) },
+ ListPadding = new Extents(4, 4, 4, 4),
+ };
+
+ dropDown2 = new DropDown(attrs);
+ dropDown2.Size2D = new Size2D(900, 108);
+ dropDown2.Position2D = new Position2D(1000, 300);
+ root.Add(dropDown2);
+
+ DropDownItemStyle itemAttrs = new DropDownItemStyle
+ {
+ BackgroundColor = new Selector<Color>
+ {
+ Pressed = new Color(0, 0, 0, 0.4f),
+ Other = new Color(1, 1, 1, 0),
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = 18 },
+ FontFamily = "SamsungOne 500",
+ Position = new Position(28, 0),
+ },
+ CheckImage = new ImageViewStyle
+ {
+ Size = new Size(40, 40),
+ ResourceUrl = new Selector<string> { All = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_checkbox_on.png" },
+ },
+ CheckImageGapToBoundary = 16,
+ };
+
+ for (int i = 0; i < 8; i++)
+ {
+ DropDown.DropDownDataItem item = new DropDown.DropDownDataItem(itemAttrs);
+ item.Size = new Size(360, 96);
+ item.Text = "Normal list " + i;
+ dropDown2.AddItem(item);
+ }
+ dropDown2.SelectedItemIndex = 0;
+
+ ////////Attach scrollbar///////////
+ scrollBar2 = new ScrollBar();
+ scrollBar2.Direction = ScrollBar.DirectionType.Vertical;
+ scrollBar2.Position2D = new Position2D(394, 2);
+ scrollBar2.Size2D = new Size2D(4, 446);
+ scrollBar2.Style.Track.BackgroundColor = Color.Green;
+ scrollBar2.Style.Thumb.Size = new Size(4, 30);
+ scrollBar2.Style.Thumb.BackgroundColor = Color.Yellow;
+ scrollBar2.Style.Track.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
+ dropDown2.AttachScrollBar(scrollBar2);
+
+ #endregion
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ if (dropDown != null)
+ {
+ if (scrollBar != null)
+ {
+ dropDown.DetachScrollBar();
+ scrollBar.Dispose();
+ scrollBar = null;
+ }
+
+ root.Remove(dropDown);
+ dropDown.Dispose();
+ dropDown = null;
+ }
+ if (dropDown2 != null)
+ {
+ if (scrollBar2 != null)
+ {
+ dropDown2.DetachScrollBar();
+ scrollBar2.Dispose();
+ scrollBar2 = null;
+ }
+
+ root.Remove(dropDown2);
+ dropDown2.Dispose();
+ dropDown2 = 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;
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Samples
+{
+
+ 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 : 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 FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
+ {
+ FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new ListItemView());
+ //Console.WriteLine($"OnCreateViewHolder... viewType: {viewType} viewID: {viewHolder.ItemView.ID}");
+
+ return viewHolder;
+ }
+
+ public override void OnBindViewHolder(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(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(FlexibleView flexibleView, int previousFocus, int currentFocus)
+ {
+ 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);
+ }
+ 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(FlexibleView.ViewHolder holder)
+ {
+ //Console.WriteLine($"+Attached: {holder.AdapterPosition}");
+ }
+
+ public override void OnViewDetachedFromWindow(FlexibleView.ViewHolder holder)
+ {
+ //Console.WriteLine($" --Detached: {holder.AdapterPosition}");
+ }
+
+ }
+
+ public class FlexibleViewSample : IExample
+ {
+ private FlexibleView flexibleView1;
+ private FlexibleView flexibleView2;
+ private ListBridge adapter;
+
+ private ScrollBar scrollBar1;
+ private ScrollBar scrollBar2;
+
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ flexibleView1 = new FlexibleView();
+ flexibleView1.Name = "RecyclerView";
+ flexibleView1.Position2D = new Position2D(500, 200);
+ 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);
+
+ flexibleView1.FocusedItemIndex = 0;
+
+ window.Add(flexibleView1);
+
+ flexibleView1.Focusable = true;
+
+ flexibleView1.KeyEvent += RecyclerView_KeyEvent;
+ flexibleView1.FocusGained += FlexibleView_FocusGained;
+ flexibleView1.FocusLost += FlexibleView_FocusLost;
+
+ scrollBar1 = new ScrollBar();
+ scrollBar1.Direction = ScrollBar.DirectionType.Vertical;
+ scrollBar1.Position2D = new Position2D(394, 2);
+ scrollBar1.Size2D = new Size2D(4, 446);
+ scrollBar1.Style.Track.BackgroundColor = Color.Green;
+ scrollBar1.Style.Thumb.Size = new Size(4, 30);
+ scrollBar1.Style.Thumb.BackgroundColor = Color.Yellow;
+ scrollBar1.Style.Track.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
+ flexibleView1.AttachScrollBar(scrollBar1);
+
+
+ flexibleView2 = new FlexibleView();
+ flexibleView2.Name = "RecyclerView";
+ flexibleView2.Position2D = new Position2D(500, 800);
+ 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);
+
+ flexibleView2.FocusedItemIndex = 0;
+
+ window.Add(flexibleView2);
+
+ flexibleView2.Focusable = true;
+
+ flexibleView2.KeyEvent += RecyclerView_KeyEvent;
+ flexibleView2.FocusGained += FlexibleView_FocusGained;
+ flexibleView2.FocusLost += FlexibleView_FocusLost;
+
+ scrollBar2 = new ScrollBar();
+ scrollBar2.Position2D = new Position2D(2, 194);
+ scrollBar2.Size2D = new Size2D(696, 4);
+ scrollBar2.Style.Track.BackgroundColor = Color.Green;
+ scrollBar2.Style.Thumb.Size = new Size(30, 4);
+ scrollBar2.Style.Thumb.BackgroundColor = Color.Yellow;
+ scrollBar2.Style.Track.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
+ flexibleView2.AttachScrollBar(scrollBar2);
+
+
+ FocusManager.Instance.SetCurrentFocusView(flexibleView1);
+ }
+
+ private void FlexibleView_FocusLost(object sender, EventArgs e)
+ {
+ View flexibleView = sender as View;
+ flexibleView.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f);
+ }
+
+ private void FlexibleView_FocusGained(object sender, EventArgs e)
+ {
+ View flexibleView = sender as View;
+ flexibleView.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.8f);
+ }
+
+ private bool RecyclerView_KeyEvent(object source, View.KeyEventArgs e)
+ {
+ FlexibleView flexibleView = source as FlexibleView;
+ return ProcessKey(flexibleView, e.Key);
+ }
+
+ private bool ProcessKey(FlexibleView flexibleView, Key key)
+ {
+ if (key.State == Key.StateType.Down)
+ {
+ if (key.KeyPressedName == "Up")
+ {
+ flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Up);
+ }
+ else if (key.KeyPressedName == "Down")
+ {
+ flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Down);
+ }
+ if (key.KeyPressedName == "Left")
+ {
+ flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Left);
+ }
+ else if (key.KeyPressedName == "Right")
+ {
+ flexibleView.MoveFocus(FlexibleView.LayoutManager.Direction.Right);
+ }
+ else if (key.KeyPressedName == "0")
+ {
+ if (flexibleView == flexibleView1)
+ {
+ FocusManager.Instance.SetCurrentFocusView(flexibleView2);
+ }
+ else if (flexibleView == flexibleView2)
+ {
+ FocusManager.Instance.SetCurrentFocusView(flexibleView1);
+ }
+ }
+ else if (key.KeyPressedName == "1")
+ {
+ adapter.InsertData(1);
+ }
+ else if (key.KeyPressedName == "2")
+ {
+ adapter.RemoveData(1);
+ }
+ else if (key.KeyPressedName == "8")
+ {
+ flexibleView.FocusedItemIndex = 0;
+ }
+ else if (key.KeyPressedName == "9")
+ {
+ flexibleView.FocusedItemIndex = 15;
+ }
+ else if (key.KeyPressedName == "7")
+ {
+ }
+ }
+
+ return false;
+ }
+
+ public void Deactivate()
+ {
+ flexibleView1.DetachScrollBar();
+ scrollBar1.Dispose();
+ flexibleView2.DetachScrollBar();
+ scrollBar2.Dispose();
+
+ Window window = Window.Instance;
+ window.Remove(flexibleView1);
+ flexibleView1.Dispose();
+ window.Remove(flexibleView2);
+ flexibleView2.Dispose();
+
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class InputFieldSample : IExample
+ {
+ private TextLabel guideText;
+ private View rootView;
+ InputField inputField;
+ InputFieldStyle inputFieldAttrs;
+
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ rootView = new View()
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ BackgroundColor = new Color(0.8f, 0.8f, 0.8f, 0.8f),
+ Focusable = true
+ };
+ window.Add(rootView);
+ rootView.TouchEvent += OnRootViewTouchEvent;
+ CreateInputField();
+ CreateGuideText();
+ }
+
+ private void CreateGuideText()
+ {
+ guideText = new TextLabel();
+ guideText.Size2D = new Size2D(1600, 150);
+ guideText.Position2D = new Position2D(30, 30);
+ guideText.TextColor = Color.Blue;
+ guideText.BackgroundColor = Color.White;
+ guideText.PointSize = 15;
+ guideText.MultiLine = true;
+ guideText.Focusable = true;
+ rootView.Add(guideText);
+ guideText.Text =
+ "Tips: \n" +
+ "This InputField is created with attibutes; \n" +
+ "User can input text after press on it; \n" +
+ "User can exit the sample by press \"Esc\" key after touch on any area except the InputField.";
+ }
+
+ private void CreateInputField()
+ {
+ inputFieldAttrs = new InputFieldStyle();
+ inputFieldAttrs.Space = 24;
+ inputFieldAttrs.BackgroundImageAttributes = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string> { All = CommonResource.GetFHResourcePath() + "1. Action bar/search_bg.png" },
+ Border = new Selector<Rectangle> { All = new Rectangle(45, 45, 0, 0) }
+ };
+
+ inputFieldAttrs.InputBoxAttributes = new TextFieldStyle
+ {
+ TextColor = new Selector<Color>
+ {
+ Normal = new Color(0, 0, 0, 1),
+ Pressed = new Color(0, 0, 0, 1),
+ Disabled = new Color(0, 0, 0, 0.4f)
+ },
+ PlaceholderTextColor = new Selector<Color>
+ {
+ All = new Color(0, 0, 0, 0.4f)
+ },
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ VerticalAlignment = VerticalAlignment.Center,
+ FontFamily = "SamsungOne 500",
+ PointSize = new Selector<float?>
+ {
+ All = 38
+ },
+ CursorWidth = 2,
+ };
+
+ inputField = new InputField(inputFieldAttrs);
+ inputField.Size2D = new Size2D(1600, 95);
+ inputField.Position2D = new Position2D(100, 300);
+ //inputField.Focusable = true;
+ rootView.Add(inputField);
+ inputField.FocusGained += onFocusGained;
+ inputField.FocusLost += onFocusLost;
+ //inputField.TouchEvent += onTouchEvent;
+ inputField.HintText = "Please input key word...";
+ }
+
+ private bool OnRootViewTouchEvent(object sender, View.TouchEventArgs e)
+ {
+ FocusManager.Instance.SetCurrentFocusView(rootView);
+ return false;
+ }
+
+ private void onFocusLost(object sender, EventArgs e)
+ {
+
+ }
+
+ private void onFocusGained(object sender, EventArgs e)
+ {
+
+ }
+
+ //private bool onTouchEvent(object sender, View.TouchEventArgs e)
+ //{
+ // return false;
+ //}
+
+ public void Deactivate()
+ {
+ if (inputField != null)
+ {
+ inputField.FocusGained -= onFocusGained;
+ inputField.FocusLost -= onFocusLost;
+ //inputField.TouchEvent -= onTouchEvent;
+ rootView.Remove(inputField);
+ inputField.Dispose();
+ inputField = null;
+ }
+ if (rootView != null)
+ {
+ rootView.TouchEvent -= OnRootViewTouchEvent;
+ Window.Instance.Remove(rootView);
+ rootView.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Samples
+{
+ 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.BaseComponents;
+using Tizen.NUI.Components;
+using Tizen.NUI.UIComponents;
+
+namespace Tizen.NUI.Samples
+{
+ public class ZItemViewSample : 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.GetFHResourcePath() + "ItemViewDemo/top-bar.png";
+ private string EDIT_IMAGE = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-edit.png";
+ private string EDIT_IMAGE_SELECTED = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-edit-selected.png";
+ private string DELETE_IMAGE = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-delete.png";
+ private string DELETE_IMAGE_SELECTED = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-delete-selected.png";
+ private string REPLACE_IMAGE = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-replace.png";
+ private string REPLACE_IMAGE_SELECTED = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-replace-selected.png";
+ private string INSERT_IMAGE = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-insert.png";
+ private string INSERT_IMAGE_SELECTED = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-insert-selected.png.png";
+ private string SELECTED_IMAGE = CommonResource.GetFHResourcePath() + "ItemViewDemo/item-select-check.png";
+
+ private string SPIRAL_LAYOUT_IMAGE = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-item-view-layout-spiral.png";
+ private string SPIRAL_LAYOUT_IMAGE_SELECTED = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-item-view-layout-spiral-selected.png";
+ private string GRID_LAYOUT_IMAGE = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-item-view-layout-grid.png";
+ private string GRID_LAYOUT_IMAGE_SELECTED = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-item-view-layout-grid-selected.png";
+ private string DEPTH_LAYOUT_IMAGE = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-item-view-layout-depth.png";
+ private string DEPTH_LAYOUT_IMAGE_SELECTED = CommonResource.GetFHResourcePath() + "ItemViewDemo/icon-item-view-layout-depth-selected.png";
+
+
+ private 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 ItemView(mItemFactoryWrapper);
+ //mItemView.BackgroundColor = Color.Blue;
+ mItemView.ParentOrigin = Position.ParentOriginCenter;
+ mItemView.PivotPoint = Position.PivotPointCenter;
+ 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, 800, 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.GetFHResourcePath() + "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");
+ }
+ else
+ {
+ Console.WriteLine("hehe");
+ }
+ View tick = view.FindChildByName("Tick");
+ if (tick)
+ {
+ if(tick.Visibility)
+ {
+ tick.Hide();
+ }
+ else
+ {
+ tick.Show();
+ }
+ }
+ };
+ }
+
+ 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) =>
+ {
+ View tick = (e.View).FindChildByName("Tick");
+ if (tick)
+ {
+ if (tick.Visibility)
+ {
+ tick.Hide();
+ }
+ else
+ {
+ tick.Show();
+ }
+ }
+ };
+ }
+
+ 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();
+ mItemView.ReplaceItem(new Item(mItemView.GetItemId(e.View), NewItemView((uint)random.Next(52))), 0.5f);
+ };
+ }
+
+ 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) =>
+ {
+ View tick = (e.View).FindChildByName("Tick");
+ if (tick)
+ {
+ if (tick.Visibility)
+ {
+ tick.Hide();
+ }
+ else
+ {
+ tick.Show();
+ }
+ }
+ };
+ }
+ 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 Tizen.NUI.Samples
+{
+ 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;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class LoadingSample : IExample
+ {
+ private TextLabel board1, board2, board;
+ private Button button1, button2, button3, button4;
+ private Loading loading1_1, loading2_1; //1-null para 2-attributes; X_1-color; X_2 image track
+ private View root;
+
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ };
+
+ CreateBoardAndButtons();
+ string[] imageArray = new string[36];
+ for (int i=0; i<36; i++)
+ {
+ if (i < 10)
+ {
+ imageArray[i] = CommonResource.GetFHResourcePath() + "9. Controller/Loading Sequence_Native/loading_0" + i + ".png";
+ }
+ else
+ {
+ imageArray[i] = CommonResource.GetFHResourcePath() + "9. Controller/Loading Sequence_Native/loading_" + i + ".png";
+ }
+ }
+
+ loading1_1 = new Loading();
+ loading1_1.Position2D = new Position2D(100, 350);
+ loading1_1.Size2D = new Size2D(100, 100);
+
+ loading1_1.Images = imageArray;
+ root.Add(loading1_1);
+
+ LoadingStyle style = new LoadingStyle
+ {
+ Images = imageArray
+ };
+
+ loading2_1 = new Loading(style);
+ loading2_1.Position2D = new Position2D(500, 350);
+ loading2_1.Size2D = new Size2D(100, 100);
+ root.Add(loading2_1);
+
+ window.Add(root);
+
+ FocusManager.Instance.SetCurrentFocusView(button1);
+ }
+
+ void CreateBoardAndButtons()
+ {
+ board = new TextLabel();
+ board.Size2D = new Size2D(1000, 100);
+ board.Position2D = new Position2D(430, 900);
+ board.PointSize = 30;
+ board.HorizontalAlignment = HorizontalAlignment.Center;
+ board.VerticalAlignment = VerticalAlignment.Center;
+ board.BackgroundColor = Color.Magenta;
+ board.Text = "log pad";
+ root.Add(board);
+
+ board1 = new TextLabel();
+ board1.Size2D = new Size2D(300, 70);
+ board1.Position2D = new Position2D(50, 200);
+ board1.PointSize = 20;
+ board1.HorizontalAlignment = HorizontalAlignment.Center;
+ board1.VerticalAlignment = VerticalAlignment.Center;
+ board1.BackgroundColor = Color.Magenta;
+ board1.Text = "NULL parameter construction";
+ root.Add(board1);
+
+ board2 = new TextLabel();
+ board2.Size2D = new Size2D(300, 70);
+ board2.Position2D = new Position2D(400, 200);
+ board2.PointSize = 20;
+ board2.HorizontalAlignment = HorizontalAlignment.Center;
+ board2.VerticalAlignment = VerticalAlignment.Center;
+ board2.BackgroundColor = Color.Magenta;
+ board2.Text = "Attribute parameter construction";
+ root.Add(board2);
+
+ button1 = new Button();
+ button1.BackgroundColor = Color.Green;
+ button1.Position2D = new Position2D(80, 600);
+ button1.Size2D = new Size2D(100, 50);
+ button1.Style.Text.Text = "FPS++";
+ root.Add(button1);
+ button1.Focusable = true;
+ button1.ClickEvent += Loading1FPSAdd;
+ button1.FocusGained += FocusGained;
+ button1.FocusLost += FocusLost;
+
+ button2 = new Button();
+ button2.BackgroundColor = Color.Green;
+ button2.Position2D = new Position2D(200, 600);
+ button2.Size2D = new Size2D(100, 50);
+ button2.Style.Text.Text = "FPS--";
+ root.Add(button2);
+ button2.Focusable = true;
+ button2.ClickEvent += Loading1FPSMinus;
+ button2.FocusGained += FocusGained;
+ button2.FocusLost += FocusLost;
+
+ button1.RightFocusableView = button2;
+ button2.LeftFocusableView = button1;
+
+ button3 = new Button();
+ button3.BackgroundColor = Color.Green;
+ button3.Position2D = new Position2D(450, 600);
+ button3.Size2D = new Size2D(180, 50);
+ button3.Style.Text.Text = "Normal Loading";
+ root.Add(button3);
+ }
+
+ private void Loading1FPSAdd(object sender, global::System.EventArgs e)
+ {
+ loading1_1.FrameRate += 1;
+ board.Text = "loading1_1 FPS: "+loading1_1.FrameRate.ToString();
+ }
+
+ private void Loading1FPSMinus(object sender, global::System.EventArgs e)
+ {
+ loading1_1.FrameRate -= 1;
+ board.Text = "loading1_1 FPS: " + loading1_1.FrameRate.ToString();
+ }
+
+ private void FocusLost(object sender, global::System.EventArgs e)
+ {
+ View view = sender as View;
+ view.Scale = new Vector3(1.2f, 1.2f, 1.0f);
+ }
+
+ private void FocusGained(object sender, global::System.EventArgs e)
+ {
+ View view = sender as View;
+ view.Scale = new Vector3(1.0f, 1.0f, 1.0f);
+ }
+
+ public void Deactivate()
+ {
+ if (board != null)
+ {
+ root.Remove(board);
+ board.Dispose();
+ board = null;
+ }
+ if (board1 != null)
+ {
+ root.Remove(board1);
+ board1.Dispose();
+ board1 = null;
+ }
+ if (board2 != null)
+ {
+ root.Remove(board2);
+ board2.Dispose();
+ board2 = null;
+ }
+ if (button1 != null)
+ {
+ button1.ClickEvent -= Loading1FPSAdd;
+ button1.FocusGained -= FocusGained;
+ button1.FocusLost -= FocusLost;
+ root.Remove(button1);
+ button1.Dispose();
+ button1 = null;
+ }
+ if (button2 != null)
+ {
+ button2.ClickEvent -= Loading1FPSMinus;
+ button2.FocusGained -= FocusGained;
+ button2.FocusLost -= FocusLost;
+ root.Remove(button2);
+ button2.Dispose();
+ button2 = null;
+ }
+ if (button3 != null)
+ {
+ root.Remove(button3);
+ button3.Dispose();
+ button3 = null;
+ }
+ if (loading1_1 != null)
+ {
+ root.Remove(loading1_1);
+ loading1_1.Dispose();
+ loading1_1 = null;
+ }
+ if (loading2_1 != null)
+ {
+ root.Remove(loading2_1);
+ loading2_1.Dispose();
+ loading2_1 = null;
+ }
+ if (root != null)
+ {
+ Window.Instance.Remove(root);
+ root.Dispose();
+ root = null;
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Samples
+{
+ public class PaginationSample : IExample
+ {
+ private Pagination pagination1;
+ private Pagination pagination2;
+
+ private readonly int PAGE_COUNT = 5;
+
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ ///////////////////////////////////////////////Create by Properties//////////////////////////////////////////////////////////
+ pagination1 = new Pagination();
+ pagination1.Name = "Pagination1";
+ pagination1.Position2D = new Position2D(500, 450);
+ pagination1.Size2D = new Size2D(400, 30);
+ pagination1.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
+ pagination1.IndicatorSize = new Size(26, 26);
+ pagination1.IndicatorImageURL = new Selector<string>()
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_nor.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/pagination_ic_sel.png",
+ };
+ pagination1.IndicatorSpacing = 8;
+ pagination1.IndicatorCount = PAGE_COUNT;
+ pagination1.SelectedIndex = 0;
+ window.Add(pagination1);
+
+ ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
+ PaginationStyle style = new PaginationStyle();
+ style.IndicatorSize = new Size(15, 15);
+ style.IndicatorImageURL = new Selector<string>()
+ {
+ Normal = CommonResource.GetTVResourcePath() + "component/c_pagination/c_paganation_medium_dot_normal.png",
+ Selected = CommonResource.GetTVResourcePath() + "component/c_pagination/c_paganation_medium_dot_focus.png",
+ };
+ style.IndicatorSpacing = 14;
+ pagination2 = new Pagination(style);
+ pagination2.Name = "Pagination2";
+ pagination2.Position2D = new Position2D(500, 500);
+ pagination2.Size2D = new Size2D(400, 30);
+ pagination2.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
+ pagination2.IndicatorCount = PAGE_COUNT;
+ pagination2.SelectedIndex = 0;
+ window.Add(pagination2);
+
+ window.KeyEvent += Window_KeyEvent;
+ }
+
+ private void Window_KeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ if (e.Key.KeyPressedName == "Left")
+ {
+ if (pagination1.SelectedIndex > 0)
+ {
+ pagination1.SelectedIndex = pagination1.SelectedIndex - 1;
+ }
+ if (pagination2.SelectedIndex > 0)
+ {
+ pagination2.SelectedIndex = pagination2.SelectedIndex - 1;
+ }
+ }
+ else if (e.Key.KeyPressedName == "Right")
+ {
+ if (pagination1.SelectedIndex < pagination1.IndicatorCount - 1)
+ {
+ pagination1.SelectedIndex = pagination1.SelectedIndex + 1;
+ }
+ if (pagination2.SelectedIndex < pagination2.IndicatorCount - 1)
+ {
+ pagination2.SelectedIndex = pagination2.SelectedIndex + 1;
+ }
+ }
+ }
+ }
+
+ public void Deactivate()
+ {
+ Window window = Window.Instance;
+ window.KeyEvent -= Window_KeyEvent;
+ window.Remove(pagination1);
+ window.Remove(pagination2);
+
+ pagination1.Dispose();
+ pagination2.Dispose();
+ }
+ }
+}
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class PopupSample : IExample
+ {
+ private View root;
+
+ private TextLabel[] createText = new TextLabel[2];
+
+ private Popup popup = null;
+ private Popup popup2 = null;
+ private TextLabel contentText = null;
+ private TextLabel contentText2 = null;
+ private int index = 0;
+ private int index2 = 0;
+ private Button button = null;
+
+ private static string[] buttonStyles = new string[]
+ {
+ "UtilityPopupButton",
+ "FamilyPopupButton",
+ "FoodPopupButton",
+ "KitchenPopupButton",
+ };
+ private static Color[] color = new Color[]
+ {
+ new Color(0.05f, 0.63f, 0.9f, 1),//#ff0ea1e6
+ new Color(0.14f, 0.77f, 0.28f, 1),//#ff24c447
+ new Color(0.75f, 0.46f, 0.06f, 1),//#ffec7510
+ new Color(0.59f, 0.38f, 0.85f, 1),//#ff9762d9
+ };
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ BackgroundColor = Color.White,
+ };
+ window.Add(root);
+
+ ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
+ createText[0] = new TextLabel();
+ createText[0].Text = "Create Popup just by properties";
+ createText[0].Size2D = new Size2D(500, 100);
+ createText[0].Position2D = new Position2D(500, 50);
+ root.Add(createText[0]);
+
+ popup = new Popup();
+ popup.MinimumSize = new Size2D(1032, 184);
+ popup.Size = new Size(1032, 400);
+ popup.Position = new Position(200, 100);
+
+ // Title
+ popup.Style.Title.PointSize = 25;
+ popup.Style.Title.SizeHeight = 68;
+ popup.Style.Title.HorizontalAlignment = HorizontalAlignment.Begin;
+ popup.Style.Title.Position = new Position(64, 52);
+ popup.Style.Title.Text = "Popup Title";
+
+ // Shadow and background
+ popup.Style.ShadowExtents = new Extents(24, 24, 24, 24);
+ popup.ShadowImage = CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png";
+ popup.ShadowImageBorder = new Rectangle(0, 0, 105, 105);
+ popup.BackgroundImage = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png";
+ popup.BackgroundImageBorder = new Rectangle(0, 0, 81, 81);
+
+ // Buttons
+ popup.AddButton("Yes");
+ popup.AddButton("Exit");
+ popup.ButtonBackground = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png";
+ popup.ButtonBackgroundBorder = new Rectangle(5, 5, 5, 5);
+ popup.ButtonOverLayBackgroundColorSelector = new Selector<Color>
+ {
+ Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f),
+ Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f),
+ Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
+ };
+ popup.ButtonShadow = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png";
+ popup.ButtonShadowBorder = new Rectangle(5, 5, 5, 5);
+ popup.ButtonTextColor = color[0];
+ popup.ButtonHeight = 132;
+ popup.PopupButtonClickEvent += PopupButtonClickedEvent;
+ popup.LayoutDirectionChanged += PopupLayoutDirectionChanged;
+ popup.Post(window);
+
+ contentText = new TextLabel();
+ contentText.Size2D = new Size2D(904, 100);
+ contentText.PointSize = 20;
+ contentText.HorizontalAlignment = HorizontalAlignment.Begin;
+ contentText.VerticalAlignment = VerticalAlignment.Center;
+ contentText.Text = "Popup ButtonStyle is " + buttonStyles[index];
+ contentText.TextColor = new Color(0,0,222,1);
+ popup.AddContentText(contentText);
+
+ ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
+ createText[1] = new TextLabel();
+ createText[1].Text = "Create Popup just by Attributes";
+ createText[1].Size2D = new Size2D(500, 100);
+ createText[1].Position2D = new Position2D(500, 550);
+ root.Add(createText[1]);
+
+ PopupStyle attrs = new PopupStyle
+ {
+ MinimumSize = new Size2D(1032, 184),
+ ShadowExtents = new Extents(24, 24, 24, 24),
+ BackgroundImage = new Selector<string> { All = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png" },
+ BackgroundImageBorder = new Selector<Rectangle> { All = new Rectangle(0, 0, 81, 81) },
+ Shadow = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string> { All = CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png" },
+ Border = new Selector<Rectangle> { All = new Rectangle(0, 0, 105, 105) }
+ },
+ Title = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = 25 },
+ TextColor = new Selector<Color> { All = Color.Black },
+ Size = new Size(0, 68),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ VerticalAlignment = VerticalAlignment.Bottom,
+ Position = new Position(64, 52),
+ Text = new Selector<string> { All = "Popup Title" },
+ },
+ Buttons = new ButtonStyle
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+ BackgroundImage = new Selector<string> { All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png" },
+ BackgroundImageBorder = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) },
+ Shadow = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string> { All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png" },
+ Border = new Selector<Rectangle> { All = new Rectangle(5, 5, 5, 5) }
+ },
+ Overlay = new ImageViewStyle
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ BackgroundColor = new Selector<Color>
+ {
+ Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f),
+ Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f),
+ Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
+ }
+ },
+ Text = new TextLabelStyle
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Selector<Color> { All = color[index2] },
+ },
+ },
+ };
+
+ popup2 = new Popup(attrs);
+ popup2.Size = new Size(1032, 400);
+ popup2.Position = new Position(200, 600);
+ popup2.AddButton("Yes");
+ popup2.AddButton("Exit");
+ popup2.ButtonHeight = 132;
+ popup2.PopupButtonClickEvent += PopupButtonClickedEvent;
+ popup2.LayoutDirectionChanged += Popup2LayoutDirectionChanged;
+ popup2.Post(window);
+
+ contentText2 = new TextLabel();
+ contentText2.Size2D = new Size2D(904, 100);
+ contentText2.PointSize = 20;
+ contentText2.HorizontalAlignment = HorizontalAlignment.Begin;
+ contentText2.VerticalAlignment = VerticalAlignment.Center;
+ contentText2.Text = "Popup2 ButtonStyle is " + buttonStyles[index];
+ popup2.ContentView.Add(contentText2);
+
+ button = new Button();
+ button.Style.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
+ button.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
+ button.Size2D = new Size2D(580, 80);
+ button.Position2D = new Position2D(1300, 500);
+ button.Style.Text.Text = "LayoutDirection is left to right";
+ button.ClickEvent += ButtonClickEvent;
+ root.Add(button);
+ }
+
+ private void Popup2LayoutDirectionChanged(object sender, View.LayoutDirectionChangedEventArgs e)
+ {
+ if (contentText2.HorizontalAlignment == HorizontalAlignment.Begin)
+ {
+ contentText2.HorizontalAlignment = HorizontalAlignment.End;
+ }
+ else if (contentText2.HorizontalAlignment == HorizontalAlignment.End)
+ {
+ contentText2.HorizontalAlignment = HorizontalAlignment.Begin;
+ }
+ }
+
+ private void PopupLayoutDirectionChanged(object sender, View.LayoutDirectionChangedEventArgs e)
+ {
+ if (contentText.HorizontalAlignment == HorizontalAlignment.Begin)
+ {
+ contentText.HorizontalAlignment = HorizontalAlignment.End;
+ }
+ else if (contentText.HorizontalAlignment == HorizontalAlignment.End)
+ {
+ contentText.HorizontalAlignment = HorizontalAlignment.Begin;
+ }
+ }
+
+ private void PopupButtonClickedEvent(object sender, Popup.ButtonClickEventArgs e)
+ {
+ Popup obj = sender as Popup;
+ if (obj != null && e.ButtonIndex == 0)
+ {
+ if(obj == popup)
+ {
+ index++;
+ index = index % buttonStyles.Length;
+ obj.ButtonTextColor = color[index];
+ contentText.Text = "Popup ButtonStyle is " + buttonStyles[index];
+ }
+ else
+ {
+ index2++;
+ index2 = index2 % buttonStyles.Length;
+ obj.ButtonTextColor = color[index2];
+ contentText2.Text = "Popup2 ButtonStyle is " + buttonStyles[index2];
+ }
+ }
+ }
+
+ private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
+ {
+ if (popup.LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ popup.LayoutDirection = ViewLayoutDirectionType.RTL;
+ popup2.LayoutDirection = ViewLayoutDirectionType.RTL;
+ button.Style.Text.Text = "LayoutDirection is right to left";
+ }
+ else
+ {
+ popup.LayoutDirection = ViewLayoutDirectionType.LTR;
+ popup2.LayoutDirection = ViewLayoutDirectionType.LTR;
+ button.Style.Text.Text = "LayoutDirection is left to right";
+ }
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ if (popup != null)
+ {
+ if (contentText != null)
+ {
+ popup.ContentView.Remove(contentText);
+ contentText.Dispose();
+ contentText = null;
+ }
+
+ root.Remove(popup);
+ popup.Dispose();
+ popup = null;
+ }
+
+ if (popup2 != null)
+ {
+ if (contentText2 != null)
+ {
+ popup2.ContentView.Remove(contentText2);
+ contentText2.Dispose();
+ contentText2 = null;
+ }
+
+ root.Remove(popup2);
+ popup2.Dispose();
+ popup2 = 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;
+ }
+
+ if (button != null)
+ {
+ root.Remove(button);
+ button.Dispose();
+ button = null;
+ }
+
+ Window.Instance.Remove(root);
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using Tizen.NUI;
+
+namespace Tizen.NUI.Samples
+{
+ public class ProgressSample : IExample
+ {
+ private TextLabel board1, board2, board;
+ private Button button1, button2, button3, button4, button5;
+ int status = 0;
+ private Progress progressBar1_1, progressBar1_2, progressBar2_1, progressBar2_2; //1-null para 2-attributes; X_1-color; X_2 image track
+ private View root;
+
+ public void Activate()
+ {
+ Window window = Window.Instance;
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ };
+
+ CreateBoardAndButtons();
+
+ //button1.ClickEvent += bar1Add;
+ //button2.ClickEvent += bar1Minus;
+ //button3.ClickEvent += circle1Add;
+ //button4.ClickEvent += circle1Minus;
+ //button5.ClickEvent += circleStatusChanged;
+
+ progressBar1_1 = new Progress();
+ progressBar1_1.Position2D = new Position2D(80, 350);
+ progressBar1_1.Size2D = new Size2D(140, 4);
+ progressBar1_1.MaxValue = 100;
+ progressBar1_1.MinValue = 0;
+ progressBar1_1.CurrentValue = 45;
+ progressBar1_1.Style.Track.BackgroundColor = Color.Green;
+ progressBar1_1.Style.Progress.BackgroundColor = Color.Black;
+ root.Add(progressBar1_1);
+
+ progressBar1_2 = new Progress();
+ progressBar1_2.Position2D = new Position2D(80, 420);
+ progressBar1_2.Size2D = new Size2D(140, 4);
+ progressBar1_2.MaxValue = 100;
+ progressBar1_2.MinValue = 0;
+ progressBar1_2.CurrentValue = 15;
+ progressBar1_2.Style.Track.BackgroundColor = Color.Green;
+ progressBar1_2.Style.Progress.BackgroundColor = Color.Black;
+
+ root.Add(progressBar1_2);
+
+ ProgressStyle attr = new ProgressStyle
+ {
+ Track = new ImageViewStyle
+ {
+ BackgroundColor = new Selector<Color>
+ {
+ All = Color.Cyan,
+ }
+ },
+ Progress = new ImageViewStyle
+ {
+ BackgroundColor = new Selector<Color>
+ {
+ All = Color.Black,
+ }
+ },
+
+ };
+
+ progressBar2_1 = new Progress(attr);
+ progressBar2_1.Position2D = new Position2D(380, 350);
+ progressBar2_1.Size2D = new Size2D(140, 4);
+ progressBar2_1.MaxValue = 100;
+ progressBar2_1.MinValue = 0;
+ progressBar2_1.CurrentValue = 30;
+ root.Add(progressBar2_1);
+
+ //progressBar2_2 = new Progress(att);
+ //progressBar2_2.Position2D = new Position2D(80, 560);
+ //progressBar2_2.Size2D = new Size2D(140, 4);
+ //progressBar2_2.MaxValue = 100;
+ //progressBar2_2.MinValue = 0;
+ //progressBar2_2.CurrentValue = 75;
+ //progressBar2_2.UpdateValue();
+ //progressBar2_2.Direction = Progress.DirectionType.Horizontal;
+ //root.Add(progressBar2_2);
+
+ 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(430, 900);
+ 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, 200);
+ board1.PointSize = 20;
+ board1.HorizontalAlignment = HorizontalAlignment.Center;
+ board1.VerticalAlignment = VerticalAlignment.Center;
+ board1.BackgroundColor = Color.Magenta;
+ board1.Text = "NULL parameter 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, 200);
+ 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 Button();
+ button1.BackgroundColor = Color.Green;
+ button1.Position2D = new Position2D(100, 700);
+ button1.Size2D = new Size2D(80, 50);
+ button1.Style.Text.Text = "+";
+ root.Add(button1);
+ button1.Focusable = true;
+ button1.ClickEvent += bar1Add;
+
+ button2 = new Button();
+ button2.BackgroundColor = Color.Green;
+ button2.Position2D = new Position2D(200, 700);
+ button2.Size2D = new Size2D(80, 50);
+ button2.Style.Text.Text = "-";
+ root.Add(button2);
+ button2.Focusable = true;
+ button2.ClickEvent += bar1Minus;
+
+ //button3 = new Button();
+ //button3.BackgroundColor = Color.Green;
+ //button3.Position2D = new Position2D(450, 700);
+ //button3.Size2D = new Size2D(80, 50);
+ //button3.Text = "+";
+ //root.Add(button3);
+ //button3.Focusable = true;
+ //button3.ClickEvent += Scroll2Add;
+
+ //button4 = new Button();
+ //button4.BackgroundColor = Color.Green;
+ //button4.Position2D = new Position2D(550, 700);
+ //button4.Size2D = new Size2D(80, 50);
+ //button4.Text = "-";
+ //root.Add(button4);
+ //button4.Focusable = true;
+ //button4.ClickEvent += Scroll2Minus;
+ }
+
+ 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 bar1Add(object sender, global::System.EventArgs e)
+ {
+ board.Text = "+";
+ progressBar1_1.CurrentValue++;
+ }
+ private void bar1Minus(object sender, global::System.EventArgs e)
+ {
+ board.Text = "-";
+ progressBar1_1.CurrentValue--;
+ }
+
+ private void circleStatusChanged(object sender, global::System.EventArgs e)
+ {
+ global::System.Console.WriteLine("----------------");
+
+ status++;
+ if (status > 2)
+ status = 0;
+ if (status == 0)
+ {
+ button5.Style.Text.Text = "Buffer";
+ //progressCircle1.ProgressState = Progress.ProgressStatusType.Buffering;
+ }
+ if (status == 1)
+ {
+ button5.Style.Text.Text = "Deter";
+ //progressCircle1.ProgressState = Progress.ProgressStatusType.Determinate;
+ }
+ if (status == 2)
+ {
+ button5.Style.Text.Text = "indeter";
+ //progressCircle1.ProgressState = Progress.ProgressStatusType.Indeterminate;
+ }
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ Window.Instance.Remove(root);
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class RadioButtonSample : IExample
+ {
+ private View root;
+
+ private TextLabel[] createText = new TextLabel[2];
+ private TextLabel[] modeText = new TextLabel[4];
+ private TextLabel[] modeText2 = new TextLabel[4];
+
+ private RadioButton[] utilityRadioButton = new RadioButton[4];
+ private RadioButton[] familyRadioButton = new RadioButton[4];
+ private RadioButton[] foodRadioButton = new RadioButton[4];
+ private RadioButton[] kitchenRadioButton = new RadioButton[4];
+ private RadioButtonGroup[] group = new RadioButtonGroup[4];
+
+ private RadioButton[] utilityRadioButton2 = new RadioButton[4];
+ private RadioButton[] familyRadioButton2 = new RadioButton[4];
+ private RadioButton[] foodRadioButton2 = new RadioButton[4];
+ private RadioButton[] kitchenRadioButton2 = new RadioButton[4];
+ private RadioButtonGroup[] group2 = new RadioButtonGroup[4];
+
+ private static string[] mode = new string[]
+ {
+ "Utility",
+ "Family",
+ "Food",
+ "Kitchen",
+ };
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ BackgroundColor = Color.White,
+ };
+ window.Add(root);
+
+ ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
+ createText[0] = new TextLabel();
+ createText[0].Text = "Create RadioButton just by properties";
+ createText[0].TextColor = Color.White;
+ createText[0].Size2D = new Size2D(500, 100);
+ createText[0].Position2D = new Position2D(400, 100);
+ root.Add(createText[0]);
+
+ int num = 4;
+ for (int i = 0; i < num; i++)
+ {
+ group[i] = new RadioButtonGroup();
+ modeText[i] = new TextLabel();
+ modeText[i].Text = mode[i];
+ modeText[i].Size2D = new Size2D(200, 48);
+ modeText[i].Position2D = new Position2D(300 + 200 * i, 200);
+ root.Add(modeText[i]);
+ }
+
+ for (int i = 0; i < num; i++)
+ {
+ utilityRadioButton[i] = new RadioButton();
+ utilityRadioButton[i].Size2D = new Size2D(48, 48);
+ utilityRadioButton[i].Position2D = new Position2D(300, 300 + i * 100);
+ utilityRadioButton[i].Style.Icon.Size = new Size(48, 48);
+ utilityRadioButton[i].Style.Icon.Padding.Start = 5;
+ utilityRadioButton[i].Style.Icon.Padding.End = 5;
+ utilityRadioButton[i].Style.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ utilityRadioButton[i].Style.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
+ };
+
+ group[0].Add(utilityRadioButton[i]);
+ ////////
+ familyRadioButton[i] = new RadioButton();
+ familyRadioButton[i].Size2D = new Size2D(48, 48);
+ familyRadioButton[i].Position2D = new Position2D(500, 300 + i * 100);
+ familyRadioButton[i].Style.Icon.Size = new Size(48, 48);
+ familyRadioButton[i].Style.Icon.Padding.Start = 5;
+ familyRadioButton[i].Style.Icon.Padding.End = 5;
+ familyRadioButton[i].Style.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ familyRadioButton[i].Style.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
+ };
+
+ group[1].Add(familyRadioButton[i]);
+ /////////
+ foodRadioButton[i] = new RadioButton();
+ foodRadioButton[i].Size2D = new Size2D(150, 48);
+ foodRadioButton[i].Position2D = new Position2D(700, 300 + i * 100);
+ foodRadioButton[i].Style.Icon.Size = new Size(48, 48);
+ foodRadioButton[i].Style.Icon.Padding.Start = 5;
+ foodRadioButton[i].Style.Icon.Padding.End = 5;
+ foodRadioButton[i].Style.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ foodRadioButton[i].Style.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
+ };
+
+ //foodRadioButton[i].Text = "Radio" + i;
+ //foodRadioButton[i].TextAlignment = HorizontalAlignment.Begin;
+ //foodRadioButton[i].PointSize = 12;
+ //foodRadioButton[i].TextPaddingLeft = 70;
+
+ group[2].Add(foodRadioButton[i]);
+ ////////
+ kitchenRadioButton[i] = new RadioButton();
+ kitchenRadioButton[i].Size2D = new Size2D(48, 48);
+ kitchenRadioButton[i].Position2D = new Position2D(900, 300 + i * 100);
+ kitchenRadioButton[i].Style.Icon.Size = new Size(48, 48);
+ kitchenRadioButton[i].Style.Icon.Padding.Start = 5;
+ kitchenRadioButton[i].Style.Icon.Padding.End = 5;
+ kitchenRadioButton[i].Style.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ kitchenRadioButton[i].Style.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
+ };
+
+ group[3].Add(kitchenRadioButton[i]);
+
+ root.Add(utilityRadioButton[i]);
+ root.Add(familyRadioButton[i]);
+ root.Add(foodRadioButton[i]);
+ root.Add(kitchenRadioButton[i]);
+ }
+ //foodRadioButton[0].LayoutDirection = ViewLayoutDirectionType.RTL;
+ ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
+ createText[1] = new TextLabel();
+ createText[1].Text = "Create RadioButton just by Attributes";
+ createText[1].TextColor = Color.White;
+ createText[1].Size2D = new Size2D(500, 100);
+ createText[1].Position2D = new Position2D(1200, 100);
+ root.Add(createText[1]);
+
+ for (int i = 0; i < num; i++)
+ {
+ group2[i] = new RadioButtonGroup();
+ modeText2[i] = new TextLabel();
+ modeText2[i].Text = mode[i];
+ modeText2[i].Size2D = new Size2D(200, 48);
+ modeText2[i].Position2D = new Position2D(1100 + 200 * i, 200);
+ root.Add(modeText2[i]);
+ }
+
+ ButtonStyle utilityAttrs = new ButtonStyle
+ {
+ Icon = new ImageControlStyle
+ {
+ Size = new Size(48, 48),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png",
+ },
+ },
+ };
+ ButtonStyle familyAttrs = new ButtonStyle
+ {
+ Icon = new ImageControlStyle
+ {
+ Size = new Size(48, 48),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
+ },
+ },
+ };
+ ButtonStyle foodAttrs = new ButtonStyle
+ {
+ Icon = new ImageControlStyle
+ {
+ Size = new Size(48, 48),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
+ },
+ },
+ };
+ ButtonStyle kitchenAttrs = new ButtonStyle
+ {
+ Icon = new ImageControlStyle
+ {
+ Size = new Size(48, 48),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
+ },
+ },
+ };
+ for (int i = 0; i < num; i++)
+ {
+ utilityRadioButton2[i] = new RadioButton(utilityAttrs);
+ utilityRadioButton2[i].Size2D = new Size2D(48, 48);
+ utilityRadioButton2[i].Position2D = new Position2D(1100, 300 + i * 100);
+ group2[0].Add(utilityRadioButton2[i]);
+
+ familyRadioButton2[i] = new RadioButton(familyAttrs);
+ familyRadioButton2[i].Size2D = new Size2D(48, 48);
+ familyRadioButton2[i].Position2D = new Position2D(1300, 300 + i * 100);
+ group2[1].Add(familyRadioButton2[i]);
+
+ foodRadioButton2[i] = new RadioButton(foodAttrs);
+ foodRadioButton2[i].Size2D = new Size2D(48, 48);
+ foodRadioButton2[i].Position2D = new Position2D(1500, 300 + i * 100);
+ group2[2].Add(foodRadioButton2[i]);
+
+ kitchenRadioButton2[i] = new RadioButton(kitchenAttrs);
+ kitchenRadioButton2[i].Size2D = new Size2D(48, 48);
+ kitchenRadioButton2[i].Position2D = new Position2D(1700, 300 + i * 100);
+ group2[3].Add(kitchenRadioButton2[i]);
+
+ root.Add(utilityRadioButton2[i]);
+ root.Add(familyRadioButton2[i]);
+ root.Add(foodRadioButton2[i]);
+ root.Add(kitchenRadioButton2[i]);
+ }
+
+ utilityRadioButton[2].IsEnabled = false;
+ familyRadioButton[2].IsEnabled = false;
+ foodRadioButton[2].IsEnabled = false;
+ kitchenRadioButton[2].IsEnabled = false;
+
+ utilityRadioButton2[2].IsEnabled = false;
+ familyRadioButton2[2].IsEnabled = false;
+ foodRadioButton2[2].IsEnabled = false;
+ kitchenRadioButton2[2].IsEnabled = false;
+
+ utilityRadioButton[3].IsEnabled = false;
+ familyRadioButton[3].IsEnabled = false;
+ foodRadioButton[3].IsEnabled = false;
+ kitchenRadioButton[3].IsEnabled = false;
+ utilityRadioButton[3].IsSelected = true;
+ familyRadioButton[3].IsSelected = true;
+ foodRadioButton[3].IsSelected = true;
+ kitchenRadioButton[3].IsSelected = true;
+
+ utilityRadioButton2[3].IsEnabled = false;
+ familyRadioButton2[3].IsEnabled = false;
+ foodRadioButton2[3].IsEnabled = false;
+ kitchenRadioButton2[3].IsEnabled = false;
+ utilityRadioButton2[3].IsSelected = true;
+ familyRadioButton2[3].IsSelected = true;
+ foodRadioButton2[3].IsSelected = true;
+ kitchenRadioButton2[3].IsSelected = true;
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ int num = 4;
+ for (int i = 0; i < num; i++)
+ {
+ root.Remove(utilityRadioButton[i]);
+ utilityRadioButton[i].Dispose();
+ utilityRadioButton[i] = null;
+
+ root.Remove(familyRadioButton[i]);
+ familyRadioButton[i].Dispose();
+ familyRadioButton[i] = null;
+
+ root.Remove(foodRadioButton[i]);
+ foodRadioButton[i].Dispose();
+ foodRadioButton[i] = null;
+
+ root.Remove(kitchenRadioButton[i]);
+ kitchenRadioButton[i].Dispose();
+ kitchenRadioButton[i] = null;
+
+ root.Remove(modeText[i]);
+ modeText[i].Dispose();
+ modeText[i] = null;
+
+ root.Remove(utilityRadioButton2[i]);
+ utilityRadioButton2[i].Dispose();
+ utilityRadioButton2[i] = null;
+
+ root.Remove(familyRadioButton2[i]);
+ familyRadioButton2[i].Dispose();
+ familyRadioButton2[i] = null;
+
+ root.Remove(foodRadioButton2[i]);
+ foodRadioButton2[i].Dispose();
+ foodRadioButton2[i] = null;
+
+ root.Remove(kitchenRadioButton2[i]);
+ kitchenRadioButton2[i].Dispose();
+ kitchenRadioButton2[i] = null;
+
+ root.Remove(modeText2[i]);
+ modeText2[i].Dispose();
+ modeText2[i] = null;
+ }
+
+ root.Remove(createText[0]);
+ createText[0].Dispose();
+ createText[0] = null;
+ root.Remove(createText[1]);
+ createText[1].Dispose();
+ createText[1] = null;
+
+ Window.Instance.Remove(root);
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class ScrollbarSample : IExample
+ {
+ private TextLabel board1, board2, board;
+ private Button button1, button2, button3, button4, button5;
+ private ScrollBar scrollBar1_1, scrollBar1_2, scrollBar2_1, scrollBar2_2; //1-null para 2-attributes; X_1-color; X_2 image track
+ private View root;
+
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ };
+
+ CreateBoardAndButtons();
+
+ scrollBar1_1 = new ScrollBar();
+ scrollBar1_1.Position2D = new Position2D(50, 300);
+ scrollBar1_1.Size2D = new Size2D(300, 4);
+ scrollBar1_1.Style.Track.BackgroundColor = Color.Green;
+ scrollBar1_1.MaxValue = (int)scrollBar1_1.SizeWidth / 10;
+ scrollBar1_1.MinValue = 0;
+ scrollBar1_1.Style.Thumb.Size = new Size(30, 4);
+ scrollBar1_1.CurrentValue = 0; //set after thumbsize
+ scrollBar1_1.Style.Thumb.BackgroundColor = Color.Black;
+ root.Add(scrollBar1_1);
+
+ scrollBar1_2 = new ScrollBar();
+ scrollBar1_2.Position2D = new Position2D(50, 400);
+ scrollBar1_2.Size2D = new Size2D(300, 4);
+ scrollBar1_2.Style.Track.BackgroundColor = Color.Green;
+ scrollBar1_2.MaxValue = (int)scrollBar1_2.SizeWidth / 10;
+ scrollBar1_2.MinValue = 0;
+ scrollBar1_2.Style.Thumb.Size = new Size(30, 4);
+ scrollBar1_2.CurrentValue = 0;//set after thumbsize
+ scrollBar1_2.Style.Thumb.BackgroundColor = Color.Yellow;
+ scrollBar1_2.Style.Track.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png";
+
+ root.Add(scrollBar1_2);
+
+ ScrollBarStyle attr = new ScrollBarStyle
+ {
+ Track = new ImageViewStyle
+ {
+ BackgroundColor = new Selector<Color>
+ {
+ All = new Color(0.43f, 0.43f, 0.43f, 0.1f),
+ }
+ },
+ Thumb = new ImageViewStyle
+ {
+ BackgroundColor = new Selector<Color>
+ {
+ All = new Color(1.0f, 0.0f, 0.0f, 0.2f),
+ }
+ },
+ };
+
+ scrollBar2_1 = new ScrollBar(attr);
+ scrollBar2_1.Position2D = new Position2D(500, 300);
+ scrollBar2_1.Size2D = new Size2D(300, 4);
+ scrollBar2_1.MaxValue = (int)scrollBar2_1.SizeWidth / 10;
+ scrollBar2_1.MinValue = 0;
+ scrollBar2_1.Style.Thumb.Size = new Size(30, 4);
+ scrollBar2_1.CurrentValue = 0; //set after thumbsize
+ root.Add(scrollBar2_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(430, 900);
+ 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, 150);
+ board1.PointSize = 20;
+ board1.HorizontalAlignment = HorizontalAlignment.Center;
+ board1.VerticalAlignment = VerticalAlignment.Center;
+ board1.BackgroundColor = Color.Magenta;
+ board1.Text = "NULL parameter 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(500, 150);
+ 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 Button();
+ button1.BackgroundColor = Color.Green;
+ button1.Position2D = new Position2D(100, 700);
+ button1.Size2D = new Size2D(80, 50);
+ button1.Style.Text.Text = "+";
+ root.Add(button1);
+ button1.Focusable = true;
+ button1.ClickEvent += Scroll1Add;
+
+ button2 = new Button();
+ button2.BackgroundColor = Color.Green;
+ button2.Position2D = new Position2D(200, 700);
+ button2.Size2D = new Size2D(80, 50);
+ button2.Style.Text.Text = "-";
+ root.Add(button2);
+ button2.Focusable = true;
+ button2.ClickEvent += Scroll1Minus;
+
+ button5 = new Button();
+ button5.BackgroundColor = Color.Green;
+ button5.Position2D = new Position2D(400, 800);
+ button5.Size2D = new Size2D(100, 50);
+ button5.Style.Text.Text = "+ / - 4";
+ root.Add(button5);
+ button5.Focusable = true;
+ button5.ClickEvent += Scroll1_2move;
+
+ Button button22 = new Button();
+ button22.BackgroundColor = Color.Green;
+ button22.Position2D = new Position2D(100, 800);
+ button22.Size2D = new Size2D(200, 50);
+ button22.Style.Text.Text = "change direction";
+ root.Add(button22);
+ button22.Focusable = true;
+ button22.ClickEvent += Scroll1_2Changed;
+
+ button3 = new Button();
+ button3.BackgroundColor = Color.Green;
+ button3.Position2D = new Position2D(450, 700);
+ button3.Size2D = new Size2D(80, 50);
+ button3.Style.Text.Text = "+";
+ root.Add(button3);
+ button3.Focusable = true;
+ button3.ClickEvent += Scroll2Add;
+
+ button4 = new Button();
+ button4.BackgroundColor = Color.Green;
+ button4.Position2D = new Position2D(550, 700);
+ button4.Size2D = new Size2D(80, 50);
+ button4.Style.Text.Text = "-";
+ root.Add(button4);
+ button4.Focusable = true;
+ button4.ClickEvent += Scroll2Minus;
+ }
+
+ 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 Scroll1Add(object sender, global::System.EventArgs e)
+ {
+ scrollBar1_1.CurrentValue++;
+ }
+ private void Scroll1Minus(object sender, global::System.EventArgs e)
+ {
+ scrollBar1_1.CurrentValue--;
+ }
+ private void Scroll2Add(object sender, global::System.EventArgs e)
+ {
+ scrollBar2_1.CurrentValue++;
+ }
+ private void Scroll2Minus(object sender, global::System.EventArgs e)
+ {
+ scrollBar2_1.CurrentValue--;
+ }
+
+ private void Scroll1_2Changed(object sender, global::System.EventArgs e)
+ {
+ if(scrollBar1_2.LayoutDirection == ViewLayoutDirectionType.LTR)
+ scrollBar1_2.LayoutDirection= ViewLayoutDirectionType.RTL;
+ else
+ scrollBar1_2.LayoutDirection = ViewLayoutDirectionType.LTR;
+ }
+
+ private void Scroll1_2move(object sender, global::System.EventArgs e)
+ {
+ if (scrollBar1_2.CurrentValue < scrollBar1_2.MaxValue / 2)
+ {
+ scrollBar1_2.SetCurrentValue(scrollBar1_2.MaxValue - 2);
+ }
+ else
+ {
+ scrollBar1_2.SetCurrentValue(2);
+ }
+ }
+
+ private void ScrollPan(object sender, global::System.EventArgs e)
+ {
+ board.Text = board.Text + " 1";
+ if (board.Text.Length > 20)
+ board.Text = "";
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ Window.Instance.Remove(root);
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class SliderSample : IExample
+ {
+ private const float MIN_VALUE = 0;
+ private const float MAX_VALUE = 100;
+
+ private View root;
+ private TextLabel[] createText = new TextLabel[2];
+ private Slider[] slider = new Slider[4];
+ private Slider[] slider2 = new Slider[4];
+ private TextLabel[] inforText = new TextLabel[2];
+
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ };
+ window.Add(root);
+ CreateInforText();
+
+ ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
+ createText[0] = new TextLabel();
+ createText[0].Text = "Create Slider just by properties";
+ createText[0].TextColor = Color.White;
+ createText[0].Size2D = new Size2D(450, 100);
+ createText[0].Position2D = new Position2D(200, 100);
+ createText[0].MultiLine = true;
+ root.Add(createText[0]);
+
+ slider[0] = CreateByProperty(40, 300, 800, 50, 20, Slider.DirectionType.Horizontal);
+ slider[1] = CreateByProperty(300, 450, 50, 400, 20, Slider.DirectionType.Vertical);
+
+ slider[2] = CreateByProperty(40, 400, 800, 50, 30, Slider.DirectionType.Horizontal);
+ slider[2].Style.LowIndicator.Text = "SubText";
+ slider[2].LowIndicatorSize = new Size(100, 40);
+
+ slider[3] = CreateByProperty(600, 450, 50, 400, 30, Slider.DirectionType.Vertical);
+ slider[3].Style.LowIndicator.Text = "SubText";
+ slider[3].LowIndicatorSize = new Size(100, 40);
+
+ /////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
+ createText[1] = new TextLabel();
+ createText[1].TextColor = Color.White;
+ createText[1].Text = "Create Slider just by Attributes";
+ createText[1].Size2D = new Size2D(450, 100);
+ createText[1].Position2D = new Position2D(1000, 100);
+ createText[1].MultiLine = true;
+ root.Add(createText[1]);
+
+ SliderStyle attributes = new SliderStyle
+ {
+ TrackThickness = 4,
+ Track = new ImageViewStyle
+ {
+ BackgroundColor = new Selector<Color>
+ {
+ All = new Color(0, 0, 0, 0.1f),
+ }
+ },
+
+ Progress = new ImageViewStyle
+ {
+ BackgroundColor = new Selector<Color>
+ {
+ All = new Color(0.05f, 0.63f, 0.9f, 1),
+ }
+ },
+
+ Thumb = new ImageViewStyle
+ {
+ Size = new Size(60, 60),
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_normal.png",
+ Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_press.png",
+ },
+ BackgroundImage = new Selector<string>
+ {
+ Normal = "",
+ Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png",
+ }
+ },
+ //ThumbBackground = new ImageViewStyle
+ //{
+ // Size = new Size(60, 60),
+ // ResourceUrl = new Selector<string>
+ // {
+ // Normal = "",
+ // Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png",
+ // }
+ //}
+ };
+
+ slider2[0] = CreateByAttributes(attributes, 890, 300, 800, 50, 20, Slider.DirectionType.Horizontal);
+ slider2[1] = CreateByAttributes(attributes, 1150, 450, 50, 400, 20, Slider.DirectionType.Vertical);
+
+ slider2[2] = CreateByAttributes(attributes, 890, 400, 800, 50, 30, Slider.DirectionType.Horizontal);
+ slider2[2].Style.LowIndicator.Text = "SubText";
+ slider2[2].LowIndicatorSize = new Size(100, 40);
+
+ slider2[3] = CreateByAttributes(attributes, 1450, 450, 50, 400, 30, Slider.DirectionType.Vertical);
+ slider2[3].Style.LowIndicator.Text = "SubText";
+ slider2[3].LowIndicatorSize = new Size(100, 40);
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ for (int i = 0; i < 3; i++)
+ {
+ if (slider[i] != null)
+ {
+ root.Remove(slider[i]);
+ slider[i].Dispose();
+ slider[i] = null;
+ }
+ if (slider2[i] != null)
+ {
+ root.Remove(slider2[i]);
+ slider2[i].Dispose();
+ slider2[i] = null;
+ }
+ }
+
+ for (int i = 0; i < 2; i++)
+ {
+ if (createText[i] != null)
+ {
+ root.Remove(createText[i]);
+ createText[i].Dispose();
+ createText[i] = null;
+ }
+
+ if (inforText[i] != null)
+ {
+ root.Remove(inforText[i]);
+ inforText[i].Dispose();
+ inforText[i] = null;
+ }
+ }
+
+ Window.Instance.Remove(root);
+ root.Dispose();
+ root = null;
+ }
+ }
+
+ private void CreateInforText()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ inforText[i] = new TextLabel();
+ inforText[i].Size2D = new Size2D(450, 60);
+ inforText[i].Position2D = new Position2D(200 + 800 * i, 200);
+ inforText[i].PointSize = 20;
+ inforText[i].TextColor = Color.Blue;
+ inforText[i].Text = "currentValue = ";
+ inforText[i].BackgroundColor = new Color(0, 0, 0, 0.1f);
+ inforText[i].HorizontalAlignment = HorizontalAlignment.Center;
+ inforText[i].VerticalAlignment = VerticalAlignment.Center;
+ root.Add(inforText[i]);
+ }
+ }
+
+ private Slider CreateByProperty(int posX, int posY, int w, int h, int curValue, Slider.DirectionType dir)
+ {
+ Slider source = new Slider();
+ source.TrackThickness = 4;
+ source.Style.Track.BackgroundColor = new Color(0, 0, 0, 0.1f);
+ source.Style.Progress.BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1);
+ source.Style.Thumb.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_normal.png",
+ Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_press.png",
+ };
+ source.Style.Thumb.Size = new Size(60, 60);
+ source.Style.Thumb.BackgroundImage = new Selector<string>
+ {
+ Normal = "",
+ Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png",
+ };
+ source.Direction = dir;
+ root.Add(source);
+ source.Focusable = true;
+ source.MinValue = MIN_VALUE;
+ source.MaxValue = MAX_VALUE;
+ source.StateChangedEvent += OnStateChanged;
+ source.ValueChangedEvent += OnValueChanged;
+ source.SlidingFinishedEvent += OnSlidingFinished;
+
+ source.Position2D = new Position2D(posX, posY);
+ source.Size2D = new Size2D(w, h);
+ source.CurrentValue = curValue;
+ return source;
+ }
+
+ private Slider CreateByAttributes(SliderStyle attrs, int posX, int posY, int w, int h, int curValue, Slider.DirectionType dir)
+ {
+ Slider source = new Slider(attrs);
+ source.Direction = dir;
+ root.Add(source);
+ source.Focusable = true;
+ source.MinValue = MIN_VALUE;
+ source.MaxValue = MAX_VALUE;
+ source.StateChangedEvent += OnStateChanged;
+ source.ValueChangedEvent += OnValueChanged;
+ source.SlidingFinishedEvent += OnSlidingFinished;
+
+ source.Position2D = new Position2D(posX, posY);
+ source.Size2D = new Size2D(w, h);
+ source.CurrentValue = curValue;
+ return source;
+ }
+
+ private void OnValueChanged(object sender, Slider.ValueChangedArgs args)
+ {
+ Slider source = sender as Slider;
+ if (source != null)
+ {
+ if (source == slider2[0] || source == slider2[1] || source == slider2[2] || source == slider2[3])
+ {
+ inforText[1].Text = "currentValue = " + args.CurrentValue;
+ }
+ else
+ {
+ inforText[0].Text = "currentValue = " + args.CurrentValue;
+ }
+ }
+ }
+
+ private void OnSlidingFinished(object sender, Slider.SlidingFinishedArgs args)
+ {
+ Slider source = sender as Slider;
+ if (source != null)
+ {
+ if (source == slider2[0] || source == slider2[1] || source == slider2[2] || source == slider2[3])
+ {
+ inforText[1].Text = "Finished currentValue = " + args.CurrentValue;
+ }
+ else
+ {
+ inforText[0].Text = "Finished currentValue = " + args.CurrentValue;
+ }
+ }
+ }
+
+ private void OnStateChanged(object sender, Slider.StateChangedArgs args)
+ {
+ if (sender is Tizen.NUI.Components.Slider)
+ {
+ Tizen.NUI.Components.Slider slider = sender as Tizen.NUI.Components.Slider;
+ if (slider != null)
+ {
+ // Do something
+ }
+ }
+ }
+ }
+}
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class SwitchSample : IExample
+ {
+ private View root;
+
+ private TextLabel[] createText = new TextLabel[2];
+ private TextLabel[] modeText = new TextLabel[4];
+ private TextLabel[] modeText2 = new TextLabel[4];
+
+ private Switch[] utilitySwitch = new Switch[4];
+ private Switch[] familySwitch = new Switch[4];
+ private Switch[] foodSwitch = new Switch[4];
+ private Switch[] kitchenSwitch = new Switch[4];
+
+ private Switch[] utilitySwitch2 = new Switch[4];
+ private Switch[] familySwitch2 = new Switch[4];
+ private Switch[] foodSwitch2 = new Switch[4];
+ private Switch[] kitchenSwitch2 = new Switch[4];
+
+ private static string[] mode = new string[]
+ {
+ "Utility",
+ "Family",
+ "Food",
+ "Kitchen",
+ };
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ };
+ window.Add(root);
+
+ ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
+ createText[0] = new TextLabel();
+ createText[0].Text = "Create Switch just by properties";
+ createText[0].Size2D = new Size2D(500, 100);
+ createText[0].Position2D = new Position2D(400, 100);
+ root.Add(createText[0]);
+
+ int num = 4;
+ for (int i = 0; i < num; i++)
+ {
+ modeText[i] = new TextLabel();
+ modeText[i].Text = mode[i];
+ modeText[i].Size2D = new Size2D(200, 48);
+ modeText[i].Position2D = new Position2D(300 + 200 * i, 200);
+ root.Add(modeText[i]);
+ }
+
+ for (int i = 0; i < num; i++)
+ {
+ utilitySwitch[i] = new Switch();
+ utilitySwitch[i].Size2D = new Size2D(96, 60);
+ utilitySwitch[i].Position2D = new Position2D(300, 300 + i * 100);
+ utilitySwitch[i].Style.Thumb.Size = new Size(60, 60);
+ utilitySwitch[i].Style.Track.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_on.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_on_dim.png",
+ };
+ utilitySwitch[i].Style.Thumb.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ };
+
+ ////////
+ familySwitch[i] = new Switch();
+ familySwitch[i].Size2D = new Size2D(96, 60);
+ familySwitch[i].Position2D = new Position2D(500, 300 + i * 100);
+ familySwitch[i].Style.Thumb.Size = new Size(60, 60);
+ familySwitch[i].Style.Track.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_24c447.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_24c447.png",
+ };
+ familySwitch[i].Style.Thumb.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ };
+ /////////
+ foodSwitch[i] = new Switch();
+ foodSwitch[i].Size2D = new Size2D(96, 60);
+ foodSwitch[i].Position2D = new Position2D(700, 300 + i * 100);
+ foodSwitch[i].Style.Thumb.Size = new Size(60, 60);
+ foodSwitch[i].Style.Track.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_ec7510.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_ec7510.png",
+ };
+ foodSwitch[i].Style.Thumb.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ };
+
+ ////////
+ kitchenSwitch[i] = new Switch();
+ kitchenSwitch[i].Size2D = new Size2D(96, 60);
+ kitchenSwitch[i].Position2D = new Position2D(900, 300 + i * 100);
+ kitchenSwitch[i].Style.Thumb.Size = new Size(60, 60);
+ kitchenSwitch[i].Style.Track.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_9762d9.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_9762d9.png",
+ };
+ kitchenSwitch[i].Style.Thumb.ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ };
+
+ root.Add(utilitySwitch[i]);
+ root.Add(familySwitch[i]);
+ root.Add(foodSwitch[i]);
+ root.Add(kitchenSwitch[i]);
+ }
+
+ ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
+ createText[1] = new TextLabel();
+ createText[1].Text = "Create Switch just by Attributes";
+ createText[1].Size2D = new Size2D(500, 100);
+ createText[1].Position2D = new Position2D(1200, 100);
+ root.Add(createText[1]);
+
+ for (int i = 0; i < num; i++)
+ {
+ modeText2[i] = new TextLabel();
+ modeText2[i].Text = mode[i];
+ modeText2[i].Size2D = new Size2D(200, 48);
+ modeText2[i].Position2D = new Position2D(1100 + 200 * i, 200);
+ root.Add(modeText2[i]);
+ }
+
+ SwitchStyle utilityAttrs = new SwitchStyle
+ {
+ IsSelectable = true,
+ Track = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_on.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_on_dim.png",
+ },
+ },
+ Thumb = new ImageViewStyle
+ {
+ Size = new Size(60, 60),
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ },
+ },
+ };
+ SwitchStyle familyAttrs = new SwitchStyle
+ {
+ IsSelectable = true,
+ Track = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_24c447.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_24c447.png",
+ },
+ },
+ Thumb = new ImageViewStyle
+ {
+ Size = new Size(60, 60),
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ },
+ },
+ };
+ SwitchStyle foodAttrs = new SwitchStyle
+ {
+ IsSelectable = true,
+ Track = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_ec7510.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_ec7510.png",
+ },
+ },
+ Thumb = new ImageViewStyle
+ {
+ Size = new Size(60, 60),
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ },
+ },
+ };
+ SwitchStyle kitchenAttrs = new SwitchStyle
+ {
+ IsSelectable = true,
+ Track = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_9762d9.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_bg_off_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_switch_bg_on_dim_9762d9.png",
+ },
+ },
+ Thumb = new ImageViewStyle
+ {
+ Size = new Size(60, 60),
+ ResourceUrl = new Selector<string>
+ {
+ Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler.png",
+ Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_switch_handler_dim.png",
+ },
+ },
+ };
+ for (int i = 0; i < num; i++)
+ {
+ utilitySwitch2[i] = new Switch(utilityAttrs);
+ utilitySwitch2[i].Size2D = new Size2D(96, 60);
+ utilitySwitch2[i].Position2D = new Position2D(1100, 300 + i * 100);
+
+ familySwitch2[i] = new Switch(familyAttrs);
+ familySwitch2[i].Size2D = new Size2D(96, 60);
+ familySwitch2[i].Position2D = new Position2D(1300, 300 + i * 100);
+
+ foodSwitch2[i] = new Switch(foodAttrs);
+ foodSwitch2[i].Size2D = new Size2D(96, 60);
+ foodSwitch2[i].Position2D = new Position2D(1500, 300 + i * 100);
+
+ kitchenSwitch2[i] = new Switch(kitchenAttrs);
+ kitchenSwitch2[i].Size2D = new Size2D(96, 60);
+ kitchenSwitch2[i].Position2D = new Position2D(1700, 300 + i * 100);
+
+ root.Add(utilitySwitch2[i]);
+ root.Add(familySwitch2[i]);
+ root.Add(foodSwitch2[i]);
+ root.Add(kitchenSwitch2[i]);
+ }
+
+ utilitySwitch[2].IsEnabled = false;
+ familySwitch[2].IsEnabled = false;
+ foodSwitch[2].IsEnabled = false;
+ kitchenSwitch[2].IsEnabled = false;
+
+ utilitySwitch2[2].IsEnabled = false;
+ familySwitch2[2].IsEnabled = false;
+ foodSwitch2[2].IsEnabled = false;
+ kitchenSwitch2[2].IsEnabled = false;
+
+ utilitySwitch[3].IsEnabled = false;
+ familySwitch[3].IsEnabled = false;
+ foodSwitch[3].IsEnabled = false;
+ kitchenSwitch[3].IsEnabled = false;
+ utilitySwitch[3].IsSelected = true;
+ familySwitch[3].IsSelected = true;
+ foodSwitch[3].IsSelected = true;
+ kitchenSwitch[3].IsSelected = true;
+
+ utilitySwitch2[3].IsEnabled = false;
+ familySwitch2[3].IsEnabled = false;
+ foodSwitch2[3].IsEnabled = false;
+ kitchenSwitch2[3].IsEnabled = false;
+ utilitySwitch2[3].IsSelected = true;
+ familySwitch2[3].IsSelected = true;
+ foodSwitch2[3].IsSelected = true;
+ kitchenSwitch2[3].IsSelected = true;
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ int num = 4;
+ for (int i = 0; i < num; i++)
+ {
+ root.Remove(utilitySwitch[i]);
+ utilitySwitch[i].Dispose();
+ utilitySwitch[i] = null;
+
+ root.Remove(familySwitch[i]);
+ familySwitch[i].Dispose();
+ familySwitch[i] = null;
+
+ root.Remove(foodSwitch[i]);
+ foodSwitch[i].Dispose();
+ foodSwitch[i] = null;
+
+ root.Remove(kitchenSwitch[i]);
+ kitchenSwitch[i].Dispose();
+ kitchenSwitch[i] = null;
+
+ root.Remove(modeText[i]);
+ modeText[i].Dispose();
+ modeText[i] = null;
+
+ root.Remove(utilitySwitch2[i]);
+ utilitySwitch2[i].Dispose();
+ utilitySwitch2[i] = null;
+
+ root.Remove(familySwitch2[i]);
+ familySwitch2[i].Dispose();
+ familySwitch2[i] = null;
+
+ root.Remove(foodSwitch2[i]);
+ foodSwitch2[i].Dispose();
+ foodSwitch2[i] = null;
+
+ root.Remove(kitchenSwitch2[i]);
+ kitchenSwitch2[i].Dispose();
+ kitchenSwitch2[i] = null;
+
+ root.Remove(modeText2[i]);
+ modeText2[i].Dispose();
+ modeText2[i] = null;
+ }
+
+ root.Remove(createText[0]);
+ createText[0].Dispose();
+ createText[0] = null;
+ root.Remove(createText[1]);
+ createText[1].Dispose();
+ createText[1] = null;
+
+ Window.Instance.Remove(root);
+ root.Dispose();
+ }
+ }
+ }
+}
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class TabSample : IExample
+ {
+ private View root;
+
+ private TextLabel[] createText = new TextLabel[2];
+
+ private Tab tab = null;
+ private Tab tab2 = null;
+
+ private Button button = null;
+ private Button button2 = null;
+ private int index = 0;
+
+ private static string[] mode = new string[]
+ {
+ "Utility Tab",
+ "Family Tab",
+ "Food Tab",
+ "Kitchen Tab",
+ };
+ private static Color[] color = new Color[]
+ {
+ new Color(0.05f, 0.63f, 0.9f, 1),//#ff0ea1e6 Utility
+ new Color(0.14f, 0.77f, 0.28f, 1),//#ff24c447 Family
+ new Color(0.75f, 0.46f, 0.06f, 1),//#ffec7510 Food
+ new Color(0.59f, 0.38f, 0.85f, 1),//#ff9762d9 Kitchen
+ };
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ root = new View()
+ {
+ Size2D = new Size2D(1920, 1080),
+ };
+ window.Add(root);
+
+ ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
+ createText[0] = new TextLabel();
+ createText[0].Text = "Create Tab just by properties";
+ createText[0].Size2D = new Size2D(450, 100);
+ createText[0].Position2D = new Position2D(200, 100);
+ createText[0].MultiLine = true;
+ root.Add(createText[0]);
+
+ tab = new Tab();
+ tab.Size2D = new Size2D(700, 108);
+ tab.Position2D = new Position2D(100, 300);
+ tab.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.5f);
+ //tab.IsNatureTextWidth = true;
+ //tab.ItemGap = 40;
+ //tab.LeftSpace = 56;
+ //tab.RightSpace = 56;
+ //tab.TopSpace = 1;
+ //tab.BottomSpace = 0;
+ tab.Style.UnderLine.Size = new Size(1, 3);
+ tab.Style.UnderLine.BackgroundColor = color[0];
+ tab.Style.Text.PointSize = 25;
+ tab.Style.Text.TextColor = new Selector<Color>
+ {
+ Normal = Color.Black,
+ Selected = color[0],
+ };
+ tab.ItemChangedEvent += TabItemChangedEvent;
+ root.Add(tab);
+
+ for (int i = 0; i < 3; i++)
+ {
+ Tab.TabItemData item = new Tab.TabItemData();
+ item.Text = "Tab " + i;
+ if(i==1)
+ {
+ item.Text = "Long Tab " + i;
+ }
+ tab.AddItem(item);
+ }
+ tab.SelectedItemIndex = 0;
+
+ ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
+ createText[1] = new TextLabel();
+ createText[1].Text = "Create Tab just by Attributes";
+ createText[1].Size2D = new Size2D(450, 100);
+ createText[1].Position2D = new Position2D(1000, 100);
+ createText[1].MultiLine = true;
+ root.Add(createText[1]);
+
+ TabStyle attrs = new TabStyle
+ {
+ //IsNatureTextWidth = false,
+ ItemPadding = new Extents(56, 56, 1, 0),
+ UnderLine = new ViewStyle
+ {
+ Size = new Size(1, 3),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+ BackgroundColor = new Selector<Color> { All = color[0]},
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = 25 },
+ TextColor = new Selector<Color>
+ {
+ Normal = Color.Black,
+ Selected = color[0],
+ },
+ },
+ };
+
+ tab2 = new Tab(attrs);
+ tab2.Size2D = new Size2D(500, 108);
+ tab2.Position2D = new Position2D(900, 300);
+ tab2.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.5f);
+ tab2.ItemChangedEvent += Tab2ItemChangedEvent;
+ root.Add(tab2);
+
+ for (int i = 0; i < 3; i++)
+ {
+ Tab.TabItemData item = new Tab.TabItemData();
+ item.Text = "Tab " + i;
+ tab2.AddItem(item);
+ }
+ tab2.SelectedItemIndex = 0;
+
+ button = new Button();
+ button.Style.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
+ button.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
+ button.Size2D = new Size2D(280, 80);
+ button.Position2D = new Position2D(400, 700);
+ button.Style.Text.Text = mode[index];
+ button.ClickEvent += ButtonClickEvent;
+ root.Add(button);
+
+ button2 = new Button();
+ button2.Style.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
+ button2.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
+ button2.Size2D = new Size2D(580, 80);
+ button2.Position2D = new Position2D(250, 500);
+ button2.Style.Text.Text = "LayoutDirection is left to right";
+ button2.ClickEvent += ButtonClickEvent2;
+ root.Add(button2);
+ }
+
+ private void TabItemChangedEvent(object sender, Tab.ItemChangedEventArgs e)
+ {
+ createText[0].Text = "Create Tab just by properties, Selected index from " + e.PreviousIndex + " to " + e.CurrentIndex;
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ if (button != null)
+ {
+ root.Remove(button);
+ button.Dispose();
+ button = null;
+ }
+
+ if (button2 != null)
+ {
+ root.Remove(button2);
+ button2.Dispose();
+ button2 = null;
+ }
+
+ if (tab != null)
+ {
+ root.Remove(tab);
+ tab.Dispose();
+ tab = null;
+ }
+ if (tab2 != null)
+ {
+ root.Remove(tab2);
+ tab2.Dispose();
+ tab2 = 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 Tab2ItemChangedEvent(object sender, Tab.ItemChangedEventArgs e)
+ {
+ createText[1].Text = "Create Tab just by Attributes, Selected index from " + e.PreviousIndex + " to " + e.CurrentIndex;
+ }
+
+ private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
+ {
+ index = (index + 1) % 4;
+ button.Style.Text.Text = mode[index];
+ tab.Style.UnderLine.BackgroundColor = color[index];
+ tab.Style.Text.TextColor = new Selector<Color>
+ {
+ Normal = Color.Black,
+ Selected = color[index],
+ };
+ tab2.Style.UnderLine.BackgroundColor = color[index];
+ tab2.Style.Text.TextColor = new Selector<Color>
+ {
+ Normal = Color.Black,
+ Selected = color[index],
+ };
+ }
+
+ private void ButtonClickEvent2(object sender, Button.ClickEventArgs e)
+ {
+ if (tab.LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ tab.LayoutDirection = ViewLayoutDirectionType.RTL;
+ tab2.LayoutDirection = ViewLayoutDirectionType.RTL;
+ button2.Style.Text.Text = "LayoutDirection is right to left";
+ }
+ else
+ {
+ tab.LayoutDirection = ViewLayoutDirectionType.LTR;
+ tab2.LayoutDirection = ViewLayoutDirectionType.LTR;
+ button2.Style.Text.Text = "LayoutDirection is left to right";
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+ public class ToastSample : IExample
+ {
+ private TextLabel board1, board2, board;
+ private Button button1, button2;
+ private Toast toast1_1, toast2_1; //1-null para 2-attributes; X_1-color; X_2 image track
+ private View root;
+
+ public void Activate()
+ {
+ Window window = Window.Instance;
+
+ root = new View()
+ {
+ Size = new Size(1920, 1080),
+ BackgroundColor = new Color(0.8f, 0.8f, 0.8f, 0.6f),
+ };
+
+ CreateBoardAndButtons();
+
+ toast1_1 = Toast.FromText("null parameter construction", 1000);
+ toast1_1.Size = new Size(500, 132);
+ toast1_1.Post(window);
+
+ ToastStyle attr = new ToastStyle
+ {
+ Size = new Size(512, 132),
+ BackgroundImage = CommonResource.GetFHResourcePath() + "12. Toast Popup/toast_background.png",
+ BackgroundImageBorder = new Rectangle(64, 64, 4, 4),
+ Duration = 3000
+ };
+
+ toast2_1 = new Toast(attr);
+ toast2_1.Message = "attibute parameter construction";
+ toast2_1.Post(window);
+ //root.Add(toast2_1);
+
+
+ board.UpFocusableView = button1;
+ window.Add(root);
+
+ FocusManager.Instance.SetCurrentFocusView(button1);
+ }
+
+ void CreateBoardAndButtons()
+ {
+ board = new TextLabel();
+ board.Size = new Size(1000, 100);
+ board.Position = new Position(430, 900);
+ 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.Size = new Size(300, 70);
+ board1.Position = new Position(50, 200);
+ board1.PointSize = 20;
+ board1.HorizontalAlignment = HorizontalAlignment.Center;
+ board1.VerticalAlignment = VerticalAlignment.Center;
+ board1.BackgroundColor = Color.Magenta;
+ board1.Text = "NULL parameter construction";
+ root.Add(board1);
+ board1.Focusable = true;
+ board1.FocusGained += Board_FocusGained;
+ board1.FocusLost += Board_FocusLost;
+
+ board2 = new TextLabel();
+ board2.Size = new Size(300, 70);
+ board2.Position = new Position(650, 200);
+ 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 Button();
+ button1.BackgroundColor = Color.Green;
+ button1.Position = new Position(80, 600);
+ button1.Size = new Size(200, 50);
+ button1.Style.Text.Text = "toast1_1 Show";
+ root.Add(button1);
+ button1.Focusable = true;
+ button1.ClickEvent += toast1_1Show;
+
+ button2 = new Button();
+ button2.BackgroundColor = Color.Green;
+ button2.Position = new Position(700, 600);
+ button2.Size = new Size(100, 50);
+ button2.Style.Text.Text = "toast2_1 Show";
+ root.Add(button2);
+ button2.Focusable = true;
+ button2.ClickEvent += toast2_1Show;
+ }
+
+ 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 toast1FPSMinus(object sender, global::System.EventArgs e)
+ {
+ //board.Text = "toast1_1 FPS: " + toast1_1.FPS.ToString();
+ }
+
+ public void Deactivate()
+ {
+ if (root != null)
+ {
+ Window.Instance.Remove(root);
+ root.Dispose();
+ }
+ }
+ }
+}
-<Project Sdk="Tizen.NET.Sdk/1.0.9">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>tizen70</TargetFramework>
- <DisableImplicitFrameworkReferences>True</DisableImplicitFrameworkReferences>
+ <TargetFramework>netcoreapp2.0</TargetFramework>
+ <RootNamespace>Tizen.NUI.Samples</RootNamespace>
+ <AssemblyName>Tizen.NUI.Samples</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>
- <Folder Include="lib\" />
- <Folder Include="res\" />
+ <None Remove="App.config" />
+ <None Remove="packages.config" />
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Tizen.NET" Version="7.0.0.15037" />
+ <PackageReference Include="Tizen.NET.API8" Version="8.0.0.99999" />
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />
</ItemGroup>
</Project>
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+/*
+ * 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.
*
*/
-using System;
-
-namespace Tizen.NUI.Samples
{
- public class App
+ "styles":
+ {
+ "ContactNameTextLabel":
+ {
+ "textColor": [ 0, 0, 0, 1 ],
+ "horizontalAlignment": "CENTER",
+ "pointSize": 14
+ },
+
+ "ContactDetailTextLabel":
{
- [STAThread]
- static void Main(string[] args)
- {
- new DaliDemo().Run(args);
- }
+ "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
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Samples
-{
- interface IExample
- {
- void Activate();
- void Deactivate();
- }
-
- public class SampleResource
- {
- internal static string GetDaliResourcePath()
- {
- return Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/";
- }
- }
-
- public class DaliDemo : NUIApplication
- {
- 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) =>
- {
- string fileName = global::System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
-
- //global::System.Diagnostics.Process.Start(fileName, name);
-
- RunSample(name);
- });
-
- Assembly assembly = this.GetType().Assembly;
-
- Type exampleType = assembly.GetType("Tizen.NUI.Samples.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 RunSample(string name)
- {
- Assembly assembly = typeof(DaliDemo).Assembly;
-
- Type exampleType = assembly?.GetType(name);
- IExample example = assembly?.CreateInstance(name) as IExample;
-
- if (null != example)
- {
- DeleteDaliDemo();
-
- example.Activate();
- }
-
- curExample = example;
- }
-
- private void ExitSample()
- {
- curExample?.Deactivate();
- curExample = null;
-
- FullGC();
-
- CreateDaliDemo();
- }
-
- protected override void OnCreate()
- {
- base.OnCreate();
- CreateDaliDemo();
-
- Window.Instance.KeyEvent += Instance_KeyEvent;
- }
-
- 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
- {
- Dispose();
- }
- }
- }
- }
-
- public void Deactivate()
- {
- demo = null;
- }
-
- private DaliTableView demo;
- }
- //public class SampleMain : NUIApplication, IExample
- //{
- // public void Activate()
- // {
- // //defaultFocusIndicator = new View();
- // //defaultFocusIndicator.BackgroundColor = Color.Transparent;
- // //FocusManager.Instance.FocusIndicator = defaultFocusIndicator;
-
- // Window.Instance.BackgroundColor = Color.Cyan;
- // Window.Instance.GetDefaultLayer().Add(container);
- // FocusManager.Instance.SetCurrentFocusView(label[currentIndex]);
- // }
-
- // public void Deactivate()
- // {
- // //Window.Instance.BackgroundColor = new Color(0.96f, 0.96f, 0.86f, 1.0f);
- // View currentView = FocusManager.Instance.GetCurrentFocusView();
- // currentIndex = Array.FindIndex(label, x => x == currentView);
-
- // Window.Instance.GetDefaultLayer().Remove(container);
- // }
-
- // protected override void OnCreate()
- // {
- // base.OnCreate();
- // container = new FlexContainer();
- // container.Size2D = new Size2D(Window.Instance.Size.Width, Window.Instance.Size.Height);
- // container.PivotPoint = PivotPoint.TopLeft;
- // container.FlexWrap = FlexContainer.WrapType.Wrap;
- // container.FlexDirection = (int)FlexContainer.FlexDirectionType.Column;
-
- // 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;
-
- // label = new MyTextView[examples.Count()];
- // for (int i = 0; i < label.Length; i++)
- // {
- // label[i] = new MyTextView();
- // label[i].Text = examples.ElementAt(i);
- // label[i].Size = new Size(300, 40, 0);
- // label[i].FlexMargin = new Vector4(20, 20, 40, 20);
- // label[i].PointSize = 15;
- // label[i].KeyEvent += SampleMain_KeyEvent;
- // label[i].TouchEvent += SampleMain_TouchEvent;
- // label[i].PivotPoint = PivotPoint.TopLeft;
- // container.Add(label[i]);
- // }
-
- // label.First().UpFocusableView = label.Last();
- // label.Last().DownFocusableView = label.First();
-
- // Window.Instance.KeyEvent += Instance_Key;
-
- // Activate();
- // sampleStack.Push(this);
- // }
-
- // private bool SampleMain_TouchEvent(object source, View.TouchEventArgs e)
- // {
- // TextLabel textLabel = source as TextLabel;
- // string sampleName = textLabel.Text;
- // RunSample("Tizen.NUI.Samples", sampleName);
- // return false; ;
- // }
-
- // public void ExitSample()
- // {
- // if (sampleStack.Count() == 1)
- // {
- // Exit();
- // Environment.Exit(0);
- // return;
- // }
-
- // IExample currentSample = sampleStack.Pop();
-
- // currentSample.Deactivate();
- // currentSample = null;
-
- // FullGC();
-
- // IExample nextSample = sampleStack.Peek();
- // nextSample.Activate();
- // }
-
- // 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)
- // {
- // IExample currentSample = sampleStack.Peek();
- // currentSample.Deactivate();
-
- // FullGC();
-
- // currentSample = item as IExample;
- // sampleStack.Push(currentSample);
-
- // currentSample.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("Tizen.NUI.Samples", sampleName);
-
- // return true;
- // }
- // }
-
- // return false;
- // }
-
- // MyTextView[] label;
- // FlexContainer container;
- // View defaultFocusIndicator;
- // int currentIndex = 0;
- // Stack<IExample> sampleStack = new Stack<IExample>();
- //}
-
- //public class MyTextView : TextLabel
- //{
- // Animation focusInAni;
- // Animation focusOutAni;
-
- // public MyTextView()
- // {
- // this.Focusable = true;
- // this.FocusGained += MyTextView_FocusGained;
- // this.FocusLost += MyTextView_FocusLost;
-
- // focusInAni = new Animation(400);
- // focusOutAni = new Animation(400);
-
- // focusInAni.AnimateTo(this, "Scale", new Vector3(1.2f, 1.2f, 1.0f));
- // focusOutAni.AnimateTo(this, "Scale", new Vector3(1.0f, 1.0f, 1.0f));
- // }
-
- // private void MyTextView_FocusLost(object sender, EventArgs e)
- // {
- // focusOutAni.Play();
- // this.BackgroundColor = Color.Transparent;
- // this.TextColor = Color.Black;
- // }
-
- // private void MyTextView_FocusGained(object sender, EventArgs e)
- // {
- // focusInAni.Play();
- // this.BackgroundColor = new Color(0.69f, 0.77f, 0.87f, 1.0f);
- // this.TextColor = Color.Red;
- // }
- //}
-}
-
+++ /dev/null
-using System.Collections.Generic;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
-
-namespace Tizen.NUI.Samples
-{
- public class LottieAnimationSample : IExample
- {
- LottieAnimationView lav;
- public void Activate()
- {
- lav = new LottieAnimationView();
- lav.URL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "a.json";
- lav.LoopCount = -1;
- lav.BackgroundColor = Color.White;
- Window.Instance.GetDefaultLayer().Add(lav);
- lav.Play();
- }
- public void Deactivate()
- {
- Window.Instance.GetDefaultLayer().Remove(lav);
- }
- }
-}