--- /dev/null
+/*
+ * 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.
+ */
+
+namespace CallApp.Tizen.Call.Helper
+{
+ /// <summary>
+ /// Reject message structure
+ /// </summary>
+ public struct RejectMessage
+ {
+ public RejectMessage(string message)
+ {
+ Message = message;
+ }
+
+ public string Message
+ {
+ get;
+ private set;
+ }
+ }
+}
/// <returns>ConferenceCallViewModel</returns>
public static ConferenceCallViewModel CreateConferenceCallViewModel()
{
- CallModel callModelAS = new CallModel(0);
- callModelAS.ContactModel.Name = "John Doe";
- callModelAS.CallerNumber = "+321224994574";
+ CallModel callModel01 = new CallModel(0);
+ callModel01.ContactModel.Name = "John Plumber";
+ callModel01.CallerNumber = "+322256032712";
- CallModel callModelGA = new CallModel(0);
- callModelGA.ContactModel.Name = "Princess Doe";
- callModelGA.CallerNumber = "+329118070585";
+ CallModel callModel02 = new CallModel(0);
+ callModel02.ContactModel.Name = "Eddie Punch-Clock";
+ callModel02.CallerNumber = "+370235512098";
- CallModel callModelRZ = new CallModel(0);
- callModelRZ.ContactModel.Name = "Vasia Pupkin";
- callModelRZ.CallerNumber = "+335286157242";
+ CallModel callModel03 = new CallModel(0);
+ callModel03.ContactModel.Name = "Johnny Lunch-Pail";
+ callModel03.CallerNumber = "+386691614669";
CallManager callManager = new CallManager();
- callManager.Calls.Add(callModelAS);
- callManager.Calls.Add(callModelGA);
- callManager.Calls.Add(callModelRZ);
+ callManager.Calls.Add(callModel01);
+ callManager.Calls.Add(callModel02);
+ callManager.Calls.Add(callModel03);
return new ConferenceCallViewModel(callManager);
}
}
};
- vm.EndCall.ContactModel.Name = "Ruslan Zakharov";
- vm.EndCall.CallerNumber = "+380676470707";
+ vm.EndCall.ContactModel.Name = "John Doe";
+ vm.EndCall.CallerNumber = "+321224994574";
+
+ return vm;
+ }
+
+ /// <summary>
+ /// Create test IncomingCallViewModel
+ /// </summary>
+ /// <returns>IncomingCallViewModel</returns>
+ public static IncomingCallViewModel CreateIncomingCallViewModel()
+ {
+ IncomingCallViewModel vm = new IncomingCallViewModel(new CallManager())
+ {
+ IncomingCall = new CallModel(0)
+ {
+ Status = CallStatus.Incoming
+ }
+ };
+
+ vm.IncomingCall.ContactModel.Name = "John Doe";
+ vm.IncomingCall.CallerNumber = "+321224994574";
return vm;
}
* limitations under the License.
*/
-using System.Collections.Generic;
+using CallApp.Tizen.Call.Helper;
+using System.Collections.ObjectModel;
namespace CallApp.Tizen.Call.Manager
{
/// Gets default messages answers
/// </summary>
/// <returns>List of default messages answers</returns>
- public List<string> GetMessageList()
+ public ObservableCollection<RejectMessage> GetMessageList()
{
- return null;
+ // FIXME: This block of code only for testing and should be removed after real API implementation
+ return new ObservableCollection<RejectMessage>()
+ {
+ new RejectMessage(Localization.Localization.PleaseTextMeRejectMessage),
+ new RejectMessage(Localization.Localization.WhatsUpRejectMessage),
+ new RejectMessage(Localization.Localization.InMeetingRejectMessage),
+ new RejectMessage(Localization.Localization.DrivingNowRejectMessage),
+ new RejectMessage(Localization.Localization.CallYouLaterRejectMessage)
+ };
+ //
}
/// <summary>
<Color x:Key="BottomInlineButtonNormalColor">#FFFAFAFA</Color>
<ControlTemplate x:Key="TopOpenDirectionPanel">
- <TizenUtilityControls:CustomGrid HeightRequest="{TemplateBinding DefaultHeight}">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="78" />
- <RowDefinition Height="22" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
-
- <TizenUtilityControls:GesturesContainer Grid.Row="0" PanUpdated="OnPanUpdated">
- <TizenUtilityControls:CustomGrid>
- <Grid.RowDefinitions>
- <RowDefinition Height="12" />
- <RowDefinition Height="18" />
- <RowDefinition Height="20" />
- </Grid.RowDefinitions>
-
- <TizenUtilityControls:CustomImage Grid.Row="1" BlendingColor="{StaticResource TopInlineButtonNormalColor}" Source="call_inline_btn_open.png">
- <TizenUtilityControls:CustomImage.Triggers>
- <DataTrigger TargetType="TizenUtilityControls:CustomImage" Binding="{TemplateBinding IsOpen}" Value="True">
- <Setter Property="Source" Value="call_inline_btn_close.png" />
- </DataTrigger>
- </TizenUtilityControls:CustomImage.Triggers>
- </TizenUtilityControls:CustomImage>
- </TizenUtilityControls:CustomGrid>
+ <StackLayout HeightRequest="{TemplateBinding DefaultHeight}">
+ <TizenUtilityControls:GesturesContainer PanUpdated="OnPanUpdated">
+ <TizenUtilityControls:CustomImage Margin="0,12,0,10" HeightRequest="18"
+ BlendingColor="{StaticResource TopInlineButtonNormalColor}"
+ Source="call_inline_btn_open.png">
+ <TizenUtilityControls:CustomImage.Triggers>
+ <DataTrigger TargetType="TizenUtilityControls:CustomImage" Binding="{TemplateBinding IsOpen}" Value="True">
+ <Setter Property="Margin" Value="0,12,0,20" />
+ <Setter Property="Source" Value="call_inline_btn_close.png" />
+ </DataTrigger>
+ </TizenUtilityControls:CustomImage.Triggers>
+ </TizenUtilityControls:CustomImage>
</TizenUtilityControls:GesturesContainer>
- <Label Grid.Row="1" HorizontalOptions="Center" VerticalOptions="Center"
- TextColor="{StaticResource TopInlineButtonNormalColor}" Text="{x:Static Localization:Localization.RejectCallWithMessage}">
+ <Label Margin="0,0,0,12" HorizontalOptions="Center"
+ TextColor="{StaticResource TopInlineButtonNormalColor}" FontSize="26"
+ Text="{x:Static Localization:Localization.RejectCallWithMessage}">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{TemplateBinding IsOpen}" Value="True">
<Setter Property="IsVisible" Value="False" />
</Label.Triggers>
</Label>
- <Button Grid.Row="1" HorizontalOptions="Center" VerticalOptions="Center"
+ <Button Margin="32,0,32,22" WidthRequest="655" HeightRequest="78" HorizontalOptions="Center"
Text="{x:Static Localization:Localization.ComposeMessageToSend}" IsVisible="False">
<Button.Triggers>
<DataTrigger TargetType="Button" Binding="{TemplateBinding IsOpen}" Value="True">
</Button.Triggers>
</Button>
- <ContentPresenter Grid.Row="3" />
- </TizenUtilityControls:CustomGrid>
+ <ContentPresenter />
+ </StackLayout>
</ControlTemplate>
<ControlTemplate x:Key="BottomOpenDirectionPanel">
"DefaultHeight",
typeof(double),
typeof(RejectCallPanel),
- 150.0);
+ 104.0);
public double DefaultHeight
{
{
case GestureStatus.Started:
_lastHeight = Height;
+
+ /* // TODO: Need to fix a bug in this place https://106.125.46.213/youtrack/issue/TizenRefApp-9373
double contentHeight = Content.Height + Height;
if (MaxOpenedHeight.Equals(0.0) || MaxOpenedHeight > contentHeight)
{
_maxOpenedHeight = MaxOpenedHeight;
}
+ */
+
+ _maxOpenedHeight = MaxOpenedHeight;
break;
<?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.IncomingCallView">
+ x:Class="CallApp.Tizen.Call.View.IncomingCallView"
+ x:Name="This"
+ xmlns:CallControls="clr-namespace:CallApp.Tizen.Call.View.Controls"
+ xmlns:Localization="clr-namespace:CallApp.Tizen.Localization"
+ xmlns:TizenUtilityControls="clr-namespace:Tizen.Utility.Controls">
+ <ContentView.Resources>
+ <ResourceDictionary>
+ <Color x:Key="ContactInfoPanelDimColor">#7D000000</Color>
+ <Color x:Key="RejectMessageListItemPressColor">#4C000000</Color>
+ </ResourceDictionary>
+ </ContentView.Resources>
+
+ <TizenUtilityControls:CustomGrid>
+ <StackLayout>
+ <TizenUtilityControls:CustomGrid>
+ <CallControls:ContactInfoPanel LayoutType="Single" StatusText="{x:Static Localization:Localization.IncomingCall}"
+ Image="{Binding IncomingCall.ContactModel.Image}"
+ PrimaryText="{Binding IncomingCall.ContactModel.Name}" SecondaryText="{Binding IncomingCall.CallerNumber}" />
+
+ <ContentView>
+ <ContentView.Triggers>
+ <DataTrigger TargetType="ContentView" Binding="{Binding Source={x:Reference This}, Path=IsDimmed}" Value="True">
+ <Setter Property="BackgroundColor" Value="{StaticResource ContactInfoPanelDimColor}" />
+ </DataTrigger>
+ </ContentView.Triggers>
+ </ContentView>
+ </TizenUtilityControls:CustomGrid>
+
+ <StackLayout HeightRequest="424" Orientation="Horizontal" BackgroundColor="{StaticResource BGColor}">
+ <CallControls:AnimatedCircleButton x:Name="xAcceptCallButton" HorizontalOptions="Start" MaxScaleFactor="3" Radius="100"
+ AnimationColor="{StaticResource CircleButtonAcceptBGColor}"
+ NormalColor="{StaticResource CircleButtonAcceptNormalColor}"
+ PressColor="{StaticResource CircleButtonAcceptPressColor}"
+ Image="call_btn_ic_accept.png" />
+
+ <CallControls:AnimatedCircleButton x:Name="xRejectCallButton" HorizontalOptions="EndAndExpand" MaxScaleFactor="3" Radius="100"
+ AnimationColor="{StaticResource CircleButtonRejectBGColor}"
+ NormalColor="{StaticResource CircleButtonRejectNormalColor}"
+ PressColor="{StaticResource CircleButtonRejectPressColor}"
+ Image="call_btn_ic_reject.png" />
+ </StackLayout>
+ </StackLayout>
+
+ <CallControls:RejectCallPanel x:Name="xRejectCallPanel" VerticalOptions="End" HeightRequest="104" MaxOpenedHeight="640"
+ OpenDirection="ToTop" BackgroundColor="{StaticResource BGColor}">
+ <CallControls:RejectMessageList Items="{Binding RejectMessages}" PressColor="{StaticResource RejectMessageListItemPressColor}" />
+ </CallControls:RejectCallPanel>
+ </TizenUtilityControls:CustomGrid>
</ContentView>
\ No newline at end of file
public IncomingCallView()
{
InitializeComponent();
+
+ xAcceptCallButton.OnAnimationCompleted += OnAcceptCallButtonAnimationCompleted;
+ xRejectCallButton.OnAnimationCompleted += OnRejectCallButtonAnimationCompleted;
+
+ xRejectCallPanel.OnSlideEvent += OnRejectCallPanelSlideEvent;
+ }
+
+ /// <summary>
+ /// Is contact info panel dim or not
+ /// </summary>
+ public static readonly BindableProperty IsDimmedProperty = BindableProperty.Create(
+ "IsDimmed",
+ typeof(bool),
+ typeof(IncomingCallView),
+ false);
+
+ public bool IsDimmed
+ {
+ get
+ {
+ return (bool)GetValue(IsDimmedProperty);
+ }
+ set
+ {
+ SetValue(IsDimmedProperty, value);
+ }
+ }
+
+ private void OnAcceptCallButtonAnimationCompleted(object sender)
+ {
+ }
+
+ private void OnRejectCallButtonAnimationCompleted(object sender)
+ {
+ }
+
+ private void OnRejectCallPanelSlideEvent(object sender, PanUpdatedEventArgs e)
+ {
+ switch (e.StatusType)
+ {
+ case GestureStatus.Started:
+ case GestureStatus.Running:
+ IsDimmed = true;
+ break;
+
+ case GestureStatus.Canceled:
+ case GestureStatus.Completed:
+ IsDimmed = false;
+ break;
+ }
}
}
}
* limitations under the License.
*/
+using CallApp.Tizen.Call.Helper;
using CallApp.Tizen.Call.Manager;
+using CallApp.Tizen.Call.Model;
+using System.Collections.ObjectModel;
+using System.Windows.Input;
using Tizen.Utility.Helpers;
+using Xamarin.Forms;
namespace CallApp.Tizen.Call.ViewModel
{
public IncomingCallViewModel(CallManager callManager)
{
_callManager = callManager;
+
+ AcceptCallCommand = new Command(OnAcceptCall);
+ RejectCallCommand = new Command(OnRejectCall);
+ RejectCallWithMessageCommand = new Command(OnRejectCallWithMessage);
+ }
+
+ /// <summary>
+ /// Command for accept call
+ /// </summary>
+ public ICommand AcceptCallCommand
+ {
+ get;
+ private set;
}
/// <summary>
- /// Accept a call
+ /// Command for reject call
/// </summary>
- public void AcceptCall()
+ public ICommand RejectCallCommand
{
+ get;
+ private set;
}
/// <summary>
- /// Reject a call
+ /// Command for reject call with message
/// </summary>
- public void RejectCall()
+ public ICommand RejectCallWithMessageCommand
{
+ get;
+ private set;
}
/// <summary>
- /// Reject a call with message
+ /// Call in incoming status
/// </summary>
- public void RejectCallWithMessage(string text)
+ private CallModel _incomingCall = null;
+ public CallModel IncomingCall
+ {
+ get
+ {
+ return _incomingCall;
+ }
+ set
+ {
+ _incomingCall = value;
+
+ OnPropertyChanged();
+ }
+ }
+
+ /// <summary>
+ /// List of reject messages
+ /// </summary>
+ public ObservableCollection<RejectMessage> RejectMessages
+ {
+ get
+ {
+ return _messagesManager.GetMessageList();
+ }
+ }
+
+ private void OnAcceptCall(object obj)
+ {
+ }
+
+ private void OnRejectCall(object obj)
+ {
+ }
+
+ private void OnRejectCallWithMessage(object obj)
{
}
}
</Compile>
<Compile Include="CallApp.Tizen.cs" />
<Compile Include="Call\Helper\TestModelCreator.cs" />
+ <Compile Include="Call\Helper\RejectMessage.cs" />
<Compile Include="Call\Helper\TimeDuration.cs" />
<Compile Include="Call\Manager\CallManager.cs" />
<Compile Include="Call\Manager\MessagesManager.cs" />
<Color x:Key="BGColor">#FFF7F7F7</Color>
<Color x:Key="DefaultTextColor">#FFFAFAFA</Color>
+ <Color x:Key="CircleButtonAcceptBGColor">#4D59B03A</Color>
<Color x:Key="CircleButtonAcceptNormalColor">#FF59B03A</Color>
<Color x:Key="CircleButtonAcceptPressColor">#FF268035</Color>