Implements music tab title animation. Changed group title font 28/138928/1
authorJH Choi <jjie.choi@samsung.com>
Fri, 14 Jul 2017 08:38:56 +0000 (17:38 +0900)
committerJH Choi <jjie.choi@samsung.com>
Fri, 14 Jul 2017 08:38:56 +0000 (17:38 +0900)
Change-Id: Ib3d7a19940e5f6af2b05267c36226b931499de3b
Signed-off-by: JH Choi <jjie.choi@samsung.com>
TVMediaHub/TVMediaHub.Tizen/Views/ImageGroup.xaml
TVMediaHub/TVMediaHub.Tizen/Views/ImageGroup.xaml.cs
TVMediaHub/TVMediaHub.Tizen/Views/MusicGroup.xaml
TVMediaHub/TVMediaHub.Tizen/Views/MusicGroup.xaml.cs
TVMediaHub/TVMediaHub.Tizen/Views/VideoGroup.xaml.cs

index db52011..1577bfc 100644 (file)
@@ -3,22 +3,10 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              x:Class="TVMediaHub.Tizen.Views.ImageGroup"
                 ItemsSource="{Binding Contents}">
-    <RelativeLayout.Resources>
-        <ResourceDictionary>
-            <Style x:Key="GroupNameNormal" TargetType="Label">
-                <Setter Property="FontFamily" Value="Breeze Sans Light"/>
-                <Setter Property="TextColor" Value="#33FFFFFF"/>
-            </Style>
-            <Style x:Key="GroupNameSelected" TargetType="Label">
-                <Setter Property="FontFamily" Value="Breeze Sans Light"/>
-                <Setter Property="TextColor" Value="#FFFFFFFF"/>
-            </Style>
-        </ResourceDictionary>
-    </RelativeLayout.Resources>
     <Button x:Name="TitleFocusArea" Opacity ="0"
             RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.085}"/>
 
-    <Label x:Name="GroupTitle" Text="{Binding Title}" Style="{StaticResource GroupNameSelected}"
+    <Label x:Name="GroupTitle" Text="{Binding Title}"
            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.085}"/>
 
     <Grid x:Name="GroupContentArea"
index e335222..6d539eb 100755 (executable)
@@ -105,6 +105,8 @@ namespace TVMediaHub.Tizen.Views
             ImageItemList = new List<ImageItem>();
 
             GroupTitle.TextColor = Color.FromRgba(255, 255, 255, 31);
+            GroupTitle.FontFamily = "BreezSans";
+            GroupTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal);
 
             TitleFocusArea.Focused += TitleFocused;
             TitleFocusArea.Unfocused += TitleUnfocused;
index 34277cc..4ae9ec0 100644 (file)
@@ -4,7 +4,8 @@
                 x:Class="TVMediaHub.Tizen.Views.MusicGroup"
                 ItemsSource="{Binding Contents}">
     <Button x:Name="TitleFocusArea" Opacity ="0"
-            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.0737}"/>
+            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.0737}"
+            Focused="OnTitleFocused" Unfocused="OnTitleUnFocused"/>
 
     <Label x:Name="GroupTitle" Text="{Binding Title}"
            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.0737}"/>
index e246b74..d4b06a0 100755 (executable)
@@ -118,6 +118,9 @@ namespace TVMediaHub.Tizen.Views
             LeftFocusList = new List<Button>();
             RightFocusList = new List<Button>();
             MusicItemList = new List<MusicItem>();
+            GroupTitle.TextColor = Color.FromRgba(255, 255, 255, 31);
+            GroupTitle.FontFamily = "BreezSans";
+            GroupTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal);
         }
 
         /// <summary>
@@ -300,5 +303,69 @@ namespace TVMediaHub.Tizen.Views
 
             return false;
         }
+
+        /// <summary>
+        /// This method is called when the group's title is focused
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">A Focus event's argument</param>
+        public void OnTitleFocused(object sender, FocusEventArgs e)
+        {
+            GroupTitle.AbortAnimation("FocusAnimation");
+            GroupTitle.Animate("FocusAnimation",
+                (v) => { },
+                length: 167,
+                finished: (v, IsCanceled) =>
+                {
+                    if (!IsCanceled)
+                    {
+
+                        GroupTitle.Animate("FocusAnimation",
+                            (v2) =>
+                            {
+                                var R = (int)(255 * (1 - v));
+                                var G = (int)(255 - 126 * v);
+                                var B = (int)(255 - 57 * v);
+                                var A = (int)(31 + 224 * v);
+                                GroupTitle.TextColor = Color.FromRgba(R, G, B, A);
+                            },
+                            length: 167,
+                            finished: (v2, IsCanceled2) =>
+                            {
+                                if (!IsCanceled)
+                                {
+                                    GroupTitle.TextColor = Color.FromRgba(0, 129, 198, 255);
+                                }
+                            });
+                    }
+                });
+        }
+
+        /// <summary>
+        /// This method is called when the group's title is unfocused
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">A Focus event's argument</param>
+        public void OnTitleUnFocused(object sender, FocusEventArgs e)
+        {
+            GroupTitle.AbortAnimation("FocusAnimation");
+            GroupTitle.Animate("FocusAnimation",
+                (v) =>
+                {
+                    var R = (int)(255 * v);
+                    var G = (int)(129 + 126 * v);
+                    var B = (int)(198 + 57 * v);
+                    var A = (int)(255 - 224 * v);
+                    GroupTitle.TextColor = Color.FromRgba(R, G, B, A);
+                },
+                length: 167,
+                finished: (v, IsCanceled) =>
+                {
+                    if (!IsCanceled)
+                    {
+                        GroupTitle.TextColor = Color.FromRgba(255, 255, 255, 31);
+                    }
+                });
+        }
     }
 }
\ No newline at end of file
index 90532d5..204d1e9 100755 (executable)
@@ -125,6 +125,8 @@ namespace TVMediaHub.Tizen.Views
             GroupTitleFocusArea = new Button();
             GroupContentArea = new Grid();
 
+            GroupTitle.FontFamily = "BreezSans";
+            GroupTitle.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Normal);
             GroupTitle.SetBinding(Xamarin.Forms.Label.TextProperty, new Binding("Title"));
             GroupTitle.TextColor = Color.FromRgba(255, 255, 255, 31);
 
@@ -225,7 +227,7 @@ namespace TVMediaHub.Tizen.Views
             GroupContentArea.RowSpacing = SizeUtils.GetWidthSize(-150);
             GroupContentArea.ColumnSpacing = SizeUtils.GetWidthSize(-150);
 
-            GroupTitle.FontSize = SizeUtils.GetFontSize(24);
+            GroupTitle.FontSize = SizeUtils.GetFontSize(28);
         }
 
         /// <summary>