Skip to content

Commit

Permalink
fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiMisiukevich committed Mar 23, 2019
1 parent 5ad4892 commit 6c26708
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 37 deletions.
18 changes: 0 additions & 18 deletions TouchEffect/Controls/Obsolete.cs

This file was deleted.

5 changes: 2 additions & 3 deletions TouchEffect/EventArgs/TouchCompletedEventArgs.cs
@@ -1,7 +1,6 @@
using System;
namespace TouchEffect.EventArgs
namespace TouchEffect.EventArgs
{
public class TouchCompletedEventArgs : System.EventArgs
public class TouchCompletedEventArgs : System.EventArgs
{
public TouchCompletedEventArgs(object parameter)
{
Expand Down
5 changes: 2 additions & 3 deletions TouchEffect/EventArgs/TouchStateChangedEventArgs.cs
@@ -1,8 +1,7 @@
using System;
using TouchEffect.Enums;
using TouchEffect.Enums;
namespace TouchEffect.EventArgs
{
public class TouchStateChangedEventArgs : System.EventArgs
public class TouchStateChangedEventArgs : System.EventArgs
{
public TouchStateChangedEventArgs(TouchState state)
{
Expand Down
2 changes: 1 addition & 1 deletion TouchEffect/Extensions/TouchViewExtenisons.cs
Expand Up @@ -5,6 +5,6 @@ namespace TouchEffect.Extensions
public static class TouchViewExtenisons
{
public static TouchView AsTouchView(this BindableObject bindable)
=> bindable as TouchView;
=> bindable as TouchView;
}
}
1 change: 0 additions & 1 deletion TouchEffect/TouchEffect.csproj
Expand Up @@ -11,7 +11,6 @@
<Folder Include="Delegates\" />
<Folder Include="EventArgs\" />
<Folder Include="Enums\" />
<Folder Include="Controls\" />
<Folder Include="Extensions\" />
</ItemGroup>
<ItemGroup>
Expand Down
24 changes: 13 additions & 11 deletions TouchEffect/TouchView.cs
Expand Up @@ -36,13 +36,15 @@ public class TouchView : AbsoluteLayout
nameof(Status),
typeof(TouchStatus),
typeof(TouchView),
TouchStatus.Completed);
TouchStatus.Completed,
BindingMode.OneWayToSource);

public static readonly BindableProperty StateProperty = BindableProperty.Create(
nameof(State),
typeof(TouchState),
typeof(TouchView),
TouchState.Regular);
TouchState.Regular,
BindingMode.OneWayToSource);

public static readonly BindableProperty RegularBackgroundColorProperty = BindableProperty.Create(
nameof(RegularBackgroundColor),
Expand Down Expand Up @@ -479,7 +481,7 @@ public Image BackgroundImage

public void HandleTouch(TouchStatus status)
{
var canExecuteCommand = !IsEnabled || Command == null || Completed == null;
var canExecuteCommand = IsEnabled && (Command != null || Completed != null);

if (status != TouchStatus.Started || canExecuteCommand)
{
Expand Down Expand Up @@ -541,7 +543,7 @@ protected async void OnStateChanged(TouchView sender, TouchStateChangedEventArgs
}

protected void ForceStateChanged()
=> OnStateChanged(this, new TouchStateChangedEventArgs(State));
=> OnStateChanged(this, new TouchStateChangedEventArgs(State));

protected void SetBackgroundImage(TouchState state)
{
Expand Down Expand Up @@ -762,12 +764,12 @@ protected async Task SetRotationY(TouchState state)
}

private Task GetAnimationTask(TouchState state)
=> Task.WhenAll(SetBackgroundColor(state),
SetOpacity(state),
SetScale(state),
SetTranslation(state),
SetRotation(state),
SetRotationX(state),
SetRotationY(state));
=> Task.WhenAll(SetBackgroundColor(state),
SetOpacity(state),
SetScale(state),
SetTranslation(state),
SetRotation(state),
SetRotationX(state),
SetRotationY(state));
}
}

0 comments on commit 6c26708

Please sign in to comment.