return vm;
}
+
+ /// <summary>
+ /// Create test ConferenceCallViewModel
+ /// </summary>
+ /// <returns>ConferenceCallViewModel</returns>
+ public static CallViewModel CreateConferenceCallViewModel()
+ {
+ CallModel callModelAS = new CallModel(0);
+ callModelAS.ContactModel.Name = "John Doe";
+ callModelAS.CallerNumber = "+321224994574";
+
+ CallModel callModelGA = new CallModel(0);
+ callModelGA.ContactModel.Name = "Princess Doe";
+ callModelGA.CallerNumber = "+329118070585";
+
+ CallModel callModelRZ = new CallModel(0);
+ callModelRZ.ContactModel.Name = "Vasia Pupkin";
+ callModelRZ.CallerNumber = "+335286157242";
+
+ CallManager callManager = new CallManager();
+ callManager.Calls.Add(callModelAS);
+ callManager.Calls.Add(callModelGA);
+ callManager.Calls.Add(callModelRZ);
+
+ return new ConferenceCallViewModel(callManager);
+ }
}
}
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
- x:Class="CallApp.Tizen.Call.View.ConferenceCallManagePage"
+ x:Class="CallApp.Tizen.Call.View.ConferenceCallManagementPage"
xmlns:CallControls="clr-namespace:CallApp.Tizen.Call.View.Controls"
xmlns:Localization="clr-namespace:CallApp.Tizen.Localization"
xmlns:TizenUtilityControls="clr-namespace:Tizen.Utility.Controls">
<ContentView Grid.Row="0" BackgroundColor="{StaticResource CallStatusBGColor}">
<Label Margin="32,0,0,0" HorizontalOptions="Start" VerticalOptions="Center" TextColor="{StaticResource DefaultTextColor}"
- FontSize="27" Text="00:00" />
+ FontSize="27" Text="{Binding CallDuration.Duration}" />
</ContentView>
- <CallControls:ConferenceCallManageList Grid.Row="1" />
+ <CallControls:ConferenceCallManagementList Grid.Row="1" Items="{Binding PeopleInConference}" />
<ContentView Grid.Row="2" BackgroundColor="{StaticResource BackPanelBGColor}">
<Button WidthRequest="524" HeightRequest="104" HorizontalOptions="Center" VerticalOptions="Center"
/// <summary>
/// Represents Conference call managing page
/// </summary>
- public partial class ConferenceCallManagePage : ContentPage
+ public partial class ConferenceCallManagementPage : ContentPage
{
- public ConferenceCallManagePage()
+ public ConferenceCallManagementPage()
{
InitializeComponent();
}
<?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.ConferenceCallView">
+ x:Class="CallApp.Tizen.Call.View.ConferenceCallView"
+ 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">
+ <TizenUtilityControls:CustomGrid>
+ <StackLayout>
+ <StackLayout>
+ <CallControls:ContactInfoPanel LayoutType="Conference" StatusText="{Binding CallDuration.Duration}"
+ PrimaryText="{x:Static Localization:Localization.Conference}" SecondaryText="{Binding ConferencePeopleCount}"
+ ActionCommand="{Binding CallManagementCommand}" />
+
+ <CallControls:CallHandlingPanel SpeakerCommand="{Binding SpeakerCommand}"
+ KeypadCommand="{Binding KeypadCommand}"
+ BluetoothCommand="{Binding BluetoothCommand}"
+ AddCallCommand="{Binding AddCallCommand}"
+ SoundCommand="{Binding SoundCommand}"
+ AddContactCommand="{Binding AddContactCommand}" />
+ <StackLayout.Triggers>
+ <DataTrigger TargetType="StackLayout" Binding="{Binding IsKeypadOpen}" Value="True">
+ <Setter Property="IsVisible" Value="False" />
+ </DataTrigger>
+ </StackLayout.Triggers>
+ </StackLayout>
+
+ <CallControls:Dialer VerticalOptions="FillAndExpand" StatusText="{Binding CallDuration.Duration}" IsOpen="{Binding IsKeypadOpen}" />
+
+ <ContentView HeightRequest="152" BackgroundColor="{StaticResource BGColor}">
+ <CallControls:AnimatedCircleButton HorizontalOptions="Center" VerticalOptions="Center" Radius="100"
+ AnimationColor="{StaticResource CircleButtonRejectBGColor}" NormalColor="{StaticResource CircleButtonRejectNormalColor}"
+ PressColor="{StaticResource CircleButtonRejectPressColor}" Image="call_btn_ic_reject.png" />
+ </ContentView>
+ </StackLayout>
+
+ <CallControls:ProximityControl Proximity="{Binding Proximity}" />
+ </TizenUtilityControls:CustomGrid>
</ContentView>
\ No newline at end of file
<Color x:Key="FlatControlTextNormalColor">#FF808080</Color>
<Style TargetType="CallControls:FlatButton">
+ <Setter Property="ImageMargin" Value="0,37,0,0" />
<Setter Property="HeightRequest" Value="188" />
<Setter Property="ImageColor" Value="{StaticResource FlatControlImageNormalColor}" />
<Setter Property="TextColor" Value="{StaticResource FlatControlTextNormalColor}" />
</Style>
<Style TargetType="CallControls:FlatCheckbox">
+ <Setter Property="ImageMargin" Value="0,37,0,0" />
<Setter Property="HeightRequest" Value="188" />
<Setter Property="ImageColor" Value="{StaticResource FlatControlImageNormalColor}" />
<Setter Property="TextColor" Value="{StaticResource FlatControlTextNormalColor}" />
<?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.Controls.ConferenceCallManageList"
+ x:Class="CallApp.Tizen.Call.View.Controls.ConferenceCallManagementList"
x:Name="This"
xmlns:CallControls="clr-namespace:CallApp.Tizen.Call.View.Controls"
- xmlns:TizenUtilityControls="clr-namespace:Tizen.Utility.Controls">
+ xmlns:TizenUtilityControls="clr-namespace:Tizen.Utility.Controls"
+ xmlns:TizenUtilityConverters="clr-namespace:Tizen.Utility.Converters">
<ContentView.Resources>
<ResourceDictionary>
+ <TizenUtilityConverters:IsNullConverter x:Key="IsNull" />
+
<Color x:Key="ContactNameTextColor">#FF000000</Color>
+ <Color x:Key="DefaultPhotoColor">#FF3DB9CC</Color>
<Color x:Key="SplitButtonNormalColor">#FF3DB9CC</Color>
<Color x:Key="SplitButtonPressColor">#FF2F919F</Color>
</ResourceDictionary>
</ContentView.Resources>
- <ListView ItemsSource="{Binding Contacts}">
+ <ListView ItemsSource="{Binding Items, Source={x:Reference This}}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
NormalColor="{StaticResource SplitButtonNormalColor}" PressColor="{StaticResource SplitButtonPressColor}"
Image="call_btn_ic_split.png" />
- <Image Margin="32,0,0,0" WidthRequest="98" HeightRequest="98" Source="{Binding Photo}" />
+ <TizenUtilityControls:CustomImage Margin="32,0,0,0" WidthRequest="98" HeightRequest="98">
+ <TizenUtilityControls:CustomImage.Triggers>
+ <DataTrigger TargetType="TizenUtilityControls:CustomImage" Binding="{Binding ContactModel.Photo, Converter={StaticResource IsNull}}" Value="True">
+ <Setter Property="Source" Value="Call ID/96x96/call_active_photo_id_default.png" />
+ <Setter Property="BlendingColor" Value="{StaticResource DefaultPhotoColor}" />
+ </DataTrigger>
+
+ <DataTrigger TargetType="TizenUtilityControls:CustomImage" Binding="{Binding ContactModel.Photo, Converter={StaticResource IsNull}}" Value="False">
+ <Setter Property="Source" Value="{Binding ContactModel.Photo}" />
+ </DataTrigger>
+ </TizenUtilityControls:CustomImage.Triggers>
+ </TizenUtilityControls:CustomImage>
<Label Margin="32,0,0,0" WidthRequest="268" HorizontalOptions="Start" VerticalOptions="Center"
- TextColor="{StaticResource ContactNameTextColor}" FontSize="21" Text="{Binding ContactName}" />
+ TextColor="{StaticResource ContactNameTextColor}" FontSize="21" Text="{Binding ContactModel.Name}" />
<CallControls:AnimatedCircleButton Margin="32,0,0,0" Radius="98"
NormalColor="{StaticResource CircleButtonRejectNormalColor}" PressColor="{StaticResource CircleButtonRejectPressColor}"
* limitations under the License.
*/
+using System.Collections;
using Xamarin.Forms;
namespace CallApp.Tizen.Call.View.Controls
{
/// <summary>
- /// Partial class of ConferenceCallManageList.xaml
+ /// Represents list of conference calls
/// </summary>
- public partial class ConferenceCallManageList : ContentView
+ public partial class ConferenceCallManagementList : ContentView
{
- public ConferenceCallManageList()
+ public ConferenceCallManagementList()
{
InitializeComponent();
}
+
+ /// <summary>
+ /// Gets or sets list of conference call list items
+ /// </summary>
+ public static readonly BindableProperty ItemsProperty = BindableProperty.Create(
+ "Items",
+ typeof(IEnumerable),
+ typeof(ConferenceCallManagementList),
+ null);
+
+ public IEnumerable Items
+ {
+ get
+ {
+ return (IEnumerable)GetValue(ItemsProperty);
+ }
+
+ set
+ {
+ SetValue(ItemsProperty, value);
+ }
+ }
}
}
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
+ <RowDefinition Height="24" />
+ <RowDefinition Height="54" />
+ <RowDefinition Height="33" />
+ <RowDefinition Height="348" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
- <TizenUtilityControls:CustomGrid Grid.Column="1" Grid.Row="0">
- <Grid.RowDefinitions>
- <RowDefinition Height="24" />
- <RowDefinition Height="54" />
- <RowDefinition Height="33" />
- <RowDefinition Height="348" />
- </Grid.RowDefinitions>
-
- <Label Grid.Row="1" HorizontalOptions="Start" VerticalOptions="Center" TextColor="{StaticResource DefaultTextColor}"
- FontSize="27" Text="{TemplateBinding StatusText}" />
+ <Label Grid.Column="0" Grid.Row="1" Margin="32,0,0,0" HorizontalOptions="Start" VerticalOptions="Center"
+ TextColor="{StaticResource DefaultTextColor}" FontSize="27" Text="{TemplateBinding StatusText}" />
- <Image Grid.Row="3" HorizontalOptions="Center" VerticalOptions="Center" Source="{TemplateBinding Image}" />
- </TizenUtilityControls:CustomGrid>
+ <Image Grid.Column="1" Grid.Row="3" HorizontalOptions="Center" VerticalOptions="Center" Source="Call ID/348x348/call_photo_id_conference.png" />
- <TizenUtilityControls:CustomGrid Grid.Column="1" Grid.Row="1">
+ <TizenUtilityControls:CustomGrid Grid.Column="1" Grid.Row="4">
<Grid.RowDefinitions>
<RowDefinition Height="42" />
<RowDefinition Height="86" />
FontSize="27" Text="{TemplateBinding SecondaryText}" />
</TizenUtilityControls:CustomGrid>
- <CallControls:FlatButton Grid.Column="2" Grid.Row="1" WidthRequest="50" HeightRequest="50" Margin="0,32,-22,0"
- HorizontalOptions="Center" VerticalOptions="Center" Image="call_multi_ic_arrow.png" />
+ <CallControls:FlatButton Grid.Column="2" Grid.Row="4" WidthRequest="50" HeightRequest="50" Margin="0,32,22,0"
+ HorizontalOptions="Center" VerticalOptions="Center" Image="call_multi_ic_arrow.png"
+ Command="{TemplateBinding ActionCommand}" />
</TizenUtilityControls:CustomGrid>
</ControlTemplate>
}
/// <summary>
+ /// Сommand to binding various custom actions
+ /// </summary>
+ public static readonly BindableProperty ActionCommandProperty = BindableProperty.Create(
+ "ActionCommand",
+ typeof(Command),
+ typeof(ContactInfoPanel),
+ null);
+
+ public Command ActionCommand
+ {
+ get
+ {
+ return (Command)GetValue(ActionCommandProperty);
+ }
+
+ set
+ {
+ SetValue(ActionCommandProperty, value);
+ }
+ }
+
+ /// <summary>
/// Layout type of panel
/// </summary>
public static readonly BindableProperty LayoutTypeProperty = BindableProperty.Create(
</Trigger>
</StackLayout.Triggers>
- <TizenUtilityControls:CustomImage HeightRequest="62" Margin="0,37,0,0" Source="{TemplateBinding Image}"
+ <TizenUtilityControls:CustomImage Margin="{TemplateBinding ImageMargin}" Source="{TemplateBinding Image}"
BlendingColor="{TemplateBinding ImageColor}">
<TizenUtilityControls:CustomImage.Triggers>
<DataTrigger TargetType="TizenUtilityControls:CustomImage" Binding="{TemplateBinding Image, Converter={StaticResource IsNull}}" Value="True">
</TizenUtilityControls:CustomImage.Triggers>
</TizenUtilityControls:CustomImage>
- <Label HeightRequest="37" Margin="0,4,0,0" HorizontalOptions="Center"
+ <Label Margin="{TemplateBinding TextMargin}" HorizontalOptions="Center"
FontSize="19" Text="{TemplateBinding Text}" TextColor="{TemplateBinding TextColor}">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{TemplateBinding Text, Converter={StaticResource IsStringEmpty}}" Value="True">
}
/// <summary>
+ /// Margin of image
+ /// </summary>
+ public static readonly BindableProperty ImageMarginProperty = BindableProperty.Create(
+ "ImageMargin",
+ typeof(Thickness),
+ typeof(FlatButton),
+ new Thickness(0));
+
+ public Thickness ImageMargin
+ {
+ get
+ {
+ return (Thickness)GetValue(ImageMarginProperty);
+ }
+
+ set
+ {
+ SetValue(ImageMarginProperty, value);
+ }
+ }
+
+ /// <summary>
/// Text of content
/// </summary>
public static readonly BindableProperty TextProperty = BindableProperty.Create(
SetValue(TextColorProperty, value);
}
}
+
+ /// <summary>
+ /// Margin of text
+ /// </summary>
+ public static readonly BindableProperty TextMarginProperty = BindableProperty.Create(
+ "TextMargin",
+ typeof(Thickness),
+ typeof(FlatButton),
+ new Thickness(0));
+
+ public Thickness TextMargin
+ {
+ get
+ {
+ return (Thickness)GetValue(TextMarginProperty);
+ }
+
+ set
+ {
+ SetValue(TextMarginProperty, value);
+ }
+ }
}
}
AddCallCommand = new Command(OnAddCall, OnAddCallCanExecute);
ToggleMuteCommand = new Command(OnToggleMute, OnToggleMuteCanExecute);
AddContactCommand = new Command(OnAddContact, OnAddContactCanExecute);
- RejectCallCommand = new Command(OnRejectCall);
+ EndCallCommand = new Command(OnEndCall);
ProximitySensor proximitySensor = new ProximitySensor();
proximitySensor.DataUpdated += OnProximitySensorDataUpdated;
}
/// <summary>
- /// Command for reject call
+ /// Command for end call
/// </summary>
- public ICommand RejectCallCommand
+ public ICommand EndCallCommand
{
get;
private set;
{
}
- private bool OnAddCallCanExecute(object arg)
+ protected virtual bool OnAddCallCanExecute(object arg)
{
- return ActiveCall.Status == CallStatus.Active;
+ return ActiveCall != null && ActiveCall.Status == CallStatus.Active;
}
private void OnToggleMute(object obj)
private bool OnToggleMuteCanExecute(object arg)
{
- return ActiveCall.Status == CallStatus.Active;
+ return ActiveCall != null && ActiveCall.Status == CallStatus.Active;
}
private void OnAddContact(object obj)
{
}
- private bool OnAddContactCanExecute(object arg)
+ protected virtual bool OnAddContactCanExecute(object arg)
{
- return ActiveCall.Status == CallStatus.Active;
+ return ActiveCall != null && ActiveCall.Status == CallStatus.Active;
}
- private void OnRejectCall(object obj)
+ private void OnEndCall(object obj)
{
}
*/
using CallApp.Tizen.Call.Manager;
+using CallApp.Tizen.Call.Model;
+using CallApp.Tizen.Call.View;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows.Input;
+using Tizen.Utility.Helpers;
+using Xamarin.Forms;
namespace CallApp.Tizen.Call.ViewModel
{
{
public ConferenceCallViewModel(CallManager callManager) : base(callManager)
{
+ CallManagementCommand = new Command(OnCallManagement);
+ SplitCallCommand = new Command(OnSplitCall);
+ BackCommand = new Command(OnBack);
+ }
+
+ /// <summary>
+ /// Command to invoke, when page is shown/hidden
+ /// </summary>
+ public ICommand CallManagementCommand
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Command for split call
+ /// </summary>
+ public ICommand SplitCallCommand
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Command for simulate back button
+ /// </summary>
+ public ICommand BackCommand
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Count of people in conference
+ /// </summary>
+ public string ConferencePeopleCount
+ {
+ get
+ {
+ return string.Format(Localization.Localization.WithNPeople, _callManager.Calls.Where(obj => obj.Status == CallStatus.Active)?.Count());
+ }
+ }
+
+ /// <summary>
+ /// List of people in conference
+ /// </summary>
+ public ObservableCollection<CallBase> PeopleInConference
+ {
+ get
+ {
+ return _callManager.Calls;
+ }
+ }
+
+ private void OnCallManagement(object obj)
+ {
+ PageNavigator.NavigateModal(new ConferenceCallManagementPage() { BindingContext = this });
+ }
+
+ private void OnSplitCall(object obj)
+ {
+ }
+
+ private void OnBack(object obj)
+ {
+ PageNavigator.Back();
+ }
+
+ protected override bool OnAddCallCanExecute(object arg)
+ {
+ return true;
+ }
+
+ protected override bool OnAddContactCanExecute(object arg)
+ {
+ return true;
}
}
}
// FIXME: This code only for testing. Need to remove after Call API is completed
CurrentVM = TestModelCreator.CreateCallViewModel();
- //
}
/// <summary>
<Compile Include="Call\View\Controls\RejectMessageList.xaml.cs">
<DependentUpon>RejectMessageList.xaml</DependentUpon>
</Compile>
- <Compile Include="Call\View\Controls\ConferenceCallManageList.xaml.cs">
- <DependentUpon>ConferenceCallManageList.xaml</DependentUpon>
+ <Compile Include="Call\View\Controls\ConferenceCallManagementList.xaml.cs">
+ <DependentUpon>ConferenceCallManagementList.xaml</DependentUpon>
</Compile>
<Compile Include="Call\View\Controls\ContactInfoPanel.xaml.cs">
<DependentUpon>ContactInfoPanel.xaml</DependentUpon>
<DependentUpon>RejectCallPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Call\View\Controls\Renderers\AnimatedCircleButtonRenderer.cs" />
- <Compile Include="Call\View\ConferenceCallManagePage.xaml.cs">
- <DependentUpon>ConferenceCallManagePage.xaml</DependentUpon>
+ <Compile Include="Call\View\ConferenceCallManagementPage.xaml.cs">
+ <DependentUpon>ConferenceCallManagementPage.xaml</DependentUpon>
</Compile>
<Compile Include="Call\View\EndCallView.xaml.cs">
<DependentUpon>EndCallView.xaml</DependentUpon>
</ItemGroup>
<ItemGroup>
<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 ID\96x96\call_active_photo_id_default.png" />
<Content Include="res\call_active_ic_call.png" />
<Content Include="res\call_btn_addcall.png" />
<Content Include="res\call_btn_bluetooth.png" />
<Content Include="res\call_btn_contacts.png" />
<Content Include="res\call_btn_ic_accept.png" />
<Content Include="res\call_btn_ic_reject.png" />
+ <Content Include="res\call_btn_ic_split.png" />
<Content Include="res\call_btn_keypad.png" />
<Content Include="res\call_btn_mute.png" />
<Content Include="res\call_btn_volume.png" />
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="Call\View\Controls\ConferenceCallManageList.xaml">
+ <EmbeddedResource Include="Call\View\Controls\ConferenceCallManagementList.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
- <EmbeddedResource Include="Call\View\ConferenceCallManagePage.xaml">
+ <EmbeddedResource Include="Call\View\ConferenceCallManagementPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
public static class PageNavigator
{
/// <summary>
- /// Navigate to new page in modal state
+ /// Navigates to new page in modal state
/// </summary>
/// <param name="page">Page to navigate</param>
public static void NavigateModal(Page page)
Logger.Debug("Application.Current.MainPage is null");
}
}
+
+ /// <summary>
+ /// Navigate to previous page in modal state
+ /// </summary>
+ public static void Back()
+ {
+ if (Application.Current.MainPage != null)
+ {
+ Application.Current.MainPage.Navigation.PopModalAsync();
+ }
+ else
+ {
+ Logger.Debug("Application.Current.MainPage is null");
+ }
+ }
}
}
}
/// <summary>
+ /// Looks up a localized string similar to Conference.
+ /// </summary>
+ public static string Conference
+ {
+ get
+ {
+ return ResourceManager.GetString("Conference", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Contacts.
/// </summary>
public static string Contacts
return ResourceManager.GetString("WhatsUpRejectMessage", resourceCulture);
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to With {0} people.
+ /// </summary>
+ public static string WithNPeople
+ {
+ get
+ {
+ return ResourceManager.GetString("WithNPeople", resourceCulture);
+ }
+ }
}
}
<data name="Swap" xml:space="preserve">
<value>Swap</value>
</data>
+ <data name="Conference" xml:space="preserve">
+ <value>Conference</value>
+ </data>
+ <data name="WithNPeople" xml:space="preserve">
+ <value>With {0} people</value>
+ </data>
</root>
\ No newline at end of file