Add All apps/Media Hub/Add pin icons in App list
authorHyerim Kim <rimi.kim@samsung.com>
Fri, 10 Mar 2017 07:12:08 +0000 (16:12 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:45 +0000 (18:34 +0900)
Add Dimmed image for app list icons

Change-Id: I07d5a2f4007ffc564644b2d246cf45ac4fd282dc
Signed-off-by: Hyerim Kim <rimi.kim@samsung.com>
LibTVRefCommonPortable/Models/AppShortcutController.cs [changed mode: 0644->0755]
LibTVRefCommonPortable/Models/SettingShortcutFactory.cs [changed mode: 0644->0755]
TVHome/TVHome.TizenTV/TVHome.TizenTV.csproj [changed mode: 0644->0755]
TVHome/TVHome/Controls/SubPanelButton.xaml [changed mode: 0644->0755]
TVHome/TVHome/Controls/SubPanelReservedButton.xaml [new file with mode: 0755]
TVHome/TVHome/Controls/SubPanelReservedButton.xaml.cs [new file with mode: 0755]
TVHome/TVHome/TVHome.csproj [changed mode: 0644->0755]
TVHome/TVHome/Views/MainPage.xaml
TVHome/TVHome/Views/SubPanel.xaml.cs [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index b48eae1..81dcc3b
@@ -26,6 +26,7 @@ namespace LibTVRefCommmonPortable.Models
 {
     public class AppShortcutController
     {
+        private List<AppShortcutInfo> returnPinnedAppsInfo = new List<AppShortcutInfo>();
 
         public AppShortcutController()
         {
@@ -60,12 +61,69 @@ namespace LibTVRefCommmonPortable.Models
             return appShortcutInfoList;
         }
 
+        private void AddAllAppsAndMediaHubShortcut()
+        {
+            var allAppsStateDescription = new StateDescription()
+            {
+                Label = "All apps",
+                IconPath = "ic_tizen_home_list_allapps_normal.png",
+                Action = new AppControlAction
+                {
+                    AppID = "org.tizen.example.TVApps.TizenTV",
+                }
+            };
+
+            var allAppsShortcutInfo = new AppShortcutInfo();
+
+            allAppsShortcutInfo.StateDescriptions.Add("default", allAppsStateDescription);
+            allAppsShortcutInfo.CurrentStateDescription = allAppsStateDescription;
+
+            returnPinnedAppsInfo.Add(allAppsShortcutInfo);
+
+            var mediaHubStateDescription = new StateDescription()
+            {
+                Label = "Media Hub",
+                IconPath = "ic_tizen_home_list_mediahub_normal.png",
+                Action = new AppControlAction
+                {
+                    AppID = "org.tizen.mediahub",
+                }
+            };
+
+            var mediaHubShortcutInfo = new AppShortcutInfo();
+            mediaHubShortcutInfo.StateDescriptions.Add("default", mediaHubStateDescription);
+            mediaHubShortcutInfo.CurrentStateDescription = mediaHubStateDescription;
+
+            returnPinnedAppsInfo.Add(mediaHubShortcutInfo);
+        }
+
+        private void AppendAddPinShortcut()
+        {
+            var addPinStateDescription = new StateDescription()
+            {
+                Label = "Add pin",
+                IconPath = "ic_tizen_home_list_addpin_normal.png",
+                Action = new AppControlAction
+                {
+                    AppID = "org.tizen.example.TVApps.TizenTV",
+                }
+            };
+
+            var addPinShortcutInfo = new AppShortcutInfo();
+
+            addPinShortcutInfo.StateDescriptions.Add("default", addPinStateDescription);
+            addPinShortcutInfo.CurrentStateDescription = addPinStateDescription;
+
+            returnPinnedAppsInfo.Add(addPinShortcutInfo);
+        }
         public IEnumerable<AppShortcutInfo> GetPinnedApps()
         {
             IApplicationManagerAPIs applicationManagerPort = DependencyService.Get<IApplicationManagerAPIs>();
             IEnumerable<AppShortcutInfo> pinned_apps_info = AppShortcutStorage.Read();
             string[] icons = { "ic_black.png", "ic_blue.png", "ic_green.png", "ic_red.png", "ic_yellow.png", "AppIcon.png" };
 
+            AddAllAppsAndMediaHubShortcut();
+
             foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info)
             {
                 Dictionary<string, string> appInfo = applicationManagerPort.GetInstalledApplication(appShortcutInfo.AppID);
@@ -92,6 +150,7 @@ namespace LibTVRefCommmonPortable.Models
 
                     appShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);
                     appShortcutInfo.CurrentStateDescription = defaultStateDescription;
+                    returnPinnedAppsInfo.Add(appShortcutInfo);
                 }
                 else
                 {
@@ -99,7 +158,9 @@ namespace LibTVRefCommmonPortable.Models
                 }
             }
 
-            return pinned_apps_info;
+            AppendAddPinShortcut();
+
+            return returnPinnedAppsInfo;
         }
 
         public void UpdatePinnedApps(IEnumerable<AppShortcutInfo> pinnedAppsInfo)
old mode 100644 (file)
new mode 100755 (executable)
index 40cd561..6a45ec8
@@ -36,6 +36,15 @@ namespace LibTVRefCommmonPortable.Models
                     {
                         StateDescriptions =
                         {
+                            {
+                                "default",
+                                new StateDescription
+                                {
+                                    Label = "WiFi ON",
+                                    IconPath = "AppIcon.png",
+                                    Action = new WiFiOffAction(),
+                                }
+                            },
                             {
                                 "on",
                                 new StateDescription
@@ -73,6 +82,15 @@ namespace LibTVRefCommmonPortable.Models
                     {
                         StateDescriptions =
                         {
+                            {
+                                "default",
+                                new StateDescription
+                                {
+                                    Label = "BT ON",
+                                    IconPath = "AppIcon.png",
+                                    Action = new BTOffAction(),
+                                }
+                            },
                             {
                                 "on",
                                 new StateDescription
old mode 100644 (file)
new mode 100755 (executable)
index af0c5df..1f2d02e
@@ -52,6 +52,7 @@
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="lib\" />\r
+    <Folder Include="res\" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ProjectReference Include="..\..\LibTVRefCommonPortable\LibTVRefCommonPortable.csproj">\r
old mode 100644 (file)
new mode 100755 (executable)
index d238c9d..27c56e7
@@ -6,28 +6,36 @@
     <RelativeLayout Opacity="0.38">\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
+                 RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.7419}"\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
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"\r
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0}"\r
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.7419}"\r
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"\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
+      <Image x:Name="ButtonDimmedImage"\r
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Width, Factor=0}"\r
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Height, Factor=0}"\r
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Height, Factor=1}"\r
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Width, Factor=1}"\r
+               Source="img_tizen_home_list_dim_apps.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.5"\r
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"\r
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.8387}"\r
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.1613}"\r
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"\r
+               Opacity="0.6"\r
                TextColor="White"\r
+               FontSize="26"\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
-                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"\r
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0}"\r
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"\r
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"\r
                 Focused="OnFocused"\r
                 Unfocused="OnUnfocused"\r
                 Clicked="OnClicked"\r
diff --git a/TVHome/TVHome/Controls/SubPanelReservedButton.xaml b/TVHome/TVHome/Controls/SubPanelReservedButton.xaml
new file mode 100755 (executable)
index 0000000..4b5c49c
--- /dev/null
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.SubPanelReservedButton">
+    <RelativeLayout>
+        <BoxView x:Name = "ButtonBox"
+                 RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
+                 RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.7419}"
+                 Opacity="0"/>
+        <Image x:Name="ButtonBgImage"
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0}"
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.7419}"
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+               Source="img_tizen_home_list_bg_white_normal.png"
+               />
+        <Image x:Name="ButtonImage"
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBgImage, Property=Width, Factor=0.3116}"
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBgImage, Property=Height, Factor=0.3116}"
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBgImage, Property=Height, Factor=0.3768}"
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBgImage, Property=Width, Factor=0.3768}"
+               Source="{Binding CurrentStateDescription.IconPath}" />
+      <Image x:Name="ButtonDimmedImage"
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBgImage, Property=Width, Factor=0}"
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBgImage, Property=Height, Factor=0}"
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBgImage, Property=Height, Factor=1}"
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBgImage, Property=Width, Factor=1}"
+               Source="img_tizen_home_list_dim_apps.png" />
+        <Label x:Name="ButtonTitle"
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.8387}"
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.1613}"
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+               Opacity="0.6"
+               TextColor="White"
+               FontSize="52"
+               LineBreakMode="TailTruncation"
+               HorizontalTextAlignment="Center"
+               Text="{Binding CurrentStateDescription.Label}" />
+        <Button x:Name = "ButtonFocusArea"
+               RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"
+               RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0}"
+               RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
+               RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+                Focused="OnFocused"
+                Unfocused="OnUnfocused"
+                Clicked="OnClicked"
+                Opacity="0" />
+    </RelativeLayout>
+</Controls:PanelButton>
\ No newline at end of file
diff --git a/TVHome/TVHome/Controls/SubPanelReservedButton.xaml.cs b/TVHome/TVHome/Controls/SubPanelReservedButton.xaml.cs
new file mode 100755 (executable)
index 0000000..83c1a19
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * 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 LibTVRefCommmonPortable.Utils;
+using Xamarin.Forms;
+
+namespace TVHome.Controls
+{
+    /// <summary>
+    /// Custom Control for Button in Sub Panel
+    /// </summary>
+    public partial class SubPanelReservedButton : PanelButton
+    {
+        public SubPanelReservedButton()
+        {
+            InitializeComponent();
+        }
+
+        public override async void OnClicked(object sender, EventArgs e)
+        {
+            if (OnClickedCommand != null)
+            {
+                OnClickedCommand.Execute("");
+            }
+
+            await View.FadeTo(0.99, 300);
+        }
+
+        public override async void OnFocused(object sender, FocusEventArgs e)
+        {
+            if (OnFocusedCommand != null)
+            {
+                OnFocusedCommand.Execute("");
+            }
+
+#pragma warning disable CS4014
+            View.FadeTo(0.8, 300);
+            ButtonTitle.FadeTo(0.8, 300);
+            ButtonBgImage.ScaleTo(1.32, 300);
+#pragma warning restore CS4014
+            //await View.ScaleTo(1.3, 300);
+            await ButtonImage.ScaleTo(1.32, 300);
+        }
+
+        public override async void OnUnfocused(object sender, FocusEventArgs e)
+        {
+#pragma warning disable CS4014
+            View.FadeTo(0.6, 300);
+            ButtonTitle.FadeTo(0.6, 300);
+            ButtonBgImage.ScaleTo(1, 300);
+#pragma warning restore CS4014
+            //await View.ScaleTo(1, 300);
+            await ButtonImage.ScaleTo(1, 300);
+        }
+    }
+}
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index 99c888c..9f65c3d
@@ -38,6 +38,9 @@
       <DependentUpon>MainPanelButton.xaml</DependentUpon>\r
     </Compile>\r
     <Compile Include="Controls\PanelButton.cs" />\r
+    <Compile Include="Controls\SubPanelReservedButton.xaml.cs">\r
+      <DependentUpon>SubPanelReservedButton.xaml</DependentUpon>\r
+    </Compile>\r
     <Compile Include="Controls\SubPanelButton.xaml.cs">\r
       <DependentUpon>SubPanelButton.xaml</DependentUpon>\r
     </Compile>\r
       <Name>LibTVRefCommonPortable</Name>\r
     </ProjectReference>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <EmbeddedResource Include="Controls\SubPanelReservedButton.xaml">\r
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
+      <SubType>Designer</SubType>\r
+    </EmbeddedResource>\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
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">\r
        <Target Name="AfterBuild">\r
        </Target>\r
        -->\r
-</Project>
\ No newline at end of file
+</Project>\r
index 9f4169e663958b3bf2d0e01eec007683027dceeb..c6bf6489ca684d3df63f9ed732c931237a5bd4d5 100755 (executable)
                             RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                             RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.89}"
                             ItemsSource="{Binding AppList}">
-                <Views:SubPanel.ItemTemplate>
-                    <DataTemplate>
-                        <Controls:SubPanelButton/>
-                    </DataTemplate>
-                </Views:SubPanel.ItemTemplate>
             </Views:SubPanel>
 
             <Views:SubPanel x:Name="SettingsSubPanel"
old mode 100644 (file)
new mode 100755 (executable)
index 47ac504..79226f3
@@ -48,7 +48,18 @@ namespace TVHome.Views
             PanelButtonStack.Children.Clear();\r
             foreach (ShortcutInfo item in ItemsSource)\r
             {\r
-                var button = ItemTemplate.CreateContent() as PanelButton;\r
+                PanelButton button;\r
+\r
+                if (item.StateDescriptions["default"].Label.Equals("All apps") || item.StateDescriptions["default"].Label.Equals("Media Hub")\r
+                    || item.StateDescriptions["default"].Label.Equals("Add pin"))\r
+                {\r
+                    button = new SubPanelReservedButton();\r
+                }\r
+                else\r
+                               {\r
+                    button = new SubPanelButton();\r
+                               }\r
+\r
                 button.View.BindingContext = item;\r
                 button.OnFocusedCommand = new Command(() =>\r
                 {\r
@@ -87,10 +98,15 @@ namespace TVHome.Views
                 item.IsEnabled = true;\r
             }\r
 \r
+            foreach (var item in PanelButtonStack.Children)\r
+            {\r
+                item.FindByName<Image>("ButtonDimmedImage").Opacity = 1;\r
+            }\r
+\r
 #pragma warning disable CS4014\r
-            this.TranslateTo(0, 0, 0);\r
+            this.TranslateTo(0, 0, 300);\r
 #pragma warning restore CS4014\r
-            await this.FadeTo(0.3, 0);\r
+            await this.FadeTo(0.3, 300);\r
         }\r
 \r
         public override async void FocusPanel()\r
@@ -106,6 +122,11 @@ namespace TVHome.Views
             var button = PanelButtonStack.Children[1];\r
             button.FindByName<Button>("ButtonFocusArea").Focus();\r
 \r
+            foreach (var item in PanelButtonStack.Children)\r
+            {\r
+                item.FindByName<Image>("ButtonDimmedImage").Opacity = 0;\r
+            }\r
+\r
 #pragma warning disable CS4014\r
             this.TranslateTo(0, -140, 300);\r
 #pragma warning restore CS4014\r