Commit f9063b96 authored by Margaux Clerc's avatar Margaux Clerc

Update contacts list view and contact detail in progress

parent 85a320df
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
/*
ContactItem.xaml.cs
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using Windows.Storage.Streams;
......@@ -21,22 +26,15 @@ namespace Linphone.Helpers
private string contactId;
private string contactName;
private ImageSource contactImage;
private string contactNumber;
private string contactEmail;
/// <summary>
/// A simple class that holds a contact item for the contacts panel.
/// </summary>
/// <param name="ContactId">The unique id of the contact from the contact store. Used to retrive the contact</param>
/// <param name="contactName">The display name of the contact</param>
public ContactItem(string ContactId, string ContactName)
{
this.contactId = ContactId;
this.contactName = ContactName;
}
/// <summary>
/// Sets the contact image. If there is no image, we set a default one picked from our solution
/// </summary>
/// <param name="ThumbnailReference">Thumbnail reference of the contact from the contact store.</param>
public async void SetImageAsync(IRandomAccessStreamReference ThumbnailReference)
{
var thumbnailImage = new BitmapImage();
......@@ -49,15 +47,11 @@ namespace Linphone.Helpers
}
else
{
thumbnailImage = new BitmapImage(new Uri("ms-appx:///Assets/unknown.png", UriKind.Absolute));
thumbnailImage = new BitmapImage(new Uri("ms-appx:///Assets/avatar.png", UriKind.Absolute));
}
this.contactImage = thumbnailImage;
}
#region Getters
/// <summary>
/// Gets the id of the contact.
/// </summary>
public string ContactId
{
get
......@@ -66,9 +60,6 @@ namespace Linphone.Helpers
}
}
/// <summary>
/// Gets the display name of the contact.
/// </summary>
public string ContactName
{
get
......@@ -77,9 +68,6 @@ namespace Linphone.Helpers
}
}
/// <summary>
/// Gets the image source of the contact.
/// </summary>
public ImageSource ContactImage
{
get
......@@ -87,6 +75,5 @@ namespace Linphone.Helpers
return contactImage;
}
}
#endregion
}
}
......@@ -171,9 +171,6 @@
<Compile Include="Views\ContactList.xaml.cs">
<DependentUpon>ContactList.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Contacts.xaml.cs">
<DependentUpon>Contacts.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Dialer.xaml.cs">
<DependentUpon>Dialer.xaml</DependentUpon>
</Compile>
......@@ -318,10 +315,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Contacts.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\Dialer.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......
......@@ -291,7 +291,6 @@ namespace Linphone.Model
//should batch add to avoid triggering callbacks
foreach (Contact c in contactBatch.Contacts)
{
//Debug.WriteLine(c.DisplayName);
ContactItem contactToAdd = new ContactItem(c.Id, c.DisplayName);
contactToAdd.SetImageAsync(c.Thumbnail);
contactItems.Add(contactToAdd);
......
......@@ -6,24 +6,34 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:linphone="clr-namespace:Linphone"
xmlns:controls="clr-namespace:Linphone.Controls"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="{ThemeResource AppBarBackgroundThemeBrush}">
<Grid x:Name="LayoutRoot" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="1" Margin="12,17,0,28">
<StackPanel Grid.Row="0" Margin="12,12,12,0">
<TextBlock x:Uid="ContactsMenu" Text="CONTACT" Style="{StaticResource HeaderTextStyle}" />
</StackPanel>
<Ellipse Width="50" Height="50" VerticalAlignment="Center" Grid.Row="1">
<Ellipse.Fill>
<ImageBrush x:Name="contactPicture" ImageSource="{Binding ContactImage}"/>
</Ellipse.Fill>
</Ellipse>
<StackPanel Grid.Row="2">
<!--<TextBlock Text="" Style="{StaticResource PhoneTextNormalStyle}"/>-->
<TextBlock x:Name="contactName" TextWrapping="Wrap" Margin="9,-7,0,0" />
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="2" Margin="12,0,12,0">
<Grid x:Name="ContentPanel" Grid.Row="3" Margin="12,0,12,0">
<ScrollViewer>
<StackPanel x:Name="actions" Orientation="Vertical" Margin="20,0,0,0">
......
......@@ -59,12 +59,8 @@ namespace Linphone.Views
if (contact.ContactImage != null)
{
Image contactPicture = new Image();
contactPicture.Width = 150;
contactPicture.Height = 150;
contactPicture.Source = contact.ContactImage;
contactPicture.Margin = new Thickness(0,0,0,15);
actions.Children.Add(contactPicture);
contactPicture.ImageSource = contact.ContactImage;
}
/* foreach (ContactPhone phone in contact.Phones)
......
......@@ -147,17 +147,17 @@
<GridView.ItemTemplate>
<DataTemplate>
<Border
Height="40"
Width="40"
Background="{Binding Converter={StaticResource JumpListItemBackground}}"
Height="45"
Width="45"
Background="Transparent"
HorizontalAlignment="Center"
Margin="4.5">
Margin="4">
<TextBlock
FontSize="30"
FontWeight="SemiBold"
Foreground="{Binding Converter={StaticResource JumpListItemForeground}}"
FontSize="22"
FontWeight="SemiLight"
Foreground="{ThemeResource SystemControlBackgroundAccentBrush}"
HorizontalAlignment="Center"
Padding="7,0"
Padding="7"
Text="{Binding Group.Key, Mode=OneWay}"
VerticalAlignment="Bottom"
AutomationProperties.AccessibilityView="Raw" />
......
using Linphone.Helpers;
/*
ContactList.xaml.cs
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using Linphone.Helpers;
using Linphone.Model;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Windows.ApplicationModel.Contacts;
using Windows.UI.Xaml.Controls;
namespace Linphone.Views
......@@ -14,16 +29,13 @@ namespace Linphone.Views
private List<AlphaKeyGroup<ContactItem>> groupsOfContacts;
private ObservableCollection<ContactItem> _contactsList = new ObservableCollection<ContactItem>();
private ObservableCollection<ContactItem> contactItems = new ObservableCollection<ContactItem>();
private ContactStore store;
public ContactList()
{
this.InitializeComponent();
groupedContactsCvs.Source = ContactsManager.Instance.GroupsOfContacts;
ContactListView.ItemsSource = ContactsManager.Instance.ContactsList;
}
}
private void ContactSearchBox_TextChanged(object sender, TextChangedEventArgs e)
{
......
<Page
x:Class="Linphone.Views.Contacts"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:model="clr-namespace:Linphone.Model"
xmlns:linphone="clr-namespace:Linphone"
xmlns:controls="clr-namespace:Linphone.Controls"
Background="{StaticResource AppBarBackgroundThemeBrush}"
mc:Ignorable="d">
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="ContentPanel" Grid.Row="2" Margin="12,0,12,0">
<Pivot SelectionChanged="Pivot_SelectionChanged">
<PivotItem Header="ContactsAll">
<ListView
x:Name="contactsList"
ItemsSource="{Binding}"
SelectionChanged="contactsList_SelectionChanged_1">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,5,0,5">
<TextBlock Text="{Binding DisplayName}" Margin="10,0,0,0"></TextBlock>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</PivotItem>
<PivotItem Header="ContactsRecents">
<ListView
x:Name="recentContacts"
ItemsSource="{Binding}"
SelectionChanged="contactsList_SelectionChanged_1">
<ListView.ItemTemplate>
<DataTemplate>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</PivotItem>
</Pivot>
</Grid>
</Grid>
</Page>
\ No newline at end of file
/*
Contacts.xaml.cs
Copyright (C) 2015 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using Linphone.Model;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Windows.ApplicationModel.Contacts;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Linphone.Views
{
/// <summary>
/// Page using native style list to display phone contacts.
/// </summary>
public partial class Contacts : Page
{
private List<Windows.ApplicationModel.Contacts.Contact> _allcontacts;
/// <summary>
/// Public constructor.
/// </summary>
public Contacts()
{
this.InitializeComponent();
if(ContactsManager.Instance.getContacts() != null)
{
_allcontacts = ContactsManager.Instance.getContacts();
Debug.WriteLine(_allcontacts.Count);
contactsList.ItemsSource = _allcontacts;
}
//recentContacts.ItemsSource = ContactsManager.Instance.GetRecentContacts();
}
/// <summary>
/// Method called when the page is displayed.
/// </summary>
/// <param name="nee"></param>
protected override void OnNavigatedTo(NavigationEventArgs nee)
{
base.OnNavigatedTo(nee);
}
private void contactsList_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
ListView list = (sender as ListView);
//Microsoft.Phone.UserData.Contact selectedContact = (list.SelectedItem as Microsoft.Phone.UserData.Contact);
//ContactManager.Instance.TempContact = selectedContact;
//NavigationService.Navigate(new Uri("/Views/Contact.xaml", UriKind.RelativeOrAbsolute));
}
private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Pivot pivot = sender as Pivot;
if (pivot == null)
{
return;
}
switch (pivot.SelectedIndex)
{
case 0:
// HubTileService.FreezeGroup("RecentContactsGroup");
break;
case 1:
//HubTileService.UnfreezeGroup("RecentContactsGroup");
break;
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment