<master> Merge branch 'master' of github.com:TouchInstinct/Training

This commit is contained in:
Rustam Zaitov 2014-03-13 13:32:56 +04:00
commit ff98ecc5ad
14 changed files with 342 additions and 4 deletions

3
.gitignore vendored
View File

@ -106,4 +106,5 @@ Generated_Code #added for RIA/Silverlight projects
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
Tickets.userprefs
Tickets.userprefs
*.userprefs

View File

@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".
These files will be deployed with your package and will be accessible using Android's
AssetManager, like this:
public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
InputStream input = Assets.Open ("my_asset.txt");
}
}
Additionally, some Android functions will automatically load asset files:
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");

View File

@ -0,0 +1,40 @@
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace Share_Android
{
[Activity(Label = "Share_Android", MainLauncher = true)]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
Button button = FindViewById<Button>(Resource.Id.myButton);
button.Click += delegate
{
Intent sendIntent = new Intent();
sendIntent.SetAction(Intent.ActionSend);
sendIntent.PutExtra(
Intent.ExtraText,
"#tag and a link: http://media.desura.com/images/members/1/398/397709/124316909678.png");
sendIntent.SetType("text/plain");
StartActivity(Intent.CreateChooser(sendIntent, "Send to.."));
};
}
}
}

View File

@ -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="Share_Android.Share_Android">
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="18" />
<application android:label="Share_Android">
</application>
</manifest>

View File

@ -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("Share_Android")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Superman")]
[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("")]

View File

@ -0,0 +1,44 @@
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.axml),
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/
icon.png
layout/
main.axml
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 "R"
(this is an Android convention) that contains the tokens for each one of the resources
included. For example, for the above Resources layout, this is what the R class would expose:
public class R {
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 R.layout.main
to reference the layout/main.axml file, or R.strings.first_string to reference the first
string in the dictionary file values/strings.xml.

View File

@ -0,0 +1,112 @@
#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("Share_Android.Resource", IsApplication=true)]
namespace Share_Android
{
[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 myButton = 2131034112;
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 click = 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

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/click" />

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="click">Click Me!</string>
<string name="app_name">Share_Android</string>
</resources>

View File

@ -0,0 +1,68 @@
<?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>{20BC4B3C-F3B5-48C1-85A2-150254720EDB}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{F278D4AB-4730-4720-B08E-FE5E31564D9E};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Share_Android</RootNamespace>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
<AssemblyName>Share_Android</AssemblyName>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<TargetFrameworkVersion>v4.3</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;__MOBILE__;__ANDROID__;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<ConsolePause>false</ConsolePause>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<DefineConstants>__MOBILE__;__ANDROID__;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
</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" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
<None Include="Properties\AndroidManifest.xml" />
</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" />
</Project>

View File

@ -49,7 +49,7 @@ namespace Social
if (FBDialogs.CanPresentShareDialog (shareParams))
PresentFacebookShareDialog (shareParams);
else
;
throw new Exception("Can't present share dialog"); // possibly there are no accounts
}
private void PresentFacebookShareDialog(FBShareDialogParams shareParams)

View File

@ -1,7 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Social", "IOs\Social.csproj", "{CC0EE67C-0932-4C64-A5D7-6714994CA602}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Social_iOS", "IOs\Social_iOS.csproj", "{CC0EE67C-0932-4C64-A5D7-6714994CA602}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Share_Android", "Android\Share_Android\Share_Android.csproj", "{20BC4B3C-F3B5-48C1-85A2-150254720EDB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -13,6 +15,18 @@ Global
AppStore|iPhone = AppStore|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.AppStore|iPhone.Build.0 = Release|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.Debug|iPhone.Build.0 = Debug|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.Release|iPhone.ActiveCfg = Release|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.Release|iPhone.Build.0 = Release|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{20BC4B3C-F3B5-48C1-85A2-150254720EDB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{CC0EE67C-0932-4C64-A5D7-6714994CA602}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{CC0EE67C-0932-4C64-A5D7-6714994CA602}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{CC0EE67C-0932-4C64-A5D7-6714994CA602}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
@ -27,6 +41,6 @@ Global
{CC0EE67C-0932-4C64-A5D7-6714994CA602}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = IOs\Social.csproj
StartupItem = Android\Share_Android\Share_Android.csproj
EndGlobalSection
EndGlobal