Browse Source

iOS/Android build fix

pull/2581/head
Nikita Tsukanov 7 years ago
parent
commit
f97c0c6368
  1. 5
      dirs.proj
  2. 16
      src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidTouchEventsHelper.cs
  3. 1
      src/iOS/Avalonia.iOS/Avalonia.iOS.csproj
  4. 16
      src/iOS/Avalonia.iOS/TopLevelImpl.cs

5
dirs.proj

@ -8,10 +8,11 @@
<ProjectReference Remove="src/Markup/Avalonia.Markup.Xaml/PortableXaml/**/*.*proj" /> <ProjectReference Remove="src/Markup/Avalonia.Markup.Xaml/PortableXaml/**/*.*proj" />
<ProjectReference Remove="src/Markup/Avalonia.Markup.Xaml/XamlIl/**/*.*proj" /> <ProjectReference Remove="src/Markup/Avalonia.Markup.Xaml/XamlIl/**/*.*proj" />
</ItemGroup> </ItemGroup>
<!-- Disabled on CI because of ancient MSBuild project format --> <ItemGroup Condition="!Exists('$(MSBuildExtensionsPath)\Xamarin\Android')">
<ItemGroup>
<ProjectReference Remove="src/Android/**/*.*proj" /> <ProjectReference Remove="src/Android/**/*.*proj" />
<ProjectReference Remove="samples/ControlCatalog.Android/ControlCatalog.Android.csproj" /> <ProjectReference Remove="samples/ControlCatalog.Android/ControlCatalog.Android.csproj" />
</ItemGroup>
<ItemGroup Condition="!Exists('$(MSBuildExtensionsPath)\Xamarin\iOS')">
<ProjectReference Remove="src/iOS/**/*.*proj" /> <ProjectReference Remove="src/iOS/**/*.*proj" />
<ProjectReference Remove="samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj" /> <ProjectReference Remove="samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj" />
</ItemGroup> </ItemGroup>

16
src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidTouchEventsHelper.cs

@ -33,7 +33,7 @@ namespace Avalonia.Android.Platform.Specific.Helpers
return null; return null;
} }
RawMouseEventType? mouseEventType = null; RawPointerEventType? mouseEventType = null;
var eventTime = DateTime.Now; var eventTime = DateTime.Now;
//Basic touch support //Basic touch support
switch (e.Action) switch (e.Action)
@ -42,17 +42,17 @@ namespace Avalonia.Android.Platform.Specific.Helpers
//may be bot flood the evnt system with too many event especially on not so powerfull mobile devices //may be bot flood the evnt system with too many event especially on not so powerfull mobile devices
if ((eventTime - _lastTouchMoveEventTime).TotalMilliseconds > 10) if ((eventTime - _lastTouchMoveEventTime).TotalMilliseconds > 10)
{ {
mouseEventType = RawMouseEventType.Move; mouseEventType = RawPointerEventType.Move;
} }
break; break;
case MotionEventActions.Down: case MotionEventActions.Down:
mouseEventType = RawMouseEventType.LeftButtonDown; mouseEventType = RawPointerEventType.LeftButtonDown;
break; break;
case MotionEventActions.Up: case MotionEventActions.Up:
mouseEventType = RawMouseEventType.LeftButtonUp; mouseEventType = RawPointerEventType.LeftButtonUp;
break; break;
} }
@ -75,14 +75,14 @@ namespace Avalonia.Android.Platform.Specific.Helpers
//we need to generate mouse move before first mouse down event //we need to generate mouse move before first mouse down event
//as this is the way buttons are working every time //as this is the way buttons are working every time
//otherwise there is a problem sometimes //otherwise there is a problem sometimes
if (mouseEventType == RawMouseEventType.LeftButtonDown) if (mouseEventType == RawPointerEventType.LeftButtonDown)
{ {
var me = new RawMouseEventArgs(mouseDevice, (uint)eventTime.Ticks, inputRoot, var me = new RawPointerEventArgs(mouseDevice, (uint)eventTime.Ticks, inputRoot,
RawMouseEventType.Move, _point, InputModifiers.None); RawPointerEventType.Move, _point, InputModifiers.None);
_view.Input(me); _view.Input(me);
} }
var mouseEvent = new RawMouseEventArgs(mouseDevice, (uint)eventTime.Ticks, inputRoot, var mouseEvent = new RawPointerEventArgs(mouseDevice, (uint)eventTime.Ticks, inputRoot,
mouseEventType.Value, _point, InputModifiers.LeftMouseButton); mouseEventType.Value, _point, InputModifiers.LeftMouseButton);
_view.Input(mouseEvent); _view.Input(mouseEvent);

1
src/iOS/Avalonia.iOS/Avalonia.iOS.csproj

@ -6,6 +6,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\packages\Avalonia\Avalonia.csproj" /> <ProjectReference Include="..\..\..\packages\Avalonia\Avalonia.csproj" />
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" ExcludeAssets="All" />
</ItemGroup> </ItemGroup>
<Import Project="..\..\Shared\PlatformSupport\PlatformSupport.projitems" Label="Shared" /> <Import Project="..\..\Shared\PlatformSupport\PlatformSupport.projitems" Label="Shared" />
<Import Project="..\..\..\build\Rx.props" /> <Import Project="..\..\..\build\Rx.props" />

16
src/iOS/Avalonia.iOS/TopLevelImpl.cs

@ -86,11 +86,11 @@ namespace Avalonia.iOS
{ {
var location = touch.LocationInView(this).ToAvalonia(); var location = touch.LocationInView(this).ToAvalonia();
Input?.Invoke(new RawMouseEventArgs( Input?.Invoke(new RawPointerEventArgs(
iOSPlatform.MouseDevice, iOSPlatform.MouseDevice,
(uint)touch.Timestamp, (uint)touch.Timestamp,
_inputRoot, _inputRoot,
RawMouseEventType.LeftButtonUp, RawPointerEventType.LeftButtonUp,
location, location,
InputModifiers.None)); InputModifiers.None));
} }
@ -104,11 +104,11 @@ namespace Avalonia.iOS
{ {
var location = touch.LocationInView(this).ToAvalonia(); var location = touch.LocationInView(this).ToAvalonia();
_touchLastPoint = location; _touchLastPoint = location;
Input?.Invoke(new RawMouseEventArgs(iOSPlatform.MouseDevice, (uint)touch.Timestamp, _inputRoot, Input?.Invoke(new RawPointerEventArgs(iOSPlatform.MouseDevice, (uint)touch.Timestamp, _inputRoot,
RawMouseEventType.Move, location, InputModifiers.None)); RawPointerEventType.Move, location, InputModifiers.None));
Input?.Invoke(new RawMouseEventArgs(iOSPlatform.MouseDevice, (uint)touch.Timestamp, _inputRoot, Input?.Invoke(new RawPointerEventArgs(iOSPlatform.MouseDevice, (uint)touch.Timestamp, _inputRoot,
RawMouseEventType.LeftButtonDown, location, InputModifiers.None)); RawPointerEventType.LeftButtonDown, location, InputModifiers.None));
} }
} }
@ -119,8 +119,8 @@ namespace Avalonia.iOS
{ {
var location = touch.LocationInView(this).ToAvalonia(); var location = touch.LocationInView(this).ToAvalonia();
if (iOSPlatform.MouseDevice.Captured != null) if (iOSPlatform.MouseDevice.Captured != null)
Input?.Invoke(new RawMouseEventArgs(iOSPlatform.MouseDevice, (uint)touch.Timestamp, _inputRoot, Input?.Invoke(new RawPointerEventArgs(iOSPlatform.MouseDevice, (uint)touch.Timestamp, _inputRoot,
RawMouseEventType.Move, location, InputModifiers.LeftMouseButton)); RawPointerEventType.Move, location, InputModifiers.LeftMouseButton));
else else
{ {
//magic number based on test - correction of 0.02 is working perfect //magic number based on test - correction of 0.02 is working perfect

Loading…
Cancel
Save