Change PanelButtons And Subpanels
authorHeonjae Jang <heonjae.jang@samsung.com>
Fri, 3 Mar 2017 01:24:49 +0000 (10:24 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:44 +0000 (18:34 +0900)
1. Create Abstract Class "PanelButton"
2. ~PanelButtons Generalize PanelButton
3. Create ItemTemplate Property in SubPanel
4. Add Boilerplate
5. StyleCop Check

Change-Id: I150850afa94072d20a40529b0d8003c473b85166

17 files changed:
TVHome/TVHome.TizenTV/Ports/ApplicationManagerPort.cs
TVHome/TVHome.TizenTV/Ports/FileSystemPort.cs
TVHome/TVHome/Controls/MainPanelButton.xaml
TVHome/TVHome/Controls/MainPanelButton.xaml.cs
TVHome/TVHome/Controls/PanelButton.cs [new file with mode: 0644]
TVHome/TVHome/Controls/SubPanelButton.xaml
TVHome/TVHome/Controls/SubPanelButton.xaml.cs
TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml
TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml.cs
TVHome/TVHome/Models/AppShortcutController.cs
TVHome/TVHome/TVHome.csproj
TVHome/TVHome/Utils/AppShortcutStorage.cs
TVHome/TVHome/Utils/IFileSystemAPIs.cs
TVHome/TVHome/Utils/IFileSystemWatcherAPIs.cs
TVHome/TVHome/Views/MainPage.xaml
TVHome/TVHome/Views/SubPanel.xaml
TVHome/TVHome/Views/SubPanel.xaml.cs

index 431a469..73b740f 100644 (file)
@@ -73,16 +73,18 @@ namespace TVHome.TizenTV.Ports
                     DebuggingPort.D("GetInstalledApplication failed");\r
                     return null;\r
                 }\r
+\r
                 result = new Dictionary<string, string>();\r
                 result.Add("Label", appInfo.Label);\r
                 result.Add("ApplicationId", appInfo.ApplicationId);\r
                 result.Add("IconPath", (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : icons[random.Next(0, 6)]);\r
             }\r
-            catch(Exception exception)\r
+            catch (Exception exception)\r
             {\r
                 DebuggingPort.E("Exception " + applicationId + " :" + exception.Message);\r
                 return null;\r
             }\r
+\r
             return result;\r
         }\r
     }\r
index 585e211..4b6fedc 100644 (file)
@@ -25,7 +25,7 @@ using Tizen;
 using Tizen.Applications;
 using TVHome.Utils;
 
-namespace TVHome.TizenTV.Ports 
+namespace TVHome.TizenTV.Ports
 {
     class FileSystemPort : IFileSystemAPIs
     {
@@ -42,6 +42,7 @@ namespace TVHome.TizenTV.Ports
             {
                 DebuggingPort.E("Exception!! " + exception.Message);
             }
+
             return fileStream;
         }
 
@@ -56,5 +57,5 @@ namespace TVHome.TizenTV.Ports
             var fileStream = stream as FileStream;
             fileStream.Dispose();
         }
-}
+    }
 }
index b5a8c28..bc040b0 100755 (executable)
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
-          xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-          x:Class="TVHome.Controls.MainPanelButton">
+<Controls:PanelButton xmlns="http://xamarin.com/schemas/2014/forms"
+                      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+                      xmlns:Controls="clr-namespace:TVHome.Controls"
+                      x:Class="TVHome.Controls.MainPanelButton">
     <RelativeLayout Opacity="0.3">
         <BoxView x:Name = "ButtonBox"
               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
@@ -29,7 +30,7 @@
                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.126}"
                Opacity="0"
-               FontSize="26"
+               FontSize="58"
                TextColor="White"
                LineBreakMode="TailTruncation"
                HorizontalTextAlignment="Center"
@@ -42,4 +43,4 @@
                 Clicked="OnClicked"
                 Opacity="0" />
     </RelativeLayout>
-</ViewCell>
+</Controls:PanelButton>
index 35ddaae..12fd4e8 100755 (executable)
@@ -24,7 +24,7 @@ namespace TVHome.Controls
     /// <summary>
     /// Custom Control for Button in Main Panel
     /// </summary>
-    public partial class MainPanelButton : ViewCell
+    public partial class MainPanelButton : PanelButton
     {
         public BindableProperty OnFocusedCommandProperty = BindableProperty.Create("OnFocusedCommand", typeof(ICommand), typeof(MainPanelButton));
 
@@ -47,7 +47,7 @@ namespace TVHome.Controls
             InitializeComponent();
         }
 
-        private async void OnFocused(object sender, FocusEventArgs e)
+        public override async void OnFocused(object sender, FocusEventArgs e)
         {
             if (OnFocusedCommand != null)
             {
@@ -73,7 +73,7 @@ namespace TVHome.Controls
             await View.FadeTo(0.6, 300);
         }
 
-        private async void OnUnfocused(object sender, FocusEventArgs e)
+        public override async void OnUnfocused(object sender, FocusEventArgs e)
         {
             if (ButtonTitle.Text.Equals("Apps"))
             {
@@ -94,7 +94,7 @@ namespace TVHome.Controls
             await View.FadeTo(0.3, 300);
         }
 
-        private async void OnClicked(object sender, EventArgs e)
+        public override async void OnClicked(object sender, EventArgs e)
         {
             if (OnClickedCommand != null)
             {
diff --git a/TVHome/TVHome/Controls/PanelButton.cs b/TVHome/TVHome/Controls/PanelButton.cs
new file mode 100644 (file)
index 0000000..e68c701
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.Windows.Input;
+using Xamarin.Forms;
+
+namespace TVHome.Controls
+{
+    public abstract class PanelButton : ViewCell
+    {
+        public BindableProperty OnFocusedCommandProperty = BindableProperty.Create("OnFocusedCommand", typeof(ICommand), typeof(PanelButton));
+
+        public ICommand OnFocusedCommand
+        {
+            get { return (ICommand)GetValue(OnFocusedCommandProperty); }
+            set { SetValue(OnFocusedCommandProperty, value); }
+        }
+
+        public BindableProperty OnClickedCommandProperty = BindableProperty.Create("OnClickedCommand", typeof(ICommand), typeof(PanelButton));
+
+        public ICommand OnClickedCommand
+        {
+            get { return (ICommand)GetValue(OnClickedCommandProperty); }
+            set { SetValue(OnClickedCommandProperty, value); }
+        }
+
+        public abstract void OnFocused(object sender, FocusEventArgs e);
+
+        public abstract void OnUnfocused(object sender, FocusEventArgs e);
+
+        public abstract void OnClicked(object sender, EventArgs e);
+    }
+}
index fe16187..5da7f34 100644 (file)
@@ -1,22 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
-<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"\r
-          xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"\r
-          x:Class="TVHome.Controls.SubPanelButton">\r
+<Controls:PanelButton xmlns="http://xamarin.com/schemas/2014/forms"\r
+                      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"\r
+                      xmlns:Controls="clr-namespace:TVHome.Controls"\r
+                      x:Class="TVHome.Controls.SubPanelButton">\r
     <RelativeLayout Opacity="0.3">\r
         <BoxView x:Name = "ButtonBox"\r
                  RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
                  RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
-                 Color="Blue" />\r
+                 Opacity="0"/>\r
         <Image x:Name="ButtonImage"\r
                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
                Source="{Binding CurrentStateDescription.IconPath}" />\r
+        <Image x:Name="ButtonGradient"\r
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
+               Source="ic_tizen_list_thumbnail_gradient_normal.9.png" />\r
         <Label x:Name="ButtonTitle"\r
                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2}"\r
                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
                RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.8}"\r
                Opacity="0"\r
+               TextColor="White"\r
                LineBreakMode="TailTruncation"\r
+               HorizontalTextAlignment="Center"\r
                Text="{Binding CurrentStateDescription.Label}" />\r
         <Button x:Name = "ButtonFocusArea"\r
                 RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
@@ -26,4 +33,4 @@
                 Clicked="OnClicked"\r
                 Opacity="0" />\r
     </RelativeLayout>\r
-</ViewCell>
\ No newline at end of file
+</Controls:PanelButton>
\ No newline at end of file
index 54a2b0d..aac076f 100644 (file)
@@ -24,54 +24,38 @@ namespace TVHome.Controls
     /// <summary>\r
     /// Custom Control for Button in Sub Panel\r
     /// </summary>\r
-    public partial class SubPanelButton : ViewCell\r
+    public partial class SubPanelButton : PanelButton\r
     {\r
-        public BindableProperty OnFocusedCommandProperty = BindableProperty.Create("OnFocusedCommand", typeof(ICommand), typeof(SubPanelButton));\r
-\r
-        public ICommand OnFocusedCommand\r
+        public SubPanelButton()\r
         {\r
-            get { return (ICommand)GetValue(OnFocusedCommandProperty); }\r
-            set { SetValue(OnFocusedCommandProperty, value); }\r
+            InitializeComponent();\r
         }\r
 \r
-        public BindableProperty OnClickedCommandProperty = BindableProperty.Create("OnClickedCommand", typeof(ICommand), typeof(SubPanelButton));\r
-\r
-        public ICommand OnClickedCommand\r
+        public override async void OnClicked(object sender, EventArgs e)\r
         {\r
-            get { return (ICommand)GetValue(OnClickedCommandProperty); }\r
-            set { SetValue(OnClickedCommandProperty, value); }\r
-        }\r
+            if (OnClickedCommand != null)\r
+            {\r
+                OnClickedCommand.Execute("");\r
+            }\r
 \r
-        public SubPanelButton()\r
-        {\r
-            InitializeComponent();\r
+            await View.FadeTo(0.9, 300);\r
         }\r
 \r
-        private async void OnFocused(object sender, FocusEventArgs e)\r
+        public override async void OnFocused(object sender, FocusEventArgs e)\r
         {\r
             if (OnFocusedCommand != null)\r
             {\r
                 OnFocusedCommand.Execute("");\r
             }\r
 \r
-            ButtonTitle.FadeTo(0.99, 300);\r
+            ButtonTitle.FadeTo(0.8, 300);\r
             await View.FadeTo(0.6, 300);\r
         }\r
 \r
-        private async void OnUnfocused(object sender, FocusEventArgs e)\r
+        public override async void OnUnfocused(object sender, FocusEventArgs e)\r
         {\r
             ButtonTitle.FadeTo(0, 300);\r
             await View.FadeTo(0.3, 300);\r
         }\r
-\r
-        private async void OnClicked(object sender, EventArgs e)\r
-        {\r
-            if (OnClickedCommand != null)\r
-            {\r
-                OnClickedCommand.Execute("");\r
-            }\r
-\r
-            await View.FadeTo(0.9, 300);\r
-        }\r
     }\r
 }
\ No newline at end of file
index 1ca5b60..ff80af6 100644 (file)
@@ -1,44 +1,45 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
-          xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-          x:Class="TVHome.Controls.SubPanelThumbnailButton">
-  <RelativeLayout Opacity="0.3">
-    <BoxView x:Name="ButtonBox"
-             WidthRequest="320"
-             HeightRequest="180"
-             Color="Blue" />
-    <Image x:Name="ThumbnailImage"
-           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
-           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
-           Source="screenshot.png" />
-    <Image x:Name="ThumbnailGradient"
-           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
-           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
-           Source="ic_tizen_list_thumbnail_gradient_normal.9.png" />
-    <Image x:Name="ThumbnailIcon"
-           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.043}"
-           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.689}"
-           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.131}"
-           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.233}"
-           Source="AppIcon.png" />
-    <Label x:Name="ThumbnailTitle"
-           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.206}"
-           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.722}"
-           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.75}"
-           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.166}"
-           Opacity="0"
-           LineBreakMode="TailTruncation"
-           HorizontalTextAlignment="Start"
-           VerticalTextAlignment="Center"
-           Text="{Binding CurrentStateDescription.Label}"
-           TextColor="#FFFFFFFF"
-           FontSize="70"/>
-    <Button x:Name="ButtonFocusArea"
-            RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
-            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
-            Focused="OnFocused"
-            Unfocused="OnUnfocused"
-            Clicked="OnClicked"
-            Opacity="0" />
-  </RelativeLayout>
-</ViewCell>
\ No newline at end of file
+<Controls:PanelButton xmlns="http://xamarin.com/schemas/2014/forms"
+                      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+                      xmlns:Controls="clr-namespace:TVHome.Controls"
+                      x:Class="TVHome.Controls.SubPanelThumbnailButton">
+    <RelativeLayout Opacity="0.3">
+        <BoxView x:Name="ButtonBox"
+                 WidthRequest="320"
+                 HeightRequest="180"
+                 Opacity="0"/>
+        <Image x:Name="ThumbnailImage"
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
+               Source="screenshot.png" />
+        <Image x:Name="ThumbnailGradient"
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+               Source="ic_tizen_list_thumbnail_gradient_normal.9.png" />
+        <Image x:Name="ThumbnailIcon"
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.043}"
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.689}"
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.131}"
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.233}"
+               Source="AppIcon.png" />
+        <Label x:Name="ThumbnailTitle"
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.206}"
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.722}"
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.75}"
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.166}"
+               Opacity="0"
+               LineBreakMode="TailTruncation"
+               HorizontalTextAlignment="Start"
+               VerticalTextAlignment="Center"
+               Text="{Binding CurrentStateDescription.Label}"
+               TextColor="#FFFFFFFF"
+               FontSize="70"/>
+        <Button x:Name="ButtonFocusArea"
+                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
+                Focused="OnFocused"
+                Unfocused="OnUnfocused"
+                Clicked="OnClicked"
+                Opacity="0" />
+    </RelativeLayout>
+</Controls:PanelButton>
\ No newline at end of file
index bcd163b..07e9dd3 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 using System;
-using System.Windows.Input;
-using TVHome.Utils;
 using Xamarin.Forms;
 
 namespace TVHome.Controls
@@ -24,54 +21,69 @@ namespace TVHome.Controls
     /// <summary>
     /// Custom Control for Thumbnail Button in Sub Panel
     /// </summary>
-    public partial class SubPanelThumbnailButton : ViewCell
+    public partial class SubPanelThumbnailButton : PanelButton
     {
-        public BindableProperty OnFocusedCommandProperty = BindableProperty.Create("OnFocusedCommand", typeof(ICommand), typeof(SubPanelThumbnailButton));
-
-        public ICommand OnFocusedCommand
+        public SubPanelThumbnailButton()
         {
-            get { return (ICommand)GetValue(OnFocusedCommandProperty); }
-            set { SetValue(OnFocusedCommandProperty, value); }
+            InitializeComponent();
         }
 
-        public BindableProperty OnClickedCommandProperty = BindableProperty.Create("OnClickedCommand", typeof(ICommand), typeof(SubPanelThumbnailButton));
-
-        public ICommand OnClickedCommand
+        private void AnimationInitialize(object sender, EventArgs e)
         {
-            get { return (ICommand)GetValue(OnClickedCommandProperty); }
-            set { SetValue(OnClickedCommandProperty, value); }
         }
 
-        public SubPanelThumbnailButton()
+        public override async void OnClicked(object sender, EventArgs e)
         {
-            InitializeComponent();
+            if (OnClickedCommand != null)
+            {
+                OnClickedCommand.Execute("");
+            }
+
+            await View.FadeTo(0.9, 300);
         }
 
-        private async void OnFocused(object sender, FocusEventArgs e)
+        public override async void OnFocused(object sender, FocusEventArgs e)
         {
             if (OnFocusedCommand != null)
             {
                 OnFocusedCommand.Execute("");
             }
+            // Height, Width 확장 Animiation
+            //var Animation = new Animation();
+            //var viewHeightAnimation = new Animation(v => View.HeightRequest = v, 180, 216);
+            //var viewWidthAnimation = new Animation(v => View.WidthRequest = v, 320, 384);
+            //var imageWidthAnimation = new Animation(v => ThumbnailImage.Scale = v, 1, 1.2);
+            //var imagePositionAnimation = new Animation(v => ThumbnailImage.TranslationX = v, 0, 32);
+            //var titleAnimation = new Animation(v => ThumbnailTitle.Opacity = v, 0, 0.99);
+            //Animation.Add(0, 1, viewHeightAnimation);
+            //Animation.Add(0, 1, viewWidthAnimation);
+            //Animation.Add(0, 1, imageWidthAnimation);
+            //Animation.Add(0, 1, imagePositionAnimation);
+            //Animation.Add(0, 1, titleAnimation);
+            //Animation.Commit(ThumbnailTitle, "FocusedAnimation", 16, 300);
 
             ThumbnailTitle.FadeTo(0.99, 300);
             await View.FadeTo(0.6, 300);
         }
 
-        private async void OnUnfocused(object sender, FocusEventArgs e)
+        public override async void OnUnfocused(object sender, FocusEventArgs e)
         {
+            // Height, Width 확장 Animiation
+            //var Animation = new Animation();
+            //var viewHeightAnimation = new Animation(v => View.HeightRequest = v, 216, 180);
+            //var viewWidthAnimation = new Animation(v => View.WidthRequest = v, 384, 320);
+            //var imageWidthAnimation = new Animation(v => ThumbnailImage.Scale = v, 1.2, 1);
+            //var imagePositionAnimation = new Animation(v => ThumbnailImage.TranslationX = v, 32, 0);
+            //var titleAnimation = new Animation(v => ThumbnailTitle.Opacity = v, 0.99, 0);
+            //Animation.Add(0, 1, viewHeightAnimation);
+            //Animation.Add(0, 1, viewWidthAnimation);
+            //Animation.Add(0, 1, imageWidthAnimation);
+            //Animation.Add(0, 1, imagePositionAnimation);
+            //Animation.Add(0, 1, titleAnimation);
+            //Animation.Commit(ThumbnailTitle, "UnfocusedAnimation", 16, 300);
+
             ThumbnailTitle.FadeTo(0, 300);
             await View.FadeTo(0.3, 300);
         }
-
-        private async void OnClicked(object sender, EventArgs e)
-        {
-            if (OnClickedCommand != null)
-            {
-                OnClickedCommand.Execute("");
-            }
-
-            await View.FadeTo(0.9, 300);
-        }
     }
 }
\ No newline at end of file
index a705a71..9cd7800 100644 (file)
@@ -49,7 +49,7 @@ namespace TVHome.Models
                     string appLabel;\r
                     string appIconPath;\r
 \r
-                    appInfo.TryGetValue("Label",out appLabel);\r
+                    appInfo.TryGetValue("Label", out appLabel);\r
                     appInfo.TryGetValue("IconPath", out appIconPath);\r
 \r
                     DebuggingUtils.Dbg("AppID: " + appShortcutInfo.AppID + ", Label : " + appLabel + " IconPath : " + appIconPath);\r
@@ -57,13 +57,13 @@ namespace TVHome.Models
                     var defaultStateDescription = new StateDescription()\r
                     {\r
                         Label = appLabel,\r
-                        IconPath = appIconPath??icons[random.Next(0, 6)], //IconPath = (resul5t[2] == null) ? "AppIcon.png" : result[2],\r
+                        IconPath = appIconPath ?? icons[random.Next(0, 6)], //IconPath = (resul5t[2] == null) ? "AppIcon.png" : result[2],\r
                         Action = new AppControlAction\r
                         {\r
                             AppID = appShortcutInfo.AppID,\r
                         }\r
                     };\r
-                    \r
+\r
                     appShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);\r
                     appShortcutInfo.CurrentStateDescription = defaultStateDescription;\r
                 }\r
@@ -72,6 +72,7 @@ namespace TVHome.Models
                     // TODO : Remove the broken appInfo from pinned_apps_info\r
                 }\r
             }\r
+\r
             return pinned_apps_info;\r
         }\r
 \r
index d7d5f2a..ad71daf 100644 (file)
     <Compile Include="Controls\MainPanelButton.xaml.cs">\r
       <DependentUpon>MainPanelButton.xaml</DependentUpon>\r
     </Compile>\r
+    <Compile Include="Controls\PanelButton.cs" />\r
     <Compile Include="Controls\SubPanelButton.xaml.cs">\r
       <DependentUpon>SubPanelButton.xaml</DependentUpon>\r
     </Compile>\r
+    <Compile Include="Controls\SubPanelThumbnailButton.xaml.cs">\r
+      <DependentUpon>SubPanelThumbnailButton.xaml</DependentUpon>\r
+    </Compile>\r
     <Compile Include="DataModels\AppControlAction.cs" />\r
     <Compile Include="DataModels\BTLaunchAction.cs" />\r
     <Compile Include="DataModels\DBItem.cs" />\r
     </EmbeddedResource>\r
   </ItemGroup>\r
   <ItemGroup>\r
+    <EmbeddedResource Include="Controls\SubPanelThumbnailButton.xaml">\r
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
+      <SubType>Designer</SubType>\r
+    </EmbeddedResource>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
     <EmbeddedResource Include="Views\MainPage.xaml">\r
       <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
       <SubType>Designer</SubType>\r
     </Reference>\r
   </ItemGroup>\r
   <ItemGroup>\r
-    <None Include="packages.config" />\r
+    <None Include="packages.config">\r
+      <SubType>Designer</SubType>\r
+    </None>\r
   </ItemGroup>\r
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />\r
   <Import Project="..\..\packages\Xamarin.Forms.2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />\r
index 8ebe083..675da81 100644 (file)
@@ -43,7 +43,7 @@ namespace TVHome.Utils
         {\r
             fileSystemWatcher.Run();\r
         }\r
-        \r
+\r
         private static List<AppShortcutInfo> GetSampleList()\r
         {\r
             var pinnedAppsInfo = new List<AppShortcutInfo>();\r
@@ -95,6 +95,7 @@ namespace TVHome.Utils
 \r
             return pinnedAppsInfo;\r
         }\r
+\r
         public static List<AppShortcutInfo> ReadFromFile(string filePath)\r
         {\r
             IFileSystemAPIs fileSystem = DependencyService.Get<IFileSystemAPIs>();\r
@@ -108,6 +109,7 @@ namespace TVHome.Utils
                 WriteToFile(result, filePath);\r
                 return result;\r
             }\r
+\r
             StreamReader streamReader = new StreamReader(fileStream);\r
             return (List<AppShortcutInfo>)serializer.Deserialize(streamReader);\r
         }\r
@@ -118,7 +120,10 @@ namespace TVHome.Utils
             XmlSerializer serializer = new XmlSerializer(typeof(List<AppShortcutInfo>));\r
             Stream fileStream = fileSystem.OpenFile(filePath, UtilFileMode.OpenOrCreate);\r
             if (fileStream == null)\r
+            {\r
                 return false;\r
+            }\r
+\r
             StreamWriter streamWriter = new StreamWriter(fileStream);\r
             serializer.Serialize(streamWriter, pinnedAppInfo);\r
             streamWriter.Flush();\r
index 4deef2c..1592e43 100644 (file)
@@ -1,4 +1,20 @@
-using System;
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.Linq;
 using System.Text;
@@ -19,6 +35,7 @@ namespace TVHome.Utils
         Truncate = 5,
         Append = 6
     }
+
     public interface IFileSystemAPIs
     {
         Stream OpenFile(string filePath, UtilFileMode mode);
index e07f298..4f3f0ce 100644 (file)
@@ -1,4 +1,20 @@
-using System;
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 TVHome.DataModels;
 
 namespace TVHome.Utils
index c270273..fbe2067 100755 (executable)
@@ -4,6 +4,7 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              xmlns:Views="clr-namespace:TVHome.Views"
              xmlns:ViewModels="clr-namespace:TVHome.ViewModels"
+             xmlns:Controls="clr-namespace:TVHome.Controls"
              Appearing="OnAppearing"
              BackgroundImage="background.jpg">
     <ContentPage.BackgroundColor>
@@ -21,6 +22,7 @@
                   RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
                   Color="Black"
                   Opacity="0.6"/>
+
             <Views:MainPanel x:Name="PageMainPanel"
                              RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.22}"
                              RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.21875}"
                             RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.18}"
                             RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                             RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"
-                            ItemsSource="{Binding RecentList}" />
+                            ItemsSource="{Binding RecentList}" >
+                <Views:SubPanel.ItemTemplate>
+                    <DataTemplate>
+                        <Controls:SubPanelThumbnailButton/>
+                    </DataTemplate>
+                </Views:SubPanel.ItemTemplate>
+            </Views:SubPanel>
 
             <Views:SubPanel x:Name="AppsSubPanel"
                             RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.18}"
                             RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                             RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"
-                            ItemsSource="{Binding AppList}" />
+                            ItemsSource="{Binding AppList}">
+                <Views:SubPanel.ItemTemplate>
+                    <DataTemplate>
+                        <Controls:SubPanelButton/>
+                    </DataTemplate>
+                </Views:SubPanel.ItemTemplate>
+            </Views:SubPanel>
 
             <Views:SubPanel x:Name="SettingsSubPanel"
                             RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.18}"
                             RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                             RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"
-                            ItemsSource="{Binding SettingsList}" />
+                            ItemsSource="{Binding SettingsList}">
+                <Views:SubPanel.ItemTemplate>
+                    <DataTemplate>
+                        <Controls:SubPanelButton/>
+                    </DataTemplate>
+                </Views:SubPanel.ItemTemplate>
+            </Views:SubPanel>
+
         </RelativeLayout>
     </ContentPage.Content>
-</ContentPage>
+</ContentPage>
\ No newline at end of file
index 52ff09c..4256e65 100644 (file)
@@ -7,7 +7,8 @@
                     Orientation="Horizontal"\r
                     HorizontalOptions="Center">\r
             <StackLayout x:Name="PanelButtonStack"\r
-                         Orientation="Horizontal">\r
+                         Orientation="Horizontal"\r
+                         Padding="96,0,96,0">\r
             </StackLayout>\r
         </ScrollView>\r
     </ContentView.Content>\r
index 715e77d..7e66a8c 100644 (file)
@@ -22,6 +22,7 @@ using TVHome.Controls;
 using TVHome.DataModels;\r
 using TVHome.ViewModels;\r
 using Xamarin.Forms;\r
+using TVHome.Utils;\r
 \r
 namespace TVHome.Views\r
 {\r
@@ -38,6 +39,14 @@ namespace TVHome.Views
             set { SetValue(ItemsSourceProperty, value); }\r
         }\r
 \r
+        public static readonly BindableProperty ItemTemplateProperty = BindableProperty.Create("ItemTemplate", typeof(DataTemplate), typeof(SubPanel));\r
+\r
+        public DataTemplate ItemTemplate\r
+        {\r
+            get { return (DataTemplate)GetValue(ItemTemplateProperty); }\r
+            set { SetValue(ItemTemplateProperty, value); }\r
+        }\r
+\r
         private bool isFocused;\r
 \r
         public SubPanel()\r
@@ -55,9 +64,10 @@ namespace TVHome.Views
             }\r
 \r
             PanelButtonStack.Children.Clear();\r
+\r
             foreach (ShortcutInfo item in ItemsSource)\r
             {\r
-                var button = new SubPanelButton();\r
+                var button = ItemTemplate.CreateContent() as PanelButton;\r
                 button.View.BindingContext = item;\r
                 button.OnFocusedCommand = new Command(() =>\r
                 {\r