TizenRefApp-8738 Implement EndCall view 47/151047/11
authorRuslan Zakharov <r.zakharov@samsung.com>
Tue, 19 Sep 2017 12:14:18 +0000 (15:14 +0300)
committerRuslan Zakharov <r.zakharov@samsung.com>
Wed, 22 Nov 2017 10:41:03 +0000 (12:41 +0200)
Added EndCall view, moved flat control colors into separate xaml

Change-Id: I9cb817960c5d59258e8950b5b297a0dbe16b83fe

12 files changed:
CallApp.Tizen/Call/Helper/TestModelCreator.cs
CallApp.Tizen/Call/Theme/FlatControlTheme.xaml [new file with mode: 0644]
CallApp.Tizen/Call/Theme/FlatControlTheme.xaml.cs [new file with mode: 0644]
CallApp.Tizen/Call/View/Controls/CallHandlingPanel.xaml
CallApp.Tizen/Call/View/Controls/ContactInfoPanel.xaml
CallApp.Tizen/Call/View/EndCallView.xaml
CallApp.Tizen/Call/ViewModel/EndCallViewModel.cs
CallApp.Tizen/CallApp.Tizen.cs
CallApp.Tizen/CallApp.Tizen.csproj
CallApp.Tizen/res/Call ID/168x168/call_end_photo_id_default.png [new file with mode: 0644]
CallApp.Tizen/res/call_end_ic_call.png [new file with mode: 0644]
CallApp.Tizen/res/call_end_message.png [new file with mode: 0644]

index 6462e61..86cadd5 100644 (file)
@@ -49,7 +49,7 @@ namespace CallApp.Tizen.Call.Helper
         /// Create test ConferenceCallViewModel
         /// </summary>
         /// <returns>ConferenceCallViewModel</returns>
-        public static CallViewModel CreateConferenceCallViewModel()
+        public static ConferenceCallViewModel CreateConferenceCallViewModel()
         {
             CallModel callModelAS = new CallModel(0);
             callModelAS.ContactModel.Name = "John Doe";
@@ -70,5 +70,25 @@ namespace CallApp.Tizen.Call.Helper
 
             return new ConferenceCallViewModel(callManager);
         }
+
+        /// <summary>
+        /// Create test EndCallViewModel
+        /// </summary>
+        /// <returns>EndCallViewModel</returns>
+        public static EndCallViewModel CreateEndCallViewModel()
+        {
+            EndCallViewModel vm = new EndCallViewModel(new CallManager())
+            {
+                EndCall = new CallModel(0)
+                {
+                    Status = CallStatus.End
+                }
+            };
+
+            vm.EndCall.ContactModel.Name = "Ruslan Zakharov";
+            vm.EndCall.CallerNumber = "+380676470707";
+
+            return vm;
+        }
     }
 }
diff --git a/CallApp.Tizen/Call/Theme/FlatControlTheme.xaml b/CallApp.Tizen/Call/Theme/FlatControlTheme.xaml
new file mode 100644 (file)
index 0000000..7431707
--- /dev/null
@@ -0,0 +1,13 @@
+<?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.Theme.FlatControlTheme">
+
+    <Color x:Key="FlatControlBorderColor">#FFD9D9D9</Color>
+    <Color x:Key="FlatControlCheckOffColor">#4C666666</Color>
+    <Color x:Key="FlatControlCheckOnColor">#FF2EB4C8</Color>
+    <Color x:Key="FlatControlDimColor">#4D4D4D4D</Color>
+    <Color x:Key="FlatControlImageNormalColor">#FF808080</Color>
+    <Color x:Key="FlatControlNormalColor">#FFFAFAFA</Color>
+    <Color x:Key="FlatControlTextNormalColor">#FF808080</Color>
+</ResourceDictionary>
\ No newline at end of file
diff --git a/CallApp.Tizen/Call/Theme/FlatControlTheme.xaml.cs b/CallApp.Tizen/Call/Theme/FlatControlTheme.xaml.cs
new file mode 100644 (file)
index 0000000..fc3263b
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * 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.Theme
+{
+    /// <summary>
+    /// Theme for FlatButton and FlatCheckbox controls
+    /// </summary>
+    public partial class FlatControlTheme : ResourceDictionary
+    {
+        public FlatControlTheme()
+        {
+            InitializeComponent();
+        }
+    }
+}
index 2a534d1..803c451 100644 (file)
@@ -4,19 +4,12 @@
              x:Class="CallApp.Tizen.Call.View.Controls.CallHandlingPanel"
              x:Name="This"
              xmlns:CallControls="clr-namespace:CallApp.Tizen.Call.View.Controls"
+             xmlns:CallTheme="clr-namespace:CallApp.Tizen.Call.Theme"
              xmlns:Localization="clr-namespace:CallApp.Tizen.Localization"
              xmlns:TizenUtilityControls="clr-namespace:Tizen.Utility.Controls">
 
     <ContentView.Resources>
-        <ResourceDictionary>
-            <Color x:Key="FlatControlBorderColor">#FFD9D9D9</Color>
-            <Color x:Key="FlatControlCheckOffColor">#4C666666</Color>
-            <Color x:Key="FlatControlCheckOnColor">#FF2EB4C8</Color>
-            <Color x:Key="FlatControlDimColor">#4D4D4D4D</Color>
-            <Color x:Key="FlatControlImageNormalColor">#FF808080</Color>
-            <Color x:Key="FlatControlNormalColor">#FFFAFAFA</Color>
-            <Color x:Key="FlatControlTextNormalColor">#FF808080</Color>
-
+        <ResourceDictionary MergedWith="CallTheme:FlatControlTheme">
             <Style TargetType="CallControls:FlatButton">
                 <Setter Property="ImageMargin" Value="0,37,0,0" />
                 <Setter Property="HeightRequest" Value="188" />
index a8ea068..daafa04 100644 (file)
                            TextColor="{StaticResource DefaultTextColor}" FontSize="27" Text="{TemplateBinding StatusText}" />
 
                     <Image Grid.Column="0" Grid.Row="2" Margin="32,0,32,0" WidthRequest="168" HeightRequest="168"
-                           HorizontalOptions="Center" VerticalOptions="Center" Source="{TemplateBinding Image}" />
+                           HorizontalOptions="Center" VerticalOptions="Center">
+                        <Image.Triggers>
+                            <DataTrigger TargetType="Image" Binding="{TemplateBinding Image, Converter={StaticResource IsNull}}" Value="True">
+                                <Setter Property="Source" Value="Call ID/168x168/call_end_photo_id_default.png" />
+                            </DataTrigger>
+
+                            <DataTrigger TargetType="Image" Binding="{TemplateBinding Image, Converter={StaticResource IsNull}}" Value="False">
+                                <Setter Property="Source" Value="{TemplateBinding Image}" />
+                            </DataTrigger>
+                        </Image.Triggers>
+                    </Image>
 
                     <TizenUtilityControls:CustomGrid Grid.Column="1" Grid.Row="2">
                         <Grid.RowDefinitions>
index 5c32df5..9e0424e 100644 (file)
@@ -1,6 +1,41 @@
 <?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.View.EndCallView">
+             x:Class="CallApp.Tizen.Call.View.EndCallView"
+             xmlns:CallControls="clr-namespace:CallApp.Tizen.Call.View.Controls"
+             xmlns:CallTheme="clr-namespace:CallApp.Tizen.Call.Theme"
+             xmlns:Localization="clr-namespace:CallApp.Tizen.Localization">
 
+    <ContentView.Resources>
+        <ResourceDictionary MergedWith="CallTheme:FlatControlTheme">
+            <Style TargetType="CallControls:FlatButton">
+                <Setter Property="ImageMargin" Value="0,36,0,0" />
+                <Setter Property="ImageColor" Value="{StaticResource FlatControlImageNormalColor}" />
+                <Setter Property="TextColor" Value="{StaticResource FlatControlTextNormalColor}" />
+                <Setter Property="DimColor" Value="{StaticResource FlatControlDimColor}" />
+                <Setter Property="NormalColor" Value="{StaticResource FlatControlNormalColor}" />
+            </Style>
+
+            <Style TargetType="Frame">
+                <Setter Property="HorizontalOptions" Value="FillAndExpand" />
+                <Setter Property="OutlineColor" Value="{StaticResource FlatControlBorderColor}" />
+                <Setter Property="HasShadow" Value="False" />
+            </Style>
+        </ResourceDictionary>
+    </ContentView.Resources>
+
+    <StackLayout>
+        <CallControls:ContactInfoPanel LayoutType="Top" StatusText="{x:Static Localization:Localization.EndCall}"
+                                       PrimaryText="{Binding EndCall.ContactModel.Name}" SecondaryText="{Binding EndCall.CallerNumber}" />
+
+        <StackLayout HeightRequest="190" Orientation="Horizontal">
+            <Frame Padding="0,0,1,0">
+                <CallControls:FlatButton Image="call_end_ic_call.png" Text="{x:Static Localization:Localization.CallBack}" Command="{Binding CallBackCommand}" />
+            </Frame>
+
+            <Frame Padding="1,0,0,0">
+                <CallControls:FlatButton Image="call_end_message.png" Text="{x:Static Localization:Localization.Message}" Command="{Binding MessageCommand}" />
+            </Frame>
+        </StackLayout>
+    </StackLayout>
 </ContentView>
\ No newline at end of file
index 15c19b1..91c2b6a 100644 (file)
  */
 
 using CallApp.Tizen.Call.Manager;
+using CallApp.Tizen.Call.Model;
+using System.Windows.Input;
 using Tizen.Utility.Helpers;
+using Xamarin.Forms;
 
 namespace CallApp.Tizen.Call.ViewModel
 {
@@ -30,19 +33,52 @@ namespace CallApp.Tizen.Call.ViewModel
         public EndCallViewModel(CallManager callManager)
         {
             _callManager = callManager;
+
+            CallBackCommand = new Command(CallBack);
+            MessageCommand = new Command(Message);
         }
 
         /// <summary>
-        /// Callback a call
+        /// Command for call back
         /// </summary>
-        public void CallBack()
+        public ICommand CallBackCommand
         {
+            get;
+            private set;
         }
 
         /// <summary>
-        /// Send a message
+        /// Command for sending message
         /// </summary>
-        public void Message()
+        public ICommand MessageCommand
+        {
+            get;
+            private set;
+        }
+
+        /// <summary>
+        /// Call in end status
+        /// </summary>
+        private CallModel _endCall = null;
+        public CallModel EndCall
+        {
+            get
+            {
+                return _endCall;
+            }
+            set
+            {
+                _endCall = value;
+
+                OnPropertyChanged();
+            }
+        }
+
+        private void CallBack(object obj)
+        {
+        }
+
+        private void Message(object obj)
         {
         }
     }
index db0d07d..eee80db 100644 (file)
@@ -23,6 +23,7 @@ namespace CallApp.Tizen
         protected override void OnCreate()
         {
             base.OnCreate();
+
             LoadApplication(new App());
         }
 
index 5ddfa16..e3858d4 100644 (file)
@@ -65,6 +65,9 @@
     <Compile Include="Call\Model\ConferenceCallModel.cs" />
     <Compile Include="Call\Model\ContactModel.cs" />
     <Compile Include="Call\Provider\ContactProvider.cs" />
+    <Compile Include="Call\Theme\FlatControlTheme.xaml.cs">
+      <DependentUpon>FlatControlTheme.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Call\ViewModel\CallViewModel.cs" />
     <Compile Include="Call\ViewModel\MiniIncomingCallViewModel.cs" />
     <Compile Include="Call\ViewModel\ConferenceCallViewModel.cs" />
     <Folder Include="lib\" />
   </ItemGroup>
   <ItemGroup>
+    <Content Include="res\Call ID\168x168\call_end_photo_id_default.png" />
     <Content Include="res\Call ID\348x348\call_photo_id.png" />
     <Content Include="res\Call ID\348x348\call_photo_id_conference.png" />
     <Content Include="res\Call ID\348x348\call_photo_id_emergency.png" />
     <Content Include="res\call_btn_mute.png" />
     <Content Include="res\call_btn_volume.png" />
     <Content Include="res\call_button_bg_accept_reject.png" />
+    <Content Include="res\call_end_ic_call.png" />
+    <Content Include="res\call_end_message.png" />
     <Content Include="res\call_inline_btn_close.png" />
     <Content Include="res\call_inline_btn_open.png" />
     <Content Include="res\call_lock_icon.png" />
       <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
     </EmbeddedResource>
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Call\Theme\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.
diff --git a/CallApp.Tizen/res/Call ID/168x168/call_end_photo_id_default.png b/CallApp.Tizen/res/Call ID/168x168/call_end_photo_id_default.png
new file mode 100644 (file)
index 0000000..df1d754
Binary files /dev/null and b/CallApp.Tizen/res/Call ID/168x168/call_end_photo_id_default.png differ
diff --git a/CallApp.Tizen/res/call_end_ic_call.png b/CallApp.Tizen/res/call_end_ic_call.png
new file mode 100644 (file)
index 0000000..1d57113
Binary files /dev/null and b/CallApp.Tizen/res/call_end_ic_call.png differ
diff --git a/CallApp.Tizen/res/call_end_message.png b/CallApp.Tizen/res/call_end_message.png
new file mode 100644 (file)
index 0000000..01fe884
Binary files /dev/null and b/CallApp.Tizen/res/call_end_message.png differ