Rebase develnui (#4853)
authordkdk-ryu <dkdk.ryu@samsung.com>
Tue, 20 Dec 2022 05:18:51 +0000 (14:18 +0900)
committerGitHub <noreply@github.com>
Tue, 20 Dec 2022 05:18:51 +0000 (14:18 +0900)
* [NUI] fix relative layout to fill regardless of children size.

* [NUI] add ImageUrl property on DefaultGridItem.

* [NUI] update imageUrl to resourceUrl

* [NUI] fix DefaultGridItem image to fill available area.

* [NUI][NUITizenGallery] add Animal ListView and GridView examples

* [NUI] Remove unused reference

* [NUI] Add ActionsProperty to AlertDialog to support xaml

To support Actions property of AlertDialog in xaml, the bindable
property ActionsProperty has been added to AlertDialog.

The AlertDialog example with xaml has been added to NUITizenGallery.

* [NUI] Version Update 22206

Co-authored-by: EverLEEst(SangHyeon Lee) <sh10233.lee@samsung.com>
Co-authored-by: Xianbing Teng <xb.teng@samsung.com>
Co-authored-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
44 files changed:
packaging/csapi-tizenfx.spec
packaging/version.txt
src/Tizen.NUI.Components/Controls/AlertDialog.cs
src/Tizen.NUI.Components/Controls/AlertDialogBindableProperty.cs
src/Tizen.NUI.Components/Controls/RecyclerView/Item/DefaultGridItem.cs
src/Tizen.NUI.Components/Controls/RecyclerView/Item/DefaultGridItemBindableProperty.cs
src/Tizen.NUI/Tizen.NUI.csproj
src/Tizen.NUI/src/internal/Layouting/RelativeLayout.cs
test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml [new file with mode: 0755]
test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml.cs [new file with mode: 0644]
test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestPage.xaml
test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestPage.xaml.cs
test/NUITizenGallery/Examples/CollectionViewTest/AnimalGrid.cs [new file with mode: 0644]
test/NUITizenGallery/Examples/CollectionViewTest/AnimalGridPage.cs [new file with mode: 0644]
test/NUITizenGallery/Examples/CollectionViewTest/AnimalGridPage.xaml [new file with mode: 0755]
test/NUITizenGallery/Examples/CollectionViewTest/AnimalList.cs [new file with mode: 0644]
test/NUITizenGallery/Examples/CollectionViewTest/AnimalListPage.cs [new file with mode: 0644]
test/NUITizenGallery/Examples/CollectionViewTest/AnimalListPage.xaml [new file with mode: 0755]
test/NUITizenGallery/Examples/CollectionViewTest/Animals.cs [new file with mode: 0644]
test/NUITizenGallery/NUITizenGallery.csproj
test/NUITizenGallery/res/images/animals/baldeagle.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/bear.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/cat.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/chicken.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/cow.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/deer.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/dog.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/duck.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/elephant.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/emperorpenguin.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/giraffe.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/horse.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/leopard.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/lion.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/panda.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/peacock.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/pig.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/pigeon.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/redfox.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/seagull.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/squirrel.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/tiger.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/wolf.jpg [new file with mode: 0644]
test/NUITizenGallery/res/images/animals/zebra.jpg [new file with mode: 0644]

index 084472a..4b3be45 100644 (file)
@@ -1,7 +1,7 @@
 # Auto-generated from csapi-tizenfx.spec.in by makespec.sh
 
 %define TIZEN_NET_API_VERSION 11
-%define TIZEN_NET_RPM_VERSION 11.0.0.999+nui22205
+%define TIZEN_NET_RPM_VERSION 11.0.0.999+nui22206
 %define TIZEN_NET_NUGET_VERSION 11.0.0.99999
 
 %define DOTNET_ASSEMBLY_PATH /usr/share/dotnet.tizen/framework
index 9e893c8..d6968b1 100755 (executable)
@@ -6,4 +6,4 @@ RPM_VERSION=11.0.0.999
 NUGET_VERSION=11.0.0.99999
 
 # RPM Version Suffix
-RPM_VERSION_SUFFIX=nui22205
+RPM_VERSION_SUFFIX=nui22206
index 642bfaf..5a4334d 100755 (executable)
@@ -346,6 +346,19 @@ namespace Tizen.NUI.Components
         {
             get
             {
+                return GetValue(ActionsProperty) as IEnumerable<View>;
+            }
+            set
+            {
+                SetValue(ActionsProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        private IEnumerable<View> InternalActions
+        {
+            get
+            {
                 return actionContentViews;
             }
             set
index d25c68d..21dc5c1 100755 (executable)
@@ -1,4 +1,5 @@
 using System.ComponentModel;
+using System.Collections.Generic;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Binding;
 
@@ -79,6 +80,24 @@ namespace Tizen.NUI.Components
         });
 
         /// <summary>
+        /// ActionsProperty
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty ActionsProperty = BindableProperty.Create(nameof(Actions), typeof(IEnumerable<View>), typeof(AlertDialog), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var instance = (AlertDialog)bindable;
+            if (newValue != null)
+            {
+                instance.InternalActions = newValue as IEnumerable<View>;
+            }
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var instance = (AlertDialog)bindable;
+            return instance.InternalActions;
+        });
+
+        /// <summary>
         /// ActionContentProperty
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
index 499f1e9..72c9221 100755 (executable)
@@ -164,23 +164,32 @@ namespace Tizen.NUI.Components
             }
         }
 
-        /* open when ImageView using Uri not string
-                /// <summary>
-                /// Image image's resource url in DefaultGridItem.
-                /// </summary>
-                [EditorBrowsable(EditorBrowsableState.Never)]
-                public string ImageUrl
-                {
-                    get
-                    {
-                        return Image.ResourceUrl;
-                    }
-                    set
-                    {
-                        Image.ResourceUrl = value;
-                    }
-                }
-        */
+        /// <summary>
+        /// Image resource url in DefaultGridItem.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string ResourceUrl
+        {
+            get => GetValue(ResourceUrlProperty) as string;
+            set
+            {
+                SetValue(ResourceUrlProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        internal string InternalResourceUrl
+        {
+            get
+            {
+                return Image.ResourceUrl;
+            }
+            set
+            {
+                Image.ResourceUrl = value;
+            }
+        }
+
 
         /// <summary>
         /// DefaultGridItem's text part.
@@ -336,6 +345,8 @@ namespace Tizen.NUI.Components
             RelativeLayout.SetRightTarget(itemImage, this);
             RelativeLayout.SetRightRelativeOffset(itemImage, 1.0F);
             RelativeLayout.SetHorizontalAlignment(itemImage, RelativeLayout.Alignment.Center);
+            RelativeLayout.SetFillHorizontal(itemImage, true);
+            RelativeLayout.SetFillVertical(itemImage, true);
 
             if (itemLabel != null)
             {
index 4a62d0f..977d95c 100755 (executable)
@@ -42,6 +42,25 @@ namespace Tizen.NUI.Components
             return instance.InternalText;
         });
 
+
+        /// <summary>
+        /// ResourceUrlProperty
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty ResourceUrlProperty = BindableProperty.Create(nameof(ResourceUrl), typeof(string), typeof(DefaultGridItem), default(string), propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var instance = (DefaultGridItem)bindable;
+            if (newValue != null)
+            {
+                instance.InternalResourceUrl = newValue as string;
+            }
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var instance = (DefaultGridItem)bindable;
+            return instance.InternalResourceUrl;
+        });
+
         /// <summary>
         /// LabelOrientationTypeProperty
         /// </summary>
index d9c7ab5..8f6d799 100755 (executable)
@@ -9,18 +9,11 @@
     </PropertyGroup>
 
     <ItemGroup>
-        <TizenPreloadFile Include="Tizen.NUI.preload"
-                          Sequence="30" />
+        <TizenPreloadFile Include="Tizen.NUI.preload" Sequence="30" />
     </ItemGroup>
     <ItemGroup>
-        <PackageReference Include="Microsoft.CSharp"
-                          Version="4.3.0" />
-        <PackageReference Include="System.Reflection"
-                          Version="4.3.0" />
-        <PackageReference Include="System.Reflection.TypeExtensions"
-                          Version="4.3.0" />
-        <PackageReference Include="Microsoft.Extensions.DependencyInjection"
-                          Version="1.1.0" />
+      <PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
+      <PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
     </ItemGroup>
     <ItemGroup>
         <ProjectReference Include="..\Tizen.Applications.Common\Tizen.Applications.Common.csproj" />
@@ -30,8 +23,7 @@
         <ProjectReference Include="..\Tizen.Applications.ThemeManager\Tizen.Applications.ThemeManager.csproj" />
         <ProjectReference Include="..\Tizen.Tracer\Tizen.Tracer.csproj" />
     </ItemGroup>
-    <Target Name="ChangeAliasesOfStrongNameAssemblies"
-            BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
+    <Target Name="ChangeAliasesOfStrongNameAssemblies" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
         <ItemGroup>
             <ReferencePath Condition="'%(FileName)' == 'Tizen.System.SystemSettings'">
                 <Aliases>TizenSystemSettings</Aliases>
index 52c9a95..07d24b2 100755 (executable)
@@ -175,7 +175,7 @@ namespace Tizen.NUI
 
             Geometry viewGeometry = new Geometry(startPosition + ((endPosition - startPosition - viewSize) * alignment), viewSize);
             Geometry spaceGeometry = new Geometry(startPosition, Math.Abs(endPosition - startPosition));
-            if (fill && spaceGeometry.Size > viewGeometry.Size)
+            if (fill)
             {
                 viewGeometry = spaceGeometry;
             }
diff --git a/test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml b/test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml
new file mode 100755 (executable)
index 0000000..f64f702
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<DialogPage x:Class="NUITizenGallery.AlertDialogTestDialogPage"
+  xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+  xmlns:sys="clr-namespace:System.Collections.Generic;assembly=netstandard">
+
+    <!-- Content is main placeholder of DialogPage. Add your dialog into this view. -->
+    <DialogPage.Content>
+        <AlertDialog x:Name="alertDialog" Title="Title" Message="Message">
+            <AlertDialog.Actions>
+                <sys:List x:TypeArguments="View">
+                    <Button x:Name="cancelButton" Text="Cancel"/>
+                    <Button x:Name="okButton" Text="OK"/>
+                </sys:List>
+            </AlertDialog.Actions>
+        </AlertDialog>
+    </DialogPage.Content>
+
+</DialogPage>
diff --git a/test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml.cs b/test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml.cs
new file mode 100644 (file)
index 0000000..6869d24
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright(c) 2022 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 Tizen.NUI;
+//using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace NUITizenGallery
+{
+    public partial class AlertDialogTestDialogPage : DialogPage
+    {
+        public AlertDialogTestDialogPage()
+        {
+            InitializeComponent();
+
+            cancelButton.Clicked += CancelButtonClicked;
+            okButton.Clicked += OkButtonClicked;
+        }
+
+        private void CancelButtonClicked(object sender, ClickedEventArgs args)
+        {
+            Navigator?.Pop();
+        }
+
+        private void OkButtonClicked(object sender, ClickedEventArgs args)
+        {
+            Navigator?.Pop();
+        }
+    }
+}
index b9a07d7..40e6715 100755 (executable)
                 <LinearLayout LinearOrientation="Vertical" CellPadding="0,20"/>
             </View.Layout>
 
+            <Button x:Name="buttonWithXaml"
+                        Text="Show AlertDialog with xaml"
+                        WidthSpecification="{Static LayoutParamPolicies.MatchParent}" />
+
             <Button x:Name="buttonOneAction"
                         Text="Show AlertDialog with one button"
                         WidthSpecification="{Static LayoutParamPolicies.MatchParent}" />
index b5a07e3..af1b9ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2022 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.
@@ -26,6 +26,7 @@ namespace NUITizenGallery
         {
             InitializeComponent();
 
+            buttonWithXaml.Clicked += ButtonWithXamlClicked;
             buttonOneAction.Clicked += ButtonOneActionClicked;
             buttonTwoActions.Clicked += ButtonTwoActionsClicked;
             buttonNoTitle.Clicked += ButtonNoTitleClicked;
@@ -37,6 +38,11 @@ namespace NUITizenGallery
 
         private int count;
 
+        private void ButtonWithXamlClicked(object sender, ClickedEventArgs args)
+        {
+            NUIApplication.GetDefaultWindow().GetDefaultNavigator().Push(new AlertDialogTestDialogPage());
+        }
+
         private void ButtonOneActionClicked(object sender, ClickedEventArgs args)
         {
             var button = new Button()
diff --git a/test/NUITizenGallery/Examples/CollectionViewTest/AnimalGrid.cs b/test/NUITizenGallery/Examples/CollectionViewTest/AnimalGrid.cs
new file mode 100644 (file)
index 0000000..3074613
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright(c) 2022 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;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+
+namespace NUITizenGallery
+{
+    internal class AnimalGrid : IExample
+    {
+        private Window window;
+
+        public void Activate()
+        {
+            Console.WriteLine($"@@@ this.GetType().Name={this.GetType().Name}, Activate()");
+
+            window = NUIApplication.GetDefaultWindow();
+            window.GetDefaultNavigator().Push(new AnimalGridPage());
+        }
+        public void Deactivate()
+        {
+            Console.WriteLine($"@@@ this.GetType().Name={this.GetType().Name}, Deactivate()");
+            window.GetDefaultNavigator().Pop();
+        }
+    }
+}
diff --git a/test/NUITizenGallery/Examples/CollectionViewTest/AnimalGridPage.cs b/test/NUITizenGallery/Examples/CollectionViewTest/AnimalGridPage.cs
new file mode 100644 (file)
index 0000000..39a92fd
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright(c) 2022 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;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using Tizen.NUI.Components.Extension;
+
+namespace NUITizenGallery
+{
+    public partial class AnimalGridPage : ContentPage
+    {
+        public AnimalGridPage()
+        {
+            InitializeComponent();
+            BindingContext = new Animals();
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (Disposed)
+            {
+                return;
+            }
+
+            if (type == DisposeTypes.Explicit)
+            {
+                RemoveAllChildren(true);
+            }
+
+            base.Dispose(type);
+        }
+
+        private void RemoveAllChildren(bool dispose = false)
+        {
+            RecursiveRemoveChildren(this, dispose);
+        }
+
+        private void RecursiveRemoveChildren(View parent, bool dispose)
+        {
+            if (parent == null)
+            {
+                return;
+            }
+
+            int maxChild = (int)parent.ChildCount;
+            for (int i = maxChild - 1; i >= 0; --i)
+            {
+                View child = parent.GetChildAt((uint)i);
+                if (child == null)
+                {
+                    continue;
+                }
+
+                RecursiveRemoveChildren(child, dispose);
+                parent.Remove(child);
+                if (dispose)
+                {
+                    child.Dispose();
+                }
+            }
+        }
+    }
+}
diff --git a/test/NUITizenGallery/Examples/CollectionViewTest/AnimalGridPage.xaml b/test/NUITizenGallery/Examples/CollectionViewTest/AnimalGridPage.xaml
new file mode 100755 (executable)
index 0000000..3a065f7
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ContentPage x:Class="NUITizenGallery.AnimalGridPage"
+  xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+  WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+  HeightSpecification="{Static LayoutParamPolicies.MatchParent}" >
+
+    <!-- AppBar is top-side bar with navigation content, title, and action. If you not set any contents, back button is automatically added. -->
+    <ContentPage.AppBar>
+        <AppBar x:Name="appBar" Title="AnimalGridPage"/>
+    </ContentPage.AppBar>
+
+    <!-- Content is main placeholder of ContentPage. Add your content into this view. -->
+    <ContentPage.Content>
+        <View x:Name="ContentView"
+          WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+          HeightSpecification="{Static LayoutParamPolicies.MatchParent}">
+
+            <View.Layout>
+                <LinearLayout LinearOrientation="Vertical" LinearAlignment="Top" CellPadding="10,10" />
+            </View.Layout>
+
+            <CollectionView x:Name="ColView"
+              WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+              HeightSpecification="{Static LayoutParamPolicies.MatchParent}"
+              ScrollingDirection="Vertical"
+              ItemsSource="{Binding Source}"
+              HideScrollbar="true"
+              SelectionMode="None">
+
+                <CollectionView.ItemsLayouter>
+                      <GridLayouter />
+                </CollectionView.ItemsLayouter>
+                <CollectionView.ItemTemplate>
+                      <DataTemplate>
+                            <DefaultGridItem
+                                WidthSpecification="230"
+                                HeightSpecification="200"
+                                Text="{Binding Path=Name}"
+                                ResourceUrl="{Binding Path=ImagePath}">
+                                <DefaultGridItem.Badge>
+                                    <CheckBox />
+                                </DefaultGridItem.Badge>
+                            </DefaultGridItem>
+                      </DataTemplate>
+                </CollectionView.ItemTemplate>
+
+
+            </CollectionView>
+        </View>
+    </ContentPage.Content>
+</ContentPage>
diff --git a/test/NUITizenGallery/Examples/CollectionViewTest/AnimalList.cs b/test/NUITizenGallery/Examples/CollectionViewTest/AnimalList.cs
new file mode 100644 (file)
index 0000000..c61e87f
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright(c) 2022 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;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+
+namespace NUITizenGallery
+{
+    internal class AnimalList : IExample
+    {
+        private Window window;
+
+        public void Activate()
+        {
+            Console.WriteLine($"@@@ this.GetType().Name={this.GetType().Name}, Activate()");
+
+            window = NUIApplication.GetDefaultWindow();
+            window.GetDefaultNavigator().Push(new AnimalListPage());
+        }
+        public void Deactivate()
+        {
+            Console.WriteLine($"@@@ this.GetType().Name={this.GetType().Name}, Deactivate()");
+            window.GetDefaultNavigator().Pop();
+        }
+    }
+}
diff --git a/test/NUITizenGallery/Examples/CollectionViewTest/AnimalListPage.cs b/test/NUITizenGallery/Examples/CollectionViewTest/AnimalListPage.cs
new file mode 100644 (file)
index 0000000..cc79d84
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright(c) 2022 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;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using Tizen.NUI.Components.Extension;
+
+namespace NUITizenGallery
+{
+    public partial class AnimalListPage : ContentPage
+    {
+        public AnimalListPage()
+        {
+            InitializeComponent();
+            BindingContext = new Animals();
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (Disposed)
+            {
+                return;
+            }
+
+            if (type == DisposeTypes.Explicit)
+            {
+                RemoveAllChildren(true);
+            }
+
+            base.Dispose(type);
+        }
+
+        private void RemoveAllChildren(bool dispose = false)
+        {
+            RecursiveRemoveChildren(this, dispose);
+        }
+
+        private void RecursiveRemoveChildren(View parent, bool dispose)
+        {
+            if (parent == null)
+            {
+                return;
+            }
+
+            int maxChild = (int)parent.ChildCount;
+            for (int i = maxChild - 1; i >= 0; --i)
+            {
+                View child = parent.GetChildAt((uint)i);
+                if (child == null)
+                {
+                    continue;
+                }
+
+                RecursiveRemoveChildren(child, dispose);
+                parent.Remove(child);
+                if (dispose)
+                {
+                    child.Dispose();
+                }
+            }
+        }
+    }
+}
diff --git a/test/NUITizenGallery/Examples/CollectionViewTest/AnimalListPage.xaml b/test/NUITizenGallery/Examples/CollectionViewTest/AnimalListPage.xaml
new file mode 100755 (executable)
index 0000000..b8b0160
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ContentPage x:Class="NUITizenGallery.AnimalListPage"
+  xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+  WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+  HeightSpecification="{Static LayoutParamPolicies.MatchParent}" >
+
+    <!-- AppBar is top-side bar with navigation content, title, and action. If you not set any contents, back button is automatically added. -->
+    <ContentPage.AppBar>
+        <AppBar x:Name="appBar" Title="AnimalListPage"/>
+    </ContentPage.AppBar>
+
+    <!-- Content is main placeholder of ContentPage. Add your content into this view. -->
+    <ContentPage.Content>
+        <View x:Name="ContentView"
+          WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+          HeightSpecification="{Static LayoutParamPolicies.MatchParent}">
+
+            <View.Layout>
+                <LinearLayout LinearOrientation="Vertical" LinearAlignment="Top" CellPadding="10,10" />
+            </View.Layout>
+
+            <CollectionView x:Name="ColView"
+              WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+              HeightSpecification="{Static LayoutParamPolicies.MatchParent}"
+              ScrollingDirection="Vertical"
+              ItemsSource="{Binding Source}"
+              HideScrollbar="true"
+              SelectionMode="None">
+
+                <CollectionView.ItemsLayouter>
+                      <LinearLayouter />
+                </CollectionView.ItemsLayouter>
+                <CollectionView.ItemTemplate>
+                      <DataTemplate>
+                            <DefaultLinearItem
+                                WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
+                                Text="{Binding Path=Name}"
+                                SubText="{Binding Path=ScientificName}">
+                                <DefaultLinearItem.Icon>
+                                    <ImageView
+                                        WidthSpecification="70"
+                                        HeightSpecification="50"
+                                        ResourceUrl="{Binding Path=ImagePath}" />
+                                </DefaultLinearItem.Icon>
+                                <DefaultLinearItem.Extra>
+                                    <CheckBox />
+                                </DefaultLinearItem.Extra>
+                            </DefaultLinearItem>
+                      </DataTemplate>
+                </CollectionView.ItemTemplate>
+
+
+            </CollectionView>
+        </View>
+    </ContentPage.Content>
+</ContentPage>
diff --git a/test/NUITizenGallery/Examples/CollectionViewTest/Animals.cs b/test/NUITizenGallery/Examples/CollectionViewTest/Animals.cs
new file mode 100644 (file)
index 0000000..14e553a
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright(c) 2022 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;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+
+public class Animal : INotifyPropertyChanged
+{
+    private string _name;
+    private string _scientificName;
+    private string _imageUrl = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/animals/";
+
+    public event PropertyChangedEventHandler PropertyChanged;
+    private void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }
+
+
+    public Animal(string name, string scientificName)
+    {
+        _name = name;
+        _scientificName = scientificName;
+    }
+
+    public string Name
+    {
+        get => _name;
+        set
+        {
+            _name = value;
+            OnPropertyChanged("Name");
+        }
+    }
+
+    public string ScientificName
+    {
+        get => _scientificName;
+        set
+        {
+            _scientificName = value;
+            OnPropertyChanged("ScientificName");
+        }
+    }
+
+    public string ImagePath
+    {
+        get
+        {
+            string filename = _name.Replace(" ", "");
+            filename = filename.ToLower() + ".jpg";
+            return _imageUrl + filename;
+        }
+    }
+}
+
+
+public class Animals
+{
+    (string Name,string ScientificName)[] namePool = {
+    ("Bald Eagle", "Haliaeetus leucocephalus"),
+    ("Bear", "Ursidae"),
+    ("Cat", "Felis catus"),
+    ("Chicken", "Gallus gallus domesticus"),
+    ("Cow", "Bos taurus"),
+    ("Deer", "Cervidae"),
+    ("Dog", "Canis lupus familiaris"),
+    ("Duck", "Anatidae"),
+    ("Elephant", "Elephantidae"),
+    ("Emperor Penguin", "Aptenodytes forsteri"),
+    ("Giraffe", "Giraffa"),
+    ("Horse", "Equus ferus"),
+    ("Leopard", "Panthera pardus"),
+    ("Lion", "Panthera leo"),
+    ("Panda", "Ailuropoda melanoleuca"),
+    ("Peacock", "Pavo cristatus"),
+    ("Pig", "Sus scrofa domesticus"),
+    ("Pigeon", "Columba livia"),
+    ("Red Fox", "Vulpes vulpes"),
+    ("Seagull", "Larus canus"),
+    ("Squirrel", "Sciurus vulgaris"),
+    ("Tiger", "Panthera tigris"),
+    ("Wolf", "Canis lupus"),
+    ("Zebra", "Hippotigris"),
+};
+    public ObservableCollection<Animal> Source {get; private set; } = new ObservableCollection<Animal>();
+
+    public Animals()
+    {
+        for (int i = 0; i < namePool.Length; i++)
+            Source.Add(new Animal(namePool[i].Name, namePool[i].ScientificName));
+    }
+}
index 764c965..fbb4f22 100755 (executable)
@@ -29,7 +29,7 @@
     </ItemGroup>
 
     <PropertyGroup>
-        <XamlOptimization>2</XamlOptimization>
+        <XamlOptimization>1</XamlOptimization>
     </PropertyGroup>
 
     <ImportGroup>
diff --git a/test/NUITizenGallery/res/images/animals/baldeagle.jpg b/test/NUITizenGallery/res/images/animals/baldeagle.jpg
new file mode 100644 (file)
index 0000000..5441f72
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/baldeagle.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/bear.jpg b/test/NUITizenGallery/res/images/animals/bear.jpg
new file mode 100644 (file)
index 0000000..d448f8b
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/bear.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/cat.jpg b/test/NUITizenGallery/res/images/animals/cat.jpg
new file mode 100644 (file)
index 0000000..60b7e2b
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/cat.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/chicken.jpg b/test/NUITizenGallery/res/images/animals/chicken.jpg
new file mode 100644 (file)
index 0000000..834df28
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/chicken.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/cow.jpg b/test/NUITizenGallery/res/images/animals/cow.jpg
new file mode 100644 (file)
index 0000000..65a01e6
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/cow.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/deer.jpg b/test/NUITizenGallery/res/images/animals/deer.jpg
new file mode 100644 (file)
index 0000000..d1949b7
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/deer.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/dog.jpg b/test/NUITizenGallery/res/images/animals/dog.jpg
new file mode 100644 (file)
index 0000000..215212c
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/dog.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/duck.jpg b/test/NUITizenGallery/res/images/animals/duck.jpg
new file mode 100644 (file)
index 0000000..e1bcddc
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/duck.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/elephant.jpg b/test/NUITizenGallery/res/images/animals/elephant.jpg
new file mode 100644 (file)
index 0000000..c3a4af2
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/elephant.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/emperorpenguin.jpg b/test/NUITizenGallery/res/images/animals/emperorpenguin.jpg
new file mode 100644 (file)
index 0000000..c9424df
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/emperorpenguin.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/giraffe.jpg b/test/NUITizenGallery/res/images/animals/giraffe.jpg
new file mode 100644 (file)
index 0000000..ecb1c4d
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/giraffe.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/horse.jpg b/test/NUITizenGallery/res/images/animals/horse.jpg
new file mode 100644 (file)
index 0000000..5a1ff53
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/horse.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/leopard.jpg b/test/NUITizenGallery/res/images/animals/leopard.jpg
new file mode 100644 (file)
index 0000000..7d6541b
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/leopard.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/lion.jpg b/test/NUITizenGallery/res/images/animals/lion.jpg
new file mode 100644 (file)
index 0000000..4225ecc
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/lion.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/panda.jpg b/test/NUITizenGallery/res/images/animals/panda.jpg
new file mode 100644 (file)
index 0000000..2db190a
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/panda.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/peacock.jpg b/test/NUITizenGallery/res/images/animals/peacock.jpg
new file mode 100644 (file)
index 0000000..3aac5b2
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/peacock.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/pig.jpg b/test/NUITizenGallery/res/images/animals/pig.jpg
new file mode 100644 (file)
index 0000000..f31bb18
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/pig.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/pigeon.jpg b/test/NUITizenGallery/res/images/animals/pigeon.jpg
new file mode 100644 (file)
index 0000000..40777bd
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/pigeon.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/redfox.jpg b/test/NUITizenGallery/res/images/animals/redfox.jpg
new file mode 100644 (file)
index 0000000..c58e6ea
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/redfox.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/seagull.jpg b/test/NUITizenGallery/res/images/animals/seagull.jpg
new file mode 100644 (file)
index 0000000..1dd6385
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/seagull.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/squirrel.jpg b/test/NUITizenGallery/res/images/animals/squirrel.jpg
new file mode 100644 (file)
index 0000000..4a5c1e7
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/squirrel.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/tiger.jpg b/test/NUITizenGallery/res/images/animals/tiger.jpg
new file mode 100644 (file)
index 0000000..963c912
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/tiger.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/wolf.jpg b/test/NUITizenGallery/res/images/animals/wolf.jpg
new file mode 100644 (file)
index 0000000..3a010de
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/wolf.jpg differ
diff --git a/test/NUITizenGallery/res/images/animals/zebra.jpg b/test/NUITizenGallery/res/images/animals/zebra.jpg
new file mode 100644 (file)
index 0000000..b787d53
Binary files /dev/null and b/test/NUITizenGallery/res/images/animals/zebra.jpg differ