-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-namespace LibTVRefCommonPortable.DataModels
+namespace LibTVRefCommonPortable.DataModels
{
public enum WatcherType
{
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*\r
- * Copyright (c) 2017 Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.1 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://floralicense.org/license/\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Collections.Generic;\r
-using System.Threading.Tasks;\r
-using LibTVRefCommonPortable.DataModels;\r
-using LibTVRefCommonPortable.Utils;\r
-\r
-using Xamarin.Forms;\r
-\r
-namespace LibTVRefCommonPortable.Models\r
-{\r
- public class RecentShortcutController\r
- {\r
- public RecentShortcutController()\r
- {\r
- }\r
-\r
- public void Remove(RecentShortcutInfo history)\r
- {\r
- RecentShortcutStorage.Delete(history);\r
- }\r
-\r
- public void RemoveAll()\r
- {\r
- RecentShortcutStorage.DeleteAll();\r
- }\r
-\r
- public bool Update(RecentShortcutInfo shortcut)\r
- {\r
- RecentShortcutStorage.Update(shortcut);\r
- return false;\r
- }\r
-\r
- public IEnumerable<RecentShortcutInfo> GetList()\r
- {\r
- // TODO : This is a clone of AppShorcutController.ReadFromFile(). Write new code by using RUA\r
- IEnumerable<AppShortcutInfo> pinned_apps_info = AppShortcutStorage.Read();\r
- IApplicationManagerAPIs applicationManagerPort = DependencyService.Get<IApplicationManagerAPIs>();\r
- List<RecentShortcutInfo> recentShortcutInfoList = new List<RecentShortcutInfo>();\r
- string[] icons = { "ic_black.png", "ic_blue.png", "ic_green.png", "ic_red.png", "ic_yellow.png", "AppIcon.png" };\r
-\r
- foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info)\r
- {\r
- Dictionary<string, string> appInfo = applicationManagerPort.GetInstalledApplication(appShortcutInfo.AppID);\r
-\r
- if (appInfo != null)\r
- {\r
- string appLabel;\r
- string appIconPath;\r
-\r
- appInfo.TryGetValue("Label", out appLabel);\r
- appInfo.TryGetValue("IconPath", out appIconPath);\r
-\r
- Random random = new Random();\r
- var defaultStateDescription = new StateDescription()\r
- {\r
- Label = appLabel,\r
- IconPath = appIconPath ?? icons[random.Next(0, 6)],\r
- Action = new AppControlAction\r
- {\r
- AppID = appShortcutInfo.AppID,\r
- }\r
- };\r
- var newRecentShortcutInfo = new RecentShortcutInfo();\r
- newRecentShortcutInfo.ScreenshotPath = "screenshot.png";\r
- // newRecentShortcutInfo.ScreenshotPath = "screenshot_" + appShortcutInfo.AppID + ".png";\r
- newRecentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);\r
- newRecentShortcutInfo.CurrentStateDescription = defaultStateDescription;\r
- recentShortcutInfoList.Add(newRecentShortcutInfo);\r
- }\r
- }\r
-\r
- return recentShortcutInfoList;\r
- }\r
-\r
- public async Task<IEnumerable<RecentShortcutInfo>> GetListAsync()\r
- {\r
- IApplicationManagerAPIs applicationManagerPort = DependencyService.Get<IApplicationManagerAPIs>();\r
- List<RecentShortcutInfo> recentShortcutInfoList = new List<RecentShortcutInfo>();\r
-\r
- var applicationList = await applicationManagerPort.GetRecentApplications();\r
- foreach (KeyValuePair<string, string[]> item in applicationList)\r
- {\r
- var defaultStateDescription = new StateDescription()\r
- {\r
- Label = item.Value[0],\r
- IconPath = item.Value[2],\r
- Action = new AppControlAction()\r
- {\r
- AppID = item.Key\r
- }\r
- };\r
- var recentShortcutInfo = new RecentShortcutInfo();\r
- recentShortcutInfo.ScreenshotPath = "screenshot_" + item.Value[0] + ".png";\r
- recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);\r
- recentShortcutInfo.CurrentStateDescription = defaultStateDescription;\r
- recentShortcutInfoList.Add(recentShortcutInfo);\r
- }\r
-\r
- return recentShortcutInfoList;\r
-\r
- }\r
- }\r
-}\r
+/*
+ * 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;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using LibTVRefCommonPortable.DataModels;
+using LibTVRefCommonPortable.Utils;
+
+using Xamarin.Forms;
+
+namespace LibTVRefCommonPortable.Models
+{
+ public class RecentShortcutController
+ {
+ public RecentShortcutController()
+ {
+ }
+
+ public void Remove(RecentShortcutInfo history)
+ {
+ RecentShortcutStorage.Delete(history);
+ }
+
+ public void RemoveAll()
+ {
+ RecentShortcutStorage.DeleteAll();
+ }
+
+ public bool Update(RecentShortcutInfo shortcut)
+ {
+ RecentShortcutStorage.Update(shortcut);
+ return false;
+ }
+
+ public IEnumerable<RecentShortcutInfo> GetList()
+ {
+ // TODO : This is a clone of AppShorcutController.ReadFromFile(). Write new code by using RUA
+ IEnumerable<AppShortcutInfo> pinned_apps_info = AppShortcutStorage.Read();
+ IApplicationManagerAPIs applicationManagerPort = DependencyService.Get<IApplicationManagerAPIs>();
+ List<RecentShortcutInfo> recentShortcutInfoList = new List<RecentShortcutInfo>();
+ string[] icons = { "ic_black.png", "ic_blue.png", "ic_green.png", "ic_red.png", "ic_yellow.png", "AppIcon.png" };
+
+ foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info)
+ {
+ Dictionary<string, string> appInfo = applicationManagerPort.GetInstalledApplication(appShortcutInfo.AppID);
+
+ if (appInfo != null)
+ {
+ string appLabel;
+ string appIconPath;
+
+ appInfo.TryGetValue("Label", out appLabel);
+ appInfo.TryGetValue("IconPath", out appIconPath);
+
+ Random random = new Random();
+ var defaultStateDescription = new StateDescription()
+ {
+ Label = appLabel,
+ IconPath = appIconPath ?? icons[random.Next(0, 6)],
+ Action = new AppControlAction
+ {
+ AppID = appShortcutInfo.AppID,
+ }
+ };
+ var newRecentShortcutInfo = new RecentShortcutInfo();
+ newRecentShortcutInfo.ScreenshotPath = "screenshot.png";
+ // newRecentShortcutInfo.ScreenshotPath = "screenshot_" + appShortcutInfo.AppID + ".png";
+ newRecentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);
+ newRecentShortcutInfo.CurrentStateDescription = defaultStateDescription;
+ recentShortcutInfoList.Add(newRecentShortcutInfo);
+ }
+ }
+
+ return recentShortcutInfoList;
+ }
+
+ public async Task<IEnumerable<RecentShortcutInfo>> GetListAsync()
+ {
+ IApplicationManagerAPIs applicationManagerPort = DependencyService.Get<IApplicationManagerAPIs>();
+ List<RecentShortcutInfo> recentShortcutInfoList = new List<RecentShortcutInfo>();
+
+ var applicationList = await applicationManagerPort.GetRecentApplications();
+ foreach (KeyValuePair<string, string[]> item in applicationList)
+ {
+ var defaultStateDescription = new StateDescription()
+ {
+ Label = item.Value[0],
+ IconPath = item.Value[2],
+ Action = new AppControlAction()
+ {
+ AppID = item.Key
+ }
+ };
+ var recentShortcutInfo = new RecentShortcutInfo();
+ recentShortcutInfo.ScreenshotPath = "screenshot_" + item.Value[0] + ".png";
+ recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);
+ recentShortcutInfo.CurrentStateDescription = defaultStateDescription;
+ recentShortcutInfoList.Add(recentShortcutInfo);
+ }
+
+ return recentShortcutInfoList;
+
+ }
+ }
+}
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-using System;
+using System;
using System.Runtime.InteropServices;
namespace TVHome.Utils
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-<?xml version="1.0" encoding="UTF-8"?>
+<?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"
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-<?xml version="1.0" encoding="UTF-8"?>
+<?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"
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-<?xml version="1.0" encoding="UTF-8"?>\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 x:Name="ButtonBox"\r
- WidthRequest="138"\r
- HeightRequest="186"\r
- HorizontalOptions="Center">\r
- <Image x:Name="ButtonImage"\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="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.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="52"\r
- LineBreakMode="TailTruncation"\r
- HorizontalTextAlignment="Center"\r
- Text="{Binding CurrentStateDescription.Label}" />\r
- <Button x:Name = "ButtonFocusArea"\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
- Opacity="0" />\r
- </RelativeLayout>\r
+<?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.SubPanelButton">
+ <RelativeLayout x:Name="ButtonBox"
+ WidthRequest="138"
+ HeightRequest="186"
+ HorizontalOptions="Center">
+ <Image x:Name="ButtonImage"
+ 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="{Binding CurrentStateDescription.IconPath}" />
+ <Image x:Name="ButtonDimmedImage"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Width, Factor=0}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Height, Factor=0}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Height, Factor=1}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, 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
-/*\r
- * Copyright (c) 2017 Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.1 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://floralicense.org/license/\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-using System;\r
-using System.Windows.Input;\r
-using LibTVRefCommonPortable.Utils;\r
-using Xamarin.Forms;\r
-\r
-namespace TVHome.Controls\r
-{\r
- /// <summary>\r
- /// Custom Control for Button in Sub Panel\r
- /// </summary>\r
- public partial class SubPanelButton : PanelButton\r
- {\r
- public SubPanelButton()\r
- {\r
- InitializeComponent();\r
- }\r
-\r
- public override async void OnClicked(object sender, EventArgs e)\r
- {\r
- if (OnClickedCommand != null)\r
- {\r
- OnClickedCommand.Execute("");\r
- }\r
-\r
- await View.FadeTo(0.99, 300);\r
- }\r
-\r
- public override async void OnFocused(object sender, FocusEventArgs e)\r
- {\r
- if (OnFocusedCommand != null)\r
- {\r
- OnFocusedCommand.Execute("");\r
- }\r
-\r
-#pragma warning disable CS4014\r
- ButtonTitle.FadeTo(0.99, 300);\r
- ButtonTitle.TranslateTo(0, 22, 300);\r
-#pragma warning restore CS4014\r
- await ButtonImage.ScaleTo(1.3, 300);\r
- }\r
-\r
- public override async void OnUnfocused(object sender, FocusEventArgs e)\r
- {\r
-#pragma warning disable CS4014\r
- ButtonTitle.FadeTo(0.5, 300);\r
- ButtonTitle.TranslateTo(0, 0, 300);\r
-#pragma warning restore CS4014\r
- await ButtonImage.ScaleTo(1, 300);\r
- }\r
- }\r
+/*
+ * 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 LibTVRefCommonPortable.Utils;
+using Xamarin.Forms;
+
+namespace TVHome.Controls
+{
+ /// <summary>
+ /// Custom Control for Button in Sub Panel
+ /// </summary>
+ public partial class SubPanelButton : PanelButton
+ {
+ public SubPanelButton()
+ {
+ 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
+ ButtonTitle.FadeTo(0.99, 300);
+ ButtonTitle.TranslateTo(0, 22, 300);
+#pragma warning restore CS4014
+ await ButtonImage.ScaleTo(1.3, 300);
+ }
+
+ public override async void OnUnfocused(object sender, FocusEventArgs e)
+ {
+#pragma warning disable CS4014
+ ButtonTitle.FadeTo(0.5, 300);
+ ButtonTitle.TranslateTo(0, 0, 300);
+#pragma warning restore CS4014
+ await ButtonImage.ScaleTo(1, 300);
+ }
+ }
}
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>
+<?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"
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-<?xml version="1.0" encoding="UTF-8"?>
+<?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"
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TVHome.Views.MainPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-/*\r
- * Copyright (c) 2017 Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.1 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://floralicense.org/license/\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-using System;\r
-using System.Collections.Generic;\r
-using System.Diagnostics;\r
-using System.Windows.Input;\r
-using LibTVRefCommonPortable.DataModels;\r
-using LibTVRefCommonPortable.Models;\r
-using LibTVRefCommonPortable.Utils;\r
-using Xamarin.Forms;\r
-\r
-namespace TVHome.Views\r
-{\r
- /// <summary>\r
- /// Root Page of Application\r
- /// </summary>\r
- public partial class MainPage : ContentPage\r
- {\r
-\r
- private Dictionary<string, Panel> SubPanelDictionary;\r
- private Panel currentSubPanel;\r
- public ICommand ChangeSubPanelCommand;\r
-\r
- public MainPage()\r
- {\r
- InitializeComponent();\r
- SubPanelDictionary = new Dictionary<string, Panel>();\r
- SubPanelDictionary.Add("Recent", RecentSubPanel);\r
- SubPanelDictionary.Add("Apps", AppsSubPanel);\r
- SubPanelDictionary.Add("Settings", SettingsSubPanel);\r
-\r
- PageMainPanel.OnFocusedCommand = new Command<string>((key) =>\r
- {\r
- DebuggingUtils.Dbg("MainPage : " + key);\r
- if (currentSubPanel != null)\r
- {\r
- currentSubPanel.HidePanel();\r
- }\r
-\r
- currentSubPanel = SubPanelDictionary[key];\r
- currentSubPanel.ShowPanel();\r
- });\r
-\r
- RecentSubPanel.OnFocusedCommand = new Command(() =>\r
- {\r
- PageMainPanel.SelectPanel();\r
- });\r
-\r
- AppsSubPanel.OnFocusedCommand = new Command(() =>\r
- {\r
- PageMainPanel.SelectPanel();\r
- });\r
-\r
- AppsSubPanel.OnUnpinCommand = new Command<string>((appId) =>\r
- {\r
- UnpinAppShortcutInfo(appId);\r
- });\r
-\r
- SettingsSubPanel.OnFocusedCommand = new Command(() =>\r
- {\r
- PageMainPanel.SelectPanel();\r
- });\r
- }\r
-\r
- private void OnAppearing(object sender, EventArgs e)\r
- {\r
- PageMainPanel.InitialFocusing();\r
- }\r
-\r
- private void UnpinAppShortcutInfo(string appId)\r
- {\r
- RemovePinnedApp(appId);\r
- }\r
-\r
- private void UpdatePinnedApps(Dictionary<string, string> PinnedApps)\r
- {\r
- List<AppShortcutInfo> pinnedAppList = new List<AppShortcutInfo>();\r
- foreach (var item in PinnedApps)\r
- {\r
- pinnedAppList.Add(new AppShortcutInfo()\r
- {\r
- AppID = item.Key,\r
- });\r
- }\r
-\r
- TVHomeImpl.GetInstance.AppShortcutControllerInstance.UpdatePinnedApps(pinnedAppList);\r
- }\r
-\r
- public void RemovePinnedApp(string AppID)\r
- {\r
- Dictionary<string, string> PinnedApps = TVHomeImpl.GetInstance.AppShortcutControllerInstance.GetPinnedAppsAppIDs();\r
- if (PinnedApps.ContainsKey(AppID))\r
- {\r
- PinnedApps.Remove(AppID);\r
- UpdatePinnedApps(PinnedApps);\r
- }\r
- }\r
- }\r
+/*
+ * 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.Diagnostics;
+using System.Windows.Input;
+using LibTVRefCommonPortable.DataModels;
+using LibTVRefCommonPortable.Models;
+using LibTVRefCommonPortable.Utils;
+using Xamarin.Forms;
+
+namespace TVHome.Views
+{
+ /// <summary>
+ /// Root Page of Application
+ /// </summary>
+ public partial class MainPage : ContentPage
+ {
+
+ private Dictionary<string, Panel> SubPanelDictionary;
+ private Panel currentSubPanel;
+ public ICommand ChangeSubPanelCommand;
+
+ public MainPage()
+ {
+ InitializeComponent();
+ SubPanelDictionary = new Dictionary<string, Panel>();
+ SubPanelDictionary.Add("Recent", RecentSubPanel);
+ SubPanelDictionary.Add("Apps", AppsSubPanel);
+ SubPanelDictionary.Add("Settings", SettingsSubPanel);
+
+ PageMainPanel.OnFocusedCommand = new Command<string>((key) =>
+ {
+ DebuggingUtils.Dbg("MainPage : " + key);
+ if (currentSubPanel != null)
+ {
+ currentSubPanel.HidePanel();
+ }
+
+ currentSubPanel = SubPanelDictionary[key];
+ currentSubPanel.ShowPanel();
+ });
+
+ RecentSubPanel.OnFocusedCommand = new Command(() =>
+ {
+ PageMainPanel.SelectPanel();
+ });
+
+ AppsSubPanel.OnFocusedCommand = new Command(() =>
+ {
+ PageMainPanel.SelectPanel();
+ });
+
+ AppsSubPanel.OnUnpinCommand = new Command<string>((appId) =>
+ {
+ UnpinAppShortcutInfo(appId);
+ });
+
+ SettingsSubPanel.OnFocusedCommand = new Command(() =>
+ {
+ PageMainPanel.SelectPanel();
+ });
+ }
+
+ private void OnAppearing(object sender, EventArgs e)
+ {
+ PageMainPanel.InitialFocusing();
+ }
+
+ private void UnpinAppShortcutInfo(string appId)
+ {
+ RemovePinnedApp(appId);
+ }
+
+ private void UpdatePinnedApps(Dictionary<string, string> PinnedApps)
+ {
+ List<AppShortcutInfo> pinnedAppList = new List<AppShortcutInfo>();
+ foreach (var item in PinnedApps)
+ {
+ pinnedAppList.Add(new AppShortcutInfo()
+ {
+ AppID = item.Key,
+ });
+ }
+
+ TVHomeImpl.GetInstance.AppShortcutControllerInstance.UpdatePinnedApps(pinnedAppList);
+ }
+
+ public void RemovePinnedApp(string AppID)
+ {
+ Dictionary<string, string> PinnedApps = TVHomeImpl.GetInstance.AppShortcutControllerInstance.GetPinnedAppsAppIDs();
+ if (PinnedApps.ContainsKey(AppID))
+ {
+ PinnedApps.Remove(AppID);
+ UpdatePinnedApps(PinnedApps);
+ }
+ }
+ }
}
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>\r
-<Views:Panel xmlns="http://xamarin.com/schemas/2014/forms"\r
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"\r
- xmlns:Views="clr-namespace:TVHome.Views"\r
- x:Class="TVHome.Views.MainPanel">\r
- <Grid x:Name="PanelButtonGrid">\r
- <Grid.ColumnDefinitions>\r
- <ColumnDefinition Width="1*" />\r
- <ColumnDefinition Width="1*" />\r
- <ColumnDefinition Width="1*" />\r
- </Grid.ColumnDefinitions>\r
- </Grid>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<Views:Panel xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:Views="clr-namespace:TVHome.Views"
+ x:Class="TVHome.Views.MainPanel">
+ <Grid x:Name="PanelButtonGrid">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*" />
+ <ColumnDefinition Width="1*" />
+ <ColumnDefinition Width="1*" />
+ </Grid.ColumnDefinitions>
+ </Grid>
</Views:Panel>
\ No newline at end of file
-/*\r
- * Copyright (c) 2017 Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.1 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://floralicense.org/license/\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-using System;\r
-using System.Collections.Generic;\r
-using System.ComponentModel;\r
-using System.Windows.Input;\r
-using TVHome.Controls;\r
-using LibTVRefCommonPortable.DataModels;\r
-using LibTVRefCommonPortable.Utils;\r
-using TVHome.ViewModels;\r
-using Xamarin.Forms;\r
-\r
-namespace TVHome.Views\r
-{\r
- /// <summary>\r
- /// Main Panel in Main Page\r
- /// </summary>\r
- public partial class MainPanel : Panel\r
- {\r
- public MainPanel()\r
- {\r
- InitializeComponent();\r
- PropertyChanged += OnItemsSourcePropertyChanged;\r
- }\r
-\r
- private void OnItemsSourcePropertyChanged(object sender, PropertyChangedEventArgs e)\r
- {\r
- if (e.PropertyName != "ItemsSource")\r
- {\r
- return;\r
- }\r
-\r
- var index = 0;\r
- PanelButtonGrid.Children.Clear();\r
- foreach (ShortcutInfo item in ItemsSource)\r
- {\r
- var button = new MainPanelButton();\r
- button.View.BindingContext = item;\r
- button.OnFocusedCommand = new Command(() =>\r
- {\r
- FocusPanel();\r
- OnFocusedCommand.Execute(item.StateDescriptions["default"].Label);\r
- });\r
- button.OnClickedCommand = new Command(() =>\r
- {\r
- item.DoAction();\r
- });\r
- PanelButtonGrid.Children.Add(button.View, index++, 0);\r
- }\r
- }\r
-\r
- public void InitialFocusing()\r
- {\r
- var button = PanelButtonGrid.Children[1];\r
- button.FindByName<Button>("ButtonFocusArea").Focus();\r
- }\r
-\r
- public override async void FocusPanel()\r
- {\r
- await PanelButtonGrid.TranslateTo(0, 0);\r
- }\r
-\r
- public override async void HidePanel()\r
- {\r
- await PanelButtonGrid.ScaleTo(0, 0);\r
- }\r
-\r
- public async void SelectPanel()\r
- {\r
- await PanelButtonGrid.TranslateTo(0, -78);\r
- }\r
-\r
- public override async void ShowPanel()\r
- {\r
- await PanelButtonGrid.ScaleTo(1, 0);\r
- }\r
- }\r
+/*
+ * 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.ComponentModel;
+using System.Windows.Input;
+using TVHome.Controls;
+using LibTVRefCommonPortable.DataModels;
+using LibTVRefCommonPortable.Utils;
+using TVHome.ViewModels;
+using Xamarin.Forms;
+
+namespace TVHome.Views
+{
+ /// <summary>
+ /// Main Panel in Main Page
+ /// </summary>
+ public partial class MainPanel : Panel
+ {
+ public MainPanel()
+ {
+ InitializeComponent();
+ PropertyChanged += OnItemsSourcePropertyChanged;
+ }
+
+ private void OnItemsSourcePropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName != "ItemsSource")
+ {
+ return;
+ }
+
+ var index = 0;
+ PanelButtonGrid.Children.Clear();
+ foreach (ShortcutInfo item in ItemsSource)
+ {
+ var button = new MainPanelButton();
+ button.View.BindingContext = item;
+ button.OnFocusedCommand = new Command(() =>
+ {
+ FocusPanel();
+ OnFocusedCommand.Execute(item.StateDescriptions["default"].Label);
+ });
+ button.OnClickedCommand = new Command(() =>
+ {
+ item.DoAction();
+ });
+ PanelButtonGrid.Children.Add(button.View, index++, 0);
+ }
+ }
+
+ public void InitialFocusing()
+ {
+ var button = PanelButtonGrid.Children[1];
+ button.FindByName<Button>("ButtonFocusArea").Focus();
+ }
+
+ public override async void FocusPanel()
+ {
+ await PanelButtonGrid.TranslateTo(0, 0);
+ }
+
+ public override async void HidePanel()
+ {
+ await PanelButtonGrid.ScaleTo(0, 0);
+ }
+
+ public async void SelectPanel()
+ {
+ await PanelButtonGrid.TranslateTo(0, -78);
+ }
+
+ public override async void ShowPanel()
+ {
+ await PanelButtonGrid.ScaleTo(1, 0);
+ }
+ }
}
\ No newline at end of file
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");
-<?xml version="1.0" encoding="UTF-8"?>\r
-<Views:Panel xmlns="http://xamarin.com/schemas/2014/forms"\r
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"\r
- xmlns:Views="clr-namespace:TVHome.Views"\r
- x:Class="TVHome.Views.SubPanel">\r
- <ScrollView x:Name="PanelScrollView"\r
- Orientation="Horizontal"\r
- HorizontalOptions="Center">\r
- <StackLayout x:Name="PanelButtonStack"\r
- Orientation="Horizontal"\r
- Padding="96,22,96,26"\r
- Spacing="78">\r
- </StackLayout>\r
- </ScrollView>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<Views:Panel xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:Views="clr-namespace:TVHome.Views"
+ x:Class="TVHome.Views.SubPanel">
+ <ScrollView x:Name="PanelScrollView"
+ Orientation="Horizontal"
+ HorizontalOptions="Center">
+ <StackLayout x:Name="PanelButtonStack"
+ Orientation="Horizontal"
+ Padding="96,22,96,26"
+ Spacing="78">
+ </StackLayout>
+ </ScrollView>
</Views:Panel>
\ No newline at end of file
-/*\r
- * Copyright (c) 2017 Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.1 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://floralicense.org/license/\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-using System;\r
-using System.Collections.Generic;\r
-using System.Windows.Input;\r
-using System.ComponentModel;\r
-using TVHome.Controls;\r
-using LibTVRefCommonPortable.DataModels;\r
-using TVHome.ViewModels;\r
-using Xamarin.Forms;\r
-using LibTVRefCommonPortable.Utils;\r
-\r
-namespace TVHome.Views\r
-{\r
- /// <summary>\r
- /// Sub Panel in Main Page\r
- /// </summary>\r
- public partial class SubPanel : Panel\r
- {\r
- public SubPanel()\r
- {\r
- InitializeComponent();\r
- isFocused = false;\r
- PropertyChanged += OnItemsSourcePropertyChanged;\r
- }\r
-\r
- private void OnItemsSourcePropertyChanged(object sender, PropertyChangedEventArgs e)\r
- {\r
- if (e.PropertyName != "ItemsSource")\r
- {\r
- return;\r
- }\r
-\r
- PanelButtonStack.Children.Clear();\r
- foreach (ShortcutInfo item in ItemsSource)\r
- {\r
- PanelButton button;\r
-\r
- if (item.StateDescriptions["default"].Label.Equals("All apps")\r
- || item.StateDescriptions["default"].Label.Equals("Add pin"))\r
- {\r
- button = new SubPanelAllAppsButton();\r
- }\r
- else if (item.StateDescriptions["default"].Label.Equals("Media Hub"))\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
- FocusPanel();\r
- });\r
- button.OnClickedCommand = new Command(() =>\r
- {\r
- if (item is AppShortcutInfo)\r
- {\r
- OnUnpinCommand.Execute((item as AppShortcutInfo).AppID);\r
- }\r
- else\r
- {\r
- item.DoAction();\r
- }\r
- });\r
- PanelButtonStack.Children.Add(button.View);\r
- }\r
-\r
- if (!isFocused)\r
- {\r
- HidePanel();\r
- }\r
- else\r
- {\r
- isFocused = false;\r
- FocusPanel();\r
- }\r
-\r
- }\r
-\r
- public override async void HidePanel()\r
- {\r
- isFocused = false;\r
- foreach (var item in PanelButtonStack.Children)\r
- {\r
- item.IsEnabled = false;\r
- }\r
-\r
-#pragma warning disable CS4014\r
- PanelScrollView.ScrollToAsync(0, 0, true);\r
- this.TranslateTo(0, 1, 0);\r
-#pragma warning restore CS4014\r
- await this.FadeTo(0, 0);\r
- }\r
-\r
- public override async void ShowPanel()\r
- {\r
- isFocused = false;\r
- foreach (var item in PanelButtonStack.Children)\r
- {\r
- item.IsEnabled = true;\r
- item.FindByName<Image>("ButtonDimmedImage").Opacity = 0.99;\r
- }\r
-\r
-#pragma warning disable CS4014\r
- this.TranslateTo(0, 0, 300);\r
-#pragma warning restore CS4014\r
- await this.FadeTo(0.3, 300);\r
- }\r
-\r
- public override async void FocusPanel()\r
- {\r
- if (isFocused)\r
- {\r
- return;\r
- }\r
-\r
- OnFocusedCommand.Execute("");\r
-\r
- isFocused = true;\r
- 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, -146, 300);\r
-#pragma warning restore CS4014\r
- await this.FadeTo(0.99, 300);\r
- }\r
- }\r
+/*
+ * 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.Windows.Input;
+using System.ComponentModel;
+using TVHome.Controls;
+using LibTVRefCommonPortable.DataModels;
+using TVHome.ViewModels;
+using Xamarin.Forms;
+using LibTVRefCommonPortable.Utils;
+
+namespace TVHome.Views
+{
+ /// <summary>
+ /// Sub Panel in Main Page
+ /// </summary>
+ public partial class SubPanel : Panel
+ {
+ public SubPanel()
+ {
+ InitializeComponent();
+ isFocused = false;
+ PropertyChanged += OnItemsSourcePropertyChanged;
+ }
+
+ private void OnItemsSourcePropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName != "ItemsSource")
+ {
+ return;
+ }
+
+ PanelButtonStack.Children.Clear();
+ foreach (ShortcutInfo item in ItemsSource)
+ {
+ PanelButton button;
+
+ if (item.StateDescriptions["default"].Label.Equals("All apps")
+ || item.StateDescriptions["default"].Label.Equals("Add pin"))
+ {
+ button = new SubPanelAllAppsButton();
+ }
+ else if (item.StateDescriptions["default"].Label.Equals("Media Hub"))
+ {
+ button = new SubPanelReservedButton();
+ }
+ else
+ {
+ button = new SubPanelButton();
+ }
+
+ button.View.BindingContext = item;
+ button.OnFocusedCommand = new Command(() =>
+ {
+ FocusPanel();
+ });
+ button.OnClickedCommand = new Command(() =>
+ {
+ if (item is AppShortcutInfo)
+ {
+ OnUnpinCommand.Execute((item as AppShortcutInfo).AppID);
+ }
+ else
+ {
+ item.DoAction();
+ }
+ });
+ PanelButtonStack.Children.Add(button.View);
+ }
+
+ if (!isFocused)
+ {
+ HidePanel();
+ }
+ else
+ {
+ isFocused = false;
+ FocusPanel();
+ }
+
+ }
+
+ public override async void HidePanel()
+ {
+ isFocused = false;
+ foreach (var item in PanelButtonStack.Children)
+ {
+ item.IsEnabled = false;
+ }
+
+#pragma warning disable CS4014
+ PanelScrollView.ScrollToAsync(0, 0, true);
+ this.TranslateTo(0, 1, 0);
+#pragma warning restore CS4014
+ await this.FadeTo(0, 0);
+ }
+
+ public override async void ShowPanel()
+ {
+ isFocused = false;
+ foreach (var item in PanelButtonStack.Children)
+ {
+ item.IsEnabled = true;
+ item.FindByName<Image>("ButtonDimmedImage").Opacity = 0.99;
+ }
+
+#pragma warning disable CS4014
+ this.TranslateTo(0, 0, 300);
+#pragma warning restore CS4014
+ await this.FadeTo(0.3, 300);
+ }
+
+ public override async void FocusPanel()
+ {
+ if (isFocused)
+ {
+ return;
+ }
+
+ OnFocusedCommand.Execute("");
+
+ isFocused = true;
+ var button = PanelButtonStack.Children[1];
+ button.FindByName<Button>("ButtonFocusArea").Focus();
+
+ foreach (var item in PanelButtonStack.Children)
+ {
+ item.FindByName<Image>("ButtonDimmedImage").Opacity = 0;
+ }
+
+#pragma warning disable CS4014
+ this.TranslateTo(0, -146, 300);
+#pragma warning restore CS4014
+ await this.FadeTo(0.99, 300);
+ }
+ }
}
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<Views:Panel xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:Views="clr-namespace:TVHome.Views"
-/*
+/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the "License");