Skip to content

Commit

Permalink
Android: Added solution file and Hello World project with BASS native…
Browse files Browse the repository at this point in the history
… libraries for Android.

Also, all the namespaces have been fixed by ReSharper on all projects. This is why a lot of files are included in this check-in.

Related to issue #406.


git-svn-id: http://hamster-svn/svn/repos/base@682 765c1f7c-9fb8-954f-9ff8-dd0915cb3117
  • Loading branch information
animal committed Jan 21, 2013
1 parent 61214e0 commit 25a1305
Show file tree
Hide file tree
Showing 159 changed files with 1,965 additions and 2,034 deletions.
19 changes: 19 additions & 0 deletions MPfm/branches/current/MPfm.Android/Assets/AboutAssets.txt
@@ -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,28 @@
using System;
using Android.App;
using Android.Widget;
using Android.OS;

namespace MPfm.Android
{
[Activity(Label = "MPfm.Android", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
int count = 1;

protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);

// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);

// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);

button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
}
}

32 changes: 32 additions & 0 deletions MPfm/branches/current/MPfm.Android/Classes/Application.cs
@@ -0,0 +1,32 @@
using System;
using Android.App;
using Android.Runtime;

namespace MPfm.Android.Classes
{
[Application (Name="my.App", Debuggable=true, Label="MPfm: Music Player for Musicians")]
public class MPfmApplication : Application
{
public MPfmApplication(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
}

public override void OnCreate()
{
base.OnCreate();

//Bootstrapper.GetContainer();
}

public override void OnLowMemory()
{
base.OnLowMemory();
}

public override void OnTerminate()
{
base.OnTerminate();
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
116 changes: 116 additions & 0 deletions MPfm/branches/current/MPfm.Android/MPfm.Android.csproj
@@ -0,0 +1,116 @@
<?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)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3B7ACEA3-D637-4BE4-A09E-8FF9A878600E}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MPfm.Android</RootNamespace>
<AssemblyName>MPfm.Android</AssemblyName>
<FileAlignment>512</FileAlignment>
<AndroidApplication>true</AndroidApplication>
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<TargetFrameworkVersion>v4.1</TargetFrameworkVersion>
<AndroidSupportedAbis>armeabi%3barmeabi-v7a%3bx86</AndroidSupportedAbis>
<AndroidStoreUncompressedFileExtensions />
<MandroidI18n />
<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;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="taglib-sharp, Version=2.0.4.0, Culture=neutral, PublicKeyToken=db62eba44689b5b0, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MPfm.Sound\Lib\Android\taglib-sharp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Classes\Activities\MainActivity.cs" />
<Compile Include="Classes\Application.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbass.so" />
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbassflac.so" />
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbassmix.so" />
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbasswv.so" />
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbass_aac.so" />
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbass_alac.so" />
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbass_ape.so" />
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbass_fx.so" />
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\Layout\Main.axml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\Values\Strings.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\Drawable\Icon.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MPfm.Core\MPfm.Core.Android.csproj">
<Project>{d536fde5-989e-4979-9b39-63621ae4a205}</Project>
<Name>MPfm.Core.Android</Name>
</ProjectReference>
<ProjectReference Include="..\MPfm.Library\MPfm.Library.Android.csproj">
<Project>{2a62d229-d7fc-41da-b676-bb1371659bfb}</Project>
<Name>MPfm.Library.Android</Name>
</ProjectReference>
<ProjectReference Include="..\MPfm.Player\MPfm.Player.Android.csproj">
<Project>{feb7497c-784c-4380-874f-46fd93c82ba1}</Project>
<Name>MPfm.Player.Android</Name>
</ProjectReference>
<ProjectReference Include="..\MPfm.Sound\MPfm.Sound.Android.csproj">
<Project>{d92f718e-9a24-4b8b-9e40-77f93cf89eae}</Project>
<Name>MPfm.Sound.Android</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Lib\armeabi\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly">
<uses-sdk android:targetSdkVersion="17" />
<application android:label="MPfm: Music Player for Musicians">
</application>
</manifest>
41 changes: 41 additions & 0 deletions MPfm/branches/current/MPfm.Android/Properties/AssemblyInfo.cs
@@ -0,0 +1,41 @@
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("MPfm.Android")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MPfm.Android")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("a557ce8c-9dbe-4b93-8fc4-95ffc126cf14")]

// 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)]
44 changes: 44 additions & 0 deletions MPfm/branches/current/MPfm.Android/Resources/AboutResources.txt
@@ -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.xml),
an internationalization string table (Strings.xml) and some icons (drawable/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, the build action should be set
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 String {
public const int FirstString = 0xabc;
public const int SecondString = 0xbcd;
}
}

You would then use Resource.Drawable.Icon to reference the Drawable/Icon.png file, or
Resource.Layout.Main to reference the Layout/Main.axml file, or Resource.String.FirstString
to reference the first string in the dictionary file Values/Strings.xml.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions MPfm/branches/current/MPfm.Android/Resources/Layout/Main.axml
@@ -0,0 +1,13 @@
<?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"
>
<Button
android:id="@+id/MyButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Hello"
/>
</LinearLayout>
82 changes: 82 additions & 0 deletions MPfm/branches/current/MPfm.Android/Resources/Resource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 25a1305

Please sign in to comment.