Commit 586e3620 authored by Nicolas Jager's avatar Nicolas Jager
Browse files

smartpanel : add account type icons

Change-Id: I90d0b543568f268d6c9161de80bdd3df01f7ed68
Tuleap: #1237
parent 95c526b2
...@@ -38,6 +38,7 @@ Account::Account(String^ name, ...@@ -38,6 +38,7 @@ Account::Account(String^ name,
accountType_ = accountType; accountType_ = accountType;
accountID_ = accountID; accountID_ = accountID;
_deviceId = deviceId; _deviceId = deviceId;
_isSelected = false;
} }
void void
......
...@@ -45,12 +45,22 @@ public: ...@@ -45,12 +45,22 @@ public:
devicesIdList_ = value; devicesIdList_ = value;
} }
} }
property bool _isSelected {
void set(bool value) {
// isSelected_ = value; disabled on purpose for future use
PropertyChanged(this, ref new PropertyChangedEventArgs("_isSelected"));
}
bool get() {
return isSelected_;
}
}
protected: protected:
void NotifyPropertyChanged(String^ propertyName); void NotifyPropertyChanged(String^ propertyName);
private: private:
Windows::Foundation::Collections::IVector<String^>^ devicesIdList_; Windows::Foundation::Collections::IVector<String^>^ devicesIdList_;
bool isSelected_;
}; };
} }
......
...@@ -56,7 +56,11 @@ internal: ...@@ -56,7 +56,11 @@ internal:
void set(Account^ value) void set(Account^ value)
{ {
oldItem_ = currentItem_; oldItem_ = currentItem_;
if (oldItem_)
oldItem_->_isSelected = false;
currentItem_ = value; currentItem_ = value;
if (currentItem_)
currentItem_->_isSelected = true;
if (value) if (value)
newAccountSelected(); newAccountSelected();
else else
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
<views:IncomingVisibility x:Key="_IncomingVisibility_" /> <views:IncomingVisibility x:Key="_IncomingVisibility_" />
<views:OutGoingVisibility x:Key="_OutGoingVisibility_" /> <views:OutGoingVisibility x:Key="_OutGoingVisibility_" />
<views:HasAnActiveCall x:Key="_HasAnActiveCall_" /> <views:HasAnActiveCall x:Key="_HasAnActiveCall_" />
<views:AccountTypeToSourceImage x:Key="_AccountTypeToSourceImage_" />
<views:AccountSelectedToVisibility x:Key="_AccountSelectedToVisibility_" />
<Style x:Key="addContactTextBoxStyle" <Style x:Key="addContactTextBoxStyle"
TargetType="TextBox"> TargetType="TextBox">
...@@ -171,36 +173,42 @@ ...@@ -171,36 +173,42 @@
<!-- template for accounts. --> <!-- template for accounts. -->
<DataTemplate x:Key="AccountTemplate" <DataTemplate x:Key="AccountTemplate"
x:DataType="local:Account"> x:DataType="local:Account">
<Grid> <Grid Margin="0,10">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="260"/> <ColumnDefinition Width="40"/>
<ColumnDefinition Width="60"/> <ColumnDefinition Width="290"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Border Grid.Column="0"
<RowDefinition Height="30"/> Margin="5,0"
<RowDefinition Height="30"/> Style="{StaticResource BorderStyle3}">
</Grid.RowDefinitions> <Image x:Name="_AccountTypeIcon_"
<TextBlock x:Name="_accountName_" VerticalAlignment="Center"
Grid.Column="0" HorizontalAlignment="Center"
Grid.Row="0" Source="{x:Bind accountType_, Converter={StaticResource _AccountTypeToSourceImage_}, Mode=OneWay}"/>
Margin="10,5,10,0" </Border>
<Button x:Name="_editAccountMenuButton_"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Content="&#xE104;"
FontFamily="Segoe MDL2 Assets"
FontSize="20"
Foreground="White"
Background="Transparent"
Visibility="{x:Bind _isSelected, Converter={StaticResource _AccountSelectedToVisibility_}, Mode=OneWay}"
Grid.Column="1">
<Button.RenderTransform>
<TranslateTransform X="-5" Y="-5"/>
</Button.RenderTransform>
</Button>
<StackPanel Grid.Column="1">
<TextBlock x:Name="_accountName_"
Style="{StaticResource TextStyle5}"
Text="{x:Bind name_}"/> Text="{x:Bind name_}"/>
<TextBlock x:Name="_accountType_" <TextBlock x:Name="_ringID_"
Grid.Column="1"
Grid.Row="0"
TextAlignment="Right"
Margin="0,5,18,0"
Foreground="ForestGreen"
Text="{x:Bind accountType_}"/>
<TextBlock x:Name="_ringID_"
Grid.Column="0"
Grid.ColumnSpan="2" Grid.ColumnSpan="2"
Grid.Row="1" Style="{StaticResource TextStyle6}"
Foreground="Crimson"
Margin="10,5,10,0"
FontSize="14"
TextTrimming="CharacterEllipsis"
Text="{x:Bind ringID_}"/> Text="{x:Bind ringID_}"/>
</StackPanel>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
<!-- template for smartpanelitems. --> <!-- template for smartpanelitems. -->
......
...@@ -667,3 +667,39 @@ void RingClientUWP::Views::SmartPanel::_shareMenuDone__Click(Platform::Object^ s ...@@ -667,3 +667,39 @@ void RingClientUWP::Views::SmartPanel::_shareMenuDone__Click(Platform::Object^ s
_shareMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _shareMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
} }
Object ^ RingClientUWP::Views::AccountTypeToSourceImage::Convert(Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object ^ parameter, String ^ language)
{
auto accountType = dynamic_cast<String^>(value);
Uri^ uri = (accountType == "RING")
? ref new Uri("ms-appx:///Assets/AccountTypeRING.png")
: ref new Uri("ms-appx:///Assets/AccountTypeSIP.png");
return ref new BitmapImage(uri);
}
Object ^ RingClientUWP::Views::AccountTypeToSourceImage::ConvertBack(Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object ^ parameter, String ^ language)
{
throw ref new Platform::NotImplementedException();
}
RingClientUWP::Views::AccountTypeToSourceImage::AccountTypeToSourceImage()
{}
Object ^ RingClientUWP::Views::AccountSelectedToVisibility::Convert(Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object ^ parameter, String ^ language)
{
//auto accountId = static_cast<bool(value);
if (/*AccountsViewModel::instance->selectedAccount->_isSelected ==*/ (bool)value == true)
return Windows::UI::Xaml::Visibility::Visible;
return Windows::UI::Xaml::Visibility::Collapsed;
}
Object ^ RingClientUWP::Views::AccountSelectedToVisibility::ConvertBack(Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object ^ parameter, String ^ language)
{
throw ref new Platform::NotImplementedException();
}
RingClientUWP::Views::AccountSelectedToVisibility::AccountSelectedToVisibility()
{}
...@@ -50,6 +50,20 @@ public: ...@@ -50,6 +50,20 @@ public:
HasAnActiveCall(); HasAnActiveCall();
}; };
public ref class AccountTypeToSourceImage sealed : IValueConverter {
public:
virtual Object^ Convert(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language);
virtual Object^ ConvertBack(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language);
AccountTypeToSourceImage();
};
public ref class AccountSelectedToVisibility sealed : IValueConverter {
public:
virtual Object^ Convert(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language);
virtual Object^ ConvertBack(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language);
AccountSelectedToVisibility();
};
public ref class NewMessageBubleNotification sealed : IValueConverter { public ref class NewMessageBubleNotification sealed : IValueConverter {
public: public:
virtual Object^ Convert(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language); virtual Object^ Convert(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language);
......
...@@ -67,6 +67,30 @@ ...@@ -67,6 +67,30 @@
<Setter Property="Foreground" <Setter Property="Foreground"
Value="Black"/> Value="Black"/>
</Style> </Style>
<Style x:Key="TextStyle5"
TargetType="TextBlock">
<Setter Property="FontSize"
Value="15"/>
<Setter Property="HorizontalAlignment"
Value="Left"/>
<Setter Property="VerticalAlignment"
Value="Center"/>
<Setter Property="FontStyle"
Value="Italic"/>
<Setter Property="Foreground"
Value="Black"/>
</Style>
<Style x:Key="TextStyle6"
TargetType="TextBlock">
<Setter Property="FontSize"
Value="12"/>
<Setter Property="HorizontalAlignment"
Value="Left"/>
<Setter Property="VerticalAlignment"
Value="Center"/>
<Setter Property="Foreground"
Value="Black"/>
</Style>
<Style x:Key="TextSegoeStyle1" <Style x:Key="TextSegoeStyle1"
TargetType="TextBlock"> TargetType="TextBlock">
<Setter Property="FontFamily" <Setter Property="FontFamily"
...@@ -165,6 +189,19 @@ ...@@ -165,6 +189,19 @@
<Setter Property="Background" <Setter Property="Background"
Value="Transparent"/> Value="Transparent"/>
</Style> </Style>
<Style x:Key="ButtonStyle7"
TargetType="Button">
<Setter Property="Width"
Value="20"/>
<Setter Property="Height"
Value="20"/>
<Setter Property="FontFamily"
Value="Segoe MDL2 Assets"/>
<Setter Property="Foreground"
Value="White"/>
<Setter Property="Background"
Value="Transparent"/>
</Style>
<Style x:Key="ToggleButtonStyle1" <Style x:Key="ToggleButtonStyle1"
TargetType="ToggleButton"> TargetType="ToggleButton">
<Setter Property="Width" <Setter Property="Width"
...@@ -279,6 +316,16 @@ ...@@ -279,6 +316,16 @@
<Setter Property="Height" Value="23"/> <Setter Property="Height" Value="23"/>
<Setter Property="Padding" Value="4"/> <Setter Property="Padding" Value="4"/>
</Style> </Style>
<Style x:Key="BorderStyle3"
TargetType="Border">
<Setter Property="Background" Value="LightBlue"/>
<Setter Property="CornerRadius" Value="6"/>
<Setter Property="Width" Value="28"/>
<Setter Property="Height" Value="50"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="white"/>
<Setter Property="Padding" Value="4"/>
</Style>
<Style x:Key="messageBubleStyle" <Style x:Key="messageBubleStyle"
TargetType="ListBoxItem"> TargetType="ListBoxItem">
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalAlignment" Value="Stretch" />
......
...@@ -262,6 +262,8 @@ ...@@ -262,6 +262,8 @@
<None Include="ring-client-uwp_TemporaryKey.pfx" /> <None Include="ring-client-uwp_TemporaryKey.pfx" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="Assets\AccountTypeRING.png" />
<Image Include="Assets\AccountTypeSIP.png" />
<Image Include="Assets\LockScreenLogo.scale-200.png" /> <Image Include="Assets\LockScreenLogo.scale-200.png" />
<Image Include="Assets\qrCodeIcon.png" /> <Image Include="Assets\qrCodeIcon.png" />
<Image Include="Assets\SplashScreen.scale-200.png" /> <Image Include="Assets\SplashScreen.scale-200.png" />
......
...@@ -217,6 +217,12 @@ ...@@ -217,6 +217,12 @@
<Image Include="Assets\qrCodeIcon.png"> <Image Include="Assets\qrCodeIcon.png">
<Filter>Assets</Filter> <Filter>Assets</Filter>
</Image> </Image>
<Image Include="Assets\AccountTypeSIP.png">
<Filter>Assets\TESTS</Filter>
</Image>
<Image Include="Assets\AccountTypeRING.png">
<Filter>Assets\TESTS</Filter>
</Image>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AppxManifest Include="Package.appxmanifest" /> <AppxManifest Include="Package.appxmanifest" />
......
Supports Markdown
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