terms: Adjust to NUI Api changes
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Fri, 26 Jun 2020 07:47:59 +0000 (09:47 +0200)
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Fri, 26 Jun 2020 07:47:59 +0000 (09:47 +0200)
Change following issues related to NUI API changes
* Update NUI version
* Renamed ScrollEvent => Scrolling
* Change namespace of ScrollEventArgs
* Remove extra scroller content which was added as workaround
* Change logic of IsScrolledToLastPage method as refering now
  to Child[0] do not work anymore, since some extra container was
  added.

Change-Id: I7d401d4702fc8e65bb95a49561456378841b8063

Oobe/Oobe.Common/Oobe.Common.csproj
Oobe/Oobe.Language/Oobe.Language.csproj
Oobe/Oobe.Region/Oobe.Region.csproj
Oobe/Oobe.Terms/Oobe.Terms.csproj
Oobe/Oobe.Terms/Views/TermsView.cs
Oobe/Oobe.Welcome/Oobe.Welcome.csproj
Oobe/Oobe.Wifi/Oobe.Wifi.csproj
Oobe/Oobe/Oobe.csproj

index 8f7056b..e31eb4c 100644 (file)
@@ -7,7 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15297">
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15327">
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
index b0c8bd4..919be04 100644 (file)
@@ -7,7 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15297">
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15327">
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
index e298419..7702e24 100644 (file)
@@ -7,7 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15297">
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15327">
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
index b0c8bd4..919be04 100644 (file)
@@ -7,7 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15297">
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15327">
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
index 2c51e9a..fc50d79 100644 (file)
@@ -32,6 +32,8 @@ namespace Oobe.Terms.Views
         private TextLabel agreeLabel;
         private Switch agreeSwitch;
         private TapGestureDetector tapGestureDetector;
+        private ScrollableBase scroller;
+        private TextLabel content;
 
         private bool agreementCheckable;
         private bool nextEnabled;
@@ -59,25 +61,16 @@ namespace Oobe.Terms.Views
             bounding.Position2D = new Position2D(56 - 6, 112 - 6);
             bounding.Size2D = new Size2D(1086, 331);
 
-            ScrollableBase scroller = new ScrollableBase{
+            scroller = new ScrollableBase{
                 Position2D = new Position2D(56, 136),
                 Size2D = new Size2D(1072, 264),
                 Scrollbar = new Scrollbar(ScrollbarStyles.Default),
                 HideScrollBar = false,
             };
 
-            // workaround crash issue in ScrollableBase
-            var scrollerContent = new View
-            {
-                Padding = new Extents(64, 67, 0, 0),
-                WidthResizePolicy = ResizePolicyType.FillToParent,
-                HeightResizePolicy = ResizePolicyType.FitToChildren,
-                Layout = new LinearLayout(),
-            };
-
             // Do not use style on content as it seriously impacts scrolling
             // performance on ScrollableBase
-            TextLabel content = new TextLabel();
+            content = new TextLabel();
             content.TextColor = new Color(0, 12.0f / 255.0f, 43.0f / 255.0f, 1.0f);
             content.PixelSize = 18.0f;
             content.FontFamily = "BreezeSans";
@@ -88,11 +81,10 @@ namespace Oobe.Terms.Views
             content.MultiLine = true;
             content.WidthResizePolicy = ResizePolicyType.FillToParent;
 
-            scrollerContent.Add(content);
-            scroller.Add(scrollerContent);
-            scroller.ScrollEvent += (object sender, ScrollableBase.ScrollEventArgs args) =>
+            scroller.Add(content);
+            scroller.Scrolling += (object sender, ScrollEventArgs args) =>
             {
-                if (IsScrolledToLastPage(sender as ScrollableBase))
+                if (IsScrolledToLastPage(args.Position))
                 {
                     AgreementCheckable = true;
                 }
@@ -155,7 +147,7 @@ namespace Oobe.Terms.Views
             // have to delay check to get proper measurements
             Timer timer = new Timer(1000);
             timer.Tick += (sender, args) => {
-                if (IsScrolledToLastPage(scroller))
+                if (IsScrolledToLastPage(new Position()))
                 {
                     AgreementCheckable = true;
                 }
@@ -227,14 +219,11 @@ namespace Oobe.Terms.Views
             }
         }
 
-        private bool IsScrolledToLastPage(ScrollableBase scroller)
+        private bool IsScrolledToLastPage(Position currentPos)
         {
-            if (scroller != null && scroller.ChildCount > 0)
+            if (scroller != null && content != null)
             {
-                var content = scroller.Children[0];
-                var diff = content.Position.Y + content.Size2D.Height - scroller.CurrentSize.Height;
-
-                if ((content.Position.Y + content.Size2D.Height - scroller.CurrentSize.Height) < 1.0f)
+                if ((content.Position.Y + content.Size2D.Height - scroller.CurrentSize.Height) + currentPos.Y < 1.0f)
                 {
                     return true;
                 }
index fd2e294..dac35c4 100644 (file)
@@ -7,7 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15297">
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15327">
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
index 0ff8af4..4af087d 100644 (file)
@@ -8,7 +8,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15297"/>
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15327"/>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
   </ItemGroup>
 
index c791d1a..955d484 100644 (file)
@@ -20,7 +20,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Tizen.NET" Version="8.0.0.15297">
+    <PackageReference Include="Tizen.NET" Version="8.0.0.15327">
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />