Skip to content

Commit 272c89f

Browse files
committed
First running conversion
1 parent cb6b309 commit 272c89f

File tree

114 files changed

+2857
-30
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+2857
-30
lines changed

ExpandingCollection.iOS.sln

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,41 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 2012
44
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Naxam.ExpandingCollection.iOS", "Naxam.ExpandingCollection.iOS\Naxam.ExpandingCollection.iOS.csproj", "{D8FC2316-B25A-4E17-AB1C-87581F89859F}"
55
EndProject
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExpandingCollectionQs", "ExpandingCollectionQs\ExpandingCollectionQs.csproj", "{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}"
7+
EndProject
68
Global
79
GlobalSection(SolutionConfigurationPlatforms) = preSolution
810
Debug|Any CPU = Debug|Any CPU
911
Release|Any CPU = Release|Any CPU
12+
Debug|iPhoneSimulator = Debug|iPhoneSimulator
13+
Release|iPhone = Release|iPhone
14+
Release|iPhoneSimulator = Release|iPhoneSimulator
15+
Debug|iPhone = Debug|iPhone
1016
EndGlobalSection
1117
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1218
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1319
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Debug|Any CPU.Build.0 = Debug|Any CPU
1420
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Release|Any CPU.ActiveCfg = Release|Any CPU
1521
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
23+
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
24+
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Release|iPhone.ActiveCfg = Release|Any CPU
25+
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Release|iPhone.Build.0 = Release|Any CPU
26+
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
27+
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
28+
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Debug|iPhone.ActiveCfg = Debug|Any CPU
29+
{D8FC2316-B25A-4E17-AB1C-87581F89859F}.Debug|iPhone.Build.0 = Debug|Any CPU
30+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
31+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
32+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Release|Any CPU.ActiveCfg = Release|iPhone
33+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Release|Any CPU.Build.0 = Release|iPhone
34+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
35+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
36+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Release|iPhone.ActiveCfg = Release|iPhone
37+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Release|iPhone.Build.0 = Release|iPhone
38+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
39+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
40+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Debug|iPhone.ActiveCfg = Debug|iPhone
41+
{6BD68FDB-362E-4A1E-88DD-54F4EDE466D6}.Debug|iPhone.Build.0 = Debug|iPhone
1642
EndGlobalSection
1743
EndGlobal
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
using System;
2+
using System.ComponentModel;
3+
using CoreAnimation;
4+
using CoreGraphics;
5+
using Foundation;
6+
using UIKit;
7+
using Naxam.ExpandingCollection.iOS;
8+
9+
namespace ExpandingCollectionQs
10+
{
11+
public interface IRotatable
12+
{
13+
void RotateAnimationFrom(UIView fromItem, UIView toItem, nfloat duration);
14+
}
15+
16+
public static class RotatableExtensions
17+
{
18+
public static void RotateAnimationFrom(this IRotatable rotable, UIView fromItem, UIView toItem, nfloat duration)
19+
{
20+
var fromRotate = AnimationFrom(0, to: (nfloat)Math.PI, key: "transform.rotation", duration: duration);
21+
var fromOpacity = AnimationFrom(1, to: 0, key: "opacity", duration: duration);
22+
var toRotate = AnimationFrom(-(nfloat)Math.PI, to: 0, key: "transform.rotation", duration: duration);
23+
var toOpacity = AnimationFrom(0, to: 1, key: "opacity", duration: duration);
24+
25+
fromItem.Layer.AddAnimation(fromRotate, null);
26+
fromItem.Layer.AddAnimation(fromOpacity, null);
27+
toItem.Layer.AddAnimation(toRotate, null);
28+
toItem.Layer.AddAnimation(toOpacity, null);
29+
}
30+
31+
static CABasicAnimation AnimationFrom(nfloat from, nfloat to, string key, nfloat duration)
32+
{
33+
var animation = CABasicAnimation.FromKeyPath(key);
34+
35+
animation.Duration = duration;
36+
animation.From = NSNumber.FromNFloat(from);
37+
animation.To = NSNumber.FromNFloat(to);
38+
animation.FillMode = CAFillMode.Forwards;
39+
animation.RemovedOnCompletion = false;
40+
41+
return animation;
42+
}
43+
}
44+
45+
46+
[Register(nameof(AnimatingBarButton)), DesignTimeVisible(true)]
47+
public class AnimatingBarButton : UIBarButtonItem, IRotatable
48+
{
49+
protected AnimatingBarButton(IntPtr handle) : base(handle)
50+
{
51+
// Note: this .ctor should not contain any initialization logic
52+
}
53+
54+
[Export("normalImageName"), Browsable(true), DisplayName("Normal Image")]
55+
public NSString NormalImageName { get; set; } = new NSString(string.Empty);
56+
57+
[Export("selectedImageName"), Browsable(true), DisplayName("Selected Image")]
58+
public NSString SelectedImageName { get; set; } = new NSString(string.Empty);
59+
60+
[Export("duration"), Browsable(true), DisplayName("Duration")]
61+
public nfloat Duration { get; set; } = 1;
62+
63+
public UIImageView NormalView { get; private set; } = new UIImageView(CGRect.Empty);
64+
public UIImageView SelectedView { get; private set; } = new UIImageView(CGRect.Empty);
65+
66+
public override void AwakeFromNib()
67+
{
68+
base.AwakeFromNib();
69+
70+
CustomView = new UIView(frame: new CGRect(x: 0, y: 0, width: 44, height: 44));
71+
72+
ConfigurateImageViews();
73+
}
74+
75+
76+
public void AnimationSelected(bool selected)
77+
{
78+
if (selected)
79+
{
80+
RotateAnimationFrom(NormalView, toItem: SelectedView, duration: Duration);
81+
}
82+
else
83+
{
84+
RotateAnimationFrom(SelectedView, toItem: NormalView, duration: Duration);
85+
}
86+
}
87+
88+
void ConfigurateImageViews()
89+
{
90+
ConfigureImageView(NormalView, imageName: NormalImageName);
91+
ConfigureImageView(SelectedView, imageName: SelectedImageName);
92+
93+
SelectedView.Alpha = 0;
94+
}
95+
96+
void ConfigureImageView(UIImageView imageView, string imageName)
97+
{
98+
if (CustomView == null) { return; }
99+
100+
imageView.TranslatesAutoresizingMaskIntoConstraints = false;
101+
imageView.Image = UIImage.FromBundle(imageName);
102+
103+
imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
104+
105+
CustomView.AddSubview(imageView);
106+
107+
foreach (var item in new[] {
108+
new Tuple<NSLayoutAttribute, nfloat>(NSLayoutAttribute.CenterX, 12),
109+
new Tuple<NSLayoutAttribute, nfloat>(NSLayoutAttribute.CenterY, -1)
110+
})
111+
{
112+
CustomView.AddConstraint(imageView, x =>
113+
{
114+
x.Attribute = item.Item1;
115+
x.Constant = item.Item2;
116+
});
117+
}
118+
119+
foreach (var item in new[] { NSLayoutAttribute.Height, NSLayoutAttribute.Width })
120+
{
121+
imageView.AddConstraint(x =>
122+
{
123+
x.Attribute = item;
124+
x.Constant = 20;
125+
});
126+
}
127+
}
128+
129+
public void RotateAnimationFrom(UIView fromItem, UIView toItem, nfloat duration)
130+
{
131+
RotatableExtensions.RotateAnimationFrom(this, fromItem, toItem, duration);
132+
}
133+
}
134+
135+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using CoreGraphics;
2+
using Foundation;
3+
using UIKit;
4+
5+
namespace ExpandingCollectionQs
6+
{
7+
// The UIApplicationDelegate for the application. This class is responsible for launching the
8+
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
9+
[Register("AppDelegate")]
10+
public class AppDelegate : UIApplicationDelegate
11+
{
12+
// class-level declarations
13+
14+
public override UIWindow Window
15+
{
16+
get;
17+
set;
18+
}
19+
20+
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
21+
{
22+
// Override point for customization after application launch.
23+
// If not required for your application you can safely delete this method
24+
25+
ConfigureNavigationTabBar();
26+
27+
return true;
28+
}
29+
30+
public override void OnResignActivation(UIApplication application)
31+
{
32+
// Invoked when the application is about to move from active to inactive state.
33+
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
34+
// or when the user quits the application and it begins the transition to the background state.
35+
// Games should use this method to pause the game.
36+
}
37+
38+
public override void DidEnterBackground(UIApplication application)
39+
{
40+
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
41+
// If your application supports background exection this method is called instead of WillTerminate when the user quits.
42+
}
43+
44+
public override void WillEnterForeground(UIApplication application)
45+
{
46+
// Called as part of the transiton from background to active state.
47+
// Here you can undo many of the changes made on entering the background.
48+
}
49+
50+
public override void OnActivated(UIApplication application)
51+
{
52+
// Restart any tasks that were paused (or not yet started) while the application was inactive.
53+
// If the application was previously in the background, optionally refresh the user interface.
54+
}
55+
56+
public override void WillTerminate(UIApplication application)
57+
{
58+
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
59+
}
60+
61+
void ConfigureNavigationTabBar()
62+
{
63+
//transparent background
64+
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
65+
66+
UINavigationBar.Appearance.ShadowImage = new UIImage();
67+
68+
UINavigationBar.Appearance.Translucent = true;
69+
70+
var shadow = new NSShadow
71+
{
72+
ShadowOffset = new CGSize(width: 0, height: 2),
73+
ShadowColor = new UIColor(red: 0, green: 0, blue: 0, alpha: 0.1f)
74+
};
75+
76+
UINavigationBar.Appearance.TitleTextAttributes = new UIStringAttributes {
77+
ForegroundColor = UIColor.White,
78+
Shadow = shadow
79+
};
80+
}
81+
}
82+
}
83+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "29x29",
16+
"scale" : "2x"
17+
},
18+
{
19+
"idiom" : "iphone",
20+
"size" : "29x29",
21+
"scale" : "3x"
22+
},
23+
{
24+
"idiom" : "iphone",
25+
"size" : "40x40",
26+
"scale" : "2x"
27+
},
28+
{
29+
"idiom" : "iphone",
30+
"size" : "40x40",
31+
"scale" : "3x"
32+
},
33+
{
34+
"idiom" : "iphone",
35+
"size" : "60x60",
36+
"scale" : "2x"
37+
},
38+
{
39+
"idiom" : "iphone",
40+
"size" : "60x60",
41+
"scale" : "3x"
42+
}
43+
],
44+
"info" : {
45+
"version" : 1,
46+
"author" : "xcode"
47+
}
48+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "boston.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
1.69 MB
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "item2.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
1.87 MB
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "san_francisco.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}

0 commit comments

Comments
 (0)