Skip to content

Commit

Permalink
- Merged together the folders of the Server and the App
Browse files Browse the repository at this point in the history
  • Loading branch information
reyalpsirc committed Dec 11, 2015
1 parent 2f75c1d commit 9f4c89c
Show file tree
Hide file tree
Showing 339 changed files with 137,114 additions and 3 deletions.
39 changes: 39 additions & 0 deletions LiveXAMLApp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#Autosave files
*~

#build
[Oo]bj/
[Bb]in/
TestResults/

# globs
Makefile.in
*.DS_Store
*.sln.cache
*.suo
*.cache
*.pidb
*.userprefs
*.usertasks
config.log
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.user
*.tar.gz
tarballs/
test-results/
Thumbs.db

#Mac bundle stuff
*.dmg
*.app

#resharper
*_Resharper.*
*.Resharper

#dotCover
*.dotCover
19 changes: 19 additions & 0 deletions LiveXAMLApp/Droid/Assets/AboutAssets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".

These files will be deployed with your package and will be accessible using Android's
AssetManager, like this:

public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

InputStream input = Assets.Open ("my_asset.txt");
}
}

Additionally, some Android functions will automatically load asset files:

Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
62 changes: 62 additions & 0 deletions LiveXAMLApp/Droid/Dependencies/WebSocketClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using WebSocket4Net;
using LiveXAML.Droid;
using System.Threading.Tasks;
using System.Threading;

[assembly: Xamarin.Forms.Dependency (typeof (WebSocketClient))]
namespace LiveXAML.Droid
{
public class WebSocketClient:IWebSocketClient
{
WebSocket websocket;
Task timer;
bool connected = false;

public WebSocketClient ()
{
}

public override void Open (string wslocalhost){
connected = false;
websocket = new WebSocket(wslocalhost,"",(WebSocketVersion) (-1));
websocket.Opened += delegate(object sender, EventArgs e) {
connected = true;
if (Opened!=null){
Opened();
}
};
websocket.MessageReceived += delegate(object sender, MessageReceivedEventArgs e) {
if (MessageReceived!=null){
MessageReceived(e.Message);
}
};
websocket.Error += delegate(object sender, SuperSocket.ClientEngine.ErrorEventArgs e) {
if (!connected && websocket!=null){
connected = true;
websocket.Close();
if (Error!=null){
Error(e.Exception);
}
}
};
timer = new Task (async delegate() {
await Task.Delay(2000);
if (!connected && websocket!=null){
connected = true;
websocket.Close();
if (Error!=null){
Error(new Exception("Connection failed"));
}
}
});
timer.Start ();
websocket.Open ();
}

public override void Send (string message){
websocket.Send(message);
}
}
}

44 changes: 44 additions & 0 deletions LiveXAMLApp/Droid/Dependencies/XamlDependency.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Linq;
using System.Reflection;
using Xamarin.Forms;
using LiveXAML.Droid;

[assembly: Xamarin.Forms.Dependency (typeof (XamlDependency))]
namespace LiveXAML.Droid
{
public class XamlDependency:IXamlDependency
{
static Func<BindableObject, string, BindableObject> loadXaml;
public XamlDependency ()
{
// This is the current situation, where the LoadFromXaml is the only non-public static method.
var genericMethod = typeof (Xamarin.Forms.Xaml.Extensions)
.GetMethods (BindingFlags.Static | BindingFlags.NonPublic).FirstOrDefault ();

// If we didn't find it, it may be because the extension method may be public now :)
if (genericMethod == null)
genericMethod = typeof (Xamarin.Forms.Xaml.Extensions)
.GetMethods (BindingFlags.Static | BindingFlags.Public)
.FirstOrDefault (m => m.GetParameters().Last().ParameterType == typeof(string));

if (genericMethod == null){
loadXaml = (view, xaml) => { throw new NotSupportedException("Xamarin.Forms implementation of XAML loading not found. Please update the Dynamic nuget package."); };
}
else {
genericMethod = genericMethod.MakeGenericMethod(typeof(BindableObject));
loadXaml = (view, xaml) => (BindableObject)genericMethod.Invoke (null, new object[] { view, xaml });
}
}

#region IXamlDependency implementation

public void LoadFromXaml<TView> (TView view, string xaml) where TView : Xamarin.Forms.BindableObject
{
loadXaml (view, xaml);
}

#endregion
}
}

121 changes: 121 additions & 0 deletions LiveXAMLApp/Droid/LiveXAML.Droid.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{0020E7C2-977D-4CC6-BDFB-27381FE45E37}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>LiveXAML.Droid</RootNamespace>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidApplication>True</AndroidApplication>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<AssemblyName>LiveXAML.Droid</AssemblyName>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<XamarinInsightsApiKey>960dba32995dcd2801d5b7c356b6307fe689f67d</XamarinInsightsApiKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<Reference Include="Xamarin.Insights">
<HintPath>..\packages\Xamarin.Insights.1.10.6\lib\MonoAndroid10\Xamarin.Insights.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v4">
<HintPath>..\packages\Xamarin.Android.Support.v4.21.0.3.0\lib\MonoAndroid10\Xamarin.Android.Support.v4.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.Android">
<HintPath>..\packages\Xamarin.Forms.1.3.5.6335\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
</Reference>
<Reference Include="FormsViewGroup">
<HintPath>..\packages\Xamarin.Forms.1.3.5.6335\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.1.3.5.6335\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.1.3.5.6335\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\monoandroid\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\monoandroid\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="Sockets.Plugin">
<HintPath>..\packages\rda.SocketsForPCL.1.2.2\lib\MonoAndroid10\Sockets.Plugin.dll</HintPath>
</Reference>
<Reference Include="Sockets.Plugin.Abstractions">
<HintPath>..\packages\rda.SocketsForPCL.1.2.2\lib\MonoAndroid10\Sockets.Plugin.Abstractions.dll</HintPath>
</Reference>
<Reference Include="ModernHttpClient">
<HintPath>..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\ModernHttpClient.dll</HintPath>
</Reference>
<Reference Include="OkHttp">
<HintPath>..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\OkHttp.dll</HintPath>
</Reference>
<Reference Include="WebSocket4Net">
<HintPath>..\packages\WebSocket4Net.0.14.1\lib\monoandroid23\WebSocket4Net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LiveXAML\LiveXAML.csproj">
<Project>{5868E89D-E592-492C-9004-D9FDCF258144}</Project>
<Name>LiveXAML</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Dependencies\XamlDependency.cs" />
<Compile Include="Dependencies\WebSocketClient.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml" />
<None Include="Assets\AboutAssets.txt" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\layout\" />
<Folder Include="Resources\values\" />
<Folder Include="Dependencies\" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\icon.png" />
<AndroidResource Include="Resources\drawable-hdpi\icon.png" />
<AndroidResource Include="Resources\drawable-xhdpi\icon.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\icon.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\packages\Xamarin.Insights.1.10.6\build\MonoAndroid10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.10.6\build\MonoAndroid10\Xamarin.Insights.targets')" />
<Import Project="..\packages\Xamarin.Forms.1.3.5.6335\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.1.3.5.6335\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
</Project>
29 changes: 29 additions & 0 deletions LiveXAMLApp/Droid/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;

using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace LiveXAML.Droid
{

[Activity (Label = "LiveXAML.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
public static ClipboardManager AndroidClipboardManager { get; private set; }

protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

global::Xamarin.Forms.Forms.Init (this, bundle);

LoadApplication (new App ());
}
}
}

6 changes: 6 additions & 0 deletions LiveXAMLApp/Droid/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.livexaml">
<uses-sdk android:minSdkVersion="15" />
<application android:label="LiveXAML">
</application>
</manifest>
28 changes: 28 additions & 0 deletions LiveXAMLApp/Droid/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle ("LiveXAML.Droid")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("cristianosantos")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion ("1.0.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

Loading

0 comments on commit 9f4c89c

Please sign in to comment.