TizenRefApp-8628 Implement project skeleton for Call app 35/137935/13
authorRuslan Zakharov <r.zakharov@samsung.com>
Mon, 10 Jul 2017 08:40:38 +0000 (11:40 +0300)
committerRuslan Zakharov <r.zakharov@samsung.com>
Thu, 27 Jul 2017 09:08:36 +0000 (12:08 +0300)
Added Flat button and checkbox controls

Change-Id: Ic6f15f17993ed52436fab348534b5262e0f54765

CallApp.Tizen/Call/Controls/FlatButton.xaml [new file with mode: 0644]
CallApp.Tizen/Call/Controls/FlatButton.xaml.cs [new file with mode: 0644]
CallApp.Tizen/Call/Controls/FlatCheckbox.xaml [new file with mode: 0644]
CallApp.Tizen/Call/Controls/FlatCheckbox.xaml.cs [new file with mode: 0644]
CallApp.Tizen/Call/Themes/CallTheme.xaml [new file with mode: 0644]
CallApp.Tizen/Call/Themes/CallTheme.xaml.cs [new file with mode: 0644]
CallApp.Tizen/Call/Themes/FlatControlTheme.xaml [new file with mode: 0644]
CallApp.Tizen/Call/Themes/FlatControlTheme.xaml.cs [new file with mode: 0644]
CallApp.Tizen/CallApp.Tizen.csproj

diff --git a/CallApp.Tizen/Call/Controls/FlatButton.xaml b/CallApp.Tizen/Call/Controls/FlatButton.xaml
new file mode 100644 (file)
index 0000000..f31ebfc
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
+             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+             x:Class="CallApp.Tizen.Call.Controls.FlatButton"
+             x:Name="This"
+             xmlns:callThemes="clr-namespace:CallApp.Tizen.Call.Themes"
+             xmlns:commonControls="clr-namespace:CallApp.Tizen.Common.Controls"
+             xmlns:commonInput="clr-namespace:CallApp.Tizen.Common.Input"
+             ControlTemplate="{StaticResource FlatButtonControlTemplate}"
+             ImageColor="{StaticResource FlatControlImageNormalColor}"
+             TextColor="{StaticResource FlatControlTextNormalColor}">
+
+    <ContentView.Resources>
+        <ResourceDictionary MergedWith="callThemes:FlatControlTheme">
+            <ControlTemplate x:Key="FlatButtonControlTemplate">
+                <Frame Padding="{TemplateBinding BorderThickness}" OutlineColor="{StaticResource FlatControlBorderColor}">
+                    <commonControls:CustomGrid>
+                        <commonControls:CustomGrid BackgroundColor="{StaticResource FlatControlBGNormalColor}">
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="*" />
+                                <ColumnDefinition Width="158" />
+                                <ColumnDefinition Width="*" />
+                            </Grid.ColumnDefinitions>
+
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="37" />
+                                <RowDefinition Height="62" />
+                                <RowDefinition Height="4" />
+                                <RowDefinition Height="37" />
+                                <RowDefinition Height="48" />
+                            </Grid.RowDefinitions>
+
+                            <commonControls:CustomImage Grid.Column="1" Grid.Row="1" HorizontalOptions="Center" VerticalOptions="Center"
+                                                        Source="{TemplateBinding Image}" BlendingColor="{TemplateBinding ImageColor}" />
+
+                            <Label Grid.Column="1" Grid.Row="3" HorizontalOptions="Center" VerticalOptions="Center" FontSize="19"
+                                   Text="{TemplateBinding Text}" TextColor="{TemplateBinding TextColor}" />
+
+                            <ContentPresenter Grid.Column="1" Grid.Row="4" />
+                        </commonControls:CustomGrid>
+
+                        <commonControls:CustomGrid>
+                            <commonControls:CustomGrid.Triggers>
+                                <Trigger TargetType="commonControls:CustomGrid" Property="commonInput:GesturesInput.IsTap" Value="True">
+                                    <Setter Property="BackgroundColor" Value="{StaticResource FlatControlBGPressColor}" />
+                                </Trigger>
+                            </commonControls:CustomGrid.Triggers>
+                        </commonControls:CustomGrid>
+                    </commonControls:CustomGrid>
+                </Frame>
+            </ControlTemplate>
+        </ResourceDictionary>
+    </ContentView.Resources>
+</ContentView>
\ No newline at end of file
diff --git a/CallApp.Tizen/Call/Controls/FlatButton.xaml.cs b/CallApp.Tizen/Call/Controls/FlatButton.xaml.cs
new file mode 100644 (file)
index 0000000..041ccae
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright 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;
+
+namespace CallApp.Tizen.Call.Controls
+{
+    public partial class FlatButton : ContentView
+    {
+        public FlatButton()
+        {
+            InitializeComponent();
+        }
+
+        /// <summary>
+        /// Thickness of content border
+        /// </summary>
+        public static readonly BindableProperty BorderThicknessProperty = BindableProperty.Create(
+            "BorderThickness",
+            typeof(Thickness),
+            typeof(FlatButton),
+            new Thickness(0));
+
+        public Thickness BorderThickness
+        {
+            get
+            {
+                return (Thickness)GetValue(BorderThicknessProperty);
+            }
+            set
+            {
+                SetValue(BorderThicknessProperty, value);
+            }
+        }
+
+        /// <summary>
+        /// Image of content
+        /// </summary>
+        public static readonly BindableProperty ImageProperty = BindableProperty.Create(
+            "Image",
+            typeof(ImageSource),
+            typeof(FlatButton),
+            null);
+
+        public ImageSource Image
+        {
+            get
+            {
+                return (ImageSource)GetValue(ImageProperty);
+            }
+            set
+            {
+                SetValue(ImageProperty, value);
+            }
+        }
+
+        /// <summary>
+        /// Color of Image
+        /// </summary>
+        public static readonly BindableProperty ImageColorProperty = BindableProperty.Create(
+            "ImageColor",
+            typeof(Color),
+            typeof(FlatButton),
+            Color.White);
+
+        public Color ImageColor
+        {
+            get
+            {
+                return (Color)GetValue(ImageColorProperty);
+            }
+            set
+            {
+                SetValue(ImageColorProperty, value);
+            }
+        }
+
+        /// <summary>
+        /// Text of content
+        /// </summary>
+        public static readonly BindableProperty TextProperty = BindableProperty.Create(
+            "Text",
+            typeof(string),
+            typeof(FlatButton),
+            string.Empty);
+
+        public string Text
+        {
+            get
+            {
+                return (string)GetValue(TextProperty);
+            }
+            set
+            {
+                SetValue(TextProperty, value);
+            }
+        }
+
+        /// <summary>
+        /// Color of Text
+        /// </summary>
+        public static readonly BindableProperty TextColorProperty = BindableProperty.Create(
+            "TextColor",
+            typeof(Color),
+            typeof(FlatButton),
+            Color.White);
+
+        public Color TextColor
+        {
+            get
+            {
+                return (Color)GetValue(TextColorProperty);
+            }
+            set
+            {
+                SetValue(TextColorProperty, value);
+            }
+        }
+    }
+}
diff --git a/CallApp.Tizen/Call/Controls/FlatCheckbox.xaml b/CallApp.Tizen/Call/Controls/FlatCheckbox.xaml
new file mode 100644 (file)
index 0000000..649a789
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<callControls:FlatButton xmlns="http://xamarin.com/schemas/2014/forms"
+                         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+                         x:Class="CallApp.Tizen.Call.Controls.FlatCheckbox"
+                         x:Name="This"
+                         xmlns:callControls="clr-namespace:CallApp.Tizen.Call.Controls"
+                         xmlns:callThemes="clr-namespace:CallApp.Tizen.Call.Themes"
+                         xmlns:commonControls="clr-namespace:CallApp.Tizen.Common.Controls"
+                         xmlns:extension="clr-namespace:Tizen.Xamarin.Forms.Extension;assembly=Tizen.Xamarin.Forms.Extension">
+
+    <callControls:FlatButton.Resources>
+        <ResourceDictionary MergedWith="callThemes:FlatControlTheme" />
+    </callControls:FlatButton.Resources>
+
+    <callControls:FlatButton.GestureRecognizers>
+        <extension:LongTapGestureRecognizer TapStarted="OnTapStart" />
+    </callControls:FlatButton.GestureRecognizers>
+
+    <commonControls:CustomGrid.Triggers>
+        <DataTrigger TargetType="callControls:FlatButton" Binding="{Binding IsChecked, Source={x:Reference This}}" Value="True">
+            <Setter Property="ImageColor" Value="{StaticResource FlatControlImageOnColor}" />
+            <Setter Property="TextColor" Value="{StaticResource FlatControlTextOnColor}" />
+        </DataTrigger>
+    </commonControls:CustomGrid.Triggers>
+
+    <commonControls:CustomGrid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="10" />
+            <RowDefinition Height="6" />
+            <RowDefinition Height="32" />
+        </Grid.RowDefinitions>
+
+        <commonControls:CustomGrid Grid.Row="1" BackgroundColor="{StaticResource FlatControlCheckOffColor}">
+            <commonControls:CustomGrid.Triggers>
+                <DataTrigger TargetType="commonControls:CustomGrid" Binding="{Binding IsChecked, Source={x:Reference This}}" Value="True">
+                    <Setter Property="BackgroundColor" Value="{StaticResource FlatControlCheckOnColor}" />
+                </DataTrigger>
+            </commonControls:CustomGrid.Triggers>
+        </commonControls:CustomGrid>
+    </commonControls:CustomGrid>
+</callControls:FlatButton>
\ No newline at end of file
diff --git a/CallApp.Tizen/Call/Controls/FlatCheckbox.xaml.cs b/CallApp.Tizen/Call/Controls/FlatCheckbox.xaml.cs
new file mode 100644 (file)
index 0000000..2b80afa
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 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 Xamarin.Forms;
+
+namespace CallApp.Tizen.Call.Controls
+{
+    public partial class FlatCheckbox : FlatButton
+    {
+        public FlatCheckbox()
+        {
+            InitializeComponent();
+        }
+
+        /// <summary>
+        /// Is checked or not
+        /// </summary>
+        public static readonly BindableProperty IsCheckedProperty = BindableProperty.Create(
+            "IsChecked",
+            typeof(bool),
+            typeof(FlatCheckbox),
+            false);
+
+        public bool IsChecked
+        {
+            get
+            {
+                return (bool)GetValue(IsCheckedProperty);
+            }
+            set
+            {
+                SetValue(IsCheckedProperty, value);
+            }
+        }
+
+        private void OnTapStart(object sender, EventArgs e)
+        {
+            IsChecked = !IsChecked;
+        }
+    }
+}
diff --git a/CallApp.Tizen/Call/Themes/CallTheme.xaml b/CallApp.Tizen/Call/Themes/CallTheme.xaml
new file mode 100644 (file)
index 0000000..5d804d8
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+                    x:Class="CallApp.Tizen.Call.Themes.CallTheme">
+
+    <Color x:Key="CallBGColor">#FFF7F7F7</Color>
+
+    <Color x:Key="CallButtonCircleRejectBGColor">#4DE02222</Color>
+    <Color x:Key="CallButtonCircleRejectNormalColor">#FFD63131</Color>
+    <Color x:Key="CallButtonCircleRejectPressColor">#FFA32626</Color>
+</ResourceDictionary>
\ No newline at end of file
diff --git a/CallApp.Tizen/Call/Themes/CallTheme.xaml.cs b/CallApp.Tizen/Call/Themes/CallTheme.xaml.cs
new file mode 100644 (file)
index 0000000..66c8172
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 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;
+
+namespace CallApp.Tizen.Call.Themes
+{
+    public partial class CallTheme : ResourceDictionary
+    {
+        public CallTheme()
+        {
+            InitializeComponent();
+        }
+    }
+}
diff --git a/CallApp.Tizen/Call/Themes/FlatControlTheme.xaml b/CallApp.Tizen/Call/Themes/FlatControlTheme.xaml
new file mode 100644 (file)
index 0000000..3854ff1
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+                    x:Class="CallApp.Tizen.Call.Themes.FlatControlTheme">
+
+    <Color x:Key="FlatControlBGNormalColor">#FFFAFAFA</Color>
+    <Color x:Key="FlatControlBGPressColor">#4C000000</Color>
+    <Color x:Key="FlatControlBorderColor">#FFD9D9D9</Color>
+    <Color x:Key="FlatControlCheckOffColor">#4C666666</Color>
+    <Color x:Key="FlatControlCheckOnColor">#FF2EB4C8</Color>
+    <Color x:Key="FlatControlImageDimColor">#4C808080</Color>
+    <Color x:Key="FlatControlImageNormalColor">#FF808080</Color>
+    <Color x:Key="FlatControlImageOnColor">#FF2EB4C8</Color>
+    <Color x:Key="FlatControlTextDimColor">#4C808080</Color>
+    <Color x:Key="FlatControlTextNormalColor">#FF808080</Color>
+    <Color x:Key="FlatControlTextOnColor">#FF2EB4C8</Color>
+</ResourceDictionary>
\ No newline at end of file
diff --git a/CallApp.Tizen/Call/Themes/FlatControlTheme.xaml.cs b/CallApp.Tizen/Call/Themes/FlatControlTheme.xaml.cs
new file mode 100644 (file)
index 0000000..648f34b
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 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;
+
+namespace CallApp.Tizen.Call.Themes
+{
+    public partial class FlatControlTheme : ResourceDictionary
+    {
+        public FlatControlTheme()
+        {
+            InitializeComponent();
+        }
+    }
+}
index 2ef256c..f007397 100644 (file)
     <Compile Include="Call\Controls\AnimatedCircleButton.xaml.cs">
       <DependentUpon>AnimatedCircleButton.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Call\Controls\FlatButton.xaml.cs">
+      <DependentUpon>FlatButton.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Call\Controls\FlatCheckbox.xaml.cs">
+      <DependentUpon>FlatCheckbox.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Call\Controls\Renderers\AnimatedCircleButtonRenderer.cs" />
+    <Compile Include="Call\Themes\CallTheme.xaml.cs">
+      <DependentUpon>CallTheme.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Call\Themes\FlatControlTheme.xaml.cs">
+      <DependentUpon>FlatControlTheme.xaml</DependentUpon>
     </Compile>
     <Compile Include="Common\Controls\CustomGrid.xaml.cs">
       <DependentUpon>CustomGrid.xaml</DependentUpon>
       <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
     </EmbeddedResource>
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Call\Controls\FlatButton.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Call\Controls\FlatCheckbox.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Call\Themes\CallTheme.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Call\Themes\FlatControlTheme.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+    </EmbeddedResource>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
                Other similar extension points exist, see Microsoft.Common.targets.