Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Adding the initial work to get Tizen started. #23
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed May 11, 2018
1 parent c1169ec commit 58b6041
Show file tree
Hide file tree
Showing 33 changed files with 638 additions and 3 deletions.
21 changes: 21 additions & 0 deletions Samples/Samples.Tizen/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Xamarin.Forms.Platform.Tizen;

namespace Samples.Tizen
{
class Program : FormsApplication
{
protected override void OnCreate()
{
base.OnCreate();

LoadApplication(new App());
}

static void Main(string[] args)
{
var app = new Program();
Forms.Init(app);
app.Run(args);
}
}
}
32 changes: 32 additions & 0 deletions Samples/Samples.Tizen/Samples.Tizen.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>tizen40</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>None</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Tizen.NET" Version="4.0.0" ExcludeAssets="Runtime" />
<PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />
<PackageReference Include="Xamarin.Forms.Platform.Tizen" Version="2.5.0.280555" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Xamarin.Essentials\Xamarin.Essentials.csproj" />
<ProjectReference Include="..\Samples\Samples.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="lib\" />
<Folder Include="res\" />
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\CodeStyles.targets" />
</Project>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions Samples/Samples.Tizen/tizen-manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.xamarin.essentials" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="com.xamarin.essentials" exec="Samples.Tizen.dll" multiple="false" nodisplay="false" taskmanage="true" splash-screen-display="true" type="dotnet" launch_mode="single">
<label>Xamarin.Essentials</label>
<icon>Samples.Tizen.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application>
<privileges>
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>
</privileges>
<provides-appdefined-privileges />
</manifest>
27 changes: 27 additions & 0 deletions Xamarin.Essentials.sln
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceTests.iOS", "DeviceTe
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceTests.UWP", "DeviceTests\DeviceTests.UWP\DeviceTests.UWP.csproj", "{4BD0D88F-7E7A-4C3B-9E34-BF3717A8FF4B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.Tizen", "Samples\Samples.Tizen\Samples.Tizen.csproj", "{4B1850CF-C568-4C16-8B42-3E9977DE5F56}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
DeviceTests\DeviceTests.Shared\DeviceTests.Shared.projitems*{4bd0d88f-7e7a-4c3b-9e34-bf3717a8ff4b}*SharedItemsImports = 4
Expand Down Expand Up @@ -325,6 +327,30 @@ Global
{4BD0D88F-7E7A-4C3B-9E34-BF3717A8FF4B}.Release|x86.ActiveCfg = Release|x86
{4BD0D88F-7E7A-4C3B-9E34-BF3717A8FF4B}.Release|x86.Build.0 = Release|x86
{4BD0D88F-7E7A-4C3B-9E34-BF3717A8FF4B}.Release|x86.Deploy.0 = Release|x86
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|ARM.ActiveCfg = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|ARM.Build.0 = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|iPhone.Build.0 = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|x64.ActiveCfg = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|x64.Build.0 = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|x86.ActiveCfg = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Debug|x86.Build.0 = Debug|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|Any CPU.Build.0 = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|ARM.ActiveCfg = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|ARM.Build.0 = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|iPhone.ActiveCfg = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|iPhone.Build.0 = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|x64.ActiveCfg = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|x64.Build.0 = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|x86.ActiveCfg = Release|Any CPU
{4B1850CF-C568-4C16-8B42-3E9977DE5F56}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -340,6 +366,7 @@ Global
{CB2072E0-A437-4811-AE17-16CAE0DDA1B1} = {EA9AC363-45BC-4959-BD17-FE3A1B724529}
{EE8FC716-27FC-405B-BD27-AF17E01A6671} = {EA9AC363-45BC-4959-BD17-FE3A1B724529}
{4BD0D88F-7E7A-4C3B-9E34-BF3717A8FF4B} = {EA9AC363-45BC-4959-BD17-FE3A1B724529}
{4B1850CF-C568-4C16-8B42-3E9977DE5F56} = {706C0487-6930-4E55-8720-C17D9FE6CA91}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {105B0052-C7EA-44D0-8697-37A45E1392AF}
Expand Down
14 changes: 14 additions & 0 deletions Xamarin.Essentials/Accelerometer/Accelerometer.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Xamarin.Essentials
{
public static partial class Accelerometer
{
internal static bool IsSupported =>
throw new NotImplementedInReferenceAssemblyException();

static void PlatformStart(SensorSpeed sensorSpeed) =>
throw new NotImplementedInReferenceAssemblyException();

static void PlatformStop() =>
throw new NotImplementedInReferenceAssemblyException();
}
}
30 changes: 30 additions & 0 deletions Xamarin.Essentials/AppInfo/AppInfo.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Globalization;
using Tizen.Applications;

namespace Xamarin.Essentials
{
public static partial class AppInfo
{
static string GetPackageName()
=> Application.Current.ApplicationInfo.PackageId;

static string GetName()
=> Application.Current.ApplicationInfo.Label;

static string GetVersionString()
{
try
{
var packageId = Application.Current.ApplicationInfo.PackageId;
return PackageManager.GetPackage(packageId).Version;
}
catch
{
return string.Empty;
}
}

static string GetBuild()
=> Version.Build.ToString(CultureInfo.InvariantCulture);
}
}
20 changes: 20 additions & 0 deletions Xamarin.Essentials/Battery/Battery.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Xamarin.Essentials
{
public static partial class Battery
{
static void StartBatteryListeners() =>
throw new NotImplementedInReferenceAssemblyException();

static void StopBatteryListeners() =>
throw new NotImplementedInReferenceAssemblyException();

static double PlatformChargeLevel =>
throw new NotImplementedInReferenceAssemblyException();

static BatteryState PlatformState =>
throw new NotImplementedInReferenceAssemblyException();

static BatteryPowerSource PlatformPowerSource =>
throw new NotImplementedInReferenceAssemblyException();
}
}
11 changes: 11 additions & 0 deletions Xamarin.Essentials/Browser/Browser.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Threading.Tasks;

namespace Xamarin.Essentials
{
public static partial class Browser
{
static Task PlatformOpenAsync(Uri uri, BrowserLaunchType launchType) =>
throw new NotImplementedInReferenceAssemblyException();
}
}
16 changes: 16 additions & 0 deletions Xamarin.Essentials/Clipboard/Clipboard.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Threading.Tasks;

namespace Xamarin.Essentials
{
public static partial class Clipboard
{
static void PlatformSetText(string text)
=> throw new NotImplementedInReferenceAssemblyException();

static bool PlatformHasText
=> throw new NotImplementedInReferenceAssemblyException();

static Task<string> PlatformGetTextAsync()
=> throw new NotImplementedInReferenceAssemblyException();
}
}
14 changes: 14 additions & 0 deletions Xamarin.Essentials/Compass/Compass.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Xamarin.Essentials
{
public static partial class Compass
{
internal static bool IsSupported =>
throw new NotImplementedInReferenceAssemblyException();

internal static void PlatformStart(SensorSpeed sensorSpeed) =>
throw new NotImplementedInReferenceAssemblyException();

internal static void PlatformStop() =>
throw new NotImplementedInReferenceAssemblyException();
}
}
19 changes: 19 additions & 0 deletions Xamarin.Essentials/Connectivity/Connectivity.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.Generic;

namespace Xamarin.Essentials
{
public static partial class Connectivity
{
static NetworkAccess PlatformNetworkAccess =>
throw new NotImplementedInReferenceAssemblyException();

static IEnumerable<ConnectionProfile> PlatformProfiles =>
throw new NotImplementedInReferenceAssemblyException();

static void StartListeners() =>
throw new NotImplementedInReferenceAssemblyException();

static void StopListeners() =>
throw new NotImplementedInReferenceAssemblyException();
}
}
10 changes: 10 additions & 0 deletions Xamarin.Essentials/DataTransfer/DataTransfer.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Threading.Tasks;

namespace Xamarin.Essentials
{
public static partial class DataTransfer
{
static Task PlatformRequestAsync(ShareTextRequest request) =>
throw new NotImplementedInReferenceAssemblyException();
}
}
11 changes: 11 additions & 0 deletions Xamarin.Essentials/DeviceDisplay/DeviceDisplay.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Xamarin.Essentials
{
public static partial class DeviceDisplay
{
static ScreenMetrics GetScreenMetrics() => throw new NotImplementedInReferenceAssemblyException();

static void StartScreenMetricsListeners() => throw new NotImplementedInReferenceAssemblyException();

static void StopScreenMetricsListeners() => throw new NotImplementedInReferenceAssemblyException();
}
}
2 changes: 2 additions & 0 deletions Xamarin.Essentials/DeviceInfo/DeviceInfo.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static class Idioms
public const string Tablet = "Tablet";
public const string Desktop = "Desktop";
public const string TV = "TV";
public const string Watch = "Watch";

public const string Unsupported = "Unsupported";
}
Expand All @@ -41,6 +42,7 @@ public static class Platforms
public const string iOS = "iOS";
public const string Android = "Android";
public const string UWP = "UWP";
public const string Tizen = "Tizen";

public const string Unsupported = "Unsupported";
}
Expand Down
56 changes: 56 additions & 0 deletions Xamarin.Essentials/DeviceInfo/DeviceInfo.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Plat = Xamarin.Essentials.Platform;

namespace Xamarin.Essentials
{
public static partial class DeviceInfo
{
static string GetModel()
=> Plat.GetSystemInfo("model_name");

static string GetManufacturer()
=> Plat.GetSystemInfo("manufacturer");

static string GetDeviceName()
=> Plat.GetSystemInfo("device_name");

static string GetVersionString()
=> Plat.GetFeatureInfo("platform.version");

static string GetPlatform()
=> Platforms.Tizen;

static string GetIdiom()
{
var profile = Plat.GetFeatureInfo("profile")?.ToUpperInvariant();

if (profile == null)
return Idioms.Unsupported;

if (profile.StartsWith("M"))
return Idioms.Phone;
else if (profile.StartsWith("W"))
return Idioms.Watch;
else if (profile.StartsWith("T"))
return Idioms.TV;
else
return Idioms.Unsupported;

// if (profile.StartsWith("I"))
// return Idioms.Car;
}

static DeviceType GetDeviceType()
{
var arch = Plat.GetFeatureInfo("platform.core.cpu.arch");
var armv7 = Plat.GetFeatureInfo<bool>("platform.core.cpu.arch.armv7");
var x86 = Plat.GetFeatureInfo<bool>("platform.core.cpu.arch.x86");

if (arch != null && arch.Equals("armv7") && armv7 && !x86)
return DeviceType.Physical;
else if (arch != null && arch.Equals("x86") && !armv7 && x86)
return DeviceType.Virtual;
else
return DeviceType.Virtual;
}
}
}
13 changes: 13 additions & 0 deletions Xamarin.Essentials/Email/Email.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Threading.Tasks;

namespace Xamarin.Essentials
{
public static partial class Email
{
internal static bool IsComposeSupported =>
throw new NotImplementedInReferenceAssemblyException();

static Task PlatformComposeAsync(EmailMessage message) =>
throw new NotImplementedInReferenceAssemblyException();
}
}
17 changes: 17 additions & 0 deletions Xamarin.Essentials/FileSystem/FileSystem.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.IO;
using System.Threading.Tasks;

namespace Xamarin.Essentials
{
public static partial class FileSystem
{
static string PlatformCacheDirectory
=> throw new NotImplementedInReferenceAssemblyException();

static string PlatformAppDataDirectory
=> throw new NotImplementedInReferenceAssemblyException();

static Task<Stream> PlatformOpenAppPackageFileAsync(string filename)
=> throw new NotImplementedInReferenceAssemblyException();
}
}
13 changes: 13 additions & 0 deletions Xamarin.Essentials/Flashlight/Flashlight.tizen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Threading.Tasks;

namespace Xamarin.Essentials
{
public static partial class Flashlight
{
static Task PlatformTurnOnAsync() =>
throw new NotImplementedInReferenceAssemblyException();

static Task PlatformTurnOffAsync() =>
throw new NotImplementedInReferenceAssemblyException();
}
}
Loading

0 comments on commit 58b6041

Please sign in to comment.