├── DOFavoriteButtonXamarin.Sample
├── dofavoritebuttonXamarinSample.gif
├── DOFavoriteButtonXamarin.Sample
│ ├── Resources
│ │ ├── 500_icon.png
│ │ ├── heart-8x.png
│ │ ├── link-intact-8x.png
│ │ ├── paperclip-8x.png
│ │ ├── play-circle-8x.png
│ │ ├── power-standby-8x.png
│ │ ├── magnifying-glass-8x.png
│ │ └── LaunchScreen.xib
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Icon20.png
│ │ │ ├── Icon29.png
│ │ │ ├── Icon40.png
│ │ │ ├── Icon58.png
│ │ │ ├── Icon60.png
│ │ │ ├── Icon76.png
│ │ │ ├── Icon80.png
│ │ │ ├── Icon87.png
│ │ │ ├── Icon1024.png
│ │ │ ├── Icon120.png
│ │ │ ├── Icon152.png
│ │ │ ├── Icon167.png
│ │ │ ├── Icon180.png
│ │ │ └── Contents.json
│ ├── Entitlements.plist
│ ├── Main.cs
│ ├── ViewController.designer.cs
│ ├── ViewController.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── LaunchScreen.storyboard
│ ├── Info.plist
│ ├── AppDelegate.cs
│ ├── DOFavoriteButtonXamarin.Sample.csproj
│ └── Main.storyboard
├── DOFavoriteButtonXamarin.Sample.sln
└── .gitignore
├── DOFavoriteButtonXamarin
├── DOFavoriteButton.designer.cs
├── Properties
│ └── AssemblyInfo.cs
├── DOFavoriteButtonXamarin.csproj
└── DOFavoriteButton.cs
├── LICENSE
├── README.md
└── .gitignore
/DOFavoriteButtonXamarin.Sample/dofavoritebuttonXamarinSample.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/dofavoritebuttonXamarinSample.gif
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/500_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/500_icon.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/heart-8x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/heart-8x.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/link-intact-8x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/link-intact-8x.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/paperclip-8x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/paperclip-8x.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/play-circle-8x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/play-circle-8x.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/power-standby-8x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/power-standby-8x.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/magnifying-glass-8x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/magnifying-glass-8x.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon20.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon29.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon40.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon58.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon58.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon60.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon76.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon80.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon87.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon87.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon1024.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon120.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon152.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon167.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon167.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimoSalomaki/DOFavoriteButton.Xamarin/HEAD/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Icon180.png
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Main.cs:
--------------------------------------------------------------------------------
1 | using UIKit;
2 |
3 | namespace DOFavoriteButtonXamarin.Sample
4 | {
5 | public class Application
6 | {
7 | // This is the main entry point of the application.
8 | static void Main(string[] args)
9 | {
10 | // if you want to use a different Application Delegate class from "AppDelegate"
11 | // you can specify it here.
12 | UIApplication.Main(args, null, "AppDelegate");
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin/DOFavoriteButton.designer.cs:
--------------------------------------------------------------------------------
1 | // WARNING
2 | //
3 | // This file has been generated automatically by Visual Studio from the outlets and
4 | // actions declared in your storyboard file.
5 | // Manual changes to this file will not be maintained.
6 | //
7 | using Foundation;
8 | using System;
9 | using System.CodeDom.Compiler;
10 |
11 | namespace DOFavoriteButtonXamarin
12 | {
13 | [Register ("DOFavoriteButton")]
14 | partial class DOFavoriteButton
15 | {
16 | void ReleaseDesignerOutlets ()
17 | {
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/ViewController.designer.cs:
--------------------------------------------------------------------------------
1 | // WARNING
2 | //
3 | // This file has been generated automatically by Visual Studio from the outlets and
4 | // actions declared in your storyboard file.
5 | // Manual changes to this file will not be maintained.
6 | //
7 | using Foundation;
8 | using System;
9 | using System.CodeDom.Compiler;
10 | using UIKit;
11 |
12 | namespace DOFavoriteButtonXamarin.Sample
13 | {
14 | [Register ("ViewController")]
15 | partial class ViewController
16 | {
17 | void ReleaseDesignerOutlets ()
18 | {
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Timo Salomäki
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DOFavoriteButton.Xamarin
2 | [](https://app.fossa.com/projects/git%2Bgithub.com%2FHankiDesign%2FDOFavoriteButton.Xamarin?ref=badge_small)
3 | 
4 | 
5 | 
6 | 
7 |
8 | DOFavoriteButton.Xamarin is a Xamarin.iOS port of the Swift based [DOFavoriteButton](https://github.com/okmr-d/DOFavoriteButton) control created by [Daiki Okumura](https://github.com/okmr-d).
9 |
10 | 
11 |
12 | ## Requirements
13 | - Xamarin.iOS 7.0+
14 | - iOS 7.0+
15 |
16 | ## Credit
17 | The original library, as well as this port, was inspired by [Twitter's iOS app](https://itunes.apple.com/us/app/twitter/id333903271).
18 |
19 | ## License
20 | This software is released under the MIT License.
21 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/ViewController.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using System;
3 | using UIKit;
4 |
5 | namespace DOFavoriteButtonXamarin.Sample
6 | {
7 | public partial class ViewController : UIViewController
8 | {
9 | public ViewController(IntPtr handle) : base(handle)
10 | {
11 | }
12 |
13 | public override void ViewDidLoad()
14 | {
15 | base.ViewDidLoad();
16 | ImageButton.AddTarget(ImageButtonTapped, UIControlEvent.TouchUpInside);
17 | ImageButton2.AddTarget(ImageButtonTapped, UIControlEvent.TouchUpInside);
18 | ImageButton3.AddTarget(ImageButtonTapped, UIControlEvent.TouchUpInside);
19 | ImageButton4.AddTarget(ImageButtonTapped, UIControlEvent.TouchUpInside);
20 | ImageButton5.AddTarget(ImageButtonTapped, UIControlEvent.TouchUpInside);
21 | }
22 |
23 | private void ImageButtonTapped(object sender, EventArgs e)
24 | {
25 | var senderButton = sender as DOFavoriteButton;
26 |
27 | if(senderButton.IsSelected)
28 | {
29 | senderButton.Deselect();
30 | }
31 |
32 | else
33 | {
34 | senderButton.Select();
35 | }
36 | }
37 |
38 | public override void DidReceiveMemoryWarning()
39 | {
40 | base.DidReceiveMemoryWarning();
41 | // Release any cached data, images, etc that aren't in use.
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("DOFavoriteButtonXamarin")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DOFavoriteButtonXamarin")]
13 | [assembly: AssemblyCopyright("Copyright © Timo Salomäki 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("50c7b8c9-e664-45af-b88e-0c9b8b9c1be1")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("DOFavoriteButtonXamarin.Sample")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DOFavoriteButtonXamarin.Sample")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("50c7b8c9-e664-45af-b88e-0c9b8b9c1be1")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDisplayName
6 | DOFavoriteButtonXamarin.Sample
7 | CFBundleIdentifier
8 | com.hankidesign.DOFavoriteButtonXamarin-Sample
9 | CFBundleShortVersionString
10 | 1.0
11 | CFBundleVersion
12 | 1.0
13 | LSRequiresIPhoneOS
14 |
15 | MinimumOSVersion
16 | 12.2
17 | UIDeviceFamily
18 |
19 | 1
20 | 2
21 |
22 | UILaunchStoryboardName
23 | LaunchScreen
24 | UIMainStoryboardFile
25 | Main
26 | UIMainStoryboardFile~ipad
27 | Main
28 | UIRequiredDeviceCapabilities
29 |
30 | armv7
31 |
32 | UISupportedInterfaceOrientations
33 |
34 | UIInterfaceOrientationPortrait
35 | UIInterfaceOrientationLandscapeLeft
36 | UIInterfaceOrientationLandscapeRight
37 |
38 | UISupportedInterfaceOrientations~ipad
39 |
40 | UIInterfaceOrientationPortrait
41 | UIInterfaceOrientationPortraitUpsideDown
42 | UIInterfaceOrientationLandscapeLeft
43 | UIInterfaceOrientationLandscapeRight
44 |
45 | XSAppIconAssets
46 | Assets.xcassets/AppIcon.appiconset
47 | CFBundleName
48 | DOFavoriteButtonXamarin.Sample
49 |
50 |
51 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin/DOFavoriteButtonXamarin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {76D12118-8509-4DA5-929F-508F4793389A}
9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | {a52b8a63-bc84-4b47-910d-692533484892}
11 | Library
12 | DOFavoriteButtonXamarin
13 | Resources
14 | DOFavoriteButtonXamarin
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug
21 | DEBUG;
22 | prompt
23 | 4
24 | false
25 |
26 |
27 | full
28 | true
29 | bin\Release
30 | prompt
31 | 4
32 | false
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DOFavoriteButtonXamarin.Sample", "DOFavoriteButtonXamarin.Sample\DOFavoriteButtonXamarin.Sample.csproj", "{47FBF0BF-CE1E-4080-9DDC-7E6A6D1D1D6A}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DOFavoriteButtonXamarin", "..\DOFavoriteButtonXamarin\DOFavoriteButtonXamarin.csproj", "{76D12118-8509-4DA5-929F-508F4793389A}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|iPhoneSimulator = Debug|iPhoneSimulator
11 | Release|iPhoneSimulator = Release|iPhoneSimulator
12 | Debug|iPhone = Debug|iPhone
13 | Release|iPhone = Release|iPhone
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {47FBF0BF-CE1E-4080-9DDC-7E6A6D1D1D6A}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
17 | {47FBF0BF-CE1E-4080-9DDC-7E6A6D1D1D6A}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
18 | {47FBF0BF-CE1E-4080-9DDC-7E6A6D1D1D6A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
19 | {47FBF0BF-CE1E-4080-9DDC-7E6A6D1D1D6A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
20 | {47FBF0BF-CE1E-4080-9DDC-7E6A6D1D1D6A}.Debug|iPhone.ActiveCfg = Debug|iPhone
21 | {47FBF0BF-CE1E-4080-9DDC-7E6A6D1D1D6A}.Debug|iPhone.Build.0 = Debug|iPhone
22 | {47FBF0BF-CE1E-4080-9DDC-7E6A6D1D1D6A}.Release|iPhone.ActiveCfg = Release|iPhone
23 | {47FBF0BF-CE1E-4080-9DDC-7E6A6D1D1D6A}.Release|iPhone.Build.0 = Release|iPhone
24 | {76D12118-8509-4DA5-929F-508F4793389A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
25 | {76D12118-8509-4DA5-929F-508F4793389A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
26 | {76D12118-8509-4DA5-929F-508F4793389A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
27 | {76D12118-8509-4DA5-929F-508F4793389A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
28 | {76D12118-8509-4DA5-929F-508F4793389A}.Debug|iPhone.ActiveCfg = Debug|Any CPU
29 | {76D12118-8509-4DA5-929F-508F4793389A}.Debug|iPhone.Build.0 = Debug|Any CPU
30 | {76D12118-8509-4DA5-929F-508F4793389A}.Release|iPhone.ActiveCfg = Release|Any CPU
31 | {76D12118-8509-4DA5-929F-508F4793389A}.Release|iPhone.Build.0 = Release|Any CPU
32 | EndGlobalSection
33 | EndGlobal
34 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using UIKit;
3 |
4 | namespace DOFavoriteButtonXamarin.Sample
5 | {
6 | // The UIApplicationDelegate for the application. This class is responsible for launching the
7 | // User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
8 | [Register("AppDelegate")]
9 | public class AppDelegate : UIApplicationDelegate
10 | {
11 | // class-level declarations
12 |
13 | public override UIWindow Window
14 | {
15 | get;
16 | set;
17 | }
18 |
19 | public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
20 | {
21 | // Override point for customization after application launch.
22 | // If not required for your application you can safely delete this method
23 |
24 | return true;
25 | }
26 |
27 | public override void OnResignActivation(UIApplication application)
28 | {
29 | // Invoked when the application is about to move from active to inactive state.
30 | // This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
31 | // or when the user quits the application and it begins the transition to the background state.
32 | // Games should use this method to pause the game.
33 | }
34 |
35 | public override void DidEnterBackground(UIApplication application)
36 | {
37 | // Use this method to release shared resources, save user data, invalidate timers and store the application state.
38 | // If your application supports background exection this method is called instead of WillTerminate when the user quits.
39 | }
40 |
41 | public override void WillEnterForeground(UIApplication application)
42 | {
43 | // Called as part of the transiton from background to active state.
44 | // Here you can undo many of the changes made on entering the background.
45 | }
46 |
47 | public override void OnActivated(UIApplication application)
48 | {
49 | // Restart any tasks that were paused (or not yet started) while the application was inactive.
50 | // If the application was previously in the background, optionally refresh the user interface.
51 | }
52 |
53 | public override void WillTerminate(UIApplication application)
54 | {
55 | // Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
56 | }
57 | }
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "scale": "2x",
5 | "size": "20x20",
6 | "idiom": "iphone",
7 | "filename": "Icon40.png"
8 | },
9 | {
10 | "scale": "3x",
11 | "size": "20x20",
12 | "idiom": "iphone",
13 | "filename": "Icon60.png"
14 | },
15 | {
16 | "scale": "2x",
17 | "size": "29x29",
18 | "idiom": "iphone",
19 | "filename": "Icon58.png"
20 | },
21 | {
22 | "scale": "3x",
23 | "size": "29x29",
24 | "idiom": "iphone",
25 | "filename": "Icon87.png"
26 | },
27 | {
28 | "scale": "2x",
29 | "size": "40x40",
30 | "idiom": "iphone",
31 | "filename": "Icon80.png"
32 | },
33 | {
34 | "scale": "3x",
35 | "size": "40x40",
36 | "idiom": "iphone",
37 | "filename": "Icon120.png"
38 | },
39 | {
40 | "scale": "2x",
41 | "size": "60x60",
42 | "idiom": "iphone",
43 | "filename": "Icon120.png"
44 | },
45 | {
46 | "scale": "3x",
47 | "size": "60x60",
48 | "idiom": "iphone",
49 | "filename": "Icon180.png"
50 | },
51 | {
52 | "scale": "1x",
53 | "size": "20x20",
54 | "idiom": "ipad",
55 | "filename": "Icon20.png"
56 | },
57 | {
58 | "scale": "2x",
59 | "size": "20x20",
60 | "idiom": "ipad",
61 | "filename": "Icon40.png"
62 | },
63 | {
64 | "scale": "1x",
65 | "size": "29x29",
66 | "idiom": "ipad",
67 | "filename": "Icon29.png"
68 | },
69 | {
70 | "scale": "2x",
71 | "size": "29x29",
72 | "idiom": "ipad",
73 | "filename": "Icon58.png"
74 | },
75 | {
76 | "scale": "1x",
77 | "size": "40x40",
78 | "idiom": "ipad",
79 | "filename": "Icon40.png"
80 | },
81 | {
82 | "scale": "2x",
83 | "size": "40x40",
84 | "idiom": "ipad",
85 | "filename": "Icon80.png"
86 | },
87 | {
88 | "scale": "1x",
89 | "size": "76x76",
90 | "idiom": "ipad",
91 | "filename": "Icon76.png"
92 | },
93 | {
94 | "scale": "2x",
95 | "size": "76x76",
96 | "idiom": "ipad",
97 | "filename": "Icon152.png"
98 | },
99 | {
100 | "scale": "2x",
101 | "size": "83.5x83.5",
102 | "idiom": "ipad",
103 | "filename": "Icon167.png"
104 | },
105 | {
106 | "scale": "1x",
107 | "size": "1024x1024",
108 | "idiom": "ios-marketing",
109 | "filename": "Icon1024.png"
110 | }
111 | ],
112 | "properties": {},
113 | "info": {
114 | "version": 1,
115 | "author": "xcode"
116 | }
117 | }
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Resources/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
21 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015/2017 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # Visual Studio 2017 auto generated files
33 | Generated\ Files/
34 |
35 | # MSTest test Results
36 | [Tt]est[Rr]esult*/
37 | [Bb]uild[Ll]og.*
38 |
39 | # NUNIT
40 | *.VisualState.xml
41 | TestResult.xml
42 |
43 | # Build Results of an ATL Project
44 | [Dd]ebugPS/
45 | [Rr]eleasePS/
46 | dlldata.c
47 |
48 | # Benchmark Results
49 | BenchmarkDotNet.Artifacts/
50 |
51 | # .NET Core
52 | project.lock.json
53 | project.fragment.lock.json
54 | artifacts/
55 | **/Properties/launchSettings.json
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_i.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *.log
81 | *.vspscc
82 | *.vssscc
83 | .builds
84 | *.pidb
85 | *.svclog
86 | *.scc
87 |
88 | # Chutzpah Test files
89 | _Chutzpah*
90 |
91 | # Visual C++ cache files
92 | ipch/
93 | *.aps
94 | *.ncb
95 | *.opendb
96 | *.opensdf
97 | *.sdf
98 | *.cachefile
99 | *.VC.db
100 | *.VC.VC.opendb
101 |
102 | # Visual Studio profiler
103 | *.psess
104 | *.vsp
105 | *.vspx
106 | *.sap
107 |
108 | # Visual Studio Trace Files
109 | *.e2e
110 |
111 | # TFS 2012 Local Workspace
112 | $tf/
113 |
114 | # Guidance Automation Toolkit
115 | *.gpState
116 |
117 | # ReSharper is a .NET coding add-in
118 | _ReSharper*/
119 | *.[Rr]e[Ss]harper
120 | *.DotSettings.user
121 |
122 | # JustCode is a .NET coding add-in
123 | .JustCode
124 |
125 | # TeamCity is a build add-in
126 | _TeamCity*
127 |
128 | # DotCover is a Code Coverage Tool
129 | *.dotCover
130 |
131 | # AxoCover is a Code Coverage Tool
132 | .axoCover/*
133 | !.axoCover/settings.json
134 |
135 | # Visual Studio code coverage results
136 | *.coverage
137 | *.coveragexml
138 |
139 | # NCrunch
140 | _NCrunch_*
141 | .*crunch*.local.xml
142 | nCrunchTemp_*
143 |
144 | # MightyMoose
145 | *.mm.*
146 | AutoTest.Net/
147 |
148 | # Web workbench (sass)
149 | .sass-cache/
150 |
151 | # Installshield output folder
152 | [Ee]xpress/
153 |
154 | # DocProject is a documentation generator add-in
155 | DocProject/buildhelp/
156 | DocProject/Help/*.HxT
157 | DocProject/Help/*.HxC
158 | DocProject/Help/*.hhc
159 | DocProject/Help/*.hhk
160 | DocProject/Help/*.hhp
161 | DocProject/Help/Html2
162 | DocProject/Help/html
163 |
164 | # Click-Once directory
165 | publish/
166 |
167 | # Publish Web Output
168 | *.[Pp]ublish.xml
169 | *.azurePubxml
170 | # Note: Comment the next line if you want to checkin your web deploy settings,
171 | # but database connection strings (with potential passwords) will be unencrypted
172 | *.pubxml
173 | *.publishproj
174 |
175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
176 | # checkin your Azure Web App publish settings, but sensitive information contained
177 | # in these scripts will be unencrypted
178 | PublishScripts/
179 |
180 | # NuGet Packages
181 | *.nupkg
182 | # The packages folder can be ignored because of Package Restore
183 | **/[Pp]ackages/*
184 | # except build/, which is used as an MSBuild target.
185 | !**/[Pp]ackages/build/
186 | # Uncomment if necessary however generally it will be regenerated when needed
187 | #!**/[Pp]ackages/repositories.config
188 | # NuGet v3's project.json files produces more ignorable files
189 | *.nuget.props
190 | *.nuget.targets
191 |
192 | # Microsoft Azure Build Output
193 | csx/
194 | *.build.csdef
195 |
196 | # Microsoft Azure Emulator
197 | ecf/
198 | rcf/
199 |
200 | # Windows Store app package directories and files
201 | AppPackages/
202 | BundleArtifacts/
203 | Package.StoreAssociation.xml
204 | _pkginfo.txt
205 | *.appx
206 |
207 | # Visual Studio cache files
208 | # files ending in .cache can be ignored
209 | *.[Cc]ache
210 | # but keep track of directories ending in .cache
211 | !*.[Cc]ache/
212 |
213 | # Others
214 | ClientBin/
215 | ~$*
216 | *~
217 | *.dbmdl
218 | *.dbproj.schemaview
219 | *.jfm
220 | *.pfx
221 | *.publishsettings
222 | orleans.codegen.cs
223 |
224 | # Including strong name files can present a security risk
225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
226 | #*.snk
227 |
228 | # Since there are multiple workflows, uncomment next line to ignore bower_components
229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
230 | #bower_components/
231 |
232 | # RIA/Silverlight projects
233 | Generated_Code/
234 |
235 | # Backup & report files from converting an old project file
236 | # to a newer Visual Studio version. Backup files are not needed,
237 | # because we have git ;-)
238 | _UpgradeReport_Files/
239 | Backup*/
240 | UpgradeLog*.XML
241 | UpgradeLog*.htm
242 | ServiceFabricBackup/
243 | *.rptproj.bak
244 |
245 | # SQL Server files
246 | *.mdf
247 | *.ldf
248 | *.ndf
249 |
250 | # Business Intelligence projects
251 | *.rdl.data
252 | *.bim.layout
253 | *.bim_*.settings
254 | *.rptproj.rsuser
255 |
256 | # Microsoft Fakes
257 | FakesAssemblies/
258 |
259 | # GhostDoc plugin setting file
260 | *.GhostDoc.xml
261 |
262 | # Node.js Tools for Visual Studio
263 | .ntvs_analysis.dat
264 | node_modules/
265 |
266 | # Visual Studio 6 build log
267 | *.plg
268 |
269 | # Visual Studio 6 workspace options file
270 | *.opt
271 |
272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
273 | *.vbw
274 |
275 | # Visual Studio LightSwitch build output
276 | **/*.HTMLClient/GeneratedArtifacts
277 | **/*.DesktopClient/GeneratedArtifacts
278 | **/*.DesktopClient/ModelManifest.xml
279 | **/*.Server/GeneratedArtifacts
280 | **/*.Server/ModelManifest.xml
281 | _Pvt_Extensions
282 |
283 | # Paket dependency manager
284 | .paket/paket.exe
285 | paket-files/
286 |
287 | # FAKE - F# Make
288 | .fake/
289 |
290 | # JetBrains Rider
291 | .idea/
292 | *.sln.iml
293 |
294 | # CodeRush
295 | .cr/
296 |
297 | # Python Tools for Visual Studio (PTVS)
298 | __pycache__/
299 | *.pyc
300 |
301 | # Cake - Uncomment if you are using it
302 | # tools/**
303 | # !tools/packages.config
304 |
305 | # Tabs Studio
306 | *.tss
307 |
308 | # Telerik's JustMock configuration file
309 | *.jmconfig
310 |
311 | # BizTalk build output
312 | *.btp.cs
313 | *.btm.cs
314 | *.odx.cs
315 | *.xsd.cs
316 |
317 | # OpenCover UI analysis results
318 | OpenCover/
319 |
320 | # Azure Stream Analytics local run output
321 | ASALocalRun/
322 |
323 | # MSBuild Binary and Structured Log
324 | *.binlog
325 |
326 | # NVidia Nsight GPU debugger configuration file
327 | *.nvuser
328 |
329 | # MFractors (Xamarin productivity tool) working folder
330 | .mfractor/
331 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | iPhoneSimulator
6 | {47FBF0BF-CE1E-4080-9DDC-7E6A6D1D1D6A}
7 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
8 | {edc1b0fa-90cd-4038-8fad-98fe74adb368}
9 | Exe
10 | DOFavoriteButtonXamarin.Sample
11 | DOFavoriteButtonXamarin.Sample
12 | Resources
13 | true
14 | NSUrlSessionHandler
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\iPhoneSimulator\Debug
21 | DEBUG
22 | prompt
23 | 4
24 | false
25 | x86_64
26 | None
27 | true
28 | 12.1
29 |
30 |
31 | none
32 | true
33 | bin\iPhoneSimulator\Release
34 | prompt
35 | 4
36 | None
37 | x86_64
38 | false
39 |
40 |
41 | true
42 | full
43 | false
44 | bin\iPhone\Debug
45 | DEBUG
46 | prompt
47 | 4
48 | false
49 | ARM64
50 | Entitlements.plist
51 | iPhone Developer
52 | true
53 |
54 |
55 | none
56 | true
57 | bin\iPhone\Release
58 | prompt
59 | 4
60 | Entitlements.plist
61 | ARM64
62 | false
63 | iPhone Developer
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | false
79 |
80 |
81 | false
82 |
83 |
84 | false
85 |
86 |
87 | false
88 |
89 |
90 | false
91 |
92 |
93 | false
94 |
95 |
96 | false
97 |
98 |
99 | false
100 |
101 |
102 | false
103 |
104 |
105 | false
106 |
107 |
108 | false
109 |
110 |
111 | false
112 |
113 |
114 | false
115 |
116 |
117 | false
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 | ViewController.cs
137 |
138 |
139 |
140 |
141 | {76D12118-8509-4DA5-929F-508F4793389A}
142 | DOFavoriteButtonXamarin
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/.gitignore:
--------------------------------------------------------------------------------
1 | # globs
2 | Makefile.in
3 | *.userprefs
4 | *.usertasks
5 | config.make
6 | config.status
7 | aclocal.m4
8 | install-sh
9 | autom4te.cache/
10 | *.tar.gz
11 | tarballs/
12 | test-results/
13 |
14 | # Mac bundle stuff
15 | *.dmg
16 | *.app
17 |
18 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
19 | # General
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 |
24 | # Icon must end with two \r
25 | Icon
26 |
27 |
28 | # Thumbnails
29 | ._*
30 |
31 | # Files that might appear in the root of a volume
32 | .DocumentRevisions-V100
33 | .fseventsd
34 | .Spotlight-V100
35 | .TemporaryItems
36 | .Trashes
37 | .VolumeIcon.icns
38 | .com.apple.timemachine.donotpresent
39 |
40 | # Directories potentially created on remote AFP share
41 | .AppleDB
42 | .AppleDesktop
43 | Network Trash Folder
44 | Temporary Items
45 | .apdisk
46 |
47 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
48 | # Windows thumbnail cache files
49 | Thumbs.db
50 | ehthumbs.db
51 | ehthumbs_vista.db
52 |
53 | # Dump file
54 | *.stackdump
55 |
56 | # Folder config file
57 | [Dd]esktop.ini
58 |
59 | # Recycle Bin used on file shares
60 | $RECYCLE.BIN/
61 |
62 | # Windows Installer files
63 | *.cab
64 | *.msi
65 | *.msix
66 | *.msm
67 | *.msp
68 |
69 | # Windows shortcuts
70 | *.lnk
71 |
72 | # content below from: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
73 | ## Ignore Visual Studio temporary files, build results, and
74 | ## files generated by popular Visual Studio add-ons.
75 | ##
76 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
77 |
78 | # User-specific files
79 | *.suo
80 | *.user
81 | *.userosscache
82 | *.sln.docstates
83 |
84 | # User-specific files (MonoDevelop/Xamarin Studio)
85 | *.userprefs
86 |
87 | # Build results
88 | [Dd]ebug/
89 | [Dd]ebugPublic/
90 | [Rr]elease/
91 | [Rr]eleases/
92 | x64/
93 | x86/
94 | bld/
95 | [Bb]in/
96 | [Oo]bj/
97 | [Ll]og/
98 |
99 | # Visual Studio 2015/2017 cache/options directory
100 | .vs/
101 | # Uncomment if you have tasks that create the project's static files in wwwroot
102 | #wwwroot/
103 |
104 | # Visual Studio 2017 auto generated files
105 | Generated\ Files/
106 |
107 | # MSTest test Results
108 | [Tt]est[Rr]esult*/
109 | [Bb]uild[Ll]og.*
110 |
111 | # NUNIT
112 | *.VisualState.xml
113 | TestResult.xml
114 |
115 | # Build Results of an ATL Project
116 | [Dd]ebugPS/
117 | [Rr]eleasePS/
118 | dlldata.c
119 |
120 | # Benchmark Results
121 | BenchmarkDotNet.Artifacts/
122 |
123 | # .NET Core
124 | project.lock.json
125 | project.fragment.lock.json
126 | artifacts/
127 |
128 | # StyleCop
129 | StyleCopReport.xml
130 |
131 | # Files built by Visual Studio
132 | *_i.c
133 | *_p.c
134 | *_h.h
135 | *.ilk
136 | *.meta
137 | *.obj
138 | *.iobj
139 | *.pch
140 | *.pdb
141 | *.ipdb
142 | *.pgc
143 | *.pgd
144 | *.rsp
145 | *.sbr
146 | *.tlb
147 | *.tli
148 | *.tlh
149 | *.tmp
150 | *.tmp_proj
151 | *_wpftmp.csproj
152 | *.log
153 | *.vspscc
154 | *.vssscc
155 | .builds
156 | *.pidb
157 | *.svclog
158 | *.scc
159 |
160 | # Chutzpah Test files
161 | _Chutzpah*
162 |
163 | # Visual C++ cache files
164 | ipch/
165 | *.aps
166 | *.ncb
167 | *.opendb
168 | *.opensdf
169 | *.sdf
170 | *.cachefile
171 | *.VC.db
172 | *.VC.VC.opendb
173 |
174 | # Visual Studio profiler
175 | *.psess
176 | *.vsp
177 | *.vspx
178 | *.sap
179 |
180 | # Visual Studio Trace Files
181 | *.e2e
182 |
183 | # TFS 2012 Local Workspace
184 | $tf/
185 |
186 | # Guidance Automation Toolkit
187 | *.gpState
188 |
189 | # ReSharper is a .NET coding add-in
190 | _ReSharper*/
191 | *.[Rr]e[Ss]harper
192 | *.DotSettings.user
193 |
194 | # JustCode is a .NET coding add-in
195 | .JustCode
196 |
197 | # TeamCity is a build add-in
198 | _TeamCity*
199 |
200 | # DotCover is a Code Coverage Tool
201 | *.dotCover
202 |
203 | # AxoCover is a Code Coverage Tool
204 | .axoCover/*
205 | !.axoCover/settings.json
206 |
207 | # Visual Studio code coverage results
208 | *.coverage
209 | *.coveragexml
210 |
211 | # NCrunch
212 | _NCrunch_*
213 | .*crunch*.local.xml
214 | nCrunchTemp_*
215 |
216 | # MightyMoose
217 | *.mm.*
218 | AutoTest.Net/
219 |
220 | # Web workbench (sass)
221 | .sass-cache/
222 |
223 | # Installshield output folder
224 | [Ee]xpress/
225 |
226 | # DocProject is a documentation generator add-in
227 | DocProject/buildhelp/
228 | DocProject/Help/*.HxT
229 | DocProject/Help/*.HxC
230 | DocProject/Help/*.hhc
231 | DocProject/Help/*.hhk
232 | DocProject/Help/*.hhp
233 | DocProject/Help/Html2
234 | DocProject/Help/html
235 |
236 | # Click-Once directory
237 | publish/
238 |
239 | # Publish Web Output
240 | *.[Pp]ublish.xml
241 | *.azurePubxml
242 | # Note: Comment the next line if you want to checkin your web deploy settings,
243 | # but database connection strings (with potential passwords) will be unencrypted
244 | *.pubxml
245 | *.publishproj
246 |
247 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
248 | # checkin your Azure Web App publish settings, but sensitive information contained
249 | # in these scripts will be unencrypted
250 | PublishScripts/
251 |
252 | # NuGet Packages
253 | *.nupkg
254 | # The packages folder can be ignored because of Package Restore
255 | **/[Pp]ackages/*
256 | # except build/, which is used as an MSBuild target.
257 | !**/[Pp]ackages/build/
258 | # Uncomment if necessary however generally it will be regenerated when needed
259 | #!**/[Pp]ackages/repositories.config
260 | # NuGet v3's project.json files produces more ignorable files
261 | *.nuget.props
262 | *.nuget.targets
263 |
264 | # Microsoft Azure Build Output
265 | csx/
266 | *.build.csdef
267 |
268 | # Microsoft Azure Emulator
269 | ecf/
270 | rcf/
271 |
272 | # Windows Store app package directories and files
273 | AppPackages/
274 | BundleArtifacts/
275 | Package.StoreAssociation.xml
276 | _pkginfo.txt
277 | *.appx
278 |
279 | # Visual Studio cache files
280 | # files ending in .cache can be ignored
281 | *.[Cc]ache
282 | # but keep track of directories ending in .cache
283 | !*.[Cc]ache/
284 |
285 | # Others
286 | ClientBin/
287 | ~$*
288 | *~
289 | *.dbmdl
290 | *.dbproj.schemaview
291 | *.jfm
292 | *.pfx
293 | *.publishsettings
294 | orleans.codegen.cs
295 |
296 | # Including strong name files can present a security risk
297 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
298 | #*.snk
299 |
300 | # Since there are multiple workflows, uncomment next line to ignore bower_components
301 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
302 | #bower_components/
303 |
304 | # RIA/Silverlight projects
305 | Generated_Code/
306 |
307 | # Backup & report files from converting an old project file
308 | # to a newer Visual Studio version. Backup files are not needed,
309 | # because we have git ;-)
310 | _UpgradeReport_Files/
311 | Backup*/
312 | UpgradeLog*.XML
313 | UpgradeLog*.htm
314 | ServiceFabricBackup/
315 | *.rptproj.bak
316 |
317 | # SQL Server files
318 | *.mdf
319 | *.ldf
320 | *.ndf
321 |
322 | # Business Intelligence projects
323 | *.rdl.data
324 | *.bim.layout
325 | *.bim_*.settings
326 | *.rptproj.rsuser
327 |
328 | # Microsoft Fakes
329 | FakesAssemblies/
330 |
331 | # GhostDoc plugin setting file
332 | *.GhostDoc.xml
333 |
334 | # Node.js Tools for Visual Studio
335 | .ntvs_analysis.dat
336 | node_modules/
337 |
338 | # Visual Studio 6 build log
339 | *.plg
340 |
341 | # Visual Studio 6 workspace options file
342 | *.opt
343 |
344 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
345 | *.vbw
346 |
347 | # Visual Studio LightSwitch build output
348 | **/*.HTMLClient/GeneratedArtifacts
349 | **/*.DesktopClient/GeneratedArtifacts
350 | **/*.DesktopClient/ModelManifest.xml
351 | **/*.Server/GeneratedArtifacts
352 | **/*.Server/ModelManifest.xml
353 | _Pvt_Extensions
354 |
355 | # Paket dependency manager
356 | .paket/paket.exe
357 | paket-files/
358 |
359 | # FAKE - F# Make
360 | .fake/
361 |
362 | # JetBrains Rider
363 | .idea/
364 | *.sln.iml
365 |
366 | # CodeRush personal settings
367 | .cr/personal
368 |
369 | # Python Tools for Visual Studio (PTVS)
370 | __pycache__/
371 | *.pyc
372 |
373 | # Cake - Uncomment if you are using it
374 | # tools/**
375 | # !tools/packages.config
376 |
377 | # Tabs Studio
378 | *.tss
379 |
380 | # Telerik's JustMock configuration file
381 | *.jmconfig
382 |
383 | # BizTalk build output
384 | *.btp.cs
385 | *.btm.cs
386 | *.odx.cs
387 | *.xsd.cs
388 |
389 | # OpenCover UI analysis results
390 | OpenCover/
391 |
392 | # Azure Stream Analytics local run output
393 | ASALocalRun/
394 |
395 | # MSBuild Binary and Structured Log
396 | *.binlog
397 |
398 | # NVidia Nsight GPU debugger configuration file
399 | *.nvuser
400 |
401 | # MFractors (Xamarin productivity tool) working folder
402 | .mfractor/
403 |
404 | # Local History for Visual Studio
405 | .localhistory/
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin.Sample/DOFavoriteButtonXamarin.Sample/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
65 |
87 |
109 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
--------------------------------------------------------------------------------
/DOFavoriteButtonXamarin/DOFavoriteButton.cs:
--------------------------------------------------------------------------------
1 | using CoreAnimation;
2 | using System;
3 | using System.ComponentModel;
4 | using CoreGraphics;
5 | using Foundation;
6 | using UIKit;
7 | using System.Linq;
8 |
9 | namespace DOFavoriteButtonXamarin
10 | {
11 | [Register("DOFavoriteButton"), DesignTimeVisible(true)]
12 | public class DOFavoriteButton : UIButton
13 | {
14 | private UIImage _image;
15 |
16 | private UIColor _imageColorOn = new UIColor(255, 172, 51, 1);
17 | private UIColor _imageColorOff = new UIColor(136, 153, 166, 1);
18 | private UIColor _circleColor = new UIColor(155, 172, 51, 1);
19 | private UIColor _lineColor = new UIColor(250, 120, 68, 1);
20 |
21 | private CAShapeLayer _imageShape;
22 | private CAShapeLayer _circleShape;
23 | private CAShapeLayer _circleMask;
24 | private CAShapeLayer[] _lines;
25 |
26 | private double _duration = 1.0;
27 |
28 | private bool _isSelected;
29 |
30 | private CAKeyFrameAnimation _circleTransform = new CAKeyFrameAnimation() { KeyPath = "transform" };
31 | private CAKeyFrameAnimation _circleMaskTransform = new CAKeyFrameAnimation() { KeyPath = "transform" };
32 | private CAKeyFrameAnimation _lineStrokeStart = new CAKeyFrameAnimation() { KeyPath = "strokeStart" };
33 | private CAKeyFrameAnimation _lineStrokeEnd = new CAKeyFrameAnimation() { KeyPath = "strokeEnd" };
34 | private CAKeyFrameAnimation _lineOpacity = new CAKeyFrameAnimation() { KeyPath = "opacity" };
35 | private CAKeyFrameAnimation _imageTransform = new CAKeyFrameAnimation() { KeyPath = "transform" };
36 |
37 | public DOFavoriteButton(IntPtr handle) : base(handle) { }
38 |
39 | public DOFavoriteButton(CGRect frame) : this(frame, new UIImage()) { }
40 | public DOFavoriteButton() : this(CGRect.Empty) { }
41 |
42 | public DOFavoriteButton(CGRect frame, UIImage image) : base(frame)
43 | {
44 | _image = image;
45 | CreateLayers();
46 | AddTargets();
47 | }
48 |
49 | public DOFavoriteButton(NSCoder aDecoder) : base(aDecoder)
50 | {
51 | CreateLayers();
52 | AddTargets();
53 | }
54 |
55 | [Export("Image"), Browsable(true)]
56 | public UIImage Image
57 | {
58 | get
59 | {
60 | return _image;
61 | }
62 | set
63 | {
64 | _image = value;
65 | CreateLayers();
66 | }
67 | }
68 |
69 | [Export("ImageColorOn"), Browsable(true)]
70 | public UIColor ImageColorOn
71 | {
72 | get
73 | {
74 | return _imageColorOn;
75 | }
76 |
77 | set
78 | {
79 | _imageColorOn = value;
80 |
81 | if (IsSelected && _imageShape != null)
82 | {
83 | _imageShape.FillColor = _imageColorOn.CGColor;
84 | }
85 | }
86 | }
87 |
88 | [Export("ImageColorOff"), Browsable(true)]
89 | public UIColor ImageColorOff
90 | {
91 | get
92 | {
93 | return _imageColorOff;
94 | }
95 |
96 | set
97 | {
98 | _imageColorOff = value;
99 |
100 | if (!IsSelected && _imageShape != null)
101 | {
102 | _imageShape.FillColor = _imageColorOff.CGColor;
103 | }
104 | }
105 | }
106 |
107 | [Export("CircleColor"), Browsable(true)]
108 | public UIColor CircleColor
109 | {
110 | get
111 | {
112 | return _circleColor;
113 | }
114 |
115 | set
116 | {
117 | _circleColor = value;
118 |
119 | if (_circleShape != null)
120 | {
121 | _circleShape.FillColor = _circleColor.CGColor;
122 | }
123 | }
124 | }
125 |
126 | [Export("LineColor"), Browsable(true)]
127 | public UIColor LineColor
128 | {
129 | get
130 | {
131 | return _lineColor;
132 | }
133 |
134 | set
135 | {
136 | _lineColor = value;
137 |
138 | if (_lines != null && _lines.Any())
139 | {
140 | foreach (var line in _lines)
141 | {
142 | _lineColor = value;
143 | line.StrokeColor = _lineColor.CGColor;
144 | }
145 | }
146 | }
147 | }
148 |
149 | [Export("Duration"), Browsable(true)]
150 | public double Duration
151 | {
152 | get
153 | {
154 | return _duration;
155 | }
156 |
157 | set
158 | {
159 | _duration = value;
160 | _circleTransform.Duration = 0.333 * _duration;
161 | _circleMaskTransform.Duration = 0.333 * _duration;
162 | _lineStrokeStart.Duration = 0.6 * _duration;
163 | _lineStrokeEnd.Duration = 0.6 * _duration;
164 | _lineOpacity.Duration = 1.0 * _duration;
165 | _imageTransform.Duration = 1.0 * _duration;
166 | }
167 | }
168 |
169 | public bool IsSelected
170 | {
171 | get
172 | {
173 | return _isSelected;
174 | }
175 |
176 | set
177 | {
178 | if (_isSelected != value)
179 | {
180 | _isSelected = value;
181 | if (_isSelected)
182 | {
183 | _imageShape.FillColor = _imageColorOn.CGColor;
184 | }
185 |
186 | else
187 | {
188 | Deselect();
189 | }
190 | }
191 | }
192 | }
193 |
194 | private void CreateLayers()
195 | {
196 | this.Layer.Sublayers = null;
197 |
198 | var imageFrame = new CGRect(Frame.Size.Width / 2 - Frame.Size.Width / 4, Frame.Size.Height / 2 - Frame.Size.Height / 4, Frame.Size.Width / 2, Frame.Size.Height / 2);
199 | var imgCenterPoint = new CGPoint(imageFrame.GetMidX(), y: imageFrame.GetMidY());
200 | var lineFrame = new CGRect(imageFrame.X - imageFrame.Width / 4, imageFrame.Y - imageFrame.Height / 4, imageFrame.Width * 1.5, imageFrame.Height * 1.5);
201 |
202 | CreateCircleShape(imageFrame, imgCenterPoint);
203 | CreateLines(lineFrame, imgCenterPoint);
204 | CreateImage(imageFrame, imgCenterPoint);
205 | CreateCircleTransformAnimation(imageFrame);
206 | CreateLineStrokeAnimation();
207 | CreateImageTransformAnimation();
208 | }
209 |
210 | private void CreateCircleShape(CGRect imageFrame, CGPoint imgCenterPoint)
211 | {
212 | _circleShape = new CAShapeLayer()
213 | {
214 | Bounds = imageFrame,
215 | Position = imgCenterPoint,
216 | Path = UIBezierPath.FromOval(imageFrame).CGPath,
217 | FillColor = _circleColor.CGColor,
218 | Transform = CATransform3D.MakeScale(0.0F, 0.0F, 1.0F)
219 | };
220 |
221 | this.Layer.AddSublayer(_circleShape);
222 |
223 | _circleMask = new CAShapeLayer()
224 | {
225 | Bounds = imageFrame,
226 | Position = imgCenterPoint,
227 | FillRule = CAShapeLayer.FillRuleEvenOdd
228 | };
229 |
230 | _circleShape.Mask = _circleMask;
231 |
232 | var maskPath = UIBezierPath.FromRect(imageFrame);
233 | maskPath.AddArc(imgCenterPoint, 0.1F, 0.0F, (System.nfloat)(Math.PI * 2F), true);
234 | _circleMask.Path = maskPath.CGPath;
235 | }
236 |
237 | private void CreateLines(CGRect lineFrame, CGPoint imgCenterPoint)
238 | {
239 | var path = new CGPath();
240 | path.MoveToPoint(new CGPoint(lineFrame.GetMidX(), lineFrame.GetMidY()));
241 | path.AddLineToPoint(new CGPoint(lineFrame.X + lineFrame.Width / 2, lineFrame.Y));
242 |
243 | _lines = new CAShapeLayer[5];
244 |
245 | for (int i = 0; i < 5; i++)
246 | {
247 | var line = new CAShapeLayer()
248 | {
249 | Bounds = lineFrame,
250 | Position = imgCenterPoint,
251 | MasksToBounds = true,
252 | Actions = new NSDictionary("strokeStart", new NSNull(), "strokeEnd", new NSNull()),
253 | StrokeColor = _lineColor.CGColor,
254 | LineWidth = 1.25F,
255 | MiterLimit = 1.25F,
256 | Path = path,
257 | LineCap = CAShapeLayer.CapRound,
258 | LineJoin = CAShapeLayer.JoinRound,
259 | StrokeStart = 0.0F,
260 | StrokeEnd = 0.0F,
261 | Opacity = 0.0F,
262 | Transform = CATransform3D.MakeRotation((nfloat)Math.PI / 5F * (nfloat)(i * 2F + 1), 0.0F, 0.0F, 1.0F)
263 | };
264 |
265 | this.Layer.AddSublayer(line);
266 | _lines[i] = line;
267 | }
268 | }
269 |
270 | private void CreateImage(CGRect imageFrame, CGPoint imgCenterPoint)
271 | {
272 | var mask = new CALayer()
273 | {
274 | Contents = _image.CGImage,
275 | Bounds = imageFrame,
276 | Position = imgCenterPoint
277 | };
278 |
279 | _imageShape = new CAShapeLayer()
280 | {
281 | Bounds = imageFrame,
282 | Position = imgCenterPoint,
283 | Path = UIBezierPath.FromRect(imageFrame).CGPath,
284 | FillColor = _imageColorOff.CGColor,
285 | Actions = new NSDictionary("fillColor", new NSNull()),
286 | Mask = mask
287 | };
288 |
289 | this.Layer.AddSublayer(_imageShape);
290 | }
291 |
292 | private void CreateCircleTransformAnimation(CGRect imageFrame)
293 | {
294 | _circleTransform.Duration = 0.333; // 0.0333 * 10
295 | _circleTransform.Values = new NSObject[8] {
296 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.0F, 0.0F, 1.0F)), // 0/10
297 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.5F, 0.5F, 1.0F)), // 1/10
298 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.0F, 1.0F, 1.0F)), // 2/10
299 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.2F, 1.0F, 1.0F)), // 3/10
300 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.3F, 1.3F, 1.0F)), // 4/10
301 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.37F, 1.37F, 1.0F)), // 5/10
302 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.4F, 1.4F, 1.0F)), // 6/10
303 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.4F, 1.4F, 1.0F)) // 10/10
304 | };
305 | _circleTransform.KeyTimes = new NSNumber[8] {
306 | NSNumber.FromDouble(0.0), // 0/10
307 | NSNumber.FromDouble(0.1), // 1/10
308 | NSNumber.FromDouble(0.2), // 2/10
309 | NSNumber.FromDouble(0.3), // 3/10
310 | NSNumber.FromDouble(0.4), // 4/10
311 | NSNumber.FromDouble(0.5), // 5/10
312 | NSNumber.FromDouble(0.6), // 6/10
313 | NSNumber.FromDouble(1.0) // 10/10
314 | };
315 |
316 | _circleMaskTransform.Duration = 0.333; // 0.0333 * 10
317 | _circleMaskTransform.Values = new NSObject[9] {
318 | NSValue.FromCATransform3D(CATransform3D.Identity), // 0/10
319 | NSValue.FromCATransform3D(CATransform3D.Identity), // 2/10
320 | NSValue.FromCATransform3D(CATransform3D.MakeScale(imageFrame.Width * 1.25F, imageFrame.Height * 1.25F, 1.0F)), // 3/10
321 | NSValue.FromCATransform3D(CATransform3D.MakeScale(imageFrame.Width * 2.688F, imageFrame.Height * 2.688F, 1.0F)), // 4/10
322 | NSValue.FromCATransform3D(CATransform3D.MakeScale(imageFrame.Width * 3.923F, imageFrame.Height * 3.923F, 1.0F)), // 5/10
323 | NSValue.FromCATransform3D(CATransform3D.MakeScale(imageFrame.Width * 4.375F, imageFrame.Height * 4.375F, 1.0F)), // 6/10
324 | NSValue.FromCATransform3D(CATransform3D.MakeScale(imageFrame.Width * 4.731F, imageFrame.Height * 4.731F, 1.0F)), // 7/10
325 | NSValue.FromCATransform3D(CATransform3D.MakeScale(imageFrame.Width * 5.0F, imageFrame.Height * 5.0F, 1.0F)), // 9/10
326 | NSValue.FromCATransform3D(CATransform3D.MakeScale(imageFrame.Width * 5.0F, imageFrame.Height * 5.0F, 1.0F)) // 10/10
327 | };
328 | _circleMaskTransform.KeyTimes = new NSNumber[9] {
329 | NSNumber.FromDouble(0.0), // 0/10
330 | NSNumber.FromDouble(0.2), // 2/10
331 | NSNumber.FromDouble(0.3), // 3/10
332 | NSNumber.FromDouble(0.4), // 4/10
333 | NSNumber.FromDouble(0.5), // 5/10
334 | NSNumber.FromDouble(0.6), // 6/10
335 | NSNumber.FromDouble(0.7), // 7/10
336 | NSNumber.FromDouble(0.9), // 9/10
337 | NSNumber.FromDouble(1.0) // 10/10
338 | };
339 | }
340 |
341 | private void CreateLineStrokeAnimation()
342 | {
343 | _lineStrokeStart.Duration = 0.6; //0.0333 * 18
344 | _lineStrokeStart.Values = new NSObject[11] {
345 | NSNumber.FromDouble(0.0), // 0/18
346 | NSNumber.FromDouble(0.0), // 1/18
347 | NSNumber.FromDouble(0.18), // 2/18
348 | NSNumber.FromDouble(0.2), // 3/18
349 | NSNumber.FromDouble(0.26), // 4/18
350 | NSNumber.FromDouble(0.32), // 5/18
351 | NSNumber.FromDouble(0.4), // 6/18
352 | NSNumber.FromDouble(0.6), // 7/18
353 | NSNumber.FromDouble(0.71), // 8/18
354 | NSNumber.FromDouble(0.89), // 17/18
355 | NSNumber.FromDouble(0.92) // 18/18
356 | };
357 | _lineStrokeStart.KeyTimes = new NSNumber[11] {
358 | NSNumber.FromDouble(0.0), // 0/18
359 | NSNumber.FromDouble(0.056), // 1/18
360 | NSNumber.FromDouble(0.111), // 2/18
361 | NSNumber.FromDouble(0.167), // 3/18
362 | NSNumber.FromDouble(0.222), // 4/18
363 | NSNumber.FromDouble(0.278), // 5/18
364 | NSNumber.FromDouble(0.333), // 6/18
365 | NSNumber.FromDouble(0.389), // 7/18
366 | NSNumber.FromDouble(0.444), // 8/18
367 | NSNumber.FromDouble(0.944), // 17/18
368 | NSNumber.FromDouble(1.0) // 18/18
369 | };
370 |
371 | _lineStrokeEnd.Duration = 0.6; //0.0333 * 18
372 | _lineStrokeEnd.Values = new NSObject[8] {
373 | NSNumber.FromDouble(0.0), // 0/18
374 | NSNumber.FromDouble(0.0), // 1/18
375 | NSNumber.FromDouble(0.32), // 2/18
376 | NSNumber.FromDouble(0.48), // 3/18
377 | NSNumber.FromDouble(0.64), // 4/18
378 | NSNumber.FromDouble(0.68), // 5/18
379 | NSNumber.FromDouble(0.92), // 17/18
380 | NSNumber.FromDouble(0.92) // 18/18
381 | };
382 | _lineStrokeEnd.KeyTimes = new NSNumber[8] {
383 | NSNumber.FromDouble(0.0), // 0/18
384 | NSNumber.FromDouble(0.056), // 1/18
385 | NSNumber.FromDouble(0.111), // 2/18
386 | NSNumber.FromDouble(0.167), // 3/18
387 | NSNumber.FromDouble(0.222), // 4/18
388 | NSNumber.FromDouble(0.278), // 5/18
389 | NSNumber.FromDouble(0.944), // 17/18
390 | NSNumber.FromDouble(1.0), // 18/18
391 | };
392 |
393 | _lineOpacity.Duration = 1.0; //0.0333 * 30
394 | _lineOpacity.Values = new NSObject[3] {
395 | NSNumber.FromDouble(1.0), // 0/30
396 | NSNumber.FromDouble(1.0), // 12/30
397 | NSNumber.FromDouble(0.0) // 17/30
398 | };
399 | _lineOpacity.KeyTimes = new NSNumber[3] {
400 | NSNumber.FromDouble(0.0), // 0/30
401 | NSNumber.FromDouble(0.4), // 12/30
402 | NSNumber.FromDouble(0.567) // 17/30
403 | };
404 | }
405 |
406 | private void CreateImageTransformAnimation()
407 | {
408 | _imageTransform.Duration = 1.0; //0.0333 * 30
409 | _imageTransform.Values = new NSObject[17] {
410 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.0F, 0.0F, 1.0F)), // 0/30
411 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.0F, 0.0F, 1.0F)), // 3/30
412 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.2F, 1.2F, 1.0F)), // 9/30
413 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.25F, 1.25F, 1.0F)), // 10/30
414 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.2F, 1.2F, 1.0F)), // 11/30
415 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.9F, 0.9F, 1.0F)), // 14/30
416 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.875F, 0.875F, 1.0F)), // 15/30
417 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.875F, 0.875F, 1.0F)), // 16/30
418 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.9F, 0.9F, 1.0F)), // 17/30
419 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.013F, 1.013F, 1.0F)), // 20/30
420 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.025F, 1.025F, 1.0F)), // 21/30
421 | NSValue.FromCATransform3D(CATransform3D.MakeScale(1.013F, 1.013F, 1.0F)), // 22/30
422 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.96F, 0.96F, 1.0F)), // 25/30
423 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.95F, 0.95F, 1.0F)), // 26/30
424 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.96F, 0.96F, 1.0F)), // 27/30
425 | NSValue.FromCATransform3D(CATransform3D.MakeScale(0.99F, 0.99F, 1.0F)), // 29/30
426 | NSValue.FromCATransform3D(CATransform3D.Identity) // 30/30
427 | };
428 | _imageTransform.KeyTimes = new NSNumber[17] {
429 | NSNumber.FromDouble(0.0), // 0/30
430 | NSNumber.FromDouble(0.1), // 3/30
431 | NSNumber.FromDouble(0.3), // 9/30
432 | NSNumber.FromDouble(0.333), // 10/30
433 | NSNumber.FromDouble(0.367), // 11/30
434 | NSNumber.FromDouble(0.467), // 14/30
435 | NSNumber.FromDouble(0.5), // 15/30
436 | NSNumber.FromDouble(0.533), // 16/30
437 | NSNumber.FromDouble(0.567), // 17/30
438 | NSNumber.FromDouble(0.667), // 20/30
439 | NSNumber.FromDouble(0.7), // 21/30
440 | NSNumber.FromDouble(0.733), // 22/30
441 | NSNumber.FromDouble(0.833), // 25/30
442 | NSNumber.FromDouble(0.867), // 26/30
443 | NSNumber.FromDouble(0.9), // 27/30
444 | NSNumber.FromDouble(0.967), // 29/30
445 | NSNumber.FromDouble(1.0) // 30/30
446 | };
447 | }
448 |
449 | private void AddTargets()
450 | {
451 | AddTarget(Handle_TouchDown, UIControlEvent.TouchDown);
452 | AddTarget(Handle_TouchUpInside, UIControlEvent.TouchUpInside);
453 | AddTarget(Handle_TouchDragExit, UIControlEvent.TouchDragExit);
454 | AddTarget(Handle_TouchDragEnter, UIControlEvent.TouchDragEnter);
455 | AddTarget(Handle_TouchCancel, UIControlEvent.TouchCancel);
456 | }
457 |
458 | void Handle_TouchDown(object sender, EventArgs e)
459 | {
460 | this.Layer.Opacity = 0.4F;
461 | }
462 |
463 | void Handle_TouchUpInside(object sender, EventArgs e)
464 | {
465 | this.Layer.Opacity = 1F;
466 | }
467 |
468 | void Handle_TouchDragExit(object sender, EventArgs e)
469 | {
470 | this.Layer.Opacity = 1F;
471 | }
472 |
473 | void Handle_TouchDragEnter(object sender, EventArgs e)
474 | {
475 | this.Layer.Opacity = 0.4F;
476 | }
477 |
478 | void Handle_TouchCancel(object sender, EventArgs e)
479 | {
480 | this.Layer.Opacity = 1F;
481 | }
482 |
483 | public void Select()
484 | {
485 | _isSelected = true;
486 | _imageShape.FillColor = _imageColorOn.CGColor;
487 |
488 | CATransaction.Begin();
489 |
490 | _circleShape.AddAnimation(_circleTransform, "transform");
491 | _circleMask.AddAnimation(_circleMaskTransform, "transform");
492 | _imageShape.AddAnimation(_imageTransform, "transform");
493 |
494 | for (int i = 0; i < 5; i++)
495 | {
496 | _lines[i].AddAnimation(_lineStrokeStart, "strokeStart");
497 | _lines[i].AddAnimation(_lineStrokeEnd, "strokeEnd");
498 | _lines[i].AddAnimation(_lineOpacity, "opacity");
499 | }
500 |
501 | CATransaction.Commit();
502 | }
503 |
504 | public void Deselect()
505 | {
506 | _isSelected = false;
507 | _imageShape.FillColor = _imageColorOff.CGColor;
508 |
509 | _circleShape.RemoveAllAnimations();
510 | _circleMask.RemoveAllAnimations();
511 | _imageShape.RemoveAllAnimations();
512 | _lines[0].RemoveAllAnimations();
513 | _lines[1].RemoveAllAnimations();
514 | _lines[2].RemoveAllAnimations();
515 | _lines[3].RemoveAllAnimations();
516 | _lines[4].RemoveAllAnimations();
517 | }
518 | }
519 | }
--------------------------------------------------------------------------------