Skip to content

Instantly share code, notes, and snippets.

@nuno-morais
Created February 24, 2018 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuno-morais/e785e1169f7af64f831a9234e35d5864 to your computer and use it in GitHub Desktop.
Save nuno-morais/e785e1169f7af64f831a9234e35d5864 to your computer and use it in GitHub Desktop.
Changed StackLayout to Grid
<ActionBar [title]="Title">
<GridLayout class="ActionBarChatContainer" columns="15*,85*" (tap)="GoToOtherChatUsersInfo()">
<Image col="0" *ngIf="Image != null" [src]="Image" stretch="aspectFit"></Image>
<Image col="0" *ngIf="Image == null" [src]="DefaultImage" stretch="aspectFit"></Image>
<GridLayout col="1" columns="*,auto">
<StackLayout col="0" orientation="vertical">
<StackLayout>
<Label class="SectionTitle" [text]="Title"></Label>
</StackLayout>
<Label text="Online"></Label>
</StackLayout>
<Label col="1" class="FontIcon" text="&#xf054;"></Label>
</GridLayout>
</GridLayout>
</ActionBar>
<GridLayout rows="*,auto">
<RadListView #chatMessagesListView row="0" class="ChatMessagesListView"
[items]="ChatMessages" selectionBehavior="None"
(itemHold)="OpenActionsDialog(ChatMessages.getItem($event.index))"
(scrolled)="OnScrolling($event)" (scrollStarted)="OnScrollStarted($event)"
scrollPosition="Bottom">
<ListViewStaggeredLayout tkListViewLayout scrollDirection="Vertical" spanCount="1">
</ListViewStaggeredLayout>
<ng-template tkListItemTemplate let-item="item">
<GridLayout columns="*" rows="auto">
<GridLayout columns="*" rows="auto"
[class]="item.UserId == User.Id ? 'MyMessageContainer' : 'OthersMessageContainer'"
[horizontalAlignment]="item.UserId == User.Id ? 'right' : 'left'">
<GridLayout rows="auto,auto" class="MessageContent">
<StackLayout row="0" orientation="horizontal" *ngIf="item.IsContentDeleted">
<Label class="FontIcon DeletedIcon" text="&#xf014;">
</Label>
<Label class="DeletedMessageLabel" textWrap="true"
text="Esta mensagem foi apagada.">
</Label>
</StackLayout>
<GridLayout rows="auto" row="0" *ngIf="!item.IsContentDeleted">
<Label row="0" *ngIf="item.ContentType == 'Text'"
[text]="item.Content" class="MessageLabel" textWrap="true"
verticalAlignment="top">
</Label>
<GridLayout row="0" rows="auto" *ngIf="item.ContentType == 'image/jpeg'"
class="MessageImage">
<Image
stretch="aspectFill"
height="auto" width="auto" verticalAlignment="top"
[src]="item.TempImagePath || DefaultImage">
</Image>
<ActivityIndicator *ngIf="item.TempImagePath == null"
[busy]="item.TempImagePath == null"></ActivityIndicator>
</GridLayout>
</GridLayout>
<StackLayout row="1" orientation="horizontal" horizontalAlignment="right">
<Label *ngIf="item.CreationDate < Today" class="MessageDateLabel"
[text]="item.CreationDate | date:'dd/MM/yyyy HH:mm'">
</Label>
<Label *ngIf="item.CreationDate >= Today" class="MessageDateLabel"
[text]="item.CreationDate | date:'HH:mm'">
</Label>
<Label *ngIf="item == LastReadByOthersChatMessage" class="FontIcon ReadIcon"
text="&#xf06e;">
</Label>
<Label *ngIf="item.UserId != User.Id && IsNewReceivedMessage(item)"
class="FontIcon NotReadIcon"
text="&#xf111;">
</Label>
</StackLayout>
</GridLayout>
</GridLayout>
</GridLayout>
</ng-template>
</RadListView>
<StackLayout row="0" class="ActivityIndicatorContainer" *ngIf="IsBusy">
<ActivityIndicator [busy]="IsBusy"></ActivityIndicator>
</StackLayout>
<StackLayout row="1" class="FooterActionsBar">
<GridLayout class="SendChatMessageContainer" columns="*,auto,auto">
<GridLayout row="0" col="0" class="InputContainer" columns="*,auto" >
<TextField class="MessageTextView" row="0" col="0" [(ngModel)]="MessageToSend"
hint="Escrever aqui..." returnKeyType="send" (returnPress)="SendTextMessage()">
</TextField>
<Button #btn class="SendButton IconButton FontIcon" row="0" col="1" text=" &#xf1d8; "
(tap)="SendTextMessage()" [isEnabled]="!IsMessageToSendEmpty()"></Button>
</GridLayout>
<Button row="0" class="IconButton FontIcon" col="1" text=" &#xf1c5; " (tap)="SelectImage()"></Button>
<Button row="0" class="IconButton FontIcon" col="2" text=" &#xf030; " (tap)="TakeAndSendCameraPicture()"></Button>
</GridLayout>
</StackLayout>
</GridLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment