Skip to content

Commit

Permalink
Merge branch 'master' into dialog
Browse files Browse the repository at this point in the history
# Conflicts:
#	FlyoutNavigation/FlyoutNavigationController.cs
  • Loading branch information
Clancey committed Jun 30, 2017
2 parents 8df6848 + b5b61dd commit 6c2b55f
Show file tree
Hide file tree
Showing 17 changed files with 341 additions and 78 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -50,4 +50,5 @@ BASE.*
/nunit-result.xml
/test-results
*.DS_Store
*.ipa
*.ipa
[Pp]ackages
103 changes: 60 additions & 43 deletions FlyoutNavigation.sln
@@ -1,43 +1,60 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyoutNavigationSample", "FlyoutNavigationSample\FlyoutNavigationSample\FlyoutNavigationSample.csproj", "{AAA188F1-E969-4095-BC66-59717D7638BB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyoutNavigation", "FlyoutNavigation\FlyoutNavigation.csproj", "{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|iPhone.ActiveCfg = Debug|iPhone
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|iPhone.Build.0 = Debug|iPhone
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|iPhone.ActiveCfg = Release|iPhone
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|iPhone.Build.0 = Release|iPhone
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|iPhone.Build.0 = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|Any CPU.Build.0 = Release|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|iPhone.ActiveCfg = Release|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|iPhone.Build.0 = Release|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyoutNavigationSample", "FlyoutNavigationSample\FlyoutNavigationSample\FlyoutNavigationSample.csproj", "{AAA188F1-E969-4095-BC66-59717D7638BB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyoutNavigation", "FlyoutNavigation\FlyoutNavigation.csproj", "{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{C0DD6455-C412-486C-96B0-7213C62B0674}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|iPhone.ActiveCfg = Debug|iPhone
{AAA188F1-E969-4095-BC66-59717D7638BB}.Debug|iPhone.Build.0 = Debug|iPhone
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|iPhone.ActiveCfg = Release|iPhone
{AAA188F1-E969-4095-BC66-59717D7638BB}.Release|iPhone.Build.0 = Release|iPhone
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|Any CPU.Build.0 = Release|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Debug|iPhone.Build.0 = Debug|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|iPhone.ActiveCfg = Release|Any CPU
{BEC8904A-0E39-4117-9E4D-AAE6A6A50B4A}.Release|iPhone.Build.0 = Release|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Release|Any CPU.Build.0 = Release|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Debug|iPhone.Build.0 = Debug|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Release|iPhone.ActiveCfg = Release|Any CPU
{C0DD6455-C412-486C-96B0-7213C62B0674}.Release|iPhone.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = FlyoutNavigationSample\FlyoutNavigationSample\FlyoutNavigationSample.csproj
EndGlobalSection
EndGlobal
10 changes: 4 additions & 6 deletions FlyoutNavigation/FlyoutNavigation.csproj
Expand Up @@ -8,6 +8,9 @@
<OutputType>Library</OutputType>
<RootNamespace>FlyoutNavigation</RootNamespace>
<AssemblyName>FlyoutNavigation</AssemblyName>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<BaseIntermediateOutputPath>obj\unified</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
Expand Down Expand Up @@ -40,16 +43,11 @@
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="MonoTouch.Dialog-1" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
<Compile Include="OpenMenuGestureRecognizer.cs" />
<Compile Include="FlyoutNavigationController.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MonoTouch.Dialog\MonoTouch.Dialog\MonoTouch.Dialog.csproj">
<Project>{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}</Project>
<Name>MonoTouch.Dialog</Name>
</ProjectReference>
</ItemGroup>
</Project>
78 changes: 66 additions & 12 deletions FlyoutNavigation/FlyoutNavigationController.cs
Expand Up @@ -288,7 +288,6 @@ void Initialize(UITableViewStyle navigationStyle = UITableViewStyle.Plain)

View.AddGestureRecognizer (openGesture = new UIScreenEdgePanGestureRecognizer(() => DragContentView (openGesture)){Edges = Position == FlyOutNavigationPosition.Left ? UIRectEdge.Left : UIRectEdge.Right});
View.AddGestureRecognizer (closeGesture = new OpenMenuGestureRecognizer (DragContentView, shouldReceiveTouch));

}
void CloseButtonTapped (object sender, EventArgs e)
{
Expand Down Expand Up @@ -337,6 +336,52 @@ public override void ViewDidLayoutSubviews()
}
}

public event EventHandler BeginAnimation;
public event EventHandler EndAnimation;
public event EventHandler OpenChanged;
private bool _prevIsOpen = false;

public class OpenChangedEventArgs : EventArgs
{
public OpenChangedEventArgs(bool isOpen){IsOpen = isOpen;}
public bool IsOpen { get; set; }
}

protected virtual void OnBeginAnimation(EventArgs e)
{
EventHandler handler = BeginAnimation;
if (handler != null)
{
handler (this, e);
}
}

protected virtual void OnEndAnimation(EventArgs e)
{
EventHandler handler = EndAnimation;
if(handler != null)
{
handler (this, e);
}
}

protected void CheckRaiseOpenChanged(){
OnEndAnimation (EventArgs.Empty);
if(_prevIsOpen != IsOpen){
OnOpenChanged (new OpenChangedEventArgs (IsOpen));
_prevIsOpen = IsOpen;
}
}

protected virtual void OnOpenChanged(OpenChangedEventArgs e)
{
EventHandler handler = OpenChanged;
if(handler != null)
{
handler (this, e);
}
}

public void DragContentView(UIGestureRecognizer gesture)
{
var panGesture = gesture as UIPanGestureRecognizer;
Expand All @@ -350,6 +395,7 @@ public void DragContentView(UIGestureRecognizer gesture)
var translation = panGesture.TranslationInView(View).X;
if (panGesture.State == UIGestureRecognizerState.Began)
{
OnBeginAnimation (EventArgs.Empty);
startX = frame.X;
}
else if (panGesture.State == UIGestureRecognizerState.Changed)
Expand Down Expand Up @@ -484,18 +530,25 @@ public void ShowMenu()
//menuBorder.Frame.Width = 1f;
View.InsertSubviewBelow(menuBorder, mainView);
}
UIView.BeginAnimations("slideMenu");

});

OnBeginAnimation (EventArgs.Empty);
UIView.Animate(.2, () =>
{
UIView.SetAnimationCurve(UIViewAnimationCurve.EaseIn);
//UIView.SetAnimationDuration(2);
setViewSize();
CGRect frame = mainView.Frame;
frame.X = Position == FlyOutNavigationPosition.Left ? menuWidth : -menuWidth;
SetLocation(frame);
setViewSize();
frame = mainView.Frame;
SetLocation(frame);
shadowView.Frame = frame;
UIView.CommitAnimations();
});
}, showComplete);

}

void showComplete()
{
CheckRaiseOpenChanged ();
}

void setViewSize()
Expand All @@ -512,13 +565,13 @@ CGRect GetViewBounds()
{
CGRect frame = View.Bounds;
if ((InterfaceOrientation == UIInterfaceOrientation.LandscapeLeft || InterfaceOrientation == UIInterfaceOrientation.LandscapeRight)) {
#if __UNIFIED__
#if UNIFIED || __UNIFIED__
var width = NMath.Max (frame.Width, frame.Height);
#else
var width = Math.Max(frame.Width, frame.Height);
#endif

#if __UNIFIED__
#if UNIFIED || __UNIFIED__
var height = NMath.Min (frame.Width, frame.Height);
#else
var height = Math.Min(frame.Width, frame.Height);
Expand Down Expand Up @@ -596,8 +649,9 @@ public void HideMenu()
[Export("animationEnded")]
void hideComplete()
{
//shadowView.RemoveFromSuperview();
//navigation.View.Hidden = true;
shadowView.RemoveFromSuperview();
navigation.View.Hidden = true;
CheckRaiseOpenChanged ();
}

public void ResignFirstResponders(UIView view)
Expand Down
Expand Up @@ -22,6 +22,7 @@ public partial class AppDelegate : UIApplicationDelegate

public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
Xamarin.Calabash.Start ();
window = new UIWindow (UIScreen.MainScreen.Bounds) {
RootViewController = new MainController ()
};
Expand Down
Expand Up @@ -81,6 +81,11 @@
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="MainController.cs" />
<Compile Include="SwipableTableView.cs" />
<Compile Include="MyStoryboardViewcontroller.cs" />
<Compile Include="MyStoryboardViewcontroller.designer.cs">
<DependentUpon>MyStoryboardViewController.cs</DependentUpon>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
Expand Down
Expand Up @@ -10,12 +10,13 @@
<OutputType>Exe</OutputType>
<RootNamespace>Sample</RootNamespace>
<AssemblyName>Sample</AssemblyName>
<BaseIntermediateOutputPath>obj\unified</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<OutputPath>bin\unified\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;__UNIFIED__;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand All @@ -34,7 +35,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<OutputPath>bin\unified\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
Expand All @@ -52,7 +53,7 @@
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<OutputPath>bin\unified\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand All @@ -73,7 +74,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<OutputPath>bin\unified\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
Expand All @@ -86,16 +87,22 @@
<MtouchI18n>
</MtouchI18n>
<MtouchArch>ARMv7</MtouchArch>
<BuildIpa>true</BuildIpa>
<IpaPackageName>Sample</IpaPackageName>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="MonoTouch.Dialog-1" />
<Reference Include="Calabash">
<HintPath>..\..\packages\Xamarin.TestCloud.Agent.0.19.2\lib\Xamarin.iOS10\Calabash.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
Expand Down
2 changes: 1 addition & 1 deletion FlyoutNavigationSample/FlyoutNavigationSample/Info.plist
Expand Up @@ -21,6 +21,6 @@
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>MinimumOSVersion</key>
<string>5.2</string>
<string>6.0</string>
</dict>
</plist>
12 changes: 7 additions & 5 deletions FlyoutNavigationSample/FlyoutNavigationSample/MainController.cs
Expand Up @@ -40,15 +40,15 @@ public override void ViewDidLoad ()
navigation.View.Frame = UIScreen.MainScreen.Bounds;
View.AddSubview (navigation.View);
this.AddChildViewController (navigation);


var taskList = new Section ("Task List");
taskList.AddAll (Tasks.Select (x => new StringElement (x)));
// Create the menu:
navigation.NavigationRoot = new RootElement ("Task List") {
new Section ("Task List") {
from page in Tasks
select new StringElement (page) as Element
},
taskList,
new Section ("Extras")
{
new BooleanElement("Toggle",true),
new StringElement("Swipable Table"),
new StringElement("Storyboard"),
}
Expand All @@ -57,6 +57,8 @@ public override void ViewDidLoad ()
// Create an array of UINavigationControllers that correspond to your
// menu items:
var viewControllers = Tasks.Select (x => new UINavigationController (new TaskPageController (navigation, x))).ToList ();
//Add null for the toggle switch
viewControllers.Add (null);
viewControllers.Add (new UINavigationController(new SwipableTableView ()));
//Load from Storyboard
var storyboardVc = CreateViewController<MyStoryboardViewController> ("MyStoryBoard","MyStoryboardViewController");
Expand Down

0 comments on commit 6c2b55f

Please sign in to comment.