Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

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 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");

View File

@@ -0,0 +1,76 @@
<?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>{27910E6B-04A5-46E2-9AC6-BAC2A17A504A}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>GithubApiClientSample</RootNamespace>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AssemblyName>GithubApiClientSample</AssemblyName>
</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>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<Reference Include="System.Json" />
<Reference Include="System.Reactive.Core">
<HintPath>..\..\libs\System.Reactive.Core.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Interfaces">
<HintPath>..\..\libs\System.Reactive.Interfaces.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Linq">
<HintPath>..\..\libs\System.Reactive.Linq.dll</HintPath>
</Reference>
</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" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\Main.axml" />
<AndroidResource Include="Resources\values\Strings.xml" />
<AndroidResource Include="Resources\drawable-hdpi\icon.png" />
<AndroidResource Include="Resources\drawable-ldpi\icon.png" />
<AndroidResource Include="Resources\drawable-mdpi\icon.png" />
<AndroidResource Include="Resources\drawable-xhdpi\icon.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\icon.png" />
<AndroidResource Include="Resources\layout\ListItem.axml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GithubApiClientSample", "GithubApiClientSample.csproj", "{27910E6B-04A5-46E2-9AC6-BAC2A17A504A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{27910E6B-04A5-46E2-9AC6-BAC2A17A504A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27910E6B-04A5-46E2-9AC6-BAC2A17A504A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27910E6B-04A5-46E2-9AC6-BAC2A17A504A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27910E6B-04A5-46E2-9AC6-BAC2A17A504A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = GithubApiClientSample.csproj
EndGlobalSection
EndGlobal

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,66 @@
#define REACTIVE
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Json;
using System.Net;
using System.Reactive;
using System.Reactive.Linq;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace GithubApiClientSample
{
[Activity (Label = "GithubApiClientSample", MainLauncher = true)]
public class MainActivity : ListActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
var baseDir = Path.Combine (Application.ApplicationInfo.DataDir, "image_cache");
if (!Directory.Exists (baseDir))
Directory.CreateDirectory (baseDir);
var data = new List<IDictionary<string,object>> ();
var urls = new Dictionary<Uri,List<string>> ();
var getUrl = new Uri ("https://api.github.com/users/mono/repos");
var hr = new HttpWebRequest (getUrl);
var req = Observable.FromAsyncPattern<WebResponse> (hr.BeginGetResponse, hr.EndGetResponse);
Observable.Defer (req).Subscribe (v => {
var json = (IEnumerable<JsonValue>) JsonValue.Load (v.GetResponseStream ());
json.Cast<JsonObject> ().ToList ().ForEach (item => {
var uri = new Uri ((string) ((JsonObject) item ["owner"])["avatar_url"]);
var file = Path.Combine (baseDir, ((int) item ["id"]) + new FileInfo (uri.LocalPath).Extension);
if (!urls.ContainsKey (uri))
urls.Add (uri, new List<string> () {file});
else
urls [uri].Add (file);
data.Add (new JavaDictionary<string,object> () { {"Text", item ["description"]}, {"Name", item ["name"]}, {"Icon", Path.Combine (baseDir, file) }});
urls.ToList ().ForEach (p => {
var iwc = new WebClient ();
iwc.DownloadDataCompleted += (isender, ie) => p.Value.ForEach (s => {
if (ie.Result != null)
using (var fs = File.Create (s))
fs.Write (ie.Result, 0, ie.Result.Length);
});
iwc.DownloadDataAsync (p.Key);
});
});
var from = new string [] {"Text", "Name", "Icon"};
var to = new int [] { Resource.Id.textMessage, Resource.Id.textName, Resource.Id.iconView};
this.RunOnUiThread (() => {
ListAdapter = new SimpleAdapter (this, data, Resource.Layout.ListItem, from, to);
});
});
}
}
}

View File

@@ -0,0 +1,28 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("GithubApiClientSample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("atsushi")]
[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,102 @@
#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("GithubApiClientSample.Resource", IsApplication=true)]
namespace GithubApiClientSample
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
public partial class Resource
{
Resource()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
public static void UpdateIdValues()
{
}
public partial class Attribute
{
private Attribute()
{
}
}
public partial class Drawable
{
// aapt resource value: 0x7f020000
public const int icon = 2130837504;
private Drawable()
{
}
}
public partial class Id
{
// aapt resource value: 0x7f050000
public const int iconView = 2131034112;
// aapt resource value: 0x7f050001
public const int linearLayout1 = 2131034113;
// aapt resource value: 0x7f050004
public const int listView = 2131034116;
// aapt resource value: 0x7f050003
public const int textMessage = 2131034115;
// aapt resource value: 0x7f050002
public const int textName = 2131034114;
private Id()
{
}
}
public partial class Layout
{
// aapt resource value: 0x7f030000
public const int ListItem = 2130903040;
// aapt resource value: 0x7f030001
public const int Main = 2130903041;
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;
private String()
{
}
}
}
}
#pragma warning restore 1591

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:src="@android:drawable/ic_menu_gallery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/iconView"
android:layout_marginRight="0.0dp"
android:padding="10dp" />
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout1">
<TextView
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/textName"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/textMessage" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,14 @@
<?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:minWidth="25px"
android:minHeight="25px">
<ListView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/listView" />
</LinearLayout>

View File

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

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveAndroidSample", "ReactiveAndroidSample\ReactiveAndroidSample.csproj", "{0A024D57-A5E0-4648-80E6-C5F525167625}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0A024D57-A5E0-4648-80E6-C5F525167625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A024D57-A5E0-4648-80E6-C5F525167625}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A024D57-A5E0-4648-80E6-C5F525167625}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A024D57-A5E0-4648-80E6-C5F525167625}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = ReactiveAndroidSample\ReactiveAndroidSample.csproj
EndGlobalSection
EndGlobal

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 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");

View File

@@ -0,0 +1,47 @@
using System;
using System.Reactive;
using System.Reactive.Linq;
using Android.App;
using Android.OS;
using Android.Views;
using Android.Widget;
namespace ReactiveAndroidSample
{
[Activity (Label = "ReactiveAndroidSample", MainLauncher = true)]
public class Activity1 : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
var text = FindViewById<TextView> (Resource.Id.theText);
var surface = FindViewById<View> (Resource.Id.theToucheable);
triple_touch_source = Observable.FromEventPattern<View.TouchEventArgs> (surface, "Touch")
.Where (ev => ev.EventArgs.Event.Action == MotionEventActions.Move)
.Where (ev => ev.EventArgs.Event.PointerCount == 3)
//.SubscribeOn (Application.SynchronizationContext)
.ToEventPattern ();
TripleTouch += (sender, ev) =>
this.RunOnUiThread (() =>
text.Text = GetEventDescription (ev.Event));
}
IEventPatternSource<View.TouchEventArgs> triple_touch_source;
public event EventHandler<View.TouchEventArgs> TripleTouch {
add { triple_touch_source.OnNext += value; }
remove { triple_touch_source.OnNext -= value; }
}
static string GetEventDescription (MotionEvent e)
{
return string.Format ("({0}, {1})", e.RawX, e.RawY);
}
}
}

View File

@@ -0,0 +1,28 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("ReactiveAndroidSample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("atsushi")]
[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("")]

Some files were not shown because too many files have changed in this diff Show More