<master> Merge branch 'master' of github.com:TouchInstinct/Training
This commit is contained in:
commit
6a167d5087
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
|
||||
namespace Rouble
|
||||
{
|
||||
[Activity(Label = "Rouble Demo", MainLauncher = true)]
|
||||
public class MainActivity : Activity
|
||||
{
|
||||
protected override void OnCreate(Bundle bundle)
|
||||
{
|
||||
base.OnCreate(bundle);
|
||||
SetContentView(Resource.Layout.Main);
|
||||
|
||||
FindViewById<TextView>(Resource.Id.textView1).SetTextWithRouble("Обычная цена: 100.50 ", RoubleType.Regular);
|
||||
FindViewById<TextView>(Resource.Id.textView2).SetTextWithRouble("Жирная цена: 10 000 ", RoubleType.Bold);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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="ru.touchin.training.rouble">
|
||||
<uses-sdk android:minSdkVersion="10" />
|
||||
<application android:label="Rouble Demo" android:icon="@drawable/icon">
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Android.App;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
[assembly: AssemblyTitle("Droid")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Touch Instinct")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Touch Instinct")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
[assembly: AssemblyVersion("1.0.0")]
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
#pragma warning disable 1591
|
||||
// ------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Mono Runtime Version: 4.0.30319.17020
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: Android.Runtime.ResourceDesignerAttribute("Rouble.Resource", IsApplication=true)]
|
||||
|
||||
namespace Rouble
|
||||
{
|
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
|
||||
public partial class Resource
|
||||
{
|
||||
|
||||
static Resource()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
public static void UpdateIdValues()
|
||||
{
|
||||
}
|
||||
|
||||
public partial class Attribute
|
||||
{
|
||||
|
||||
static Attribute()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Attribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Drawable
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f020000
|
||||
public const int Icon = 2130837504;
|
||||
|
||||
static Drawable()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Drawable()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Id
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f050000
|
||||
public const int textView1 = 2131034112;
|
||||
|
||||
// aapt resource value: 0x7f050001
|
||||
public const int textView2 = 2131034113;
|
||||
|
||||
static Id()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Id()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Layout
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f030000
|
||||
public const int Main = 2130903040;
|
||||
|
||||
static Layout()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Layout()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class String
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f040001
|
||||
public const int app_name = 2130968577;
|
||||
|
||||
// aapt resource value: 0x7f040000
|
||||
public const int hello = 2130968576;
|
||||
|
||||
static String()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private String()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:text="Text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView1" />
|
||||
<TextView
|
||||
android:text="Text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView2"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="hello">Hello World, Click Me!</string>
|
||||
<string name="app_name">Droid</string>
|
||||
</resources>
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
<?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>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D119DAC0-88F6-45FB-84E6-9535831B5036}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Rouble</RootNamespace>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
|
||||
<AssemblyName>Droid</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.3</TargetFrameworkVersion>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="..\Shared\Rouble.cs">
|
||||
<Link>Rouble.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Shared\RoubleType.cs">
|
||||
<Link>RoubleType.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="TextViewExt.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Main.axml" />
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
<AndroidResource Include="Resources\drawable\Icon.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="Assets\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidAsset Include="..\Shared\Rouble.ttf">
|
||||
<Link>Assets\Rouble.ttf</Link>
|
||||
</AndroidAsset>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using Android.App;
|
||||
using Android.Graphics;
|
||||
using Android.Text.Style;
|
||||
using Android.Widget;
|
||||
using Android.Text;
|
||||
|
||||
namespace Rouble
|
||||
{
|
||||
public static class TextViewExt
|
||||
{
|
||||
private static CharacterStyle RoubleSpan { get; set; }
|
||||
private static Typeface Rouble { get; set; }
|
||||
|
||||
static TextViewExt()
|
||||
{
|
||||
Rouble = Typeface.CreateFromAsset(Application.Context.Assets, "Rouble.ttf");
|
||||
RoubleSpan = new CustomTypefaceSpan(Rouble);
|
||||
}
|
||||
|
||||
public static void SetTextWithRouble(this TextView label, string text, RoubleType roubleType)
|
||||
{
|
||||
var textFormatted = new SpannableString(text + Roubles.GetRoubleSymbFor(roubleType));
|
||||
textFormatted.SetSpan(RoubleSpan, textFormatted.Length() - 1, textFormatted.Length(), SpanTypes.ExclusiveExclusive);
|
||||
label.TextFormatted = textFormatted;
|
||||
}
|
||||
|
||||
private class CustomTypefaceSpan: MetricAffectingSpan
|
||||
{
|
||||
private Typeface _typeface;
|
||||
|
||||
public CustomTypefaceSpan(Typeface typeface)
|
||||
{
|
||||
_typeface = typeface;
|
||||
}
|
||||
|
||||
public override void UpdateDrawState(TextPaint drawState)
|
||||
{
|
||||
Apply(drawState);
|
||||
}
|
||||
|
||||
public override void UpdateMeasureState(TextPaint paint)
|
||||
{
|
||||
Apply(paint);
|
||||
}
|
||||
|
||||
private void Apply(Paint paint)
|
||||
{
|
||||
paint.SetTypeface(_typeface);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 11.00
|
|||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rouble", "IOs\Rouble.csproj", "{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rouble.Droid", "Droid\Rouble.Droid.csproj", "{D119DAC0-88F6-45FB-84E6-9535831B5036}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
|
|
@ -11,20 +13,34 @@ Global
|
|||
Release|iPhone = Release|iPhone
|
||||
Ad-Hoc|iPhone = Ad-Hoc|iPhone
|
||||
AppStore|iPhone = AppStore|iPhone
|
||||
Debug|Android = Debug|Android
|
||||
Release|Android = Release|Android
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.AppStore|iPhone.Build.0 = AppStore|iPhone
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Debug|Android.ActiveCfg = Debug|iPhoneSimulator
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Release|Android.ActiveCfg = Debug|iPhoneSimulator
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{0F5F2F1C-52CD-4DF6-84F7-223D5CCEAAE9}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{D119DAC0-88F6-45FB-84E6-9535831B5036}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
{D119DAC0-88F6-45FB-84E6-9535831B5036}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||
{D119DAC0-88F6-45FB-84E6-9535831B5036}.Debug|Android.ActiveCfg = Debug|Any CPU
|
||||
{D119DAC0-88F6-45FB-84E6-9535831B5036}.Debug|Android.Build.0 = Debug|Any CPU
|
||||
{D119DAC0-88F6-45FB-84E6-9535831B5036}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{D119DAC0-88F6-45FB-84E6-9535831B5036}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{D119DAC0-88F6-45FB-84E6-9535831B5036}.Release|Android.ActiveCfg = Debug|Any CPU
|
||||
{D119DAC0-88F6-45FB-84E6-9535831B5036}.Release|Android.Build.0 = Debug|Any CPU
|
||||
{D119DAC0-88F6-45FB-84E6-9535831B5036}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{D119DAC0-88F6-45FB-84E6-9535831B5036}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = IOs\Rouble.csproj
|
||||
|
|
|
|||
Loading…
Reference in New Issue