public ExercisePreviewViewModel()
{
- Skip = new Command(() => _ = NavigationService.Instance.NavigateToLoadingView());
+ Skip = new Command(() => _ = NavigationService.Instance.NavigateToExercisingView());
+ Back = new Command(NavigationService.Instance.Pop);
PreviousWorkout = new Command(GoPrevious);
NextWorkout = new Command(GoNext);
}
/// <summary>
- /// Review movement
+ /// Gets back command.
/// </summary>
- public ICommand ReviewMovement { get; private set; }
+ public ICommand Back { get; private set; }
/// <summary>
/// Skip review
public class LoadingViewModel : BaseViewModel, IDisposable
{
private const int TickIntervalInMilliseconds = 1500;
- private string text;
- private Timer timer;
- private bool disposed = false;
+ private const int CountingPixelSizeSmall = 120;
+ private const int CountingPixelSizeMedium = 280;
+ private const int CountingPixelSizeLarge = 400;
- private string[] messages = new string[]
+ private readonly string[] messages = new string[]
{
"get ready",
- "1",
- "2",
"3",
+ "2",
+ "1",
"GO!",
string.Empty,
};
+ private string text;
+ private int pixelSize;
+ private Timer timer;
+ private bool disposed = false;
+
public LoadingViewModel()
{
StartCounting();
}
}
+ public int PixelSize
+ {
+ get => pixelSize;
+ set
+ {
+ if (pixelSize != value)
+ {
+ pixelSize = value;
+ RaisePropertyChanged();
+ }
+ }
+ }
+
public void Dispose()
{
Dispose(true);
int count = 0;
timer = new Timer(TickIntervalInMilliseconds);
Text = messages[count++];
+ PixelSize = CountingPixelSizeSmall;
timer.Tick += (sender, args) =>
{
Text = messages[count++];
+ PixelSize = CountingPixelSizeLarge;
- // If next string to display is 'String.Empty'
if (count == messages.Length - 1)
{
- // Workaround.
- // After setting Text to 'GO!', we don't need to wait 1.5 sec before starting preview.
- // But if we move to ExersingView here, the string 'GO!' is not displayed.
- timer.Interval = 0;
+ PixelSize = CountingPixelSizeMedium;
}
if (count == messages.Length)
{
- Services.NavigationService.Instance.NavigateToExercisingView();
return false;
}
private void InitializeCallbacks()
{
- this.reviewButton.Clicked += ReplyVideo;
this.nextButton.Clicked += ReplyVideo;
this.previousButton.Clicked += ReplyVideo;
this.player.Hide();
-using System.Threading.Tasks;
using Fitness.Controls;
-using Fitness.Services;
-using Tizen.Security;
+using Tizen.NUI;
namespace Fitness.Views
{
public LoadingView()
{
InitializeComponent();
+ CountingLabel.PropertyChanged += CountingLabel_PropertyChanged;
+ PropertyMap fontStyle = new PropertyMap();
+ fontStyle.Add("weight", new PropertyValue("medium"));
+ CountingLabel.FontStyle = fontStyle;
+
+ }
+
+ private void CountingLabel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ Services.Logger.Debug($"CountingLabel_PropertyChanged called for {e.PropertyName}. Text: {CountingLabel.Text}");
+ if (e.PropertyName == nameof(CountingLabel.Text) && CountingLabel.Text == string.Empty)
+ {
+ Hide();
+ }
}
}
}
<View.Layout>
<LinearLayout LinearOrientation="Horizontal" LinearAlignment="CenterVertical" CellPadding="40,40"/>
</View.Layout>
- <ctrl:NinePatchButton BindingContext="{Binding Source={x:Reference context}}" Text="Review Movement" Size="{views:SizeInUnits Width=219,Height=26}" Command="{Binding ReviewMovement}" x:Name="reviewButton" behaviors:StyleSetter.Style="{x:Static styles:Buttons.RegularRepeat}"/>
- <ctrl:NinePatchButton BindingContext="{Binding Source={x:Reference context}}" Text="Skip" Size="{views:SizeInUnits Width=219,Height=26}" Command="{Binding Skip}" behaviors:StyleSetter.Style="{x:Static styles:Buttons.Regular}"/>
+ <ctrl:NinePatchButton BindingContext="{Binding Source={x:Reference context}}" Text="Back" Size="{views:SizeInUnits Width=219,Height=26}" Command="{Binding Back}" behaviors:StyleSetter.Style="{x:Static styles:Buttons.Regular}"/>
+ <ctrl:NinePatchButton BindingContext="{Binding Source={x:Reference context}}" Text="Let's try!" Size="{views:SizeInUnits Width=219,Height=26}" Command="{Binding Skip}" behaviors:StyleSetter.Style="{x:Static styles:Buttons.Regular}"/>
</View>
</View>
</View>
<views:BarView BindingContext="{Binding Source={x:Reference Root}, Path=BindingContext}"
PrevCommand="{Binding Prev}"
NextCommand="{Binding Next}"/>
+ <views:LoadingView x:Name="LoadingView"/>
</ctrl:Page>
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ctrl="clr-namespace:Fitness.Controls"
xmlns:vm="clr-namespace:Fitness.ViewModels"
- BackgroundColor="#EEEFF1"
+ BackgroundColor="Transparent"
>
<ctrl:Page.BindingContext>
<vm:LoadingViewModel x:Name="context"/>
<ctrl:Page.Layout>
<AbsoluteLayout/>
</ctrl:Page.Layout>
+ <ImageView HeightResizePolicy="FillToParent" WidthResizePolicy="FillToParent" ResourceUrl="*Resource*/layout/images/0_BG_dim.png"/>
<ImageView PositionUsesPivotPoint="true" ParentOrigin="Center" PivotPoint="Center" HeightResizePolicy="SizeRelativeToParent" WidthForHeight="true" SizeModeFactor="0.0,0.8,1.0" ResourceUrl="*Resource*/layout/images/circle.svg" x:Name="image" Opacity="0.48"/>
- <TextLabel Text="{Binding Text}" PixelSize="420" WidthResizePolicy="FillToParent" HeightResizePolicy="FillToParent" PositionUsesPivotPoint="true" PivotPoint="Center" ParentOrigin="Center" VerticalAlignment="Center" HorizontalAlignment="Center" TextColor="#000C2B"/>
+ <TextLabel x:Name="CountingLabel" Text="{Binding Text}" PixelSize="{Binding PixelSize}" WidthResizePolicy="FillToParent" HeightResizePolicy="FillToParent" PositionUsesPivotPoint="true" PivotPoint="Center" ParentOrigin="Center" VerticalAlignment="Center" HorizontalAlignment="Center" TextColor="#000C2B"/>
</ctrl:Page>