Skip to content

Commit d7fe18a

Browse files
Merge pull request #747 from vb2ae/Update_Setup_Projects
Update setup projects
2 parents 4b03903 + d082b25 commit d7fe18a

File tree

156 files changed

+22167
-9611
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+22167
-9611
lines changed

samples/features/Features.Forms/Features.Forms.Android/Resources/Resource.designer.cs

Lines changed: 69 additions & 9103 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
2+
using System.Net.Mime;
23
using Android.App;
4+
using Android.Widget;
35
using Caliburn.Micro;
46
using Setup.Android.ViewModels;
57

@@ -9,7 +11,6 @@ namespace Setup.Android.Activities
911
public class HomeActivity : Activity
1012
{
1113
private readonly HomeViewModel viewModel;
12-
1314
public HomeActivity()
1415
{
1516
viewModel = IoC.Get<HomeViewModel>();
@@ -19,18 +20,18 @@ public HomeActivity()
1920
viewAware.AttachView(this);
2021
}
2122

22-
protected override void OnResume()
23+
protected override async void OnResume()
2324
{
2425
base.OnResume();
2526

26-
ScreenExtensions.TryActivate(viewModel);
27+
await ScreenExtensions.TryActivateAsync(viewModel);
2728
}
2829

29-
protected override void OnPause()
30+
protected override async void OnPause()
3031
{
3132
base.OnPause();
3233

33-
ScreenExtensions.TryDeactivate(viewModel, false);
34+
await ScreenExtensions.TryDeactivateAsync(viewModel, false);
3435
}
3536
}
36-
}
37+
}

samples/setup/Setup.Android/Resources/Resource.Designer.cs

Lines changed: 21 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/setup/Setup.Android/Resources/layout/Main.axml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:orientation="vertical"
44
android:layout_width="fill_parent"
5-
android:layout_height="fill_parent" />
5+
android:layout_height="fill_parent" >
6+
<TextView
7+
android:id="@+id/SubmittedMessage"
8+
android:layout_marginBottom="10dp"
9+
android:layout_width="fill_parent"
10+
android:layout_height="wrap_content"
11+
android:gravity="center" />
12+
</LinearLayout>

samples/setup/Setup.Android/Setup.Android.csproj

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,22 @@
4040
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
4141
</PropertyGroup>
4242
<ItemGroup>
43-
<Reference Include="Caliburn.Micro, Version=3.0.3.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
44-
<HintPath>..\packages\Caliburn.Micro.Core.3.0.3\lib\portable-net45+win8+wp8+wpa81+MonoAndroid10+Xamarin.iOS10+MonoTouch10+uap10.0\Caliburn.Micro.dll</HintPath>
45-
<Private>True</Private>
43+
<Reference Include="Caliburn.Micro.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
44+
<HintPath>..\packages\vb2ae.Caliburn.Micro.Core.4.0.169-g30e441eef5\lib\netstandard2.0\Caliburn.Micro.Core.dll</HintPath>
4645
</Reference>
47-
<Reference Include="Caliburn.Micro.Platform, Version=3.0.3.0, Culture=neutral, processorArchitecture=MSIL">
48-
<HintPath>..\packages\Caliburn.Micro.3.0.3\lib\MonoAndroid10\Caliburn.Micro.Platform.dll</HintPath>
49-
<Private>True</Private>
50-
</Reference>
51-
<Reference Include="Caliburn.Micro.Platform.Core, Version=3.0.3.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
52-
<HintPath>..\packages\Caliburn.Micro.3.0.3\lib\MonoAndroid10\Caliburn.Micro.Platform.Core.dll</HintPath>
53-
<Private>True</Private>
46+
<Reference Include="Caliburn.Micro.Platform, Version=4.0.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
47+
<HintPath>..\packages\vb2ae.Caliburn.Micro.4.0.169-g30e441eef5\lib\monoandroid80\Caliburn.Micro.Platform.dll</HintPath>
5448
</Reference>
49+
<Reference Include="Java.Interop" />
5550
<Reference Include="Mono.Android" />
5651
<Reference Include="mscorlib" />
5752
<Reference Include="System" />
5853
<Reference Include="System.Core" />
5954
<Reference Include="System.Xml.Linq" />
6055
<Reference Include="System.Xml" />
56+
<Reference Include="vb2ae.Caliburn.Micro.Platform.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
57+
<HintPath>..\packages\vb2ae.Caliburn.Micro.4.0.169-g30e441eef5\lib\monoandroid80\vb2ae.Caliburn.Micro.Platform.Core.dll</HintPath>
58+
</Reference>
6159
</ItemGroup>
6260
<ItemGroup>
6361
<Compile Include="Activities\HomeActivity.cs" />

samples/setup/Setup.Android/ViewModels/HomeViewModel.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,21 @@ namespace Setup.Android.ViewModels
55
{
66
public class HomeViewModel : Screen
77
{
8+
private string _title;
9+
10+
public string Title
11+
{
12+
get => _title;
13+
set
14+
{
15+
_title = value;
16+
NotifyOfPropertyChange("Title");
17+
}
18+
}
19+
20+
public HomeViewModel()
21+
{
22+
Title = "Welcome to Caliburn Micro in Xamarin.Android";
23+
}
824
}
9-
}
25+
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Caliburn.Micro" version="3.0.3" targetFramework="monoandroid60" />
4-
<package id="Caliburn.Micro.Core" version="3.0.3" targetFramework="monoandroid60" />
3+
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="monoandroid90" />
4+
<package id="vb2ae.Caliburn.Micro" version="4.0.169-g30e441eef5" targetFramework="monoandroid90" />
5+
<package id="vb2ae.Caliburn.Micro.Core" version="4.0.169-g30e441eef5" targetFramework="monoandroid90" />
56
</packages>

samples/setup/Setup.Forms/Setup.Forms.Droid/Resources/Resource.Designer.cs

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Reflection;
5+
using System.Text;
6+
7+
using Android.App;
8+
using Android.Content;
9+
using Android.OS;
10+
using Android.Runtime;
11+
using Android.Views;
12+
using Android.Widget;
13+
using Caliburn.Micro;
14+
using Setup.Forms5.ViewModels;
15+
16+
namespace Setup.Forms5.Droid
17+
{
18+
[Application]
19+
public class Application : CaliburnApplication
20+
{
21+
private SimpleContainer container;
22+
23+
public Application(IntPtr javaReference, JniHandleOwnership transfer)
24+
: base(javaReference, transfer)
25+
{
26+
27+
}
28+
29+
public override void OnCreate()
30+
{
31+
base.OnCreate();
32+
33+
Initialize();
34+
}
35+
36+
protected override void Configure()
37+
{
38+
container = new SimpleContainer();
39+
container.Instance(container);
40+
container.Singleton<App>();
41+
}
42+
43+
protected override IEnumerable<Assembly> SelectAssemblies()
44+
{
45+
return new[]
46+
{
47+
GetType().Assembly,
48+
typeof (HomeViewModel).Assembly
49+
};
50+
}
51+
52+
protected override void BuildUp(object instance)
53+
{
54+
container.BuildUp(instance);
55+
}
56+
57+
protected override IEnumerable<object> GetAllInstances(Type service)
58+
{
59+
return container.GetAllInstances(service);
60+
}
61+
62+
protected override object GetInstance(Type service, string key)
63+
{
64+
return container.GetInstance(service, key);
65+
}
66+
}
67+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Any raw assets you want to be deployed with your application can be placed in
2+
this directory (and child directories) and given a Build Action of "AndroidAsset".
3+
4+
These files will be deployed with your package and will be accessible using Android's
5+
AssetManager, like this:
6+
7+
public class ReadAsset : Activity
8+
{
9+
protected override void OnCreate (Bundle bundle)
10+
{
11+
base.OnCreate (bundle);
12+
13+
InputStream input = Assets.Open ("my_asset.txt");
14+
}
15+
}
16+
17+
Additionally, some Android functions will automatically load asset files:
18+
19+
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
3+
using Android.App;
4+
using Android.Content.PM;
5+
using Android.Runtime;
6+
using Android.OS;
7+
using Caliburn.Micro;
8+
using Setup.Forms5;
9+
10+
namespace Setup.Forms5.Droid
11+
{
12+
[Activity(Label = "Setup.Forms5", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
13+
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
14+
{
15+
protected override void OnCreate(Bundle savedInstanceState)
16+
{
17+
base.OnCreate(savedInstanceState);
18+
19+
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
20+
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
21+
LoadApplication(IoC.Get<Setup.Forms5.App>());
22+
}
23+
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
24+
{
25+
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
26+
27+
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
28+
}
29+
}
30+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.setup.forms5" android:installLocation="auto">
3+
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="30" />
4+
<application android:label="Setup.Forms5.Android" android:theme="@style/MainTheme"></application>
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
</manifest>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
using Android.App;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("Setup.Forms5.Android")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("Setup.Forms5.Android")]
14+
[assembly: AssemblyCopyright("Copyright © 2014")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: ComVisible(false)]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
[assembly: AssemblyVersion("1.0.0.0")]
26+
[assembly: AssemblyFileVersion("1.0.0.0")]
27+
28+
// Add some common permissions, these can be removed if not needed
29+
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
30+
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]

0 commit comments

Comments
 (0)