Fix ninepatch for RecentApps
authorGeunsun, Lee <gs86.lee@samsung.com>
Mon, 17 Apr 2017 01:05:34 +0000 (10:05 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:53 +0000 (18:34 +0900)
Change-Id: I8bf40e472810fcb38d93720cd8421c62ff5635ed

TVHome/TVHome/Controls/NinePatchImage.xaml [new file with mode: 0644]
TVHome/TVHome/Controls/NinePatchImage.xaml.cs [new file with mode: 0644]
TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml
TVHome/TVHome/TVHome.csproj

diff --git a/TVHome/TVHome/Controls/NinePatchImage.xaml b/TVHome/TVHome/Controls/NinePatchImage.xaml
new file mode 100644 (file)
index 0000000..3aa8785
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<Image xmlns="http://xamarin.com/schemas/2014/forms"
+             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+             x:Class="TVHome.Controls.NinePatchImage">
+</Image>
\ No newline at end of file
diff --git a/TVHome/TVHome/Controls/NinePatchImage.xaml.cs b/TVHome/TVHome/Controls/NinePatchImage.xaml.cs
new file mode 100644 (file)
index 0000000..aea53f5
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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 Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace TVHome.Controls
+{
+
+    /// <summary>
+    /// A custom control for displaying nine patch image
+    /// </summary>
+    [XamlCompilation(XamlCompilationOptions.Compile)]
+    public partial class NinePatchImage : Image
+    {
+        /// <summary>
+        /// Identifies the BorderLeft bindable property
+        /// </summary>
+        public static readonly BindableProperty BorderLeftProperty = BindableProperty.Create("BorderLeft", typeof(int), typeof(NinePatchImage), default(int));
+
+        /// <summary>
+        /// Gets or sets left border of NinePatchImage
+        /// </summary>
+        public int BorderLeft
+        {
+            get { return (int)GetValue(BorderLeftProperty); }
+            set { SetValue(BorderLeftProperty, value); }
+        }
+
+        /// <summary>
+        /// Identifies the BorderRight bindable property
+        /// </summary>
+        public static readonly BindableProperty BorderRightProperty = BindableProperty.Create("BorderRight", typeof(int), typeof(NinePatchImage), default(int));
+
+        /// <summary>
+        /// Gets or sets right border of NinePatchImage
+        /// </summary>
+        public int BorderRight
+        {
+            get { return (int)GetValue(BorderRightProperty); }
+            set { SetValue(BorderRightProperty, value); }
+        }
+
+        /// <summary>
+        /// Identifies the BorderTop bindable property
+        /// </summary>
+        public static readonly BindableProperty BorderTopProperty = BindableProperty.Create("BorderTop", typeof(int), typeof(NinePatchImage), default(int));
+
+        /// <summary>
+        /// Gets or sets top border of NinePatchImage
+        /// </summary>
+        public int BorderTop
+        {
+            get { return (int)GetValue(BorderTopProperty); }
+            set { SetValue(BorderTopProperty, value); }
+        }
+
+        /// <summary>
+        /// Identifies the BorderBottom bindable property
+        /// </summary>
+        public static readonly BindableProperty BorderBottomProperty = BindableProperty.Create("BorderBottom", typeof(int), typeof(NinePatchImage), default(int));
+
+        /// <summary>
+        /// Gets or sets bottom border of NinePatchImage
+        /// </summary>
+        public int BorderBottom
+        {
+            get { return (int)GetValue(BorderBottomProperty); }
+            set { SetValue(BorderBottomProperty, value); }
+        }
+
+        /// <summary>
+        /// A constructor
+        /// </summary>
+        public NinePatchImage()
+        {
+            InitializeComponent();
+        }
+    }
+}
index a1c36c2..3b22242 100755 (executable)
             RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
             RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
             Source="{Binding ScreenshotPath}" />
-    <Image x:Name="ThumbnailGradient"
+    <Controls:NinePatchImage 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}"
+            Aspect="Fill"
+            BorderTop="89"
+            BorderBottom="89"
+            BorderLeft="4"
+            BorderRight="4"
             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}"
index ec20bf2..24b7380 100755 (executable)
@@ -37,6 +37,9 @@
     <Compile Include="Controls\MainPanelButton.xaml.cs">
       <DependentUpon>MainPanelButton.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Controls\NinePatchImage.xaml.cs">
+      <DependentUpon>NinePatchImage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Controls\PanelButton.cs" />
     <Compile Include="Controls\SubPanelAllAppsButton.xaml.cs">
       <DependentUpon>SubPanelAllAppsButton.xaml</DependentUpon>
   <ItemGroup>
     <None Include="packages.config" />
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Controls\NinePatchImage.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
   <Import Project="..\..\packages\Xamarin.Forms.2.3.4.214-pre5\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.4.214-pre5\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">