├── .gitignore ├── Example ├── Code │ ├── CodeExample │ │ ├── CodeExample.cs │ │ ├── CodeExample.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── Droid │ │ ├── Assets │ │ │ └── AboutAssets.txt │ │ ├── CodeExample.Droid.csproj │ │ ├── MainActivity.cs │ │ ├── Properties │ │ │ ├── AndroidManifest.xml │ │ │ └── AssemblyInfo.cs │ │ ├── Resources │ │ │ ├── AboutResources.txt │ │ │ ├── drawable-hdpi │ │ │ │ └── icon.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── icon.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── icon.png │ │ │ ├── drawable │ │ │ │ └── icon.png │ │ │ ├── layout │ │ │ │ ├── Tabbar.axml │ │ │ │ └── Toolbar.axml │ │ │ └── values │ │ │ │ └── styles.xml │ │ └── packages.config │ └── iOS │ │ ├── AppDelegate.cs │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── CodeExample.iOS.csproj │ │ ├── Entitlements.plist │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ ├── Main.cs │ │ └── packages.config └── Xaml │ ├── Droid │ ├── Assets │ │ └── AboutAssets.txt │ ├── MainActivity.cs │ ├── Properties │ │ ├── AndroidManifest.xml │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── AboutResources.txt │ │ ├── drawable-hdpi │ │ │ └── icon.png │ │ ├── drawable-xhdpi │ │ │ └── icon.png │ │ ├── drawable-xxhdpi │ │ │ └── icon.png │ │ ├── drawable │ │ │ └── icon.png │ │ ├── layout │ │ │ ├── Tabbar.axml │ │ │ └── Toolbar.axml │ │ └── values │ │ │ └── styles.xml │ ├── XamlExample.Droid.csproj │ └── packages.config │ ├── XamlExample │ ├── App.xaml │ ├── App.xaml.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── XamlExample.csproj │ ├── XamlExamplePage.xaml │ ├── XamlExamplePage.xaml.cs │ └── packages.config │ └── iOS │ ├── AppDelegate.cs │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Entitlements.plist │ ├── Info.plist │ ├── LaunchScreen.storyboard │ ├── Main.cs │ ├── XamlExample.iOS.csproj │ └── packages.config ├── HybridWebPlatform.Droid ├── ControlRenderers │ └── HybridWebView │ │ ├── HybridWebPlatformChromeClient.cs │ │ ├── HybridWebPlatformJavascriptCallback.cs │ │ ├── HybridWebPlatformNativeView.cs │ │ ├── HybridWebPlatformNewWindowViewClient.cs │ │ ├── HybridWebPlatformViewClient.cs │ │ ├── HybridWebPlatformViewRenderer.cs │ │ └── HybridWebPlatformXamarinApi.cs ├── HybridWebPlatform.Droid.csproj ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ └── values │ │ └── Strings.xml └── packages.config ├── HybridWebPlatform.iOS ├── ControlRenderers │ └── HybridWebView │ │ ├── HybridWebPlatformNavigationDelegate.cs │ │ ├── HybridWebPlatformUIDelegate.cs │ │ └── HybridWebPlatformViewRenderer.cs ├── HybridWebPlatform.iOS.csproj ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── HybridWebPlatform.sln ├── HybridWebPlatform ├── Contracts │ └── HybridJavascriptMessage.cs ├── Control │ ├── HybridWebPlatformView.cs │ └── IHybridWebPlatformViewRenderer.cs ├── HybridWebPlatform.csproj ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── Nuspec └── HybridWebControl.nuspec └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Xamarin stuff 2 | Components 3 | [Pp]ackages 4 | *.userprefs 5 | Resource.designer.cs 6 | 7 | ## Ignore Visual Studio temporary files, build results, and 8 | ## files generated by popular Visual Studio add-ons. 9 | 10 | # User-specific files 11 | *.suo 12 | *.user 13 | *.sln.docstates 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | x64/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # MSTest test Results 26 | [Tt]est[Rr]esult*/ 27 | [Bb]uild[Ll]og.* 28 | 29 | #NUNIT 30 | *.VisualState.xml 31 | TestResult.xml 32 | 33 | # Build Results of an ATL Project 34 | [Dd]ebugPS/ 35 | [Rr]eleasePS/ 36 | dlldata.c 37 | 38 | *_i.c 39 | *_p.c 40 | *_i.h 41 | *.ilk 42 | *.meta 43 | *.obj 44 | *.pch 45 | *.pdb 46 | *.pgc 47 | *.pgd 48 | *.rsp 49 | *.sbr 50 | *.tlb 51 | *.tli 52 | *.tlh 53 | *.tmp 54 | *.tmp_proj 55 | *.log 56 | *.vspscc 57 | *.vssscc 58 | .builds 59 | *.pidb 60 | *.svclog 61 | *.scc 62 | 63 | # Chutzpah Test files 64 | _Chutzpah* 65 | 66 | # Visual C++ cache files 67 | ipch/ 68 | *.aps 69 | *.ncb 70 | *.opensdf 71 | *.sdf 72 | *.cachefile 73 | 74 | # Visual Studio profiler 75 | *.psess 76 | *.vsp 77 | *.vspx 78 | 79 | # TFS 2012 Local Workspace 80 | $tf/ 81 | 82 | # Guidance Automation Toolkit 83 | *.gpState 84 | 85 | # ReSharper is a .NET coding add-in 86 | _ReSharper*/ 87 | *.[Rr]e[Ss]harper 88 | *.DotSettings.user 89 | 90 | # JustCode is a .NET coding addin-in 91 | .JustCode 92 | 93 | # TeamCity is a build add-in 94 | _TeamCity* 95 | 96 | # DotCover is a Code Coverage Tool 97 | *.dotCover 98 | 99 | # NCrunch 100 | *.ncrunch* 101 | _NCrunch_* 102 | .*crunch*.local.xml 103 | 104 | # MightyMoose 105 | *.mm.* 106 | AutoTest.Net/ 107 | 108 | # Web workbench (sass) 109 | .sass-cache/ 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.[Pp]ublish.xml 129 | *.azurePubxml 130 | 131 | # NuGet Packages Directory 132 | packages/ 133 | ## TODO: If the tool you use requires repositories.config uncomment the next line 134 | #!packages/repositories.config 135 | 136 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 137 | # This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented) 138 | !packages/build/ 139 | 140 | # Windows Azure Build Output 141 | csx/ 142 | *.build.csdef 143 | 144 | # Windows Store app package directory 145 | AppPackages/ 146 | 147 | # Others 148 | sql/ 149 | *.Cache 150 | ClientBin/ 151 | [Ss]tyle[Cc]op.* 152 | ~$* 153 | *~ 154 | *.dbmdl 155 | *.dbproj.schemaview 156 | *.pfx 157 | *.publishsettings 158 | node_modules/ 159 | 160 | # RIA/Silverlight projects 161 | Generated_Code/ 162 | 163 | # Backup & report files from converting an old project file to a newer 164 | # Visual Studio version. Backup files are not needed, because we have git ;-) 165 | _UpgradeReport_Files/ 166 | Backup*/ 167 | UpgradeLog*.XML 168 | UpgradeLog*.htm 169 | 170 | # SQL Server files 171 | *.mdf 172 | *.ldf 173 | 174 | # Business Intelligence projects 175 | *.rdl.data 176 | *.bim.layout 177 | *.bim_*.settings 178 | 179 | # Microsoft Fakes 180 | FakesAssemblies/ 181 | 182 | *.userprefs 183 | 184 | .DS_Store 185 | -------------------------------------------------------------------------------- /Example/Code/CodeExample/CodeExample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using HybridWebPlatform; 3 | using Xamarin.Forms; 4 | 5 | 6 | namespace CodeExample 7 | { 8 | public class App : Application 9 | { 10 | HybridWebPlatformView webView; 11 | 12 | public App() 13 | { 14 | webView = new HybridWebPlatformView(); 15 | // The root page of your application 16 | var content = new ContentPage 17 | { 18 | Title = "CodeExample", 19 | Content = webView 20 | }; 21 | 22 | MainPage = new NavigationPage(content); 23 | } 24 | 25 | protected override void OnStart() 26 | { 27 | webView.LoadPage(new Uri("http://google.com")); 28 | } 29 | 30 | protected override void OnSleep() 31 | { 32 | // Handle when your app sleeps 33 | } 34 | 35 | protected override void OnResume() 36 | { 37 | // Handle when your app resumes 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Example/Code/CodeExample/CodeExample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC} 7 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | true 9 | Library 10 | CodeExample 11 | CodeExample 12 | v4.5 13 | Profile111 14 | 1.0.0.6 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug 21 | DEBUG; 22 | prompt 23 | 4 24 | 25 | 26 | true 27 | bin\Release 28 | prompt 29 | 4 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll 38 | 39 | 40 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll 41 | 42 | 43 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | {37DC4546-2D9A-4290-809E-E2D962DBB36A} 52 | HybridWebPlatform 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Example/Code/CodeExample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("CodeExample")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("")] 12 | [assembly: AssemblyCopyright("(c) mr wheelkers")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | -------------------------------------------------------------------------------- /Example/Code/CodeExample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Example/Code/Droid/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with your package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); 20 | -------------------------------------------------------------------------------- /Example/Code/Droid/CodeExample.Droid.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF} 7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | Library 9 | CodeExample.Droid 10 | CodeExample.Droid 11 | v7.1 12 | True 13 | Resources\Resource.designer.cs 14 | Resource 15 | Properties\AndroidManifest.xml 16 | Resources 17 | Assets 18 | true 19 | 1.0.0.6 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug 26 | DEBUG; 27 | prompt 28 | 4 29 | None 30 | arm64-v8a;armeabi;armeabi-v7a;x86 31 | 32 | 33 | true 34 | pdbonly 35 | true 36 | bin\Release 37 | prompt 38 | 4 39 | true 40 | false 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | ..\..\..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll 49 | 50 | 51 | ..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll 52 | 53 | 54 | ..\..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll 55 | 56 | 57 | ..\..\..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll 58 | 59 | 60 | ..\..\..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll 61 | 62 | 63 | ..\..\..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll 64 | 65 | 66 | ..\..\..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll 67 | 68 | 69 | ..\..\..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll 70 | 71 | 72 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\MonoAndroid10\FormsViewGroup.dll 73 | 74 | 75 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\MonoAndroid10\Xamarin.Forms.Core.dll 76 | 77 | 78 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll 79 | 80 | 81 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\MonoAndroid10\Xamarin.Forms.Platform.dll 82 | 83 | 84 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC} 111 | CodeExample 112 | 113 | 114 | {37DC4546-2D9A-4290-809E-E2D962DBB36A} 115 | HybridWebPlatform 116 | 117 | 118 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8} 119 | HybridWebPlatform.Droid 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /Example/Code/Droid/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Android.App; 4 | using Android.Content; 5 | using Android.Content.PM; 6 | using Android.Runtime; 7 | using Android.Views; 8 | using Android.Widget; 9 | using Android.OS; 10 | 11 | namespace CodeExample.Droid 12 | { 13 | [Activity(Label = "CodeExample.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 14 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 15 | { 16 | protected override void OnCreate(Bundle bundle) 17 | { 18 | TabLayoutResource = Resource.Layout.Tabbar; 19 | ToolbarResource = Resource.Layout.Toolbar; 20 | 21 | base.OnCreate(bundle); 22 | 23 | global::Xamarin.Forms.Forms.Init(this, bundle); 24 | 25 | LoadApplication(new App()); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Example/Code/Droid/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Example/Code/Droid/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using Android.App; 4 | 5 | // Information about this assembly is defined by the following attributes. 6 | // Change them to the values specific to your project. 7 | 8 | [assembly: AssemblyTitle("CodeExample.Droid")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("")] 13 | [assembly: AssemblyCopyright("(c) mr wheelkers")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 18 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 19 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 20 | 21 | [assembly: AssemblyVersion("1.0.0")] 22 | 23 | // The following attributes are used to specify the signing key for the assembly, 24 | // if desired. See the Mono documentation for more information about signing. 25 | 26 | //[assembly: AssemblyDelaySign(false)] 27 | //[assembly: AssemblyKeyFile("")] 28 | -------------------------------------------------------------------------------- /Example/Code/Droid/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.axml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable/ 12 | icon.png 13 | 14 | layout/ 15 | main.axml 16 | 17 | values/ 18 | strings.xml 19 | 20 | In order to get the build system to recognize Android resources, set the build action to 21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 22 | instead operate on resource IDs. When you compile an Android application that uses resources, 23 | the build system will package the resources for distribution and generate a class called "R" 24 | (this is an Android convention) that contains the tokens for each one of the resources 25 | included. For example, for the above Resources layout, this is what the R class would expose: 26 | 27 | public class R { 28 | public class drawable { 29 | public const int icon = 0x123; 30 | } 31 | 32 | public class layout { 33 | public const int main = 0x456; 34 | } 35 | 36 | public class strings { 37 | public const int first_string = 0xabc; 38 | public const int second_string = 0xbcd; 39 | } 40 | } 41 | 42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main 43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first 44 | string in the dictionary file values/strings.xml. 45 | -------------------------------------------------------------------------------- /Example/Code/Droid/Resources/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HybridWebPlatform/Hybrid-Web-Platform/801f52db266f4a5fa640ea1cf5adf76fb4a80a4f/Example/Code/Droid/Resources/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /Example/Code/Droid/Resources/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HybridWebPlatform/Hybrid-Web-Platform/801f52db266f4a5fa640ea1cf5adf76fb4a80a4f/Example/Code/Droid/Resources/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /Example/Code/Droid/Resources/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HybridWebPlatform/Hybrid-Web-Platform/801f52db266f4a5fa640ea1cf5adf76fb4a80a4f/Example/Code/Droid/Resources/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /Example/Code/Droid/Resources/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HybridWebPlatform/Hybrid-Web-Platform/801f52db266f4a5fa640ea1cf5adf76fb4a80a4f/Example/Code/Droid/Resources/drawable/icon.png -------------------------------------------------------------------------------- /Example/Code/Droid/Resources/layout/Tabbar.axml: -------------------------------------------------------------------------------- 1 |  2 | 13 | -------------------------------------------------------------------------------- /Example/Code/Droid/Resources/layout/Toolbar.axml: -------------------------------------------------------------------------------- 1 |  2 | 10 | -------------------------------------------------------------------------------- /Example/Code/Droid/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 7 | 8 | 35 | 41 | 42 | -------------------------------------------------------------------------------- /Example/Code/Droid/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Example/Code/iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace CodeExample.iOS 9 | { 10 | [Register("AppDelegate")] 11 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 12 | { 13 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 14 | { 15 | new HybridWebPlatform.iOS.HybridWebPlatformViewRenderer(); 16 | global::Xamarin.Forms.Forms.Init(); 17 | 18 | LoadApplication(new App()); 19 | 20 | return base.FinishedLaunching(app, options); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Example/Code/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "iphone", 5 | "size": "29x29", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "iphone", 10 | "size": "29x29", 11 | "scale": "2x" 12 | }, 13 | { 14 | "idiom": "iphone", 15 | "size": "29x29", 16 | "scale": "3x" 17 | }, 18 | { 19 | "idiom": "iphone", 20 | "size": "40x40", 21 | "scale": "2x" 22 | }, 23 | { 24 | "idiom": "iphone", 25 | "size": "40x40", 26 | "scale": "3x" 27 | }, 28 | { 29 | "idiom": "iphone", 30 | "size": "57x57", 31 | "scale": "1x" 32 | }, 33 | { 34 | "idiom": "iphone", 35 | "size": "57x57", 36 | "scale": "2x" 37 | }, 38 | { 39 | "idiom": "iphone", 40 | "size": "60x60", 41 | "scale": "2x" 42 | }, 43 | { 44 | "idiom": "iphone", 45 | "size": "60x60", 46 | "scale": "3x" 47 | }, 48 | { 49 | "idiom": "ipad", 50 | "size": "29x29", 51 | "scale": "1x" 52 | }, 53 | { 54 | "idiom": "ipad", 55 | "size": "29x29", 56 | "scale": "2x" 57 | }, 58 | { 59 | "idiom": "ipad", 60 | "size": "40x40", 61 | "scale": "1x" 62 | }, 63 | { 64 | "idiom": "ipad", 65 | "size": "40x40", 66 | "scale": "2x" 67 | }, 68 | { 69 | "idiom": "ipad", 70 | "size": "50x50", 71 | "scale": "1x" 72 | }, 73 | { 74 | "idiom": "ipad", 75 | "size": "50x50", 76 | "scale": "2x" 77 | }, 78 | { 79 | "idiom": "ipad", 80 | "size": "72x72", 81 | "scale": "1x" 82 | }, 83 | { 84 | "idiom": "ipad", 85 | "size": "72x72", 86 | "scale": "2x" 87 | }, 88 | { 89 | "idiom": "ipad", 90 | "size": "76x76", 91 | "scale": "1x" 92 | }, 93 | { 94 | "idiom": "ipad", 95 | "size": "76x76", 96 | "scale": "2x" 97 | }, 98 | { 99 | "size": "24x24", 100 | "idiom": "watch", 101 | "scale": "2x", 102 | "role": "notificationCenter", 103 | "subtype": "38mm" 104 | }, 105 | { 106 | "size": "27.5x27.5", 107 | "idiom": "watch", 108 | "scale": "2x", 109 | "role": "notificationCenter", 110 | "subtype": "42mm" 111 | }, 112 | { 113 | "size": "29x29", 114 | "idiom": "watch", 115 | "role": "companionSettings", 116 | "scale": "2x" 117 | }, 118 | { 119 | "size": "29x29", 120 | "idiom": "watch", 121 | "role": "companionSettings", 122 | "scale": "3x" 123 | }, 124 | { 125 | "size": "40x40", 126 | "idiom": "watch", 127 | "scale": "2x", 128 | "role": "appLauncher", 129 | "subtype": "38mm" 130 | }, 131 | { 132 | "size": "44x44", 133 | "idiom": "watch", 134 | "scale": "2x", 135 | "role": "longLook", 136 | "subtype": "42mm" 137 | }, 138 | { 139 | "size": "86x86", 140 | "idiom": "watch", 141 | "scale": "2x", 142 | "role": "quickLook", 143 | "subtype": "38mm" 144 | }, 145 | { 146 | "size": "98x98", 147 | "idiom": "watch", 148 | "scale": "2x", 149 | "role": "quickLook", 150 | "subtype": "42mm" 151 | } 152 | ], 153 | "info": { 154 | "version": 1, 155 | "author": "xcode" 156 | } 157 | } -------------------------------------------------------------------------------- /Example/Code/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Code/iOS/CodeExample.iOS.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | iPhoneSimulator 6 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A} 7 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | Exe 9 | CodeExample.iOS 10 | CodeExample.iOS 11 | Resources 12 | 1.0.0.6 13 | 14 | 15 | true 16 | full 17 | false 18 | bin\iPhoneSimulator\Debug 19 | DEBUG;ENABLE_TEST_CLOUD; 20 | prompt 21 | 4 22 | iPhone Developer 23 | true 24 | true 25 | 51934 26 | None 27 | x86_64 28 | HttpClientHandler 29 | Default 30 | false 31 | 32 | 33 | pdbonly 34 | true 35 | bin\iPhone\Release 36 | 37 | prompt 38 | 4 39 | iPhone Developer 40 | true 41 | Entitlements.plist 42 | SdkOnly 43 | ARMv7, ARM64 44 | HttpClientHandler 45 | Default 46 | 47 | 48 | pdbonly 49 | true 50 | bin\iPhoneSimulator\Release 51 | 52 | prompt 53 | 4 54 | iPhone Developer 55 | None 56 | x86_64 57 | HttpClientHandler 58 | Default 59 | 60 | 61 | true 62 | full 63 | false 64 | bin\iPhone\Debug 65 | DEBUG;ENABLE_TEST_CLOUD; 66 | prompt 67 | 4 68 | iPhone Developer 69 | true 70 | true 71 | true 72 | true 73 | Entitlements.plist 74 | SdkOnly 75 | ARMv7, ARM64 76 | HttpClientHandler 77 | Default 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll 86 | 87 | 88 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll 89 | 90 | 91 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll 92 | 93 | 94 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC} 119 | CodeExample 120 | 121 | 122 | {37DC4546-2D9A-4290-809E-E2D962DBB36A} 123 | HybridWebPlatform 124 | 125 | 126 | {CBAFBB3A-83A4-4416-9897-A33E1595447E} 127 | HybridWebPlatform.iOS 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /Example/Code/iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Example/Code/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDisplayName 6 | CodeExample 7 | CFBundleName 8 | CodeExample 9 | CFBundleIdentifier 10 | com.companyname.codeexample 11 | CFBundleShortVersionString 12 | 1.0 13 | CFBundleVersion 14 | 1.0 15 | LSRequiresIPhoneOS 16 | 17 | MinimumOSVersion 18 | 8.0 19 | UIDeviceFamily 20 | 21 | 1 22 | 2 23 | 24 | UILaunchStoryboardName 25 | LaunchScreen 26 | UIRequiredDeviceCapabilities 27 | 28 | armv7 29 | 30 | UISupportedInterfaceOrientations 31 | 32 | UIInterfaceOrientationPortrait 33 | UIInterfaceOrientationLandscapeLeft 34 | UIInterfaceOrientationLandscapeRight 35 | 36 | UISupportedInterfaceOrientations~ipad 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationPortraitUpsideDown 40 | UIInterfaceOrientationLandscapeLeft 41 | UIInterfaceOrientationLandscapeRight 42 | 43 | NSAppTransportSecurity 44 | 45 | NSAllowsArbitraryLoads 46 | 47 | 48 | XSAppIconAssets 49 | Assets.xcassets/AppIcon.appiconset 50 | 51 | 52 | -------------------------------------------------------------------------------- /Example/Code/iOS/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 |  2 | 13 | 14 | 16 | 19 | 20 | 21 | 22 | 24 | 25 | 28 | 29 | 32 | 35 | 36 | 40 | 46 | 50 | 56 | 57 | 58 | 63 | 64 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Example/Code/iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace CodeExample.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, "AppDelegate"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Example/Code/iOS/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Example/Xaml/Droid/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with your package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); 20 | -------------------------------------------------------------------------------- /Example/Xaml/Droid/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Android.App; 4 | using Android.Content; 5 | using Android.Content.PM; 6 | using Android.Runtime; 7 | using Android.Views; 8 | using Android.Widget; 9 | using Android.OS; 10 | 11 | namespace XamlExample.Droid 12 | { 13 | [Activity(Label = "XamlExample.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 14 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 15 | { 16 | protected override void OnCreate(Bundle bundle) 17 | { 18 | TabLayoutResource = Resource.Layout.Tabbar; 19 | ToolbarResource = Resource.Layout.Toolbar; 20 | 21 | base.OnCreate(bundle); 22 | 23 | global::Xamarin.Forms.Forms.Init(this, bundle); 24 | 25 | LoadApplication(new App()); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Example/Xaml/Droid/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Example/Xaml/Droid/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using Android.App; 4 | 5 | // Information about this assembly is defined by the following attributes. 6 | // Change them to the values specific to your project. 7 | 8 | [assembly: AssemblyTitle("XamlExample.Droid")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("")] 13 | [assembly: AssemblyCopyright("(c) mr wheelkers")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 18 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 19 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 20 | 21 | [assembly: AssemblyVersion("1.0.0")] 22 | 23 | // The following attributes are used to specify the signing key for the assembly, 24 | // if desired. See the Mono documentation for more information about signing. 25 | 26 | //[assembly: AssemblyDelaySign(false)] 27 | //[assembly: AssemblyKeyFile("")] 28 | -------------------------------------------------------------------------------- /Example/Xaml/Droid/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.axml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable/ 12 | icon.png 13 | 14 | layout/ 15 | main.axml 16 | 17 | values/ 18 | strings.xml 19 | 20 | In order to get the build system to recognize Android resources, set the build action to 21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 22 | instead operate on resource IDs. When you compile an Android application that uses resources, 23 | the build system will package the resources for distribution and generate a class called "R" 24 | (this is an Android convention) that contains the tokens for each one of the resources 25 | included. For example, for the above Resources layout, this is what the R class would expose: 26 | 27 | public class R { 28 | public class drawable { 29 | public const int icon = 0x123; 30 | } 31 | 32 | public class layout { 33 | public const int main = 0x456; 34 | } 35 | 36 | public class strings { 37 | public const int first_string = 0xabc; 38 | public const int second_string = 0xbcd; 39 | } 40 | } 41 | 42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main 43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first 44 | string in the dictionary file values/strings.xml. 45 | -------------------------------------------------------------------------------- /Example/Xaml/Droid/Resources/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HybridWebPlatform/Hybrid-Web-Platform/801f52db266f4a5fa640ea1cf5adf76fb4a80a4f/Example/Xaml/Droid/Resources/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /Example/Xaml/Droid/Resources/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HybridWebPlatform/Hybrid-Web-Platform/801f52db266f4a5fa640ea1cf5adf76fb4a80a4f/Example/Xaml/Droid/Resources/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /Example/Xaml/Droid/Resources/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HybridWebPlatform/Hybrid-Web-Platform/801f52db266f4a5fa640ea1cf5adf76fb4a80a4f/Example/Xaml/Droid/Resources/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /Example/Xaml/Droid/Resources/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HybridWebPlatform/Hybrid-Web-Platform/801f52db266f4a5fa640ea1cf5adf76fb4a80a4f/Example/Xaml/Droid/Resources/drawable/icon.png -------------------------------------------------------------------------------- /Example/Xaml/Droid/Resources/layout/Tabbar.axml: -------------------------------------------------------------------------------- 1 |  2 | 13 | -------------------------------------------------------------------------------- /Example/Xaml/Droid/Resources/layout/Toolbar.axml: -------------------------------------------------------------------------------- 1 |  2 | 10 | -------------------------------------------------------------------------------- /Example/Xaml/Droid/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 7 | 8 | 35 | 41 | 42 | -------------------------------------------------------------------------------- /Example/Xaml/Droid/XamlExample.Droid.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {C44E2B6D-9A59-466E-B652-28918C280046} 7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | Library 9 | XamlExample.Droid 10 | XamlExample.Droid 11 | v7.1 12 | True 13 | Resources\Resource.designer.cs 14 | Resource 15 | Properties\AndroidManifest.xml 16 | Resources 17 | Assets 18 | true 19 | 1.0.0.6 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug 26 | DEBUG; 27 | prompt 28 | 4 29 | None 30 | arm64-v8a;armeabi;armeabi-v7a;x86 31 | 32 | 33 | true 34 | pdbonly 35 | true 36 | bin\Release 37 | prompt 38 | 4 39 | true 40 | false 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | ..\..\..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll 49 | 50 | 51 | ..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll 52 | 53 | 54 | ..\..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll 55 | 56 | 57 | ..\..\..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll 58 | 59 | 60 | ..\..\..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll 61 | 62 | 63 | ..\..\..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll 64 | 65 | 66 | ..\..\..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll 67 | 68 | 69 | ..\..\..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll 70 | 71 | 72 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\MonoAndroid10\FormsViewGroup.dll 73 | 74 | 75 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\MonoAndroid10\Xamarin.Forms.Core.dll 76 | 77 | 78 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll 79 | 80 | 81 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\MonoAndroid10\Xamarin.Forms.Platform.dll 82 | 83 | 84 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | {2FB55230-2E1C-435E-B649-4559327CDCE7} 111 | XamlExample 112 | 113 | 114 | {37DC4546-2D9A-4290-809E-E2D962DBB36A} 115 | HybridWebPlatform 116 | 117 | 118 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8} 119 | HybridWebPlatform.Droid 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /Example/Xaml/Droid/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Example/Xaml/XamlExample/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Example/Xaml/XamlExample/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | 3 | namespace XamlExample 4 | { 5 | public partial class App : Application 6 | { 7 | public App() 8 | { 9 | InitializeComponent(); 10 | 11 | MainPage = new XamlExamplePage(); 12 | } 13 | 14 | protected override void OnStart() 15 | { 16 | // Handle when your app starts 17 | } 18 | 19 | protected override void OnSleep() 20 | { 21 | // Handle when your app sleeps 22 | } 23 | 24 | protected override void OnResume() 25 | { 26 | // Handle when your app resumes 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Example/Xaml/XamlExample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("XamlExample")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("")] 12 | [assembly: AssemblyCopyright("(c) mr wheelkers")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | -------------------------------------------------------------------------------- /Example/Xaml/XamlExample/XamlExample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {2FB55230-2E1C-435E-B649-4559327CDCE7} 7 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | true 9 | Library 10 | XamlExample 11 | XamlExample 12 | v4.5 13 | Profile111 14 | 1.0.0.6 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug 21 | DEBUG; 22 | prompt 23 | 4 24 | 25 | 26 | true 27 | bin\Release 28 | prompt 29 | 4 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | App.xaml 38 | 39 | 40 | XamlExamplePage.xaml 41 | 42 | 43 | 44 | 45 | 46 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll 47 | 48 | 49 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll 50 | 51 | 52 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | {37DC4546-2D9A-4290-809E-E2D962DBB36A} 61 | HybridWebPlatform 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /Example/Xaml/XamlExample/XamlExamplePage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Example/Xaml/XamlExample/XamlExamplePage.xaml.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | 3 | namespace XamlExample 4 | { 5 | public partial class XamlExamplePage : ContentPage 6 | { 7 | public XamlExamplePage() 8 | { 9 | InitializeComponent(); 10 | WebView.LoadPage(new System.Uri("http://google.com")); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Example/Xaml/XamlExample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Example/Xaml/iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace XamlExample.iOS 9 | { 10 | [Register("AppDelegate")] 11 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 12 | { 13 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 14 | { 15 | new HybridWebPlatform.iOS.HybridWebPlatformViewRenderer(); 16 | 17 | global::Xamarin.Forms.Forms.Init(); 18 | 19 | LoadApplication(new App()); 20 | 21 | return base.FinishedLaunching(app, options); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Example/Xaml/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "iphone", 5 | "size": "29x29", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "iphone", 10 | "size": "29x29", 11 | "scale": "2x" 12 | }, 13 | { 14 | "idiom": "iphone", 15 | "size": "29x29", 16 | "scale": "3x" 17 | }, 18 | { 19 | "idiom": "iphone", 20 | "size": "40x40", 21 | "scale": "2x" 22 | }, 23 | { 24 | "idiom": "iphone", 25 | "size": "40x40", 26 | "scale": "3x" 27 | }, 28 | { 29 | "idiom": "iphone", 30 | "size": "57x57", 31 | "scale": "1x" 32 | }, 33 | { 34 | "idiom": "iphone", 35 | "size": "57x57", 36 | "scale": "2x" 37 | }, 38 | { 39 | "idiom": "iphone", 40 | "size": "60x60", 41 | "scale": "2x" 42 | }, 43 | { 44 | "idiom": "iphone", 45 | "size": "60x60", 46 | "scale": "3x" 47 | }, 48 | { 49 | "idiom": "ipad", 50 | "size": "29x29", 51 | "scale": "1x" 52 | }, 53 | { 54 | "idiom": "ipad", 55 | "size": "29x29", 56 | "scale": "2x" 57 | }, 58 | { 59 | "idiom": "ipad", 60 | "size": "40x40", 61 | "scale": "1x" 62 | }, 63 | { 64 | "idiom": "ipad", 65 | "size": "40x40", 66 | "scale": "2x" 67 | }, 68 | { 69 | "idiom": "ipad", 70 | "size": "50x50", 71 | "scale": "1x" 72 | }, 73 | { 74 | "idiom": "ipad", 75 | "size": "50x50", 76 | "scale": "2x" 77 | }, 78 | { 79 | "idiom": "ipad", 80 | "size": "72x72", 81 | "scale": "1x" 82 | }, 83 | { 84 | "idiom": "ipad", 85 | "size": "72x72", 86 | "scale": "2x" 87 | }, 88 | { 89 | "idiom": "ipad", 90 | "size": "76x76", 91 | "scale": "1x" 92 | }, 93 | { 94 | "idiom": "ipad", 95 | "size": "76x76", 96 | "scale": "2x" 97 | }, 98 | { 99 | "size": "24x24", 100 | "idiom": "watch", 101 | "scale": "2x", 102 | "role": "notificationCenter", 103 | "subtype": "38mm" 104 | }, 105 | { 106 | "size": "27.5x27.5", 107 | "idiom": "watch", 108 | "scale": "2x", 109 | "role": "notificationCenter", 110 | "subtype": "42mm" 111 | }, 112 | { 113 | "size": "29x29", 114 | "idiom": "watch", 115 | "role": "companionSettings", 116 | "scale": "2x" 117 | }, 118 | { 119 | "size": "29x29", 120 | "idiom": "watch", 121 | "role": "companionSettings", 122 | "scale": "3x" 123 | }, 124 | { 125 | "size": "40x40", 126 | "idiom": "watch", 127 | "scale": "2x", 128 | "role": "appLauncher", 129 | "subtype": "38mm" 130 | }, 131 | { 132 | "size": "44x44", 133 | "idiom": "watch", 134 | "scale": "2x", 135 | "role": "longLook", 136 | "subtype": "42mm" 137 | }, 138 | { 139 | "size": "86x86", 140 | "idiom": "watch", 141 | "scale": "2x", 142 | "role": "quickLook", 143 | "subtype": "38mm" 144 | }, 145 | { 146 | "size": "98x98", 147 | "idiom": "watch", 148 | "scale": "2x", 149 | "role": "quickLook", 150 | "subtype": "42mm" 151 | } 152 | ], 153 | "info": { 154 | "version": 1, 155 | "author": "xcode" 156 | } 157 | } -------------------------------------------------------------------------------- /Example/Xaml/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Xaml/iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Example/Xaml/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDisplayName 6 | XamlExample 7 | CFBundleName 8 | XamlExample 9 | CFBundleIdentifier 10 | com.companyname.xamlexample 11 | CFBundleShortVersionString 12 | 1.0 13 | CFBundleVersion 14 | 1.0 15 | LSRequiresIPhoneOS 16 | 17 | MinimumOSVersion 18 | 8.0 19 | UIDeviceFamily 20 | 21 | 1 22 | 2 23 | 24 | UILaunchStoryboardName 25 | LaunchScreen 26 | UIRequiredDeviceCapabilities 27 | 28 | armv7 29 | 30 | UISupportedInterfaceOrientations 31 | 32 | UIInterfaceOrientationPortrait 33 | UIInterfaceOrientationLandscapeLeft 34 | UIInterfaceOrientationLandscapeRight 35 | 36 | UISupportedInterfaceOrientations~ipad 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationPortraitUpsideDown 40 | UIInterfaceOrientationLandscapeLeft 41 | UIInterfaceOrientationLandscapeRight 42 | 43 | NSAppTransportSecurity 44 | 45 | NSAllowsArbitraryLoads 46 | 47 | 48 | XSAppIconAssets 49 | Assets.xcassets/AppIcon.appiconset 50 | 51 | 52 | -------------------------------------------------------------------------------- /Example/Xaml/iOS/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 |  2 | 13 | 14 | 16 | 19 | 20 | 21 | 22 | 24 | 25 | 28 | 29 | 32 | 35 | 36 | 40 | 46 | 50 | 56 | 57 | 58 | 63 | 64 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Example/Xaml/iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace XamlExample.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, "AppDelegate"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Example/Xaml/iOS/XamlExample.iOS.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | iPhoneSimulator 6 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8} 7 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | Exe 9 | XamlExample.iOS 10 | XamlExample.iOS 11 | Resources 12 | 1.0.0.6 13 | 14 | 15 | true 16 | full 17 | false 18 | bin\iPhoneSimulator\Debug 19 | DEBUG;ENABLE_TEST_CLOUD; 20 | prompt 21 | 4 22 | iPhone Developer 23 | true 24 | true 25 | 32104 26 | None 27 | x86_64 28 | HttpClientHandler 29 | Default 30 | false 31 | 32 | 33 | pdbonly 34 | true 35 | bin\iPhone\Release 36 | 37 | prompt 38 | 4 39 | iPhone Developer 40 | true 41 | Entitlements.plist 42 | SdkOnly 43 | ARMv7, ARM64 44 | HttpClientHandler 45 | Default 46 | 47 | 48 | pdbonly 49 | true 50 | bin\iPhoneSimulator\Release 51 | 52 | prompt 53 | 4 54 | iPhone Developer 55 | None 56 | x86_64 57 | HttpClientHandler 58 | Default 59 | 60 | 61 | true 62 | full 63 | false 64 | bin\iPhone\Debug 65 | DEBUG;ENABLE_TEST_CLOUD; 66 | prompt 67 | 4 68 | iPhone Developer 69 | true 70 | true 71 | true 72 | true 73 | Entitlements.plist 74 | SdkOnly 75 | ARMv7, ARM64 76 | HttpClientHandler 77 | Default 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll 86 | 87 | 88 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll 89 | 90 | 91 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll 92 | 93 | 94 | ..\..\..\packages\Xamarin.Forms.2.3.3.193\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | {2FB55230-2E1C-435E-B649-4559327CDCE7} 119 | XamlExample 120 | 121 | 122 | {37DC4546-2D9A-4290-809E-E2D962DBB36A} 123 | HybridWebPlatform 124 | 125 | 126 | {CBAFBB3A-83A4-4416-9897-A33E1595447E} 127 | HybridWebPlatform.iOS 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /Example/Xaml/iOS/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/ControlRenderers/HybridWebView/HybridWebPlatformChromeClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Webkit; 3 | 4 | namespace HybridWebPlatform.Droid 5 | { 6 | public class HybridWebPlatformChromeClient : WebChromeClient 7 | { 8 | public event Action OpenExternalWindow; 9 | 10 | Action callback; 11 | 12 | public HybridWebPlatformChromeClient(Action callback) 13 | { 14 | this.callback = callback; 15 | } 16 | 17 | [Java.Interop.Export] 18 | public void openFileChooser(IValueCallback uploadMsg, Java.Lang.String acceptType, Java.Lang.String capture) 19 | { 20 | if (callback != null) 21 | { 22 | callback(uploadMsg, acceptType, capture); 23 | } 24 | } 25 | 26 | public override void OnGeolocationPermissionsShowPrompt(string origin, GeolocationPermissions.ICallback callback) 27 | { 28 | callback.Invoke(origin, true, false); 29 | } 30 | 31 | public override bool OnCreateWindow(WebView view, bool isDialog, bool isUserGesture, Android.OS.Message resultMsg) 32 | { 33 | WebView newWebView = new WebView(view.Context); 34 | newWebView.SetWebViewClient(new HybridWebPlatformNewWindowViewClient(OpenExternalWindow)); 35 | WebView.WebViewTransport transport = (WebView.WebViewTransport)resultMsg.Obj; 36 | transport.WebView = newWebView; 37 | resultMsg.SendToTarget(); 38 | return true; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/ControlRenderers/HybridWebView/HybridWebPlatformJavascriptCallback.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Webkit; 3 | using Java.Lang; 4 | 5 | namespace HybridWebPlatform.Droid 6 | { 7 | public class HybridWebPlatformJavascriptCallback : Java.Lang.Object, IValueCallback 8 | { 9 | public event Action ReceivedCallback; 10 | 11 | public HybridWebPlatformJavascriptCallback() 12 | { 13 | } 14 | 15 | public void OnReceiveValue(Java.Lang.Object value) 16 | { 17 | if (ReceivedCallback != null) 18 | { 19 | ReceivedCallback(((Java.Lang.String)value).ToString()); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/ControlRenderers/HybridWebView/HybridWebPlatformNativeView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Runtime; 3 | using Android.Views; 4 | using Android.Webkit; 5 | 6 | namespace HybridWebPlatform.Droid 7 | { 8 | public class HybridWebPlatformNativeView : WebView 9 | { 10 | private readonly GestureDetector detector; 11 | private readonly bool enableDetector; 12 | 13 | public HybridWebPlatformNativeView(HybridWebPlatformViewRenderer renderer, bool enableAdditionalTouchDetector) : base(renderer.Context) 14 | { 15 | enableDetector = enableAdditionalTouchDetector; 16 | 17 | if (enableDetector) 18 | { 19 | var listener = new MyGestureListener(renderer); 20 | this.detector = new GestureDetector(this.Context, listener); 21 | } 22 | } 23 | 24 | public HybridWebPlatformNativeView(IntPtr ptr, JniHandleOwnership handle) : base(ptr, handle) 25 | { 26 | 27 | } 28 | 29 | public override bool OnTouchEvent(MotionEvent e) 30 | { 31 | if (enableDetector) 32 | { 33 | this.detector.OnTouchEvent(e); 34 | } 35 | return base.OnTouchEvent(e); 36 | } 37 | 38 | private class MyGestureListener : GestureDetector.SimpleOnGestureListener 39 | { 40 | private const int SWIPE_MIN_DISTANCE = 120; 41 | private const int SWIPE_MAX_OFF_PATH = 200; 42 | private const int SWIPE_THRESHOLD_VELOCITY = 200; 43 | 44 | private readonly WeakReference webHybrid; 45 | 46 | public MyGestureListener(HybridWebPlatformViewRenderer renderer) 47 | { 48 | this.webHybrid = new WeakReference(renderer); 49 | } 50 | 51 | // public override void OnLongPress(MotionEvent e) 52 | // { 53 | // Console.WriteLine("OnLongPress"); 54 | // base.OnLongPress(e); 55 | // } 56 | // 57 | // public override bool OnDoubleTap(MotionEvent e) 58 | // { 59 | // Console.WriteLine("OnDoubleTap"); 60 | // return base.OnDoubleTap(e); 61 | // } 62 | // 63 | // public override bool OnDoubleTapEvent(MotionEvent e) 64 | // { 65 | // Console.WriteLine("OnDoubleTapEvent"); 66 | // return base.OnDoubleTapEvent(e); 67 | // } 68 | // 69 | // public override bool OnSingleTapUp(MotionEvent e) 70 | // { 71 | // Console.WriteLine("OnSingleTapUp"); 72 | // return base.OnSingleTapUp(e); 73 | // } 74 | // 75 | // public override bool OnDown(MotionEvent e) 76 | // { 77 | // Console.WriteLine("OnDown"); 78 | // return base.OnDown(e); 79 | // } 80 | 81 | //public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) 82 | //{ 83 | //HybridWebPlatformRenderer hybrid; 84 | 85 | //if (this.webHybrid.TryGetTarget(out hybrid) && Math.Abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) 86 | //{ 87 | // if (e1.GetX() - e2.GetX() > SWIPE_MIN_DISTANCE) 88 | // { 89 | // hybrid.Element.OnLeftSwipe(this, EventArgs.Empty); 90 | // } 91 | // else if (e2.GetX() - e1.GetX() > SWIPE_MIN_DISTANCE) 92 | // { 93 | // hybrid.Element.OnRightSwipe(this, EventArgs.Empty); 94 | // } 95 | //} 96 | 97 | //return base.OnFling(e1, e2, velocityX, velocityY); 98 | //} 99 | 100 | // public override bool OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) 101 | // { 102 | // Console.WriteLine("OnScroll"); 103 | // return base.OnScroll(e1, e2, distanceX, distanceY); 104 | // } 105 | // 106 | // public override void OnShowPress(MotionEvent e) 107 | // { 108 | // Console.WriteLine("OnShowPress"); 109 | // base.OnShowPress(e); 110 | // } 111 | // 112 | // public override bool OnSingleTapConfirmed(MotionEvent e) 113 | // { 114 | // Console.WriteLine("OnSingleTapConfirmed"); 115 | // return base.OnSingleTapConfirmed(e); 116 | // } 117 | 118 | } 119 | } 120 | } -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/ControlRenderers/HybridWebView/HybridWebPlatformNewWindowViewClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Webkit; 3 | 4 | namespace HybridWebPlatform.Droid 5 | { 6 | public class HybridWebPlatformNewWindowViewClient : WebViewClient 7 | { 8 | Action openExternalLink; 9 | 10 | public HybridWebPlatformNewWindowViewClient(Action openExternalLink) 11 | { 12 | this.openExternalLink = openExternalLink; 13 | } 14 | 15 | public override bool ShouldOverrideUrlLoading(WebView view, string url) 16 | { 17 | if (openExternalLink != null) 18 | { 19 | openExternalLink(new Uri(url)); 20 | } 21 | view.Dispose(); 22 | return false; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/ControlRenderers/HybridWebView/HybridWebPlatformViewClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Webkit; 3 | 4 | namespace HybridWebPlatform.Droid 5 | { 6 | public class HybridWebPlatformViewClient : WebViewClient 7 | { 8 | public event Action ReceivedError; 9 | public event Action StartLoadingUrl; 10 | public event Action FinishedLoadingUrl; 11 | public event Func OverrideUrlLoading; 12 | 13 | public bool IsLoading 14 | { 15 | get; 16 | private set; 17 | } 18 | 19 | public override void OnReceivedError(WebView view, ClientError errorCode, string description, string failingUrl) 20 | { 21 | IsLoading = false; 22 | base.OnReceivedError(view, errorCode, description, failingUrl); 23 | 24 | if (ReceivedError != null) 25 | { 26 | ReceivedError(failingUrl, description, (int)errorCode); 27 | } 28 | } 29 | 30 | public override void OnReceivedError(WebView view, IWebResourceRequest request, WebResourceError error) 31 | { 32 | IsLoading = false; 33 | base.OnReceivedError(view, request, error); 34 | 35 | if (ReceivedError != null) 36 | { 37 | ReceivedError(request.Url.ToString(), error.Description, (int)error.ErrorCode); 38 | } 39 | } 40 | 41 | public override bool ShouldOverrideUrlLoading(WebView view, string url) 42 | { 43 | if (OverrideUrlLoading != null) 44 | { 45 | return OverrideUrlLoading(url); 46 | } 47 | return false; 48 | } 49 | 50 | public override void OnPageStarted(WebView view, string url, Android.Graphics.Bitmap favicon) 51 | { 52 | IsLoading = true; 53 | if (StartLoadingUrl != null) 54 | { 55 | StartLoadingUrl(url); 56 | } 57 | } 58 | 59 | public override void OnPageFinished(WebView view, string url) 60 | { 61 | IsLoading = false; 62 | if (FinishedLoadingUrl != null) 63 | { 64 | FinishedLoadingUrl(url); 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/ControlRenderers/HybridWebView/HybridWebPlatformViewRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Content; 3 | using Android.Views; 4 | using HybridWebPlatform; 5 | using HybridWebPlatform.Droid; 6 | using Xamarin.Forms; 7 | using Xamarin.Forms.Platform.Android; 8 | using XLabs.Platform; 9 | 10 | [assembly: ExportRenderer(typeof(HybridWebPlatformView), typeof(HybridWebPlatformViewRenderer))] 11 | namespace HybridWebPlatform.Droid 12 | { 13 | public class HybridWebPlatformViewRenderer : ViewRenderer, IHybridWebPlatformViewRenderer 14 | { 15 | public static bool EnableHardwareRendering = false; 16 | public static bool EnableAdditionalTouchGesturesHandling = true; 17 | 18 | public static Func GetWebViewClientDelegate; 19 | public static Func GetWebChromeClientDelegate; 20 | 21 | public event Func PageLoadRequest; 22 | public event Action PageLoadStarted; 23 | public event Action PageLoadFinished; 24 | public event Action PageLoadError; 25 | public event Action JavascriptExecuted; 26 | public event Action PageLoadInNewWindowRequest; 27 | 28 | private HybridWebPlatformViewClient viewClient; 29 | private const string NativeFuncCall = "Xamarin.call"; 30 | private const string NativeFunction = "function Native(action, data){Xamarin.call(JSON.stringify({ a: action, d: data }));}"; 31 | 32 | public bool CanGoBack 33 | { 34 | get 35 | { 36 | return this.Control.CanGoBack(); 37 | } 38 | } 39 | 40 | public bool CanGoForward 41 | { 42 | get 43 | { 44 | return this.Control.CanGoForward(); 45 | } 46 | } 47 | 48 | public string CurrentUrl 49 | { 50 | get 51 | { 52 | return this.Control.Url; 53 | } 54 | } 55 | 56 | public bool IsLoading 57 | { 58 | get 59 | { 60 | return this.viewClient.IsLoading; 61 | } 62 | } 63 | 64 | public void GoBack() 65 | { 66 | this.Control.GoBack(); 67 | } 68 | 69 | public void GoForward() 70 | { 71 | this.Control.GoForward(); 72 | } 73 | 74 | public void RefreshPage() 75 | { 76 | this.Control.Reload(); 77 | } 78 | 79 | public void LoadPage(Uri page) 80 | { 81 | this.Control.LoadUrl(page.AbsoluteUri); 82 | } 83 | 84 | public void LoadFromString(string html) 85 | { 86 | this.Control.LoadData(html, "text/html", "UTF-8"); 87 | } 88 | 89 | public void ExecuteJavascript(string javascript) 90 | { 91 | Inject(javascript); 92 | } 93 | 94 | public override SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint) 95 | { 96 | var sizeRequest = base.GetDesiredSize(widthConstraint, heightConstraint); 97 | sizeRequest.Request = new Size(sizeRequest.Request.Width, 0); 98 | return sizeRequest; 99 | } 100 | 101 | protected virtual HybridWebPlatformChromeClient GetWebChromeClient() 102 | { 103 | var d = GetWebChromeClientDelegate; 104 | 105 | var client = d != null ? d(this) : new HybridWebPlatformChromeClient(null); 106 | 107 | client.OpenExternalWindow += LoadUrlInExternalWindow; 108 | 109 | return client; 110 | } 111 | 112 | protected override void OnElementChanged(ElementChangedEventArgs e) 113 | { 114 | base.OnElementChanged(e); 115 | 116 | if (this.Control == null && e.NewElement != null) 117 | { 118 | var webView = new HybridWebPlatformNativeView(this, EnableAdditionalTouchGesturesHandling); 119 | 120 | webView.Settings.JavaScriptEnabled = true; 121 | webView.Settings.DomStorageEnabled = true; 122 | webView.SetLayerType(EnableHardwareRendering ? LayerType.Hardware : LayerType.Software, null); 123 | webView.SetBackgroundColor(Color.Transparent.ToAndroid()); 124 | 125 | this.viewClient = this.CreateWebClient(); 126 | 127 | webView.SetWebViewClient(viewClient); 128 | webView.SetWebChromeClient(this.GetWebChromeClient()); 129 | 130 | webView.Settings.JavaScriptEnabled = true; 131 | webView.Settings.AllowFileAccess = true; 132 | webView.Settings.AllowContentAccess = true; 133 | webView.Settings.DatabaseEnabled = true; 134 | webView.Settings.DomStorageEnabled = true; 135 | webView.Settings.JavaScriptCanOpenWindowsAutomatically = true; 136 | webView.Settings.LoadsImagesAutomatically = true; 137 | webView.Settings.SetGeolocationEnabled(true); 138 | webView.Settings.SetSupportMultipleWindows(true); 139 | webView.Settings.SetSupportZoom(false); 140 | 141 | webView.AddJavascriptInterface(new HybridWebPlatformXamarinApi(this), "Xamarin"); 142 | 143 | this.SetNativeControl(webView); 144 | 145 | webView.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); 146 | } 147 | 148 | e.NewElement.SetViewRenderer(this); 149 | 150 | } 151 | 152 | protected override void Dispose(bool disposing) 153 | { 154 | if (disposing && this.Element != null) 155 | { 156 | if (this.Control != null) 157 | { 158 | this.Control.StopLoading(); 159 | } 160 | } 161 | 162 | base.Dispose(disposing); 163 | } 164 | 165 | private void Inject(string script) 166 | { 167 | if (Control != null) 168 | { 169 | this.Control.LoadUrl(string.Format("javascript: {0}", script)); 170 | } 171 | } 172 | 173 | private HybridWebPlatformViewClient CreateWebClient() 174 | { 175 | 176 | var creationDelegate = GetWebViewClientDelegate; 177 | 178 | var webClient = creationDelegate != null ? creationDelegate(this) : new HybridWebPlatformViewClient(); 179 | 180 | webClient.ReceivedError += WebClient_ReceivedError; 181 | webClient.FinishedLoadingUrl += WebClient_FinishedLoadingUrl; 182 | webClient.StartLoadingUrl += WebClient_StartLoadingUrl; 183 | webClient.OverrideUrlLoading += WebClient_OverrideUrlLoading; 184 | 185 | return webClient; 186 | } 187 | 188 | private void LoadUrlInExternalWindow(Uri obj) 189 | { 190 | if (PageLoadInNewWindowRequest != null) 191 | { 192 | PageLoadInNewWindowRequest(obj); 193 | } 194 | } 195 | 196 | private void WebClient_ReceivedError(string arg1, string arg2, int arg3) 197 | { 198 | if (PageLoadError != null) 199 | { 200 | this.PageLoadError(new Uri(arg1), arg2, arg3); 201 | } 202 | } 203 | 204 | private void WebClient_FinishedLoadingUrl(string obj) 205 | { 206 | this.Inject(NativeFunction); 207 | this.Inject(HybridWebPlatformView.GetInitialJsScript(NativeFuncCall)); 208 | 209 | if (PageLoadFinished != null) 210 | { 211 | this.PageLoadFinished(new Uri(obj)); 212 | } 213 | } 214 | 215 | private void WebClient_StartLoadingUrl(string obj) 216 | { 217 | if (PageLoadStarted != null) 218 | { 219 | this.PageLoadStarted(new Uri(obj)); 220 | } 221 | } 222 | 223 | private bool WebClient_OverrideUrlLoading(string arg) 224 | { 225 | Uri page = new Uri(arg); 226 | 227 | if (CheckIfUriIsMailtoOrPhoneNumber(page)) 228 | { 229 | return true; 230 | } 231 | 232 | if (PageLoadRequest != null) 233 | { 234 | //We negate the result here as if page load request == true we should not override the page request 235 | return !this.PageLoadRequest(page); 236 | } 237 | return false; 238 | } 239 | 240 | private bool CheckIfUriIsMailtoOrPhoneNumber(Uri uri) 241 | { 242 | if (string.Equals(uri.Scheme, "mailto", StringComparison.OrdinalIgnoreCase)) 243 | { 244 | Intent i = new Intent(Intent.ActionSendto, Android.Net.Uri.Parse(uri.AbsoluteUri)); 245 | 246 | i.AddFlags(ActivityFlags.NewTask); 247 | 248 | this.Control.StartActivity(i); 249 | 250 | return true; 251 | } 252 | 253 | if (string.Equals(uri.Scheme, "tel", StringComparison.OrdinalIgnoreCase)) 254 | { 255 | Intent i = new Intent(Intent.ActionDial, Android.Net.Uri.Parse(uri.AbsoluteUri)); 256 | 257 | i.AddFlags(ActivityFlags.NewTask); 258 | 259 | this.Control.StartActivity(i); 260 | 261 | return true; 262 | } 263 | 264 | return false; 265 | } 266 | } 267 | } 268 | -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/ControlRenderers/HybridWebView/HybridWebPlatformXamarinApi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Webkit; 3 | using Java.Interop; 4 | 5 | namespace HybridWebPlatform.Droid 6 | { 7 | public class HybridWebPlatformXamarinApi : Java.Lang.Object 8 | { 9 | private readonly WeakReference webHybrid; 10 | 11 | public HybridWebPlatformXamarinApi(HybridWebPlatformViewRenderer webHybrid) 12 | { 13 | this.webHybrid = new WeakReference(webHybrid); 14 | } 15 | 16 | [JavascriptInterface] 17 | [Export("call")] 18 | public void Call(string message) 19 | { 20 | HybridWebPlatformViewRenderer hybrid; 21 | HybridWebPlatformView webView; 22 | if (this.webHybrid != null && this.webHybrid.TryGetTarget(out hybrid) && ((webView = hybrid.Element) != null)) 23 | { 24 | webView.MessageReceived(message); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/HybridWebPlatform.Droid.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8} 7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | Library 9 | HybridWebPlatform.Droid 10 | HybridWebPlatform.Droid 11 | v7.1 12 | Resources\Resource.designer.cs 13 | Resource 14 | Resources 15 | Assets 16 | true 17 | 18 | 1.0.0.6 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug 25 | DEBUG; 26 | prompt 27 | 4 28 | None 29 | 30 | 31 | true 32 | pdbonly 33 | true 34 | bin\Release 35 | prompt 36 | 4 37 | true 38 | false 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | ..\packages\ExifLib.PCL.1.0.2-pre01\lib\netstandard1.0\ExifLib.dll 47 | 48 | 49 | ..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll 50 | 51 | 52 | ..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll 53 | 54 | 55 | ..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll 56 | 57 | 58 | ..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll 59 | 60 | 61 | ..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll 62 | 63 | 64 | ..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll 65 | 66 | 67 | ..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll 68 | 69 | 70 | ..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll 71 | 72 | 73 | ..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\FormsViewGroup.dll 74 | 75 | 76 | ..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Core.dll 77 | 78 | 79 | ..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll 80 | 81 | 82 | ..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Platform.dll 83 | 84 | 85 | ..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll 86 | 87 | 88 | ..\packages\XLabs.Core.2.3.0-pre05\lib\netstandard1.0\XLabs.Core.dll 89 | 90 | 91 | ..\packages\XLabs.IoC.2.3.0-pre05\lib\netstandard1.0\XLabs.IOC.dll 92 | 93 | 94 | ..\packages\XLabs.Serialization.2.3.0-pre05\lib\NETStandard1.0\XLabs.Serialization.dll 95 | 96 | 97 | ..\packages\XLabs.Platform.2.3.0-pre05\lib\monoandroid\XLabs.Platform.dll 98 | 99 | 100 | ..\packages\XLabs.Platform.2.3.0-pre05\lib\monoandroid\XLabs.Platform.Droid.dll 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | {37DC4546-2D9A-4290-809E-E2D962DBB36A} 127 | HybridWebPlatform 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("HybridWebControl.Droid")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("")] 12 | [assembly: AssemblyCopyright("(c) mr wheelkers")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.0.0")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.axml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable/ 12 | icon.png 13 | 14 | layout/ 15 | main.axml 16 | 17 | values/ 18 | strings.xml 19 | 20 | In order to get the build system to recognize Android resources, set the build action to 21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 22 | instead operate on resource IDs. When you compile an Android application that uses resources, 23 | the build system will package the resources for distribution and generate a class called "R" 24 | (this is an Android convention) that contains the tokens for each one of the resources 25 | included. For example, for the above Resources layout, this is what the R class would expose: 26 | 27 | public class R { 28 | public class drawable { 29 | public const int icon = 0x123; 30 | } 31 | 32 | public class layout { 33 | public const int main = 0x456; 34 | } 35 | 36 | public class strings { 37 | public const int first_string = 0xabc; 38 | public const int second_string = 0xbcd; 39 | } 40 | } 41 | 42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main 43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first 44 | string in the dictionary file values/strings.xml. 45 | -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/Resources/values/Strings.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | HybridWebControl.Droid 5 | 6 | -------------------------------------------------------------------------------- /HybridWebPlatform.Droid/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /HybridWebPlatform.iOS/ControlRenderers/HybridWebView/HybridWebPlatformNavigationDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Foundation; 3 | using WebKit; 4 | 5 | namespace HybridWebPlatform.iOS 6 | { 7 | public class HybridWebPlatformNavigationDelegate : WKNavigationDelegate 8 | { 9 | public event Action ReceivedError; 10 | public event Action StartLoadingUrl; 11 | public event Action FinishedLoadingUrl; 12 | public event Func ShouldStartPageLoading; 13 | public event Action OpenExternalWindow; 14 | 15 | public HybridWebPlatformNavigationDelegate() 16 | { 17 | } 18 | 19 | public override void DecidePolicy(WKWebView webView, WKNavigationAction navigationAction, Action decisionHandler) 20 | { 21 | var action = WKNavigationActionPolicy.Allow; 22 | 23 | if (navigationAction.TargetFrame == null) 24 | { 25 | if (OpenExternalWindow != null) 26 | { 27 | OpenExternalWindow(new Uri(navigationAction.Request.Url.AbsoluteString)); 28 | } 29 | decisionHandler(WKNavigationActionPolicy.Cancel); 30 | } 31 | 32 | if (ShouldStartPageLoading != null) 33 | { 34 | action = ShouldStartPageLoading(navigationAction.Request.Url.AbsoluteString) ? WKNavigationActionPolicy.Allow : WKNavigationActionPolicy.Cancel; 35 | } 36 | 37 | decisionHandler(action); 38 | } 39 | 40 | public override void DecidePolicy(WKWebView webView, WKNavigationResponse navigationResponse, Action decisionHandler) 41 | { 42 | NSHttpUrlResponse response = navigationResponse.Response as NSHttpUrlResponse; 43 | NSHttpCookie[] cookies = NSHttpCookie.CookiesWithResponseHeaderFields(response.AllHeaderFields, response.Url); 44 | 45 | foreach (NSHttpCookie cookie in cookies) 46 | { 47 | NSHttpCookieStorage.SharedStorage.SetCookie(cookie); 48 | } 49 | 50 | decisionHandler(WKNavigationResponsePolicy.Allow); 51 | } 52 | 53 | public override void DidStartProvisionalNavigation(WKWebView webView, WKNavigation navigation) 54 | { 55 | if (StartLoadingUrl != null) 56 | { 57 | StartLoadingUrl(webView.Url.AbsoluteString); 58 | } 59 | } 60 | 61 | public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation) 62 | { 63 | if (FinishedLoadingUrl != null) 64 | { 65 | FinishedLoadingUrl(webView.Url.AbsoluteString); 66 | } 67 | } 68 | 69 | public override void DidFailNavigation(WKWebView webView, WKNavigation navigation, NSError error) 70 | { 71 | if (ReceivedError != null) 72 | { 73 | string description = ""; 74 | int errorCode = 0; 75 | string url = ""; 76 | 77 | if (error != null) 78 | { 79 | description = error.Description; 80 | errorCode = (int)error.Code; 81 | } 82 | 83 | if (webView.Url != null) 84 | { 85 | url = webView.Url.AbsoluteString; 86 | } 87 | 88 | ReceivedError(url, description, errorCode); 89 | } 90 | } 91 | 92 | public override void DidFailProvisionalNavigation(WKWebView webView, WKNavigation navigation, NSError error) 93 | { 94 | if (ReceivedError != null) 95 | { 96 | string description = ""; 97 | int errorCode = 0; 98 | string url = ""; 99 | 100 | if (error != null) 101 | { 102 | description = error.Description; 103 | errorCode = (int)error.Code; 104 | } 105 | 106 | if (webView.Url != null) 107 | { 108 | url = webView.Url.AbsoluteString; 109 | } 110 | 111 | ReceivedError(url, description, errorCode); 112 | } 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /HybridWebPlatform.iOS/ControlRenderers/HybridWebView/HybridWebPlatformUIDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using UIKit; 4 | using WebKit; 5 | 6 | namespace HybridWebPlatform.iOS 7 | { 8 | class HybridWebPlatformUIDelegate : WebKit.WKUIDelegate 9 | { 10 | public override void RunJavaScriptAlertPanel(WKWebView webView, string message, WKFrameInfo frame, Action completionHandler) 11 | { 12 | var alertController = UIAlertController.Create("", message, UIAlertControllerStyle.Alert); 13 | 14 | var actionOk = UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (UIAlertAction obj) => 15 | { 16 | completionHandler(); 17 | }); 18 | 19 | alertController.AddAction(actionOk); 20 | 21 | UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alertController, true, null); 22 | } 23 | 24 | public override void RunJavaScriptConfirmPanel(WKWebView webView, string message, WKFrameInfo frame, Action completionHandler) 25 | { 26 | var alertController = UIAlertController.Create("", message, UIAlertControllerStyle.Alert); 27 | 28 | var actionOk = UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (UIAlertAction obj) => 29 | { 30 | completionHandler(true); 31 | }); 32 | var actionCancel = UIAlertAction.Create("Cancel", UIAlertActionStyle.Default, (UIAlertAction obj) => 33 | { 34 | completionHandler(false); 35 | }); 36 | 37 | alertController.AddAction(actionOk); 38 | alertController.AddAction(actionCancel); 39 | 40 | UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alertController, true, null); 41 | } 42 | 43 | public override void RunJavaScriptTextInputPanel(WKWebView webView, string prompt, string defaultText, WKFrameInfo frame, Action completionHandler) 44 | { 45 | var alertController = UIAlertController.Create("", prompt, UIAlertControllerStyle.Alert); 46 | 47 | alertController.AddTextField((UITextField obj) => obj.Text = defaultText); 48 | var actionOk = UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (UIAlertAction obj) => 49 | { 50 | string text = alertController.TextFields.Any() ? alertController.TextFields.First().Text : defaultText; 51 | completionHandler(text); 52 | }); 53 | var actionCancel = UIAlertAction.Create("Cancel", UIAlertActionStyle.Default, (UIAlertAction obj) => 54 | { 55 | completionHandler(null); 56 | }); 57 | 58 | alertController.AddAction(actionOk); 59 | alertController.AddAction(actionCancel); 60 | 61 | UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alertController, true, null); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /HybridWebPlatform.iOS/ControlRenderers/HybridWebView/HybridWebPlatformViewRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Foundation; 3 | using HybridWebPlatform; 4 | using HybridWebPlatform.iOS; 5 | using UIKit; 6 | using WebKit; 7 | using Xamarin.Forms; 8 | using Xamarin.Forms.Platform.iOS; 9 | 10 | [assembly: ExportRenderer(typeof(HybridWebPlatformView), typeof(HybridWebPlatformViewRenderer))] 11 | namespace HybridWebPlatform.iOS 12 | { 13 | public class HybridWebPlatformViewRenderer : ViewRenderer, IWKScriptMessageHandler, IHybridWebPlatformViewRenderer 14 | { 15 | public event Func PageLoadRequest; 16 | public event Action PageLoadStarted; 17 | public event Action PageLoadFinished; 18 | public event Action PageLoadError; 19 | public event Action JavascriptExecuted; 20 | public event Action PageLoadInNewWindowRequest; 21 | 22 | private WKUserContentController userController; 23 | 24 | private const string NativeFuncCall = "window.webkit.messageHandlers.native.postMessage"; 25 | private const string NativeFunction = "function Native(action, data){window.webkit.messageHandlers.native.postMessage(JSON.stringify({ a: action, d: data }));}"; 26 | 27 | public bool CanGoBack 28 | { 29 | get 30 | { 31 | return this.Control.CanGoBack; 32 | } 33 | } 34 | 35 | public bool CanGoForward 36 | { 37 | get 38 | { 39 | return this.Control.CanGoForward; 40 | } 41 | } 42 | 43 | public string CurrentUrl 44 | { 45 | get 46 | { 47 | return this.Control.Url.AbsoluteString; 48 | } 49 | } 50 | 51 | public bool IsLoading 52 | { 53 | get 54 | { 55 | return this.Control.IsLoading; 56 | } 57 | } 58 | 59 | public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint) 60 | { 61 | return new SizeRequest(Size.Zero, Size.Zero); 62 | } 63 | 64 | public override void LayoutSubviews() 65 | { 66 | base.LayoutSubviews(); 67 | Control.ScrollView.Frame = Control.Bounds; 68 | } 69 | 70 | public void DidReceiveScriptMessage(WKUserContentController userContentController, WKScriptMessage message) 71 | { 72 | Element.MessageReceived(message.Body.ToString()); 73 | } 74 | 75 | public void GoBack() 76 | { 77 | this.Control.GoBack(); 78 | } 79 | 80 | public void GoForward() 81 | { 82 | this.Control.GoForward(); 83 | } 84 | 85 | public void RefreshPage() 86 | { 87 | this.Control.Reload(); 88 | } 89 | 90 | public void LoadPage(Uri page) 91 | { 92 | this.Control.LoadRequest(new NSUrlRequest(new NSUrl(page.AbsoluteUri))); 93 | } 94 | 95 | public void ExecuteJavascript(string javascript) 96 | { 97 | Inject(javascript); 98 | } 99 | 100 | protected override void OnElementChanged(ElementChangedEventArgs e) 101 | { 102 | base.OnElementChanged(e); 103 | 104 | if (Control == null && e.NewElement != null) 105 | { 106 | userController = new WKUserContentController(); 107 | 108 | var config = new WKWebViewConfiguration() 109 | { 110 | UserContentController = userController 111 | }; 112 | 113 | var script = new WKUserScript(new NSString(NativeFunction + HybridWebPlatformView.GetInitialJsScript(NativeFuncCall)), WKUserScriptInjectionTime.AtDocumentEnd, false); 114 | 115 | userController.AddUserScript(script); 116 | 117 | userController.AddScriptMessageHandler(this, "native"); 118 | 119 | var webView = new WKWebView(Frame, config) { NavigationDelegate = CreateNavidationalDelagate(), UIDelegate = new HybridWebPlatformUIDelegate() }; 120 | 121 | webView.Opaque = false; 122 | 123 | webView.BackgroundColor = UIColor.Clear; 124 | 125 | SetNativeControl(webView); 126 | 127 | } 128 | 129 | e.NewElement.SetViewRenderer(this); 130 | } 131 | 132 | private void Inject(string script) 133 | { 134 | if (Control != null) 135 | { 136 | InvokeOnMainThread(() => Control.EvaluateJavaScript(new NSString(script), (r, e) => 137 | { 138 | var returnValues = new Tuple(r, e); 139 | if (JavascriptExecuted != null) 140 | { 141 | JavascriptExecuted(""); 142 | } 143 | })); 144 | } 145 | } 146 | 147 | private HybridWebPlatformNavigationDelegate CreateNavidationalDelagate() 148 | { 149 | var navigationDelegate = new HybridWebPlatformNavigationDelegate(); 150 | 151 | navigationDelegate.ReceivedError += NavigationDelegate_ReceivedError; 152 | navigationDelegate.FinishedLoadingUrl += NavigationDelegate_FinishedLoadingUrl; 153 | navigationDelegate.StartLoadingUrl += NavigationDelegate_StartLoadingUrl; 154 | navigationDelegate.ShouldStartPageLoading += NavigationDelegate_ShouldStartPageLoading; 155 | navigationDelegate.OpenExternalWindow += NavigationDelegate_OpenExternalWindow; 156 | 157 | return navigationDelegate; 158 | } 159 | 160 | private void NavigationDelegate_ReceivedError(string arg1, string arg2, int arg3) 161 | { 162 | UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; 163 | if (PageLoadError != null) 164 | { 165 | this.PageLoadError(new Uri(arg1), arg2, arg3); 166 | } 167 | } 168 | 169 | private void NavigationDelegate_FinishedLoadingUrl(string obj) 170 | { 171 | UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; 172 | if (PageLoadFinished != null) 173 | { 174 | this.PageLoadFinished(new Uri(obj)); 175 | } 176 | } 177 | 178 | private void NavigationDelegate_StartLoadingUrl(string obj) 179 | { 180 | UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; 181 | if (PageLoadStarted != null) 182 | { 183 | this.PageLoadStarted(new Uri(obj)); 184 | } 185 | } 186 | 187 | private bool NavigationDelegate_ShouldStartPageLoading(string arg) 188 | { 189 | if (PageLoadRequest != null) 190 | { 191 | return this.PageLoadRequest(new Uri(arg)); 192 | } 193 | return true; 194 | } 195 | 196 | private void NavigationDelegate_OpenExternalWindow(Uri obj) 197 | { 198 | UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; 199 | if (PageLoadInNewWindowRequest != null) 200 | { 201 | this.PageLoadInNewWindowRequest(obj); 202 | } 203 | } 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /HybridWebPlatform.iOS/HybridWebPlatform.iOS.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {CBAFBB3A-83A4-4416-9897-A33E1595447E} 7 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | Library 9 | HybridWebPlatform.iOS 10 | HybridWebPlatform.iOS 11 | Resources 12 | 1.0.0.6 13 | 14 | 15 | true 16 | full 17 | false 18 | bin\Debug 19 | DEBUG; 20 | prompt 21 | 4 22 | iPhone Developer 23 | true 24 | true 25 | 54683 26 | false 27 | 28 | 29 | 30 | 31 | 32 | pdbonly 33 | true 34 | bin\Release 35 | 36 | prompt 37 | 4 38 | iPhone Developer 39 | SdkOnly 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | ..\packages\ExifLib.PCL.1.0.2-pre01\lib\netstandard1.0\ExifLib.dll 50 | 51 | 52 | ..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll 53 | 54 | 55 | ..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll 56 | 57 | 58 | ..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll 59 | 60 | 61 | ..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll 62 | 63 | 64 | ..\packages\XLabs.Core.2.3.0-pre05\lib\netstandard1.0\XLabs.Core.dll 65 | 66 | 67 | ..\packages\XLabs.IoC.2.3.0-pre05\lib\netstandard1.0\XLabs.IOC.dll 68 | 69 | 70 | ..\packages\XLabs.Serialization.2.3.0-pre05\lib\NETStandard1.0\XLabs.Serialization.dll 71 | 72 | 73 | ..\packages\XLabs.Platform.2.3.0-pre05\lib\xamarinios10\XLabs.Platform.dll 74 | 75 | 76 | ..\packages\XLabs.Platform.2.3.0-pre05\lib\xamarinios10\XLabs.Platform.iOS.dll 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | {37DC4546-2D9A-4290-809E-E2D962DBB36A} 95 | HybridWebPlatform 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /HybridWebPlatform.iOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("HybridWebControl.iOS")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("")] 12 | [assembly: AssemblyCopyright("(c) mr wheelkers")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | -------------------------------------------------------------------------------- /HybridWebPlatform.iOS/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HybridWebPlatform.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HybridWebPlatform", "HybridWebPlatform\HybridWebPlatform.csproj", "{37DC4546-2D9A-4290-809E-E2D962DBB36A}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HybridWebPlatform.Droid", "HybridWebPlatform.Droid\HybridWebPlatform.Droid.csproj", "{6EB5711B-B194-4724-BF95-FB3EF09C04C8}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HybridWebPlatform.iOS", "HybridWebPlatform.iOS\HybridWebPlatform.iOS.csproj", "{CBAFBB3A-83A4-4416-9897-A33E1595447E}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example", "Example", "{66DB4B9E-BA92-4FD6-9E03-94905E39731A}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Xaml", "Xaml", "{5E2D14ED-3CD7-4954-95E7-194575C45C3E}" 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Code", "Code", "{60C9F095-DCF7-4BEE-ABAB-82CD456DBC1B}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlExample", "Example\Xaml\XamlExample\XamlExample.csproj", "{2FB55230-2E1C-435E-B649-4559327CDCE7}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlExample.iOS", "Example\Xaml\iOS\XamlExample.iOS.csproj", "{EAE350F7-D4EE-4BCB-9A0E-0368897178E8}" 19 | EndProject 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlExample.Droid", "Example\Xaml\Droid\XamlExample.Droid.csproj", "{C44E2B6D-9A59-466E-B652-28918C280046}" 21 | EndProject 22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeExample", "Example\Code\CodeExample\CodeExample.csproj", "{D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}" 23 | EndProject 24 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeExample.iOS", "Example\Code\iOS\CodeExample.iOS.csproj", "{F6483EE1-8992-40BC-BF26-C5DD83068E4A}" 25 | EndProject 26 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeExample.Droid", "Example\Code\Droid\CodeExample.Droid.csproj", "{0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}" 27 | EndProject 28 | Global 29 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 30 | Debug|Any CPU = Debug|Any CPU 31 | Release|Any CPU = Release|Any CPU 32 | Debug|iPhoneSimulator = Debug|iPhoneSimulator 33 | Release|iPhone = Release|iPhone 34 | Release|iPhoneSimulator = Release|iPhoneSimulator 35 | Debug|iPhone = Debug|iPhone 36 | EndGlobalSection 37 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 38 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 43 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 44 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Release|iPhone.ActiveCfg = Release|Any CPU 45 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Release|iPhone.Build.0 = Release|Any CPU 46 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 47 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 48 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Debug|iPhone.ActiveCfg = Debug|Any CPU 49 | {37DC4546-2D9A-4290-809E-E2D962DBB36A}.Debug|iPhone.Build.0 = Debug|Any CPU 50 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 51 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Debug|Any CPU.Build.0 = Debug|Any CPU 52 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 55 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 56 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Release|iPhone.ActiveCfg = Release|Any CPU 57 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Release|iPhone.Build.0 = Release|Any CPU 58 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 59 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 60 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Debug|iPhone.ActiveCfg = Debug|Any CPU 61 | {6EB5711B-B194-4724-BF95-FB3EF09C04C8}.Debug|iPhone.Build.0 = Debug|Any CPU 62 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 63 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Debug|Any CPU.Build.0 = Debug|Any CPU 64 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Release|Any CPU.ActiveCfg = Release|Any CPU 65 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Release|Any CPU.Build.0 = Release|Any CPU 66 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 67 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 68 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Release|iPhone.ActiveCfg = Release|Any CPU 69 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Release|iPhone.Build.0 = Release|Any CPU 70 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 71 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 72 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Debug|iPhone.ActiveCfg = Debug|Any CPU 73 | {CBAFBB3A-83A4-4416-9897-A33E1595447E}.Debug|iPhone.Build.0 = Debug|Any CPU 74 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 75 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Debug|Any CPU.Build.0 = Debug|Any CPU 76 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Release|Any CPU.ActiveCfg = Release|Any CPU 77 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Release|Any CPU.Build.0 = Release|Any CPU 78 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 79 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 80 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Release|iPhone.ActiveCfg = Release|Any CPU 81 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Release|iPhone.Build.0 = Release|Any CPU 82 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 83 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 84 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Debug|iPhone.ActiveCfg = Debug|Any CPU 85 | {2FB55230-2E1C-435E-B649-4559327CDCE7}.Debug|iPhone.Build.0 = Debug|Any CPU 86 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator 87 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator 88 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Release|Any CPU.ActiveCfg = Release|iPhone 89 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Release|Any CPU.Build.0 = Release|iPhone 90 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator 91 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator 92 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Release|iPhone.ActiveCfg = Release|iPhone 93 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Release|iPhone.Build.0 = Release|iPhone 94 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator 95 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator 96 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Debug|iPhone.ActiveCfg = Debug|iPhone 97 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8}.Debug|iPhone.Build.0 = Debug|iPhone 98 | {C44E2B6D-9A59-466E-B652-28918C280046}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 99 | {C44E2B6D-9A59-466E-B652-28918C280046}.Debug|Any CPU.Build.0 = Debug|Any CPU 100 | {C44E2B6D-9A59-466E-B652-28918C280046}.Release|Any CPU.ActiveCfg = Release|Any CPU 101 | {C44E2B6D-9A59-466E-B652-28918C280046}.Release|Any CPU.Build.0 = Release|Any CPU 102 | {C44E2B6D-9A59-466E-B652-28918C280046}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 103 | {C44E2B6D-9A59-466E-B652-28918C280046}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 104 | {C44E2B6D-9A59-466E-B652-28918C280046}.Release|iPhone.ActiveCfg = Release|Any CPU 105 | {C44E2B6D-9A59-466E-B652-28918C280046}.Release|iPhone.Build.0 = Release|Any CPU 106 | {C44E2B6D-9A59-466E-B652-28918C280046}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 107 | {C44E2B6D-9A59-466E-B652-28918C280046}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 108 | {C44E2B6D-9A59-466E-B652-28918C280046}.Debug|iPhone.ActiveCfg = Debug|Any CPU 109 | {C44E2B6D-9A59-466E-B652-28918C280046}.Debug|iPhone.Build.0 = Debug|Any CPU 110 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 111 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Debug|Any CPU.Build.0 = Debug|Any CPU 112 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Release|Any CPU.ActiveCfg = Release|Any CPU 113 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Release|Any CPU.Build.0 = Release|Any CPU 114 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 115 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 116 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Release|iPhone.ActiveCfg = Release|Any CPU 117 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Release|iPhone.Build.0 = Release|Any CPU 118 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 119 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 120 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Debug|iPhone.ActiveCfg = Debug|Any CPU 121 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC}.Debug|iPhone.Build.0 = Debug|Any CPU 122 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator 123 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator 124 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Release|Any CPU.ActiveCfg = Release|iPhone 125 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Release|Any CPU.Build.0 = Release|iPhone 126 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator 127 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator 128 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Release|iPhone.ActiveCfg = Release|iPhone 129 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Release|iPhone.Build.0 = Release|iPhone 130 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator 131 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator 132 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Debug|iPhone.ActiveCfg = Debug|iPhone 133 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A}.Debug|iPhone.Build.0 = Debug|iPhone 134 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 135 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Debug|Any CPU.Build.0 = Debug|Any CPU 136 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Release|Any CPU.ActiveCfg = Release|Any CPU 137 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Release|Any CPU.Build.0 = Release|Any CPU 138 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 139 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 140 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Release|iPhone.ActiveCfg = Release|Any CPU 141 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Release|iPhone.Build.0 = Release|Any CPU 142 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 143 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 144 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Debug|iPhone.ActiveCfg = Debug|Any CPU 145 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF}.Debug|iPhone.Build.0 = Debug|Any CPU 146 | EndGlobalSection 147 | GlobalSection(NestedProjects) = preSolution 148 | {5E2D14ED-3CD7-4954-95E7-194575C45C3E} = {66DB4B9E-BA92-4FD6-9E03-94905E39731A} 149 | {60C9F095-DCF7-4BEE-ABAB-82CD456DBC1B} = {66DB4B9E-BA92-4FD6-9E03-94905E39731A} 150 | {2FB55230-2E1C-435E-B649-4559327CDCE7} = {5E2D14ED-3CD7-4954-95E7-194575C45C3E} 151 | {EAE350F7-D4EE-4BCB-9A0E-0368897178E8} = {5E2D14ED-3CD7-4954-95E7-194575C45C3E} 152 | {C44E2B6D-9A59-466E-B652-28918C280046} = {5E2D14ED-3CD7-4954-95E7-194575C45C3E} 153 | {D7BEA3ED-8BAD-484D-9D55-6140A59D93EC} = {60C9F095-DCF7-4BEE-ABAB-82CD456DBC1B} 154 | {F6483EE1-8992-40BC-BF26-C5DD83068E4A} = {60C9F095-DCF7-4BEE-ABAB-82CD456DBC1B} 155 | {0C7E8596-950B-43B9-BE9E-5C8EC5A8B4EF} = {60C9F095-DCF7-4BEE-ABAB-82CD456DBC1B} 156 | EndGlobalSection 157 | GlobalSection(MonoDevelopProperties) = preSolution 158 | version = 1.0.0.6 159 | EndGlobalSection 160 | EndGlobal 161 | -------------------------------------------------------------------------------- /HybridWebPlatform/Contracts/HybridJavascriptMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace HybridWebPlatform.Contracts 5 | { 6 | [DataContract] 7 | public class HybridJavascriptMessage 8 | { 9 | [DataMember(Name = "a")] 10 | public string Action { get; set; } 11 | [DataMember(Name = "d")] 12 | public object Data { get; set; } 13 | [DataMember(Name = "c")] 14 | public string Callback { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /HybridWebPlatform/Control/HybridWebPlatformView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using HybridWebPlatform.Contracts; 6 | using Xamarin.Forms; 7 | using XLabs.Ioc; 8 | using XLabs.Serialization; 9 | 10 | namespace HybridWebPlatform 11 | { 12 | public class HybridWebPlatformView : View 13 | { 14 | private string currentHash; 15 | private IHybridWebPlatformViewRenderer actionSource; 16 | private TaskCompletionSource rendererLoadedSource; 17 | 18 | private readonly IJsonSerializer jsonSerializer; 19 | private readonly Dictionary> registeredActions; 20 | private readonly Dictionary> registeredFunctions; 21 | 22 | public HybridWebPlatformView() : this((Resolver.IsSet ? Resolver.Resolve() : null) 23 | ?? DependencyService.Get() ?? new SystemJsonSerializer()) 24 | { 25 | } 26 | 27 | public HybridWebPlatformView(IJsonSerializer jsonSerializer) 28 | { 29 | this.jsonSerializer = jsonSerializer; 30 | this.registeredActions = new Dictionary>(); 31 | this.registeredFunctions = new Dictionary>(); 32 | rendererLoadedSource = new TaskCompletionSource(); 33 | RegisterHybridInternalJavascriptCallbacks(); 34 | } 35 | 36 | public bool CanGoBack 37 | { 38 | get 39 | { 40 | return actionSource.CanGoBack; 41 | } 42 | } 43 | 44 | public bool CanGoForward 45 | { 46 | get 47 | { 48 | return actionSource.CanGoForward; 49 | } 50 | } 51 | 52 | public string CurrentUrl 53 | { 54 | get 55 | { 56 | return actionSource.CurrentUrl; 57 | } 58 | } 59 | 60 | public bool IsLoading 61 | { 62 | get 63 | { 64 | return actionSource.IsLoading; 65 | } 66 | } 67 | 68 | public string CurrentHashAnchor 69 | { 70 | get 71 | { 72 | return currentHash; 73 | } 74 | } 75 | 76 | //Required browser actions 77 | 78 | public event Func PageLoadRequest; 79 | public event Action PageLoadStarted; 80 | public event Action PageLoadFinished; 81 | public event Action PageLoadError; 82 | public event Action NewWebBrowserWindowOpenRequest; 83 | 84 | //Required Js actions 85 | 86 | public event Action HashAnchorChanged; 87 | public event Action JavascriptExecutionError; 88 | 89 | public void GoBack() 90 | { 91 | actionSource.GoBack(); 92 | } 93 | 94 | public void GoForward() 95 | { 96 | actionSource.GoForward(); 97 | } 98 | 99 | public void RefreshPage() 100 | { 101 | actionSource.RefreshPage(); 102 | } 103 | 104 | public void RegisterCallback(string name, Action action) 105 | { 106 | this.registeredActions.Add(name, action); 107 | } 108 | 109 | public bool RemoveCallback(string name) 110 | { 111 | return this.registeredActions.Remove(name); 112 | } 113 | 114 | public void RegisterNativeFunction(string name, Func func) 115 | { 116 | this.registeredFunctions.Add(name, func); 117 | } 118 | 119 | public bool RemoveNativeFunction(string name) 120 | { 121 | return this.registeredFunctions.Remove(name); 122 | } 123 | 124 | public void LoadPage(Uri page) 125 | { 126 | if (actionSource == null) 127 | { 128 | CheckIfRendererLoaded(page); 129 | return; 130 | } 131 | 132 | string actualLink = page.AbsoluteUri; 133 | string hashResult = null; 134 | 135 | if (page.AbsoluteUri.Contains("#")) 136 | { 137 | int firstHashPosition = page.AbsoluteUri.IndexOf('#'); 138 | 139 | actualLink = page.AbsoluteUri.Substring(0, firstHashPosition); 140 | 141 | hashResult = page.AbsoluteUri.Substring(firstHashPosition); 142 | } 143 | 144 | actionSource.LoadPage(new Uri(actualLink)); 145 | 146 | if (!string.IsNullOrEmpty(hashResult)) 147 | { 148 | Task.Factory.StartNew(() => 149 | { 150 | while (this.IsLoading) 151 | { 152 | //Waiting for page to load before applying javascript 153 | //Required for iOS (we can not navigate that contain #anchors in iOS) 154 | Task.Delay(100).Wait(); 155 | } 156 | LoadHashAnchor(hashResult); 157 | }); 158 | } 159 | } 160 | 161 | public void LoadHashAnchor(string anchor) 162 | { 163 | actionSource.ExecuteJavascript($"window.location.href = '{anchor}';"); 164 | } 165 | 166 | public void ExecuteJavascript(string javascript) 167 | { 168 | actionSource.ExecuteJavascript(javascript); 169 | } 170 | 171 | public void ExecuteJavascriptFunction(string functionName, params object[] parameters) 172 | { 173 | var builder = new StringBuilder(); 174 | 175 | builder.Append(functionName); 176 | builder.Append("("); 177 | for (var n = 0; n < parameters.Length; n++) 178 | { 179 | builder.Append(this.jsonSerializer.Serialize(parameters[n])); 180 | if (n < parameters.Length - 1) 181 | { 182 | builder.Append(", "); 183 | } 184 | } 185 | builder.Append(");"); 186 | 187 | ExecuteJavascript(builder.ToString()); 188 | } 189 | 190 | public void RemoveAllCallbacks() 191 | { 192 | this.registeredActions.Clear(); 193 | } 194 | 195 | public void RemoveAllFunctions() 196 | { 197 | this.registeredFunctions.Clear(); 198 | } 199 | 200 | internal void SetViewRenderer(IHybridWebPlatformViewRenderer source) 201 | { 202 | UnregisterOldWebActionSource(); 203 | this.actionSource = source; 204 | this.actionSource.PageLoadRequest += this.PageLoadRequestHandler; 205 | this.actionSource.PageLoadStarted += this.PageLoadStartedHandler; 206 | this.actionSource.PageLoadFinished += this.PageLoadFinishedHandler; 207 | this.actionSource.PageLoadError += this.PageLoadErrorHandler; 208 | this.actionSource.PageLoadInNewWindowRequest += this.NewWebBrowserWindowOpenRequestHandler; 209 | rendererLoadedSource.SetResult(true); 210 | } 211 | 212 | internal bool TryGetAction(string name, out Action action) 213 | { 214 | return this.registeredActions.TryGetValue(name, out action); 215 | } 216 | 217 | internal bool TryGetFunc(string name, out Func func) 218 | { 219 | return this.registeredFunctions.TryGetValue(name, out func); 220 | } 221 | 222 | internal void MessageReceived(string message) 223 | { 224 | var m = this.jsonSerializer.Deserialize(message); 225 | 226 | if (m?.Action == null) return; 227 | 228 | Action action; 229 | 230 | if (this.TryGetAction(m.Action, out action)) 231 | { 232 | action.Invoke(m.Data.ToString()); 233 | return; 234 | } 235 | 236 | Func func; 237 | 238 | if (this.TryGetFunc(m.Action, out func)) 239 | { 240 | Task.Run(() => 241 | { 242 | var result = func.Invoke(m.Data.ToString()); 243 | 244 | ExecuteJavascriptFunction($"NativeFuncs[{m.Callback}]", result); 245 | }); 246 | } 247 | } 248 | 249 | internal void HashAnchorChangedCallback(string newHash) 250 | { 251 | if (currentHash == newHash) return; 252 | currentHash = newHash; 253 | if (HashAnchorChanged != null) 254 | { 255 | HashAnchorChanged(newHash); 256 | } 257 | } 258 | 259 | internal void OnNewWebBrowserWindowOpenRequest(Uri uri) 260 | { 261 | if (NewWebBrowserWindowOpenRequest != null) 262 | { 263 | NewWebBrowserWindowOpenRequest(uri); 264 | } 265 | } 266 | 267 | internal static string GetInitialJsScript(string nativeFunction) 268 | { 269 | var builder = new StringBuilder(); 270 | builder.Append("NativeFuncs = [];"); 271 | builder.Append("function NativeFunc(action, data, callback){"); 272 | builder.Append(" var callbackIdx = NativeFuncs.push(callback) - 1;"); 273 | builder.Append(nativeFunction); 274 | builder.Append("(JSON.stringify({ a: action, d: data, c: callbackIdx }));}"); 275 | builder.Append(" if (typeof(window.NativeFuncsReady) !== 'undefined') { "); 276 | builder.Append(" window.NativeFuncsReady(); "); 277 | builder.Append(" } "); 278 | builder.Append("window.addEventListener(\"hashchange\", function(){Native('hashChanged',window.location.hash);});"); 279 | return builder.ToString(); 280 | } 281 | 282 | private void RegisterHybridInternalJavascriptCallbacks() 283 | { 284 | this.RegisterCallback("hashChanged", HashAnchorChangedCallback); 285 | } 286 | 287 | private void UnregisterOldWebActionSource() 288 | { 289 | if (this.actionSource == null) return; 290 | 291 | rendererLoadedSource = new TaskCompletionSource(); 292 | this.actionSource.PageLoadRequest -= this.PageLoadRequestHandler; 293 | this.actionSource.PageLoadStarted -= this.PageLoadStartedHandler; 294 | this.actionSource.PageLoadFinished -= this.PageLoadFinishedHandler; 295 | this.actionSource.PageLoadError -= this.PageLoadErrorHandler; 296 | this.actionSource.PageLoadInNewWindowRequest -= this.NewWebBrowserWindowOpenRequestHandler; 297 | } 298 | 299 | private bool PageLoadRequestHandler(Uri uri) 300 | { 301 | if (PageLoadRequest != null) 302 | { 303 | return PageLoadRequest(uri); 304 | } 305 | 306 | return true; 307 | } 308 | 309 | private void PageLoadStartedHandler(Uri uri) 310 | { 311 | if (PageLoadStarted != null) 312 | { 313 | PageLoadStarted(uri); 314 | } 315 | } 316 | 317 | private void PageLoadFinishedHandler(Uri uri) 318 | { 319 | if (PageLoadFinished != null) 320 | { 321 | PageLoadFinished(uri); 322 | } 323 | } 324 | 325 | private void PageLoadErrorHandler(Uri uri, string message, int errorCode) 326 | { 327 | if (PageLoadError != null) 328 | { 329 | PageLoadError(uri, message, errorCode); 330 | } 331 | } 332 | 333 | private void NewWebBrowserWindowOpenRequestHandler(Uri uri) 334 | { 335 | if (NewWebBrowserWindowOpenRequest != null) 336 | { 337 | NewWebBrowserWindowOpenRequest(uri); 338 | } 339 | } 340 | 341 | private async Task CheckIfRendererLoaded(Uri url) 342 | { 343 | await rendererLoadedSource.Task; 344 | LoadPage(url); 345 | } 346 | } 347 | } 348 | -------------------------------------------------------------------------------- /HybridWebPlatform/Control/IHybridWebPlatformViewRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace HybridWebPlatform 5 | { 6 | internal interface IHybridWebPlatformViewRenderer 7 | { 8 | bool CanGoBack 9 | { 10 | get; 11 | } 12 | 13 | bool CanGoForward 14 | { 15 | get; 16 | } 17 | 18 | bool IsLoading 19 | { 20 | get; 21 | } 22 | 23 | string CurrentUrl 24 | { 25 | get; 26 | } 27 | 28 | event Func PageLoadRequest; 29 | event Action PageLoadStarted; 30 | event Action PageLoadFinished; 31 | event Action PageLoadError; 32 | event Action JavascriptExecuted; 33 | event Action PageLoadInNewWindowRequest; 34 | 35 | void GoBack(); 36 | void GoForward(); 37 | void RefreshPage(); 38 | void LoadPage(Uri page); 39 | void ExecuteJavascript(string javascript); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /HybridWebPlatform/HybridWebPlatform.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {37DC4546-2D9A-4290-809E-E2D962DBB36A} 7 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | Library 9 | HybridWebPlatform 10 | HybridWebPlatform 11 | v4.5 12 | Profile111 13 | 1.0.0.6 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug 20 | DEBUG; 21 | prompt 22 | 4 23 | 24 | 25 | true 26 | bin\Release 27 | prompt 28 | 4 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | ..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll 39 | 40 | 41 | ..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll 42 | 43 | 44 | ..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll 45 | 46 | 47 | ..\packages\ExifLib.PCL.1.0.2-pre01\lib\netstandard1.0\ExifLib.dll 48 | 49 | 50 | ..\packages\XLabs.Core.2.3.0-pre05\lib\portable-net45+win8+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Core.dll 51 | 52 | 53 | ..\packages\XLabs.IoC.2.3.0-pre05\lib\portable-net45+win8+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.IOC.dll 54 | 55 | 56 | ..\packages\XLabs.Serialization.2.3.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Serialization.dll 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /HybridWebPlatform/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("HybridWebControl")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("")] 12 | [assembly: AssemblyCopyright("(c) mr wheelkers")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.0.*")] 21 | 22 | [assembly: InternalsVisibleTo("HybridWebPlatform.Droid")] 23 | [assembly: InternalsVisibleTo("HybridWebPlatform.iOS")] 24 | 25 | // The following attributes are used to specify the signing key for the assembly, 26 | // if desired. See the Mono documentation for more information about signing. 27 | 28 | //[assembly: AssemblyDelaySign(false)] 29 | //[assembly: AssemblyKeyFile("")] 30 | -------------------------------------------------------------------------------- /HybridWebPlatform/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Nuspec/HybridWebControl.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HybridWebPlatform 5 | 1.0.0.6-pre01 6 | HybridWebPlatform 7 | mr-wheelkers 8 | xlabs, mr-wheelkers 9 | https://opensource.org/licenses/MIT 10 | https://github.com/mr-wheelkers/Hybrid-Web-Platform 11 | false 12 | Full-fledged WebView as Xamarin.Forms plugin with cross-platform C# to JavaScript and JavaScript to C# calls support. Eventually invented for painless hybrid apps creation. 13 | Initial release 14 | Copyright 2017 15 | XamarinAndroid XamarinIOS Xamarin Android iOS HybridWebControl HybridWebView ExtendedWebView Javascript WebView 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Warning! 2 | 3 | The project doesn't maintain anymore. 4 | 5 | ## Abstract 6 | Full-fledged WebView as Xamarin.Forms plugin (XLabs based) with cross-platform C# to JavaScript and JavaScript to C# calls support. Built for painless hybrid apps creation. 7 | 8 | HybridWebPlatform based on great XLabs core components, but does not depends on [XLabs.HybridWebView](https://github.com/XLabs/Xamarin-Forms-Labs/wiki/HybridWebView). Moreover, HybridWebPlatform replacing XLabs.HybridWebView as more advanced and not legacy plugin. 9 | 10 | ## HybridWebPlatform Advantages 11 | It solves the following problems for: 12 | 13 | - Xamrin.Forms WebView 14 | - Allows to call C# from JavaScript 15 | - XLabs.WebView 16 | - Fix rendering perfromance issue on Android (Hardware rendering) 17 | 18 | ## Road Map 19 | - [ ] Enable Hardware accelaration by default (actual for Android) 20 | - [ ] Support UWP 21 | - [ ] Fix keyboard overlap issue on Android 22 | 23 | ## How-to Use 24 | 1. Install NuGet package for all PCL, Android and iOS projects using e.g. Xamarin Studio. *To install NuGet correctly, make sure you use Profile111 for PCL.* 25 | 1. [iOS] Invoke Renderer (TBD) 26 | 1. [Android] Add Android.Export (http://stackoverflow.com/questions/31085554/you-need-to-add-a-reference-to-mono-android-export-dll-when-you-use-exportattrib) 27 | 1. [Android][Optional] Enable hardware rendering using the following code within _MainActivity.OnCreate()_ class before _LoadApplication()_ invoke. 28 | ``` 29 | // ... 30 | HybridWebControl.Droid.HybridWebViewRenderer.EnableHardwareRendering = true; 31 | LoadApplication(new App()); 32 | ``` 33 | --------------------------------------------------------------------------------