List view (#3)
authorKamil Stepaniuk/IoT & UI Sample (PLT) /SRPOL/Designer/Samsung Electronics <k.stepaniuk@samsung.com>
Mon, 16 Mar 2020 12:53:30 +0000 (13:53 +0100)
committerLukasz Stanislawski/IoT & UI Sample (PLT) /SRPOL/Engineer/Samsung Electronics <l.stanislaws@samsung.com>
Mon, 16 Mar 2020 12:53:30 +0000 (13:53 +0100)
* Creating listView

Creating listView and displaying it in Wifi step

Signed-off-by: k.stepaniuk <k.stepaniuk@partner.samsung.com>
15 files changed:
Oobe/Oobe/Controls/ViewStack.cs
Oobe/Oobe/Managers/ProcessManager.cs
Oobe/Oobe/Oobe.csproj
Oobe/OobeCommon/OobeCommon.csproj
Oobe/OobeLanguage/OobeLanguage.csproj
Oobe/OobeRegion/OobeRegion.csproj
Oobe/OobeTerms/Class1.cs
Oobe/OobeTerms/OobeTerms.csproj
Oobe/OobeWelcome/Class1.cs
Oobe/OobeWelcome/OobeWelcome.csproj
Oobe/OobeWifi/Class1.cs [deleted file]
Oobe/OobeWifi/Controls/ListView.cs [new file with mode: 0644]
Oobe/OobeWifi/Controls/WifiView.cs [new file with mode: 0644]
Oobe/OobeWifi/OobeWifi.csproj
Oobe/OobeWifi/WifiStep.cs [new file with mode: 0644]

index 549e323..be63b24 100644 (file)
@@ -45,10 +45,11 @@ namespace Oobe.Controls
                             new LayoutLength(0),
                             new LayoutLength(totalWidth),
                             new LayoutLength(totalHeight));
-                    } else
+                    }
+                    else
                     {
                         childLayout.Layout(
-                            new LayoutLength(- stack.PagesLeftPadding),
+                            new LayoutLength(-stack.PagesLeftPadding),
                             new LayoutLength(0),
                             new LayoutLength(totalWidth - stack.PagesLeftPadding),
                             new LayoutLength(totalHeight));
@@ -99,7 +100,7 @@ namespace Oobe.Controls
         public ViewStack() : base()
         {
             ClippingMode = ClippingModeType.ClipToBoundingBox;
-            Layout = new ViewStackBaseCustomLayout();
+            //Layout = new ViewStackBaseCustomLayout();
             pageEnterAnimation = new Animation();
             pageLeaveAnimation = new Animation();
             pageEnterAnimation.Finished += OnPageEntered;
index 2de00b5..e05a25a 100644 (file)
@@ -5,8 +5,9 @@ using Oobe.Views;
 using Tizen.NUI;
 using Oobe.Region;
 using System;
- namespace Oobe
+using Oobe.Wifi;
+
+namespace Oobe
  {
      public class ProcessManager : IProcessNavigation
      {
@@ -17,10 +18,12 @@ using System;
         public ProcessManager()
         {
             //TODO consider loading this from xaml, xml or something...
-            steps = new LinkedList<Lazy<ProcessStep>>(new List<Lazy<ProcessStep>>{
+            steps = new LinkedList<Lazy<ProcessStep>>(new []{
                 new Lazy<ProcessStep>(() => new LanguageStep()),
                 new Lazy<ProcessStep>(() => new RegionStep())}
             );
+            //only for review
+            steps.AddFirst(new Lazy<ProcessStep>(() => new WifiStep()));
         }
 
         public void Start()
index a0e31ca..fb093d5 100644 (file)
@@ -19,7 +19,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15106">
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15114">
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.0.9" />
index ed55487..4104a25 100644 (file)
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">\r
+<Project Sdk="Microsoft.NET.Sdk">\r
 \r
   <PropertyGroup>\r
     <OutputType>Library</OutputType>\r
@@ -7,8 +7,7 @@
   </PropertyGroup>\r
 \r
   <ItemGroup>\r
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15106">\r
-      <ExcludeAssets>Runtime</ExcludeAssets>\r
-    </PackageReference>\r
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15114" />\r
+    <PackageReference Include="Tizen.NET.Sdk" Version="1.0.9" />\r
   </ItemGroup>\r
 </Project>\r
index eb29790..549ba57 100644 (file)
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">\r
+<Project Sdk="Microsoft.NET.Sdk">\r
 \r
   <PropertyGroup>\r
     <OutputType>Library</OutputType>\r
@@ -7,9 +7,8 @@
   </PropertyGroup>\r
 \r
   <ItemGroup>\r
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15106">\r
-      <ExcludeAssets>Runtime</ExcludeAssets>\r
-    </PackageReference>\r
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15114" />\r
+    <PackageReference Include="Tizen.NET.Sdk" Version="1.0.9" />\r
   </ItemGroup>\r
 \r
   <ItemGroup>\r
index c8c933c..793a680 100644 (file)
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">\r
+<Project Sdk="Microsoft.NET.Sdk">\r
 \r
   <PropertyGroup>\r
     <OutputType>Library</OutputType>\r
@@ -7,9 +7,8 @@
   </PropertyGroup>\r
 \r
   <ItemGroup>\r
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15106">\r
-      <ExcludeAssets>Runtime</ExcludeAssets>\r
-    </PackageReference>\r
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15114" />\r
+    <PackageReference Include="Tizen.NET.Sdk" Version="1.0.9" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ProjectReference Include="..\OobeCommon\OobeCommon.csproj" />\r
index f339223..c110a4e 100644 (file)
@@ -1,6 +1,6 @@
 using System;\r
 \r
-namespace OobeTerms\r
+namespace Oobe.Terms\r
 {\r
     public class Class1\r
     {\r
index ed55487..4104a25 100644 (file)
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">\r
+<Project Sdk="Microsoft.NET.Sdk">\r
 \r
   <PropertyGroup>\r
     <OutputType>Library</OutputType>\r
@@ -7,8 +7,7 @@
   </PropertyGroup>\r
 \r
   <ItemGroup>\r
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15106">\r
-      <ExcludeAssets>Runtime</ExcludeAssets>\r
-    </PackageReference>\r
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15114" />\r
+    <PackageReference Include="Tizen.NET.Sdk" Version="1.0.9" />\r
   </ItemGroup>\r
 </Project>\r
index e369e62..362ac96 100644 (file)
@@ -1,6 +1,6 @@
 using System;\r
 \r
-namespace OobeWelcome\r
+namespace Oobe.Welcome\r
 {\r
     public class Class1\r
     {\r
index ed55487..4104a25 100644 (file)
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">\r
+<Project Sdk="Microsoft.NET.Sdk">\r
 \r
   <PropertyGroup>\r
     <OutputType>Library</OutputType>\r
@@ -7,8 +7,7 @@
   </PropertyGroup>\r
 \r
   <ItemGroup>\r
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15106">\r
-      <ExcludeAssets>Runtime</ExcludeAssets>\r
-    </PackageReference>\r
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15114" />\r
+    <PackageReference Include="Tizen.NET.Sdk" Version="1.0.9" />\r
   </ItemGroup>\r
 </Project>\r
diff --git a/Oobe/OobeWifi/Class1.cs b/Oobe/OobeWifi/Class1.cs
deleted file mode 100644 (file)
index defc1d7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-using System;\r
-\r
-namespace OobeWifi\r
-{\r
-    public class Class1\r
-    {\r
-    }\r
-}\r
diff --git a/Oobe/OobeWifi/Controls/ListView.cs b/Oobe/OobeWifi/Controls/ListView.cs
new file mode 100644 (file)
index 0000000..eadbc78
--- /dev/null
@@ -0,0 +1,71 @@
+using System.Collections.Generic;
+using System.Linq;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Oobe.Wifi.Controls
+{
+    public class ListView : ScrollableBase
+    {
+        private List<View> items;
+
+        private View LayoutView
+        {
+            get
+            {
+                if (this.Children.Any() == false)
+                {
+                    this.Add(new View()
+                    {
+                        Layout = new LinearLayout()
+                        {
+                            LinearOrientation = LinearLayout.Orientation.Vertical,
+                        },
+                        BackgroundColor = new Color(0.7f, 0.7f, 0.7f, 1f),
+                        WidthResizePolicy = ResizePolicyType.FillToParent,
+                    });
+                }
+                return this.Children.First();
+            }
+        }
+
+        public ListView()
+        {
+            this.ScrollingDirection = ScrollableBase.Direction.Vertical;
+        }
+
+        public IEnumerable<View> Items
+        {
+            get
+            {
+                return items;
+            }
+            set
+            {
+                if (value != items)
+                {
+                    Clear();
+                    items = value.ToList();
+                    AttachItems(items);
+                }
+            }
+        }
+
+        private void Clear()
+        {
+            foreach (var child in LayoutView.Children.ToList())
+            {
+                LayoutView.Remove(child);
+            }
+        }
+
+        private void AttachItems(IEnumerable<View> items)
+        {
+            foreach (var item in items)
+            {
+                LayoutView.Add(item);
+            }
+        }
+    }
+}
diff --git a/Oobe/OobeWifi/Controls/WifiView.cs b/Oobe/OobeWifi/Controls/WifiView.cs
new file mode 100644 (file)
index 0000000..1239155
--- /dev/null
@@ -0,0 +1,76 @@
+using System.Collections.Generic;
+using System.Linq;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace Oobe.Wifi.Controls
+{
+    public class WifiView
+    {
+        private View view = null;
+
+        private static View CreateViewAbsolute(string s)
+        {
+            View mainView = new View()
+            {
+                BackgroundColor = Color.Green,
+                Layout = new AbsoluteLayout(),
+                WidthResizePolicy = ResizePolicyType.FillToParent,
+            };
+            TextLabel text = new TextLabel(s);
+            text.WidthResizePolicy = ResizePolicyType.UseNaturalSize;
+            text.HorizontalAlignment = HorizontalAlignment.Begin;
+            text.VerticalAlignment = VerticalAlignment.Center;
+            text.TextColor = new Color(0.4f, 1 / (float)((s.GetHashCode() % 10) + 1), 1 / (float)((s.GetHashCode() % 20) + 1), 1);
+            text.PointSize = 88.0f;
+            text.BackgroundColor = Color.Yellow;
+            text.PivotPoint = new Position(0.0f, 0.5f);
+            text.PositionUsesPivotPoint = true;
+            text.ParentOrigin = new Position(0.0f, 0.5f);
+
+            mainView.Add(text);
+            return mainView;
+        }
+
+        public static IEnumerable<View> CreateViews()
+        {
+            foreach (var item in Enumerable.Range(1, 100))
+            {
+                yield return CreateViewAbsolute($"{item}");
+            }
+        }
+        
+        public View View
+        {
+            get
+            {
+                if( view == null )
+                {
+                    view = new View()
+                    {
+                        Layout = new LinearLayout()
+                        {
+                            LinearOrientation = LinearLayout.Orientation.Vertical,
+                        },
+                    };
+                    view.Add(CreateText("Header"));
+                    view.Add(new ListView()
+                    {
+                        Items = CreateViews(),
+                        Size = new Size(360, 360),
+                    });
+                }
+                return view;
+            }
+        }
+
+        private static TextLabel CreateText(string text)
+        {
+            TextLabel text2 = new TextLabel(text);
+            text2.BackgroundColor = Color.Green;
+            text2.TextColor = Color.Black;
+            text2.PointSize = 51.0f;
+            return text2;
+        }
+    }
+}
index ed55487..549ba57 100644 (file)
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">\r
+<Project Sdk="Microsoft.NET.Sdk">\r
 \r
   <PropertyGroup>\r
     <OutputType>Library</OutputType>\r
@@ -7,8 +7,11 @@
   </PropertyGroup>\r
 \r
   <ItemGroup>\r
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15106">\r
-      <ExcludeAssets>Runtime</ExcludeAssets>\r
-    </PackageReference>\r
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15114" />\r
+    <PackageReference Include="Tizen.NET.Sdk" Version="1.0.9" />\r
+  </ItemGroup>\r
+\r
+  <ItemGroup>\r
+    <ProjectReference Include="..\OobeCommon\OobeCommon.csproj" />\r
   </ItemGroup>\r
 </Project>\r
diff --git a/Oobe/OobeWifi/WifiStep.cs b/Oobe/OobeWifi/WifiStep.cs
new file mode 100644 (file)
index 0000000..8a279d5
--- /dev/null
@@ -0,0 +1,36 @@
+using Oobe.Common.Interfaces;
+using Oobe.Wifi.Controls;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Oobe.Wifi
+{
+    public class WifiStep : ProcessStep
+    {
+        public override View CreateView(IProcessNavigation nav)
+        {
+            var view = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Horizontal,
+                },
+            };
+            view.Add(CreateText("left"));
+            view.Add(new WifiView().View);
+            view.Add(CreateText("right"));
+            return view;
+        }
+
+        private static TextLabel CreateText(string text)
+        {
+            TextLabel text2 = new TextLabel(text);
+            text2.BackgroundColor = Color.Green;
+            text2.TextColor = Color.Black;
+            text2.PointSize = 51.0f;
+            return text2;
+        }
+    }
+}