{
public class AppShortcutController
{
+ private List<AppShortcutInfo> returnPinnedAppsInfo = new List<AppShortcutInfo>();
public AppShortcutController()
{
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);
appShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);
appShortcutInfo.CurrentStateDescription = defaultStateDescription;
+ returnPinnedAppsInfo.Add(appShortcutInfo);
}
else
{
}
}
- return pinned_apps_info;
+ AppendAddPinShortcut();
+
+ return returnPinnedAppsInfo;
}
public void UpdatePinnedApps(IEnumerable<AppShortcutInfo> pinnedAppsInfo)
{
StateDescriptions =
{
+ {
+ "default",
+ new StateDescription
+ {
+ Label = "WiFi ON",
+ IconPath = "AppIcon.png",
+ Action = new WiFiOffAction(),
+ }
+ },
{
"on",
new StateDescription
{
StateDescriptions =
{
+ {
+ "default",
+ new StateDescription
+ {
+ Label = "BT ON",
+ IconPath = "AppIcon.png",
+ Action = new BTOffAction(),
+ }
+ },
{
"on",
new StateDescription
</ItemGroup>\r
<ItemGroup>\r
<Folder Include="lib\" />\r
+ <Folder Include="res\" />\r
</ItemGroup>\r
<ItemGroup>\r
<ProjectReference Include="..\..\LibTVRefCommonPortable\LibTVRefCommonPortable.csproj">\r
<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
--- /dev/null
+<?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
--- /dev/null
+/*
+ * 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
<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
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"
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
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
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