Added Shell samples
|
@ -49,6 +49,7 @@ The CollectionView is a flexible and performant view for presenting lists of dat
|
|||
In addition to allowing different layouts, the CollectionView has better performance than the ListView, but... how much does it improve the performance?.
|
||||
|
||||
![CollectionView](images/collectionviewperf.png)
|
||||
![CollectionView Create Renderer](images/collectionviewperf-createrenderer.png)
|
||||
|
||||
### Fast Renderers
|
||||
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28917.182
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoShellPerformance.Android", "NoShellPerformance\NoShellPerformance.Android\NoShellPerformance.Android.csproj", "{08F2E514-33F1-47FA-BF28-756EB13856F2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoShellPerformance.iOS", "NoShellPerformance\NoShellPerformance.iOS\NoShellPerformance.iOS.csproj", "{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoShellPerformance", "NoShellPerformance\NoShellPerformance\NoShellPerformance.csproj", "{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|iPhone = Debug|iPhone
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|iPhone = Release|iPhone
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Debug|iPhone.Deploy.0 = Debug|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Release|iPhone.Deploy.0 = Release|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{08F2E514-33F1-47FA-BF28-756EB13856F2}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Debug|Any CPU.Deploy.0 = Debug|iPhoneSimulator
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Debug|iPhone.Deploy.0 = Debug|iPhone
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Debug|iPhoneSimulator.Deploy.0 = Debug|iPhoneSimulator
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Release|Any CPU.ActiveCfg = Release|iPhone
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Release|Any CPU.Build.0 = Release|iPhone
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Release|Any CPU.Deploy.0 = Release|iPhone
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Release|iPhone.Deploy.0 = Release|iPhone
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}.Release|iPhoneSimulator.Deploy.0 = Release|iPhoneSimulator
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Debug|iPhone.Deploy.0 = Debug|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Release|iPhone.Deploy.0 = Release|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{1646EFFA-2DEF-4ED7-97E5-A0F19CC64A7B}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8EFABB83-53C9-4481-9E23-4822548EAF09}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -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 you 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");
|
|
@ -0,0 +1,67 @@
|
|||
using Java.IO;
|
||||
using Java.Lang;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace NoShellPerformance.Droid.Helpers
|
||||
{
|
||||
// Based on: https://github.com/toomasz/XamarinAppStartupTime
|
||||
// By Tomasz Ścisłowicz
|
||||
public class ProfilerTimeHelper
|
||||
{
|
||||
const string LogcatTimeFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
|
||||
private static DateTime? StartupTime;
|
||||
private static bool _attemptedToGetStartupTime;
|
||||
|
||||
public static DateTime? GetAppStartupTime()
|
||||
{
|
||||
if (_attemptedToGetStartupTime)
|
||||
{
|
||||
return StartupTime;
|
||||
}
|
||||
if (!StartupTime.HasValue)
|
||||
{
|
||||
StartupTime = GetStartupTimeFromLogcat();
|
||||
_attemptedToGetStartupTime = true;
|
||||
}
|
||||
return StartupTime;
|
||||
}
|
||||
|
||||
private static DateTime? GetStartupTimeFromLogcat()
|
||||
{
|
||||
var pid = Android.OS.Process.MyPid();
|
||||
|
||||
var process = new ProcessBuilder().
|
||||
RedirectErrorStream(true).
|
||||
Command("/system/bin/logcat", $"--pid={pid}", "-m", "1", "-v", "year").Start();
|
||||
|
||||
using (var bufferedReader = new BufferedReader(new InputStreamReader(process.InputStream)))
|
||||
{
|
||||
string line = null;
|
||||
while ((line = bufferedReader.ReadLine()) != null)
|
||||
{
|
||||
if (ParseLogDateTime(line, out DateTime date))
|
||||
{
|
||||
return date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool ParseLogDateTime(string logLine, out DateTime dateTime)
|
||||
{
|
||||
if (logLine.Length < LogcatTimeFormat.Length)
|
||||
{
|
||||
dateTime = new DateTime();
|
||||
return false;
|
||||
}
|
||||
var timeStr = logLine.Substring(0, LogcatTimeFormat.Length);
|
||||
|
||||
return DateTime.TryParseExact(timeStr, LogcatTimeFormat,
|
||||
CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out dateTime);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
using Android.Runtime;
|
||||
using Android.OS;
|
||||
using NoShellPerformance.Droid.Services;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace NoShellPerformance.Droid
|
||||
{
|
||||
[Activity(
|
||||
Label = "NoShellPerformance",
|
||||
Icon = "@mipmap/icon",
|
||||
Theme = "@style/MainTheme",
|
||||
MainLauncher = true,
|
||||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
TabLayoutResource = Resource.Layout.Tabbar;
|
||||
ToolbarResource = Resource.Layout.Toolbar;
|
||||
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
|
||||
Forms.Init(this, savedInstanceState);
|
||||
DependencyService.Register<ProfilerService>();
|
||||
LoadApplication(new App());
|
||||
}
|
||||
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
|
||||
{
|
||||
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
||||
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
<?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>
|
||||
<ProjectGuid>{08F2E514-33F1-47FA-BF28-756EB13856F2}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TemplateGuid>{6968b3a4-1835-46a3-ac5c-1ae33b475983}</TemplateGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>NoShellPerformance.Droid</RootNamespace>
|
||||
<AssemblyName>NoShellPerformance.Android</AssemblyName>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
|
||||
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
|
||||
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<AotAssemblies>true</AotAssemblies>
|
||||
<EnableLLVM>false</EnableLLVM>
|
||||
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<AotAssemblies>true</AotAssemblies>
|
||||
<EnableLLVM>true</EnableLLVM>
|
||||
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
|
||||
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="28.0.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="28.0.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.1" />
|
||||
<PackageReference Include="Xamarin.Android.Support.CustomTabs" Version="28.0.0.1" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Helpers\ProfilerTimeHelper.cs" />
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\ProfilerService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Assets\AboutAssets.txt" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Tabbar.axml" />
|
||||
<AndroidResource Include="Resources\layout\Toolbar.axml" />
|
||||
<AndroidResource Include="Resources\values\styles.xml" />
|
||||
<AndroidResource Include="Resources\values\colors.xml" />
|
||||
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
|
||||
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
|
||||
<AndroidResource Include="Resources\drawable\xamarin_logo.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\drawable-hdpi\" />
|
||||
<Folder Include="Resources\drawable-xhdpi\" />
|
||||
<Folder Include="Resources\drawable-xxhdpi\" />
|
||||
<Folder Include="Resources\drawable-xxxhdpi\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NoShellPerformance\NoShellPerformance.csproj">
|
||||
<Project>{8A7F400C-2ED8-463D-A378-1EE41AD4E845}</Project>
|
||||
<Name>NoShellPerformance</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
</Project>
|
|
@ -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.NoShellPerformance">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
|
||||
<application android:label="NoShellPerformance.Android"></application>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
</manifest>
|
|
@ -0,0 +1,34 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("NoShellPerformance.Android")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NoShellPerformance.Android")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
// Add some common permissions, these can be removed if not needed
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
|
|
@ -0,0 +1,50 @@
|
|||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.xml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable-hdpi/
|
||||
icon.png
|
||||
|
||||
drawable-ldpi/
|
||||
icon.png
|
||||
|
||||
drawable-mdpi/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.xml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called
|
||||
"Resource" that contains the tokens for each one of the resources included. For example,
|
||||
for the above Resources layout, this is what the Resource class would expose:
|
||||
|
||||
public class Resource {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
|
||||
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
12361
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/Resource.designer.cs
сгенерированный
Normal file
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/drawable/xamarin_logo.png
Normal file
После Ширина: | Высота: | Размер: 21 KiB |
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/sliding_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:tabIndicatorColor="@android:color/white"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed" />
|
|
@ -0,0 +1,9 @@
|
|||
<android.support.v7.widget.Toolbar
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/launcher_background" />
|
||||
<foreground android:drawable="@mipmap/launcher_foreground" />
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/launcher_background" />
|
||||
<foreground android:drawable="@mipmap/launcher_foreground" />
|
||||
</adaptive-icon>
|
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/mipmap-hdpi/icon.png
Normal file
После Ширина: | Высота: | Размер: 4.6 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/mipmap-hdpi/launcher_foreground.png
Normal file
После Ширина: | Высота: | Размер: 11 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/mipmap-mdpi/icon.png
Normal file
После Ширина: | Высота: | Размер: 2.7 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/mipmap-mdpi/launcher_foreground.png
Normal file
После Ширина: | Высота: | Размер: 6.3 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/mipmap-xhdpi/icon.png
Normal file
После Ширина: | Высота: | Размер: 6.9 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/mipmap-xhdpi/launcher_foreground.png
Normal file
После Ширина: | Высота: | Размер: 18 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/mipmap-xxhdpi/icon.png
Normal file
После Ширина: | Высота: | Размер: 12 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/mipmap-xxhdpi/launcher_foreground.png
Normal file
После Ширина: | Высота: | Размер: 33 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.Android/Resources/mipmap-xxxhdpi/icon.png
Normal file
После Ширина: | Высота: | Размер: 19 KiB |
После Ширина: | Высота: | Размер: 51 KiB |
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="launcher_background">#FFFFFF</color>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
</resources>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<resources>
|
||||
|
||||
<style name="MainTheme" parent="MainTheme.Base">
|
||||
</style>
|
||||
<!-- Base theme applied no matter what API -->
|
||||
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
|
||||
<item name="windowNoTitle">true</item>
|
||||
<!--We will be using the toolbar so no need to show ActionBar-->
|
||||
<item name="windowActionBar">false</item>
|
||||
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
|
||||
<!-- colorPrimary is used for the default action bar background -->
|
||||
<item name="colorPrimary">#2196F3</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">#1976D2</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
<item name="colorAccent">#FF4081</item>
|
||||
<!-- You can also set colorControlNormal, colorControlActivated
|
||||
colorControlHighlight and colorSwitchThumbNormal. -->
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
|
||||
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="colorAccent">#FF4081</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -0,0 +1,48 @@
|
|||
using NoShellPerformance.Droid.Helpers;
|
||||
using NoShellPerformance.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NoShellPerformance.Droid.Services
|
||||
{
|
||||
public class ProfilerService : IProfilerService
|
||||
{
|
||||
private static Dictionary<string, DateTime?> _eventTimingsSinceStartup = new Dictionary<string, DateTime?>();
|
||||
|
||||
public static void RegisterInternalEvent(string eventName)
|
||||
{
|
||||
if (_eventTimingsSinceStartup.ContainsKey(eventName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_eventTimingsSinceStartup.Add(eventName, DateTime.Now);
|
||||
}
|
||||
|
||||
public void RegisterEvent(string eventName)
|
||||
{
|
||||
RegisterInternalEvent(eventName);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, TimeSpan?>> GetTimingsSinceStartup()
|
||||
{
|
||||
return await Task.Factory.StartNew(() =>
|
||||
{
|
||||
var timings = new Dictionary<string, TimeSpan?>();
|
||||
var startupTime = ProfilerTimeHelper.GetAppStartupTime();
|
||||
|
||||
foreach (var eventInfo in _eventTimingsSinceStartup)
|
||||
{
|
||||
timings.Add(eventInfo.Key, eventInfo.Value - startupTime);
|
||||
}
|
||||
return timings;
|
||||
});
|
||||
}
|
||||
|
||||
public DateTime? GetStartupTime()
|
||||
{
|
||||
return ProfilerTimeHelper.GetAppStartupTime();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
using Foundation;
|
||||
using NoShellPerformance.iOS.Services;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace NoShellPerformance.iOS
|
||||
{
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register("AppDelegate")]
|
||||
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
|
||||
{
|
||||
//
|
||||
// This method is invoked when the application has loaded and is ready to run. In this
|
||||
// method you should instantiate the window, load the UI into it and then make the window
|
||||
// visible.
|
||||
//
|
||||
// You have 17 seconds to return from this method, or iOS will terminate your application.
|
||||
//
|
||||
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
||||
{
|
||||
global::Xamarin.Forms.Forms.Init();
|
||||
DependencyService.Register<ProfilerService>();
|
||||
LoadApplication(new App());
|
||||
|
||||
return base.FinishedLaunching(app, options);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
{
|
||||
"images": [
|
||||
{
|
||||
"scale": "2x",
|
||||
"size": "20x20",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon40.png"
|
||||
},
|
||||
{
|
||||
"scale": "3x",
|
||||
"size": "20x20",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon60.png"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"size": "29x29",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon58.png"
|
||||
},
|
||||
{
|
||||
"scale": "3x",
|
||||
"size": "29x29",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon87.png"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"size": "40x40",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon80.png"
|
||||
},
|
||||
{
|
||||
"scale": "3x",
|
||||
"size": "40x40",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon120.png"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"size": "60x60",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon120.png"
|
||||
},
|
||||
{
|
||||
"scale": "3x",
|
||||
"size": "60x60",
|
||||
"idiom": "iphone",
|
||||
"filename": "Icon180.png"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"size": "20x20",
|
||||
"idiom": "ipad",
|
||||
"filename": "Icon20.png"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"size": "20x20",
|
||||
"idiom": "ipad",
|
||||
"filename": "Icon40.png"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"size": "29x29",
|
||||
"idiom": "ipad",
|
||||
"filename": "Icon29.png"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"size": "29x29",
|
||||
"idiom": "ipad",
|
||||
"filename": "Icon58.png"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"size": "40x40",
|
||||
"idiom": "ipad",
|
||||
"filename": "Icon40.png"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"size": "40x40",
|
||||
"idiom": "ipad",
|
||||
"filename": "Icon80.png"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"size": "76x76",
|
||||
"idiom": "ipad",
|
||||
"filename": "Icon76.png"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"size": "76x76",
|
||||
"idiom": "ipad",
|
||||
"filename": "Icon152.png"
|
||||
},
|
||||
{
|
||||
"scale": "2x",
|
||||
"size": "83.5x83.5",
|
||||
"idiom": "ipad",
|
||||
"filename": "Icon167.png"
|
||||
},
|
||||
{
|
||||
"scale": "1x",
|
||||
"size": "1024x1024",
|
||||
"idiom": "ios-marketing",
|
||||
"filename": "Icon1024.png"
|
||||
}
|
||||
],
|
||||
"properties": {},
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
}
|
||||
}
|
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png
Normal file
После Ширина: | Высота: | Размер: 69 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png
Normal file
После Ширина: | Высота: | Размер: 3.7 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png
Normal file
После Ширина: | Высота: | Размер: 4.6 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png
Normal file
После Ширина: | Высота: | Размер: 4.6 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png
Normal file
После Ширина: | Высота: | Размер: 5.1 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png
Normal file
После Ширина: | Высота: | Размер: 1.3 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png
Normal file
После Ширина: | Высота: | Размер: 845 B |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png
Normal file
После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png
Normal file
После Ширина: | Высота: | Размер: 1.7 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png
Normal file
После Ширина: | Высота: | Размер: 2.5 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png
Normal file
После Ширина: | Высота: | Размер: 2.3 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png
Normal file
После Ширина: | Высота: | Размер: 2.4 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png
Normal file
После Ширина: | Высота: | Размер: 2.7 KiB |
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>NoShellPerformance</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.companyname.NoShellPerformance</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>NoShellPerformance</string>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/AppIcon.appiconset</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace NoShellPerformance.iOS
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main(args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{71F206F6-33B4-4FEA-8FEC-577B723A1DBB}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TemplateGuid>{89a4fe7c-635d-49c9-8d8c-5cd363c0d68d}</TemplateGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>NoShellPerformance.iOS</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>NoShellPerformance.iOS</AssemblyName>
|
||||
<MtouchEnableSGenConc>true</MtouchEnableSGenConc>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="Services\ProfilerService.cs" />
|
||||
<None Include="Entitlements.plist" />
|
||||
<None Include="Info.plist" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon1024.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon180.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon167.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon152.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon120.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon87.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon80.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon76.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon60.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon58.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon40.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon29.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon20.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<BundleResource Include="Resources\tab_about.png" />
|
||||
<BundleResource Include="Resources\tab_about%402x.png" />
|
||||
<BundleResource Include="Resources\tab_about%403x.png" />
|
||||
<BundleResource Include="Resources\tab_feed.png" />
|
||||
<BundleResource Include="Resources\tab_feed%402x.png" />
|
||||
<BundleResource Include="Resources\tab_feed%403x.png" />
|
||||
<BundleResource Include="Resources\xamarin_logo.png" />
|
||||
<BundleResource Include="Resources\xamarin_logo%402x.png" />
|
||||
<BundleResource Include="Resources\xamarin_logo%403x.png" />
|
||||
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NoShellPerformance\NoShellPerformance.csproj">
|
||||
<Project>{8A7F400C-2ED8-463D-A378-1EE41AD4E845}</Project>
|
||||
<Name>NoShellPerformance</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("NoShellPerformance.iOS")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NoShellPerformance.iOS")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/Default-568h@2x.png
Normal file
После Ширина: | Высота: | Размер: 8.7 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/Default-Portrait.png
Normal file
После Ширина: | Высота: | Размер: 10 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/Default-Portrait@2x.png
Normal file
После Ширина: | Высота: | Размер: 34 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/Default.png
Normal file
После Ширина: | Высота: | Размер: 7.1 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/Default@2x.png
Normal file
После Ширина: | Высота: | Размер: 8.2 KiB |
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="X5k-f2-b5h">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="gAE-YM-kbH">
|
||||
<objects>
|
||||
<viewController id="X5k-f2-b5h" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Y8P-hJ-Z43"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="9ZL-r4-8FZ"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="yd7-JS-zBw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" misplaced="YES" image="Icon-60.png" translatesAutoresizingMaskIntoConstraints="NO" id="23">
|
||||
<rect key="frame" x="270" y="270" width="60" height="60"/>
|
||||
<rect key="contentStretch" x="0.0" y="0.0" width="0.0" height="0.0"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.20392156862745098" green="0.59607843137254901" blue="0.85882352941176465" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="23" firstAttribute="centerY" secondItem="yd7-JS-zBw" secondAttribute="centerY" priority="1" id="39"/>
|
||||
<constraint firstItem="23" firstAttribute="centerX" secondItem="yd7-JS-zBw" secondAttribute="centerX" priority="1" id="41"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="XAI-xm-WK6" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="349" y="339"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="Icon-60.png" width="180" height="180"/>
|
||||
</resources>
|
||||
</document>
|
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/tab_about.png
Normal file
После Ширина: | Высота: | Размер: 518 B |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/tab_about@2x.png
Normal file
После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/tab_about@3x.png
Normal file
После Ширина: | Высота: | Размер: 2.0 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/tab_feed.png
Normal file
После Ширина: | Высота: | Размер: 415 B |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/tab_feed@2x.png
Normal file
После Ширина: | Высота: | Размер: 863 B |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/tab_feed@3x.png
Normal file
После Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/xamarin_logo.png
Normal file
После Ширина: | Высота: | Размер: 4.2 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/xamarin_logo@2x.png
Normal file
После Ширина: | Высота: | Размер: 9.1 KiB |
Двоичные данные
src/Shell/No Shell/NoShellPerformance/NoShellPerformance.iOS/Resources/xamarin_logo@3x.png
Normal file
После Ширина: | Высота: | Размер: 21 KiB |
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using NoShellPerformance.Services;
|
||||
|
||||
namespace NoShellPerformance.iOS.Services
|
||||
{
|
||||
public class ProfilerService : IProfilerService
|
||||
{
|
||||
public DateTime? GetStartupTime()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<Dictionary<string, TimeSpan?>> GetTimingsSinceStartup()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RegisterEvent(string eventName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Application xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
x:Class="NoShellPerformance.App">
|
||||
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<!--Global Styles-->
|
||||
<Color x:Key="NavigationPrimary">#2196F3</Color>
|
||||
<Style TargetType="NavigationPage">
|
||||
<Setter Property="BarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
|
||||
<Setter Property="BarTextColor" Value="White" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
</Application>
|
|
@ -0,0 +1,33 @@
|
|||
using Xamarin.Forms;
|
||||
using NoShellPerformance.Services;
|
||||
using NoShellPerformance.Views;
|
||||
|
||||
namespace NoShellPerformance
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
public static IProfilerService ProfilerService { get; set; } = DependencyService.Get<IProfilerService>();
|
||||
|
||||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
DependencyService.Register<MockDataStore>();
|
||||
MainPage = new MainPage();
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
ProfilerService.RegisterEvent("Xamarin.Forms App OnStart");
|
||||
}
|
||||
|
||||
protected override void OnSleep()
|
||||
{
|
||||
// Handle when your app sleeps
|
||||
}
|
||||
|
||||
protected override void OnResume()
|
||||
{
|
||||
// Handle when your app resumes
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
using Xamarin.Forms.Xaml;
|
||||
|
||||
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
|
||||
namespace NoShellPerformance.Extensions
|
||||
{
|
||||
public static class TimeSpanExtensions
|
||||
{
|
||||
public static string ToCanonicString(this TimeSpan? timeSpan)
|
||||
{
|
||||
if (!timeSpan.HasValue)
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
return timeSpan.Value.ToCanonicString();
|
||||
}
|
||||
|
||||
public static string ToCanonicString(this TimeSpan timeSpan, int secondsToSkipMsPart = 40)
|
||||
{
|
||||
int totalDays = (int)timeSpan.TotalDays;
|
||||
|
||||
if (totalDays > 0)
|
||||
{
|
||||
return $"{totalDays}d{timeSpan.Hours}h{timeSpan.Minutes}m{timeSpan.Seconds}s";
|
||||
}
|
||||
|
||||
if (timeSpan.Hours > 0)
|
||||
{
|
||||
return $"{timeSpan.Hours}h{timeSpan.Minutes}m{timeSpan.Seconds}s";
|
||||
}
|
||||
|
||||
if (timeSpan.Minutes > 0)
|
||||
{
|
||||
return $"{timeSpan.Minutes}m{timeSpan.Seconds}s";
|
||||
}
|
||||
|
||||
if (timeSpan.Seconds < 1)
|
||||
{
|
||||
return $"{timeSpan.Milliseconds}ms";
|
||||
}
|
||||
|
||||
if (timeSpan.Seconds < secondsToSkipMsPart)
|
||||
{
|
||||
return $"{timeSpan.Seconds}s{timeSpan.Milliseconds}ms";
|
||||
}
|
||||
|
||||
return $"{timeSpan.Seconds}s";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
|
||||
namespace NoShellPerformance.Models
|
||||
{
|
||||
public class Item
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Text { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
using NoShellPerformance.Extensions;
|
||||
using System;
|
||||
|
||||
namespace NoShellPerformance.Models
|
||||
{
|
||||
public class Timing
|
||||
{
|
||||
public Timing(string eventName, TimeSpan? elapsedTime)
|
||||
{
|
||||
EventName = eventName;
|
||||
ElapsedTime = elapsedTime?.ToCanonicString();
|
||||
}
|
||||
|
||||
public string EventName { get; }
|
||||
public string ElapsedTime { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NoShellPerformance.Services
|
||||
{
|
||||
public interface IDataStore<T>
|
||||
{
|
||||
Task<bool> AddItemAsync(T item);
|
||||
Task<bool> UpdateItemAsync(T item);
|
||||
Task<bool> DeleteItemAsync(string id);
|
||||
Task<T> GetItemAsync(string id);
|
||||
Task<IEnumerable<T>> GetItemsAsync(bool forceRefresh = false);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NoShellPerformance.Services
|
||||
{
|
||||
public interface IProfilerService
|
||||
{
|
||||
void RegisterEvent(string eventName);
|
||||
Task<Dictionary<string, TimeSpan?>> GetTimingsSinceStartup();
|
||||
DateTime? GetStartupTime();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NoShellPerformance.Models;
|
||||
|
||||
namespace NoShellPerformance.Services
|
||||
{
|
||||
public class MockDataStore : IDataStore<Item>
|
||||
{
|
||||
List<Item> items;
|
||||
|
||||
public MockDataStore()
|
||||
{
|
||||
items = new List<Item>();
|
||||
var mockItems = new List<Item>
|
||||
{
|
||||
new Item { Id = Guid.NewGuid().ToString(), Text = "First item", Description="This is an item description." },
|
||||
new Item { Id = Guid.NewGuid().ToString(), Text = "Second item", Description="This is an item description." },
|
||||
new Item { Id = Guid.NewGuid().ToString(), Text = "Third item", Description="This is an item description." },
|
||||
new Item { Id = Guid.NewGuid().ToString(), Text = "Fourth item", Description="This is an item description." },
|
||||
new Item { Id = Guid.NewGuid().ToString(), Text = "Fifth item", Description="This is an item description." },
|
||||
new Item { Id = Guid.NewGuid().ToString(), Text = "Sixth item", Description="This is an item description." }
|
||||
};
|
||||
|
||||
foreach (var item in mockItems)
|
||||
{
|
||||
items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> AddItemAsync(Item item)
|
||||
{
|
||||
items.Add(item);
|
||||
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateItemAsync(Item item)
|
||||
{
|
||||
var oldItem = items.Where((Item arg) => arg.Id == item.Id).FirstOrDefault();
|
||||
items.Remove(oldItem);
|
||||
items.Add(item);
|
||||
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteItemAsync(string id)
|
||||
{
|
||||
var oldItem = items.Where((Item arg) => arg.Id == id).FirstOrDefault();
|
||||
items.Remove(oldItem);
|
||||
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
public async Task<Item> GetItemAsync(string id)
|
||||
{
|
||||
return await Task.FromResult(items.FirstOrDefault(s => s.Id == id));
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Item>> GetItemsAsync(bool forceRefresh = false)
|
||||
{
|
||||
return await Task.FromResult(items);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace NoShellPerformance.ViewModels
|
||||
{
|
||||
public class AboutViewModel : BaseViewModel
|
||||
{
|
||||
public AboutViewModel()
|
||||
{
|
||||
Title = "About";
|
||||
|
||||
OpenWebCommand = new Command(() => Device.OpenUri(new Uri("https://xamarin.com/platform")));
|
||||
}
|
||||
|
||||
public ICommand OpenWebCommand { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using Xamarin.Forms;
|
||||
|
||||
using NoShellPerformance.Models;
|
||||
using NoShellPerformance.Services;
|
||||
|
||||
namespace NoShellPerformance.ViewModels
|
||||
{
|
||||
public class BaseViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public IDataStore<Item> DataStore => DependencyService.Get<IDataStore<Item>>() ?? new MockDataStore();
|
||||
|
||||
bool isBusy = false;
|
||||
public bool IsBusy
|
||||
{
|
||||
get { return isBusy; }
|
||||
set { SetProperty(ref isBusy, value); }
|
||||
}
|
||||
|
||||
string title = string.Empty;
|
||||
public string Title
|
||||
{
|
||||
get { return title; }
|
||||
set { SetProperty(ref title, value); }
|
||||
}
|
||||
|
||||
protected bool SetProperty<T>(ref T backingStore, T value,
|
||||
[CallerMemberName]string propertyName = "",
|
||||
Action onChanged = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(backingStore, value))
|
||||
return false;
|
||||
|
||||
backingStore = value;
|
||||
onChanged?.Invoke();
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
||||
{
|
||||
var changed = PropertyChanged;
|
||||
if (changed == null)
|
||||
return;
|
||||
|
||||
changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
|
||||
using NoShellPerformance.Models;
|
||||
|
||||
namespace NoShellPerformance.ViewModels
|
||||
{
|
||||
public class ItemDetailViewModel : BaseViewModel
|
||||
{
|
||||
public Item Item { get; set; }
|
||||
public ItemDetailViewModel(Item item = null)
|
||||
{
|
||||
Title = item?.Text;
|
||||
Item = item;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
using NoShellPerformance.Models;
|
||||
using NoShellPerformance.Views;
|
||||
using NoShellPerformance.Services;
|
||||
using System.Linq;
|
||||
|
||||
namespace NoShellPerformance.ViewModels
|
||||
{
|
||||
public class ItemsViewModel : BaseViewModel
|
||||
{
|
||||
private IProfilerService _profilerService;
|
||||
|
||||
string timing;
|
||||
public string Timing
|
||||
{
|
||||
get { return timing; }
|
||||
set { SetProperty(ref timing, value); }
|
||||
}
|
||||
public ObservableCollection<Item> Items { get; set; }
|
||||
public Command LoadItemsCommand { get; set; }
|
||||
|
||||
public ItemsViewModel(IProfilerService profilerService)
|
||||
{
|
||||
_profilerService = profilerService;
|
||||
|
||||
Title = "Browse";
|
||||
Items = new ObservableCollection<Item>();
|
||||
LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommand());
|
||||
|
||||
MessagingCenter.Subscribe<NewItemPage, Item>(this, "AddItem", async (obj, item) =>
|
||||
{
|
||||
var newItem = item as Item;
|
||||
Items.Add(newItem);
|
||||
await DataStore.AddItemAsync(newItem);
|
||||
});
|
||||
}
|
||||
|
||||
async Task ExecuteLoadItemsCommand()
|
||||
{
|
||||
if (IsBusy)
|
||||
return;
|
||||
|
||||
IsBusy = true;
|
||||
|
||||
try
|
||||
{
|
||||
var data = await _profilerService.GetTimingsSinceStartup();
|
||||
|
||||
var timing = data
|
||||
.Select(t => new Timing(t.Key, t.Value))
|
||||
.First();
|
||||
|
||||
Timing = timing.ElapsedTime;
|
||||
|
||||
Items.Clear();
|
||||
var items = await DataStore.GetItemsAsync(true);
|
||||
foreach (var item in items)
|
||||
{
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsBusy = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
x:Class="NoShellPerformance.Views.AboutPage"
|
||||
xmlns:vm="clr-namespace:NoShellPerformance.ViewModels"
|
||||
Title="{Binding Title}">
|
||||
|
||||
<ContentPage.BindingContext>
|
||||
<vm:AboutViewModel />
|
||||
</ContentPage.BindingContext>
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<Color x:Key="Primary">#2196F3</Color>
|
||||
<Color x:Key="Accent">#96d1ff</Color>
|
||||
<Color x:Key="LightTextColor">#999999</Color>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackLayout BackgroundColor="{StaticResource Accent}" VerticalOptions="FillAndExpand" HorizontalOptions="Fill">
|
||||
<StackLayout Orientation="Horizontal" HorizontalOptions="Center" VerticalOptions="Center">
|
||||
<ContentView Padding="0,40,0,40" VerticalOptions="FillAndExpand">
|
||||
<Image Source="xamarin_logo.png" VerticalOptions="Center" HeightRequest="64" />
|
||||
</ContentView>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
<ScrollView Grid.Row="1">
|
||||
<StackLayout Orientation="Vertical" Padding="16,40,16,40" Spacing="10">
|
||||
<Label FontSize="22">
|
||||
<Label.FormattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.Spans>
|
||||
<Span Text="AppName" FontAttributes="Bold" FontSize="22" />
|
||||
<Span Text=" " />
|
||||
<Span Text="1.0" ForegroundColor="{StaticResource LightTextColor}" />
|
||||
</FormattedString.Spans>
|
||||
</FormattedString>
|
||||
</Label.FormattedText>
|
||||
</Label>
|
||||
<Label>
|
||||
<Label.FormattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.Spans>
|
||||
<Span Text="This app is written in C# and native APIs using the" />
|
||||
<Span Text=" " />
|
||||
<Span Text="Xamarin Platform" FontAttributes="Bold" />
|
||||
<Span Text="." />
|
||||
</FormattedString.Spans>
|
||||
</FormattedString>
|
||||
</Label.FormattedText>
|
||||
</Label>
|
||||
<Label>
|
||||
<Label.FormattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.Spans>
|
||||
<Span Text="It shares code with its" />
|
||||
<Span Text=" " />
|
||||
<Span Text="iOS, Android, and Windows" FontAttributes="Bold" />
|
||||
<Span Text=" " />
|
||||
<Span Text="versions." />
|
||||
</FormattedString.Spans>
|
||||
</FormattedString>
|
||||
</Label.FormattedText>
|
||||
</Label>
|
||||
<Button Margin="0,10,0,0" Text="Learn more"
|
||||
Command="{Binding OpenWebCommand}"
|
||||
BackgroundColor="{StaticResource Primary}"
|
||||
TextColor="White" />
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</Grid>
|
||||
|
||||
</ContentPage>
|
|
@ -0,0 +1,16 @@
|
|||
using System.ComponentModel;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace NoShellPerformance.Views
|
||||
{
|
||||
// Learn more about making custom code visible in the Xamarin.Forms previewer
|
||||
// by visiting https://aka.ms/xamarinforms-previewer
|
||||
[DesignTimeVisible(false)]
|
||||
public partial class AboutPage : ContentPage
|
||||
{
|
||||
public AboutPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
x:Class="NoShellPerformance.Views.ItemDetailPage"
|
||||
Title="{Binding Title}">
|
||||
|
||||
<StackLayout Spacing="20" Padding="15">
|
||||
<Label Text="Text:" FontSize="Medium" />
|
||||
<Label Text="{Binding Item.Text}" d:Text="Item name" FontSize="Small"/>
|
||||
<Label Text="Description:" FontSize="Medium" />
|
||||
<Label Text="{Binding Item.Description}" d:Text="Item description" FontSize="Small"/>
|
||||
</StackLayout>
|
||||
|
||||
</ContentPage>
|
|
@ -0,0 +1,36 @@
|
|||
using System.ComponentModel;
|
||||
using Xamarin.Forms;
|
||||
using NoShellPerformance.Models;
|
||||
using NoShellPerformance.ViewModels;
|
||||
|
||||
namespace NoShellPerformance.Views
|
||||
{
|
||||
// Learn more about making custom code visible in the Xamarin.Forms previewer
|
||||
// by visiting https://aka.ms/xamarinforms-previewer
|
||||
[DesignTimeVisible(false)]
|
||||
public partial class ItemDetailPage : ContentPage
|
||||
{
|
||||
ItemDetailViewModel viewModel;
|
||||
|
||||
public ItemDetailPage(ItemDetailViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BindingContext = this.viewModel = viewModel;
|
||||
}
|
||||
|
||||
public ItemDetailPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var item = new Item
|
||||
{
|
||||
Text = "Item 1",
|
||||
Description = "This is an item description."
|
||||
};
|
||||
|
||||
viewModel = new ItemDetailViewModel(item);
|
||||
BindingContext = viewModel;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
x:Class="NoShellPerformance.Views.ItemsPage"
|
||||
Title="{Binding Title}"
|
||||
x:Name="BrowseItemsPage">
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem Text="Add" Clicked="AddItem_Clicked" />
|
||||
</ContentPage.ToolbarItems>
|
||||
<StackLayout>
|
||||
<Label
|
||||
Text="{Binding Timing}"
|
||||
Margin="6" />
|
||||
<ListView x:Name="ItemsListView"
|
||||
ItemsSource="{Binding Items}"
|
||||
VerticalOptions="FillAndExpand"
|
||||
HasUnevenRows="true"
|
||||
RefreshCommand="{Binding LoadItemsCommand}"
|
||||
IsPullToRefreshEnabled="true"
|
||||
IsRefreshing="{Binding IsBusy, Mode=OneWay}"
|
||||
CachingStrategy="RecycleElement"
|
||||
ItemSelected="OnItemSelected">
|
||||
<d:ListView.ItemsSource>
|
||||
<x:Array Type="{x:Type x:String}">
|
||||
<x:String>First Item</x:String>
|
||||
<x:String>Second Item</x:String>
|
||||
<x:String>Third Item</x:String>
|
||||
<x:String>Forth Item</x:String>
|
||||
<x:String>Fifth Item</x:String>
|
||||
<x:String>Sixth Item</x:String>
|
||||
</x:Array>
|
||||
</d:ListView.ItemsSource>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout Padding="10">
|
||||
<Label Text="{Binding Text}"
|
||||
d:Text="{Binding .}"
|
||||
LineBreakMode="NoWrap"
|
||||
Style="{DynamicResource ListItemTextStyle}"
|
||||
FontSize="16" />
|
||||
<Label Text="{Binding Description}"
|
||||
d:Text="Item description"
|
||||
LineBreakMode="NoWrap"
|
||||
Style="{DynamicResource ListItemDetailTextStyle}"
|
||||
FontSize="13" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
</ContentPage>
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using Xamarin.Forms;
|
||||
using NoShellPerformance.Models;
|
||||
using NoShellPerformance.ViewModels;
|
||||
using NoShellPerformance.Services;
|
||||
|
||||
namespace NoShellPerformance.Views
|
||||
{
|
||||
// Learn more about making custom code visible in the Xamarin.Forms previewer
|
||||
// by visiting https://aka.ms/xamarinforms-previewer
|
||||
[DesignTimeVisible(false)]
|
||||
public partial class ItemsPage : ContentPage
|
||||
{
|
||||
ItemsViewModel viewModel;
|
||||
|
||||
public ItemsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BindingContext = viewModel = new ItemsViewModel(DependencyService.Get<IProfilerService>());
|
||||
}
|
||||
|
||||
async void OnItemSelected(object sender, SelectedItemChangedEventArgs args)
|
||||
{
|
||||
var item = args.SelectedItem as Item;
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
await Navigation.PushAsync(new ItemDetailPage(new ItemDetailViewModel(item)));
|
||||
|
||||
// Manually deselect item.
|
||||
ItemsListView.SelectedItem = null;
|
||||
}
|
||||
|
||||
async void AddItem_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PushModalAsync(new NavigationPage(new NewItemPage()));
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
|
||||
if (viewModel.Items.Count == 0)
|
||||
viewModel.LoadItemsCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
xmlns:views="clr-namespace:NoShellPerformance.Views"
|
||||
x:Class="NoShellPerformance.Views.MainPage">
|
||||
|
||||
<TabbedPage.Children>
|
||||
<NavigationPage Title="Browse">
|
||||
<NavigationPage.Icon>
|
||||
<OnPlatform x:TypeArguments="FileImageSource">
|
||||
<On Platform="iOS" Value="tab_feed.png"/>
|
||||
</OnPlatform>
|
||||
</NavigationPage.Icon>
|
||||
<x:Arguments>
|
||||
<views:ItemsPage />
|
||||
</x:Arguments>
|
||||
</NavigationPage>
|
||||
|
||||
<NavigationPage Title="About">
|
||||
<NavigationPage.Icon>
|
||||
<OnPlatform x:TypeArguments="FileImageSource">
|
||||
<On Platform="iOS" Value="tab_about.png"/>
|
||||
</OnPlatform>
|
||||
</NavigationPage.Icon>
|
||||
<x:Arguments>
|
||||
<views:AboutPage />
|
||||
</x:Arguments>
|
||||
</NavigationPage>
|
||||
</TabbedPage.Children>
|
||||
|
||||
</TabbedPage>
|
|
@ -0,0 +1,16 @@
|
|||
using System.ComponentModel;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace NoShellPerformance.Views
|
||||
{
|
||||
// Learn more about making custom code visible in the Xamarin.Forms previewer
|
||||
// by visiting https://aka.ms/xamarinforms-previewer
|
||||
[DesignTimeVisible(false)]
|
||||
public partial class MainPage : TabbedPage
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
x:Class="NoShellPerformance.Views.NewItemPage"
|
||||
Title="New Item">
|
||||
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem Text="Cancel" Clicked="Cancel_Clicked" />
|
||||
<ToolbarItem Text="Save" Clicked="Save_Clicked" />
|
||||
</ContentPage.ToolbarItems>
|
||||
|
||||
<ContentPage.Content>
|
||||
<StackLayout Spacing="20" Padding="15">
|
||||
<Label Text="Text" FontSize="Medium" />
|
||||
<Entry Text="{Binding Item.Text}" d:Text="Item name" FontSize="Small" />
|
||||
<Label Text="Description" FontSize="Medium" />
|
||||
<Editor Text="{Binding Item.Description}" d:Text="Item description" FontSize="Small" Margin="0" />
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
|
||||
</ContentPage>
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using Xamarin.Forms;
|
||||
|
||||
using NoShellPerformance.Models;
|
||||
|
||||
namespace NoShellPerformance.Views
|
||||
{
|
||||
// Learn more about making custom code visible in the Xamarin.Forms previewer
|
||||
// by visiting https://aka.ms/xamarinforms-previewer
|
||||
[DesignTimeVisible(false)]
|
||||
public partial class NewItemPage : ContentPage
|
||||
{
|
||||
public Item Item { get; set; }
|
||||
|
||||
public NewItemPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Item = new Item
|
||||
{
|
||||
Text = "Item name",
|
||||
Description = "This is an item description."
|
||||
};
|
||||
|
||||
BindingContext = this;
|
||||
}
|
||||
|
||||
async void Save_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
MessagingCenter.Send(this, "AddItem", Item);
|
||||
await Navigation.PopModalAsync();
|
||||
}
|
||||
|
||||
async void Cancel_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PopModalAsync();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28917.182
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShellPerformance.Android", "ShellPerformance\ShellPerformance.Android\ShellPerformance.Android.csproj", "{E39BDE12-F469-417E-B12D-7028A7AD62AD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShellPerformance.iOS", "ShellPerformance\ShellPerformance.iOS\ShellPerformance.iOS.csproj", "{0F2149E1-CD43-4EA3-B721-939E520D5166}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShellPerformance", "ShellPerformance\ShellPerformance\ShellPerformance.csproj", "{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|iPhone = Debug|iPhone
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|iPhone = Release|iPhone
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Debug|iPhone.Deploy.0 = Debug|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Release|iPhone.Deploy.0 = Release|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{E39BDE12-F469-417E-B12D-7028A7AD62AD}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Debug|Any CPU.Deploy.0 = Debug|iPhoneSimulator
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Debug|iPhone.Deploy.0 = Debug|iPhone
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Debug|iPhoneSimulator.Deploy.0 = Debug|iPhoneSimulator
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Release|Any CPU.ActiveCfg = Release|iPhone
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Release|Any CPU.Build.0 = Release|iPhone
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Release|Any CPU.Deploy.0 = Release|iPhone
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Release|iPhone.Deploy.0 = Release|iPhone
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{0F2149E1-CD43-4EA3-B721-939E520D5166}.Release|iPhoneSimulator.Deploy.0 = Release|iPhoneSimulator
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Debug|iPhone.Deploy.0 = Debug|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Release|iPhone.Deploy.0 = Release|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{EB90FB23-5C1D-4268-ACD2-D4947CBCD8AF}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1C78E1B5-82DE-44ED-A43F-BEA2681D0E2E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -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 you 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");
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Java.IO;
|
||||
using Java.Lang;
|
||||
|
||||
namespace ShellPerformance.Droid.Helpers
|
||||
{
|
||||
// Based on: https://github.com/toomasz/XamarinAppStartupTime
|
||||
// By Tomasz Ścisłowicz
|
||||
public class ProfilerTimeHelper
|
||||
{
|
||||
const string LogcatTimeFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
|
||||
private static DateTime? StartupTime;
|
||||
private static bool _attemptedToGetStartupTime;
|
||||
|
||||
public static DateTime? GetAppStartupTime()
|
||||
{
|
||||
if (_attemptedToGetStartupTime)
|
||||
{
|
||||
return StartupTime;
|
||||
}
|
||||
if (!StartupTime.HasValue)
|
||||
{
|
||||
StartupTime = GetStartupTimeFromLogcat();
|
||||
_attemptedToGetStartupTime = true;
|
||||
}
|
||||
return StartupTime;
|
||||
}
|
||||
|
||||
private static DateTime? GetStartupTimeFromLogcat()
|
||||
{
|
||||
var pid = Android.OS.Process.MyPid();
|
||||
|
||||
var process = new ProcessBuilder().
|
||||
RedirectErrorStream(true).
|
||||
Command("/system/bin/logcat", $"--pid={pid}", "-m", "1", "-v", "year").Start();
|
||||
|
||||
using (var bufferedReader = new BufferedReader(new InputStreamReader(process.InputStream)))
|
||||
{
|
||||
string line = null;
|
||||
while ((line = bufferedReader.ReadLine()) != null)
|
||||
{
|
||||
if (ParseLogDateTime(line, out DateTime date))
|
||||
{
|
||||
return date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool ParseLogDateTime(string logLine, out DateTime dateTime)
|
||||
{
|
||||
if (logLine.Length < LogcatTimeFormat.Length)
|
||||
{
|
||||
dateTime = new DateTime();
|
||||
return false;
|
||||
}
|
||||
var timeStr = logLine.Substring(0, LogcatTimeFormat.Length);
|
||||
|
||||
return DateTime.TryParseExact(timeStr, LogcatTimeFormat,
|
||||
CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out dateTime);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
using Android.Runtime;
|
||||
using Android.OS;
|
||||
using Xamarin.Forms;
|
||||
using ShellPerformance.Droid.Services;
|
||||
|
||||
namespace ShellPerformance.Droid
|
||||
{
|
||||
[Activity(
|
||||
Label = "ShellPerformance",
|
||||
Icon = "@mipmap/icon",
|
||||
Theme = "@style/MainTheme",
|
||||
MainLauncher = true,
|
||||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
TabLayoutResource = Resource.Layout.Tabbar;
|
||||
ToolbarResource = Resource.Layout.Toolbar;
|
||||
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
Forms.SetFlags("Shell_Experimental", "Visual_Experimental", "CollectionView_Experimental", "FastRenderers_Experimental");
|
||||
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
|
||||
Forms.Init(this, savedInstanceState);
|
||||
DependencyService.Register<ProfilerService>();
|
||||
LoadApplication(new App());
|
||||
}
|
||||
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
|
||||
{
|
||||
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
||||
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.ShellPerformance">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
|
||||
<application android:label="ShellPerformance.Android"></application>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
</manifest>
|
|
@ -0,0 +1,34 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ShellPerformance.Android")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ShellPerformance.Android")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
// Add some common permissions, these can be removed if not needed
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
|
|
@ -0,0 +1,50 @@
|
|||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.xml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable-hdpi/
|
||||
icon.png
|
||||
|
||||
drawable-ldpi/
|
||||
icon.png
|
||||
|
||||
drawable-mdpi/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.xml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called
|
||||
"Resource" that contains the tokens for each one of the resources included. For example,
|
||||
for the above Resources layout, this is what the Resource class would expose:
|
||||
|
||||
public class Resource {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
|
||||
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
12367
src/Shell/Shell/ShellPerformance/ShellPerformance.Android/Resources/Resource.designer.cs
сгенерированный
Normal file
Двоичные данные
src/Shell/Shell/ShellPerformance/ShellPerformance.Android/Resources/drawable/tab_about.png
Normal file
После Ширина: | Высота: | Размер: 518 B |
Двоичные данные
src/Shell/Shell/ShellPerformance/ShellPerformance.Android/Resources/drawable/tab_feed.png
Normal file
После Ширина: | Высота: | Размер: 415 B |
Двоичные данные
src/Shell/Shell/ShellPerformance/ShellPerformance.Android/Resources/drawable/xamarin_logo.png
Normal file
После Ширина: | Высота: | Размер: 21 KiB |
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/sliding_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:tabIndicatorColor="@android:color/white"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed" />
|