Skip to content

Commit

Permalink
updated sample
Browse files Browse the repository at this point in the history
  • Loading branch information
roubachof committed Jun 23, 2021
1 parent 21b924b commit 646f9a1
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>DragAndDropSample.iOS</AssemblyName>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<ProvisioningType>manual</ProvisioningType>
<ProvisioningType>automatic</ProvisioningType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -26,6 +26,11 @@
<MtouchArch>x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
<MtouchSdkVersion>14.5</MtouchSdkVersion>
<MtouchFastDev>false</MtouchFastDev>
<DeviceSpecificBuild>false</DeviceSpecificBuild>
<MtouchEnableSGenConc>false</MtouchEnableSGenConc>
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
Expand All @@ -47,9 +52,10 @@
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<CodesignKey>Apple Development: Jean-Marie Alfonsi (NVUSN2Q6P2)</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignProvision>VS: WildCard Development</CodesignProvision>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
Expand Down
78 changes: 39 additions & 39 deletions DragAndDropSample/DragAndDropSample.iOS/Info.plist
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>MinimumOSVersion</key>
<string>13.2</string>
<key>CFBundleDisplayName</key>
<string>DragAndDropSample</string>
<key>CFBundleIdentifier</key>
<string>com.sharpnado.DragAndDropSample</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleName</key>
<string>Sharpnado.DragAndDropCollection.Sample</string>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>MinimumOSVersion</key>
<string>13.2</string>
<key>CFBundleDisplayName</key>
<string>Sharpnado HLV</string>
<key>CFBundleIdentifier</key>
<string>com.sharpnado.hlvsample</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleName</key>
<string>Sharpnado.DragAndDropCollection.Sample</string>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false />
</dict>
</plist>

Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public int CurrentIndex

public ICommand OnScrollEndCommand { get; private set; }

public ICommand OnDragStarted { get; private set; }

public ICommand OnDragEnded { get; private set; }

public TaskLoaderNotifier<IReadOnlyCollection<SillyDude>> SillyPeopleLoaderNotifier { get; }

public ListMode Mode
Expand Down Expand Up @@ -102,6 +106,20 @@ private void InitCommands()
() => System.Diagnostics.Debug.WriteLine("SillyInfiniteGridPeopleVm: OnScrollBeginCommand"));
OnScrollEndCommand = new Command(
() => System.Diagnostics.Debug.WriteLine("SillyInfiniteGridPeopleVm: OnScrollEndCommand"));

OnDragStarted = new Command(
(info) =>
{
var dragInfo = (DragAndDropInfo)info;
System.Diagnostics.Debug.WriteLine($"OnDragStarted( from: {dragInfo.From}, to: {dragInfo.To} )");
});

OnDragEnded = new Command(
(info) =>
{
var dragInfo = (DragAndDropInfo)info;
System.Diagnostics.Debug.WriteLine($"OnDragEnded( from: {dragInfo.From}, to: {dragInfo.To} )");
});
}

private async Task<PageResult<SillyDude>> LoadSillyPeoplePageAsync(int pageNumber, int pageSize, bool isRefresh)
Expand Down
2 changes: 2 additions & 0 deletions DragAndDropSample/DragAndDropSample/Views/GridPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
CollectionPadding="10,30,10,75"
ColumnCount="2"
CurrentIndex="{Binding CurrentIndex}"
DragAndDropEndedCommand="{Binding OnDragEnded}"
DragAndDropStartedCommand="{Binding OnDragStarted}"
DragAndDropTrigger="Pan"
EnableDragAndDrop="{Binding Source={x:Reference DragAndDropSwitch}, Path=IsToggled}"
InfiniteListLoader="{Binding SillyPeoplePaginator}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public override void OnSelectedChanged(RecyclerView.ViewHolder viewHolder, int a
draggableViewCell.IsDragAndDropping = true;
_draggedViewCell = draggableViewCell;
}

_onDragAndDropStart?.Execute(new DragAndDropInfo(
viewHolder.AdapterPosition,
-1,
((ViewHolder)viewHolder).BindingContext));
}
else if (actionState == ItemTouchHelper.ActionStateIdle)
{
Expand Down Expand Up @@ -122,14 +127,9 @@ public override bool OnMove(

_to = target.AdapterPosition;

// System.Diagnostics.Debug.WriteLine($">>>>> OnMove( from: {viewHolder.AdapterPosition}, to: {target.AdapterPosition} )");
// System.Diagnostics.Debug.WriteLine($">>>>> OnMove( from: {_from}, to: {_to} )");
_recycleViewAdapter.OnItemMoving(viewHolder.AdapterPosition, target.AdapterPosition);

_onDragAndDropStart?.Execute(new DragAndDropInfo(
_from,
_to,
((ViewHolder)viewHolder).BindingContext));

return true;
}

Expand Down
37 changes: 19 additions & 18 deletions Sharpnado.HorizontalListView.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ VisualStudioVersion = 16.0.30621.155
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sharpnado.HorizontalListView", "Sharpnado.HorizontalListView\Sharpnado.HorizontalListView.csproj", "{76625DCB-B2F9-4E7E-AE80-B657AE9D2566}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sharpnado.HorizontalListView.Droid", "Sharpnado.HorizontalListView.Droid\Sharpnado.HorizontalListView.Droid.csproj", "{5C880A51-9E8A-42A9-9FA5-10BC7D3E9FFC}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sharpnado.HorizontalListView.Droid", "Sharpnado.HorizontalListView.Droid\Sharpnado.HorizontalListView.Droid.csproj", "{92E0ECFC-C8C0-4C03-BA61-A2701390D7DE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sharpnado.HorizontalListView.iOS", "Sharpnado.HorizontalListView.iOS\Sharpnado.HorizontalListView.iOS.csproj", "{E71F3053-056C-4381-9638-048ED73BDFF6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sharpnado.HorizontalListView.iOS", "Sharpnado.HorizontalListView.iOS\Sharpnado.HorizontalListView.iOS.csproj", "{798BAFAE-13C4-4E85-A62A-E535403411FE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{8CB48033-BE95-414B-9B59-16038B284788}"
EndProject
Expand Down Expand Up @@ -42,21 +42,21 @@ Global
{76625DCB-B2F9-4E7E-AE80-B657AE9D2566}.Release|Any CPU.Build.0 = Release|Any CPU
{76625DCB-B2F9-4E7E-AE80-B657AE9D2566}.Release|iPhone.ActiveCfg = Release|Any CPU
{76625DCB-B2F9-4E7E-AE80-B657AE9D2566}.Release|iPhone.Build.0 = Release|Any CPU
{5C880A51-9E8A-42A9-9FA5-10BC7D3E9FFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C880A51-9E8A-42A9-9FA5-10BC7D3E9FFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C880A51-9E8A-42A9-9FA5-10BC7D3E9FFC}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{5C880A51-9E8A-42A9-9FA5-10BC7D3E9FFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C880A51-9E8A-42A9-9FA5-10BC7D3E9FFC}.Release|Any CPU.Build.0 = Release|Any CPU
{5C880A51-9E8A-42A9-9FA5-10BC7D3E9FFC}.Release|iPhone.ActiveCfg = Release|Any CPU
{5C880A51-9E8A-42A9-9FA5-10BC7D3E9FFC}.Release|iPhone.Build.0 = Release|Any CPU
{E71F3053-056C-4381-9638-048ED73BDFF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E71F3053-056C-4381-9638-048ED73BDFF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E71F3053-056C-4381-9638-048ED73BDFF6}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{E71F3053-056C-4381-9638-048ED73BDFF6}.Debug|iPhone.Build.0 = Debug|Any CPU
{E71F3053-056C-4381-9638-048ED73BDFF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E71F3053-056C-4381-9638-048ED73BDFF6}.Release|Any CPU.Build.0 = Release|Any CPU
{E71F3053-056C-4381-9638-048ED73BDFF6}.Release|iPhone.ActiveCfg = Release|Any CPU
{E71F3053-056C-4381-9638-048ED73BDFF6}.Release|iPhone.Build.0 = Release|Any CPU
{92E0ECFC-C8C0-4C03-BA61-A2701390D7DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92E0ECFC-C8C0-4C03-BA61-A2701390D7DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92E0ECFC-C8C0-4C03-BA61-A2701390D7DE}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{92E0ECFC-C8C0-4C03-BA61-A2701390D7DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92E0ECFC-C8C0-4C03-BA61-A2701390D7DE}.Release|Any CPU.Build.0 = Release|Any CPU
{92E0ECFC-C8C0-4C03-BA61-A2701390D7DE}.Release|iPhone.ActiveCfg = Release|Any CPU
{92E0ECFC-C8C0-4C03-BA61-A2701390D7DE}.Release|iPhone.Build.0 = Release|Any CPU
{798BAFAE-13C4-4E85-A62A-E535403411FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{798BAFAE-13C4-4E85-A62A-E535403411FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{798BAFAE-13C4-4E85-A62A-E535403411FE}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{798BAFAE-13C4-4E85-A62A-E535403411FE}.Debug|iPhone.Build.0 = Debug|Any CPU
{798BAFAE-13C4-4E85-A62A-E535403411FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{798BAFAE-13C4-4E85-A62A-E535403411FE}.Release|Any CPU.Build.0 = Release|Any CPU
{798BAFAE-13C4-4E85-A62A-E535403411FE}.Release|iPhone.ActiveCfg = Release|Any CPU
{798BAFAE-13C4-4E85-A62A-E535403411FE}.Release|iPhone.Build.0 = Release|Any CPU
{55F41B9B-D1D7-42A3-8E77-A12A42E8A808}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{55F41B9B-D1D7-42A3-8E77-A12A42E8A808}.Debug|Any CPU.Build.0 = Debug|Any CPU
{55F41B9B-D1D7-42A3-8E77-A12A42E8A808}.Debug|iPhone.ActiveCfg = Debug|Any CPU
Expand All @@ -75,13 +75,14 @@ Global
{A07EEB14-ECD1-4D9F-8819-FC1B1FC06001}.Release|iPhone.Build.0 = Release|Any CPU
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Debug|Any CPU.Deploy.0 = Debug|iPhoneSimulator
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Debug|iPhone.ActiveCfg = Debug|iPhone
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Debug|iPhone.Build.0 = Debug|iPhone
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Debug|iPhone.Deploy.0 = Debug|iPhone
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Release|iPhone.ActiveCfg = Release|iPhone
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Release|iPhone.Build.0 = Release|iPhone
{57551E87-1A59-4AF0-8012-BA65C96BA8DC}.Debug|Any CPU.Deploy.0 = Debug|iPhoneSimulator
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 7 additions & 7 deletions Sharpnado.HorizontalListView/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------

[assembly: System.Reflection.AssemblyVersion("1.8.2")]
[assembly: System.Reflection.AssemblyFileVersion("1.8.2")]
[assembly: System.Reflection.AssemblyDescription("Xamarin Forms HorizontalListView, including carousel, vertical and grid layout.")]
[assembly: System.Reflection.AssemblyCompany("Sharpnado")]
[assembly: System.Reflection.AssemblyProduct("Sharpnado.HorizontalListView")]
[assembly: System.Reflection.AssemblyCopyright("Copyright © Sharpnado 2020")]
[assembly: System.Reflection.AssemblyDescription("Xamarin Forms HorizontalListView, including carousel, vertical and grid layout.")]
[assembly: System.Reflection.AssemblyFileVersion("1.8.2")]
[assembly: System.Reflection.AssemblyVersion("1.8.2")]
[assembly: System.Reflection.AssemblyTitle("Sharpnado.HorizontalListView")]


4 changes: 2 additions & 2 deletions Sharpnado.HorizontalListView/ViewModels/DragAndDropInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ namespace Sharpnado.HorizontalListView.ViewModels
{
public class DragAndDropInfo
{
public DragAndDropInfo(int to, int @from, object content)
public DragAndDropInfo(int from, int to, object content)
{
From = from;
To = to;
From = @from;
Content = content;
}

Expand Down

0 comments on commit 646f9a1

Please sign in to comment.