Skip to content

Commit

Permalink
feat(issue-285): update ui for chatdetail view
Browse files Browse the repository at this point in the history
  • Loading branch information
live-dev999 committed Apr 4, 2022
1 parent c0de605 commit 432d238
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Globalization;
using Xamarin.Forms;

namespace O2NextGen.SmallTalk.Core.Converters
{
public class InversOwnerConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return false;
var val = int.Parse(value.ToString());
if (val == 1)
{
return true;
}
return false;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Xamarin.Forms;

namespace O2NextGen.SmallTalk.Core.Converters
{
public class OwnerConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value == null)
return true;
var val = int.Parse(value.ToString());
if (val == 1)
{
return false;
}
return true;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="O2NextGen.SmallTalk.Core.Views.ChatDetailView"
xmlns:viewModelBase="clr-namespace:O2NextGen.SmallTalk.Core.ViewModels.Base"
xmlns:viewmodels="clr-namespace:O2NextGen.SmallTalk.Core.ViewModels" xmlns:smalltalk="clr-namespace:O2NextGen.Sdk.NetCore.Models.smalltalk;assembly=O2NextGen.Sdk.Models"
xmlns:viewmodels="clr-namespace:O2NextGen.SmallTalk.Core.ViewModels"
xmlns:smalltalk="clr-namespace:O2NextGen.Sdk.NetCore.Models.smalltalk;assembly=O2NextGen.Sdk.Models" xmlns:converter="clr-namespace:O2NextGen.SmallTalk.Core.Converters"
viewModelBase:ViewModelLocator.AutoWireViewModel="true"
x:DataType="viewmodels:ChatDetailViewModel">
<ContentPage.Resources>
<converter:OwnerConverter x:Key="OwnerConverter"/>
<converter:InversOwnerConverter x:Key="InversOwnerConverter"/>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout>
<Label Text="{Binding Session}"></Label>
Expand All @@ -19,15 +24,16 @@
<ListView.ItemTemplate>
<DataTemplate x:DataType="smalltalk:ChatMessage">
<ViewCell>
<Grid >
<Grid ColumnDefinitions="*, 40" Margin="10"
<Grid RowDefinitions="auto,auto">
<Grid ColumnDefinitions="*, 40" Margin="10" IsVisible="{Binding SenderId,Converter={StaticResource OwnerConverter}}"
Grid.Row="1"
>
<!--<Label Text="{Binding UserName}"/>-->
<Frame CornerRadius="10"
HasShadow="True"
HorizontalOptions="Start"
Margin="0"
BackgroundColor="DeepSkyBlue"
Grid.Column="0"
Padding="10">
<StackLayout>
Expand All @@ -37,35 +43,21 @@
</Frame>
</Grid>

<Grid ColumnDefinitions="40, *" Margin="10">
<Label Text="{Binding Id}"/>
<Grid ColumnDefinitions="40, *" Margin="10" IsVisible="{Binding SenderId,Converter={StaticResource InversOwnerConverter}}">
<!--<Label Text="{Binding Id}"/>-->
<Frame CornerRadius="10"
Grid.Column="1"
HorizontalOptions="End"
HasShadow="True"
Margin="0"
BackgroundColor="LightGray"
BackgroundColor="Gray"
Padding="10">
<StackLayout>
<Label Margin="0,0,0,0" Text="{Binding Message}" LineBreakMode="WordWrap"/>
<Label Text="10:18 PM"/>
</StackLayout>
</Frame>
</Grid>

<!--<StackLayout Orientation="Horizontal">
<Label Text="{Binding Id}"/>
<Frame CornerRadius="10"
Grid.Column="1"
HorizontalOptions="End"
HasShadow="True"
Margin="0"
BackgroundColor="LightGray"
Padding="10">
<Label Margin="10" Text="{Binding Message}" LineBreakMode="WordWrap"/>
</Frame>
</StackLayout>-->
</Grid>
</ViewCell>
</DataTemplate>
Expand Down

0 comments on commit 432d238

Please sign in to comment.