Skip to content

Commit

Permalink
fix: Add Mobile Samples Heads (post update to Uno 5.X and net7.0 bump)
Browse files Browse the repository at this point in the history
  • Loading branch information
agneszitte authored and kazo0 committed Jul 18, 2023
1 parent 321b215 commit eb194e9
Show file tree
Hide file tree
Showing 21 changed files with 561 additions and 5 deletions.
70 changes: 70 additions & 0 deletions Uno.Themes.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Uno.Themes.Samples.UWP", "s
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Themes.Samples.Wasm", "src\samples\UWP\Uno.Themes.Samples.Wasm\Uno.Themes.Samples.Wasm.csproj", "{5D0F3763-F3BF-4478-B2D3-B47AB74205C9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Themes.Samples.Mobile", "src\samples\UWP\Uno.Themes.Samples.Mobile\Uno.Themes.Samples.Mobile.csproj", "{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{F42C65EA-6E6A-43B9-9D9F-D8C6063AD309}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "library", "library", "{EB41D6CC-AEBE-40A8-B42C-D3F7FBA7001E}"
Expand Down Expand Up @@ -191,6 +193,72 @@ Global
{5D0F3763-F3BF-4478-B2D3-B47AB74205C9}.Release|WASM.Build.0 = Release|Any CPU
{5D0F3763-F3BF-4478-B2D3-B47AB74205C9}.Release|x64.ActiveCfg = Release|Any CPU
{5D0F3763-F3BF-4478-B2D3-B47AB74205C9}.Release|x64.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Android.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Android.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Android.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|iPhone.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|macOS.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|macOS.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|macOS.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Packages_UWP.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Packages_UWP.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Packages_UWP.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Packages_WinUI.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Packages_WinUI.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Packages_WinUI.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Tests.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Tests.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|Tests.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|UWP_x64.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|UWP_x64.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|UWP_x64.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|WASM.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|WASM.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|WASM.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|x64.ActiveCfg = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|x64.Build.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Debug|x64.Deploy.0 = Debug|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Android.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Android.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Android.Deploy.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Any CPU.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Any CPU.Deploy.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|iPhone.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|iPhone.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|iPhone.Deploy.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|macOS.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|macOS.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|macOS.Deploy.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Packages_UWP.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Packages_UWP.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Packages_UWP.Deploy.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Packages_WinUI.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Packages_WinUI.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Packages_WinUI.Deploy.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Tests.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Tests.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|Tests.Deploy.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|UWP_x64.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|UWP_x64.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|UWP_x64.Deploy.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|WASM.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|WASM.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|WASM.Deploy.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|x64.ActiveCfg = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|x64.Build.0 = Release|Any CPU
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E}.Release|x64.Deploy.0 = Release|Any CPU
{290980EF-0A64-43A5-AEB4-E022D82BBF8B}.Debug|Android.ActiveCfg = Debug|Any CPU
{290980EF-0A64-43A5-AEB4-E022D82BBF8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{290980EF-0A64-43A5-AEB4-E022D82BBF8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
Expand Down Expand Up @@ -340,6 +408,7 @@ Global
{6279C845-92F8-4333-AB99-3D213163593C} = {F42C65EA-6E6A-43B9-9D9F-D8C6063AD309}
{265517E4-AB14-453D-92DA-F32AA1D4007D} = {B402BF43-62D6-463C-A71F-941B8EFF463F}
{5D0F3763-F3BF-4478-B2D3-B47AB74205C9} = {B402BF43-62D6-463C-A71F-941B8EFF463F}
{D45D0327-B421-48F5-98BC-7C9B1D6ABD9E} = {B402BF43-62D6-463C-A71F-941B8EFF463F}
{1EB1EA7F-DD48-49C2-97B3-ADB8E86EF28D} = {464D0819-2E75-4DED-9F70-039580314AFA}
{290980EF-0A64-43A5-AEB4-E022D82BBF8B} = {B402BF43-62D6-463C-A71F-941B8EFF463F}
{98C1FDAC-C692-4C65-99E7-70FDD53B8F2E} = {EB41D6CC-AEBE-40A8-B42C-D3F7FBA7001E}
Expand All @@ -356,5 +425,6 @@ Global
src\samples\UWP\Uno.Themes.Samples.Shared\Uno.Themes.Samples.Shared.projitems*{290980ef-0a64-43a5-aeb4-e022d82bbf8b}*SharedItemsImports = 5
src\samples\UWP\Uno.Themes.Samples.Shared\Uno.Themes.Samples.Shared.projitems*{5d0f3763-f3bf-4478-b2d3-b47ab74205c9}*SharedItemsImports = 5
src\samples\UWP\Uno.Themes.Samples.Shared\Uno.Themes.Samples.Shared.projitems*{6279c845-92f8-4333-ab99-3d213163593c}*SharedItemsImports = 13
src\samples\UWP\Uno.Themes.Samples.Shared\Uno.Themes.Samples.Shared.projitems*{d45d0327-b421-48f5-98bc-7c9b1d6abd9e}*SharedItemsImports = 5
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion crosstargeting_override.props.sample
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<!-- <TargetFrameworkOverride Condition="''!='hint: .NET 7.0 macOS AppKit'">net7.0-macos;$(TargetFrameworkOverride)</TargetFrameworkOverride> -->

<!-- DO NOT COMMENT OUT: net7.0 is a required tfm in all cases -->
<TargetFrameworkOverride Condition="'$(TargetFrameworkOverride)'!='' AND !$(TargetFrameworkOverride.Contains('net7.0'))">net7.0;$(TargetFrameworkOverride)</TargetFrameworkOverride>
<TargetFrameworkOverride Condition="'$(TargetFrameworkOverride)'!='' AND !$(TargetFrameworkOverride.Contains('net7.0;'))">net7.0;$(TargetFrameworkOverride)</TargetFrameworkOverride>

<!--

Expand Down
2 changes: 1 addition & 1 deletion src/library/Uno.Material/xamlmerge.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageReference Include="Uno.XamlMerge.Task" Version="$(_Uno_XamlMerge_Task_Version)" PrivateAssets="All" />
</ItemGroup>

<Import Project="$(NuGetPackageRoot)uno.xamlmerge.task\$(_Uno_XamlMerge_Task_Version)\build\Uno.XamlMerge.Task.targets"
<Import Project="$(NuGetPackageRoot)\uno.xamlmerge.task\$(_Uno_XamlMerge_Task_Version)\build\Uno.XamlMerge.Task.targets"
Condition="'$(TargetFramework)' == '' and '$(TargetFrameworks)'!='' and exists('$(NuGetPackageRoot)\uno.xamlmerge.task\$(_Uno_XamlMerge_Task_Version)')" />

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1">
<uses-permission android:name="android.permission.INTERNET" />
<application android:allowBackup="true" android:supportsRtl="true"></application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
To add cross-platform image assets for your Uno Platform app, use the Assets folder
in the shared project instead. Assets in this folder are Android-only assets.

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");
42 changes: 42 additions & 0 deletions src/samples/UWP/Uno.Themes.Samples.Mobile/Android/Main.Android.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Com.Nostra13.Universalimageloader.Core;
using Windows.UI.Xaml.Media;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Uno.Themes.Samples.Droid
{
[global::Android.App.ApplicationAttribute(
Label = "@string/ApplicationName",
LargeHeap = true,
HardwareAccelerated = true,
Theme = "@style/AppTheme"
)]
public class Application : Windows.UI.Xaml.NativeApplication
{
public Application(IntPtr javaReference, JniHandleOwnership transfer)
: base(() => new App(), javaReference, transfer)
{
ConfigureUniversalImageLoader();
}

private static void ConfigureUniversalImageLoader()
{
// Create global configuration and initialize ImageLoader with this config
ImageLoaderConfiguration config = new ImageLoaderConfiguration
.Builder(Context)
.Build();

ImageLoader.Instance.Init(config);

ImageSource.DefaultImageLoader = ImageLoader.Instance.LoadImageAsync;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;
using Android.Widget;

namespace Uno.Themes.Samples.Droid
{
[Activity(
MainLauncher = true,
ConfigurationChanges = global::Uno.UI.ActivityHelper.AllConfigChanges,
WindowSoftInputMode = SoftInput.AdjustNothing | SoftInput.StateHidden
)]
public class MainActivity : Windows.UI.Xaml.ApplicationActivity
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
To add cross-platform image assets for your Uno Platform app, use the Assets folder
in the shared project instead. Resources in this folder are Android-only.

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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="Hello">Hello World, Click Me!</string>
<string name="ApplicationName">Uno.Themes.Samples</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light">

<!-- This removes the ActionBar -->
<item name="windowActionBar">false</item>
<item name="android:windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowNoTitle">true</item>

</style>

<style name="Theme.AppCompat.Translucent">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
</style>

</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# See this for more details: http://developer.xamarin.com/guides/android/advanced_topics/garbage_collection/
MONO_GC_PARAMS=bridge-implementation=tarjan,nursery-size=32m,soft-heap-limit=256m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
26 changes: 26 additions & 0 deletions src/samples/UWP/Uno.Themes.Samples.Mobile/MacCatalyst/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>2</integer>
</array>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/iconapp.appiconset</string>

<!--
Adjust this to your application's encryption usage.
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
-->
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using UIKit;

namespace Uno.Themes.Samples.MacCatalyst
{
public class EntryPoint
{
// This is the main entry point of the application.
public static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(App));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"images": [
{
"orientation": "portrait",
"extent": "full-screen",
"minimum-system-version": "7.0",
"scale": "2x",
"size": "640x960",
"idiom": "iphone"
},
{
"orientation": "portrait",
"extent": "full-screen",
"minimum-system-version": "7.0",
"subtype": "retina4",
"scale": "2x",
"size": "640x1136",
"idiom": "iphone"
},
{
"orientation": "portrait",
"extent": "full-screen",
"minimum-system-version": "7.0",
"scale": "1x",
"size": "768x1024",
"idiom": "ipad"
},
{
"orientation": "landscape",
"extent": "full-screen",
"minimum-system-version": "7.0",
"scale": "1x",
"size": "1024x768",
"idiom": "ipad"
},
{
"orientation": "portrait",
"extent": "full-screen",
"minimum-system-version": "7.0",
"scale": "2x",
"size": "1536x2048",
"idiom": "ipad"
},
{
"orientation": "landscape",
"extent": "full-screen",
"minimum-system-version": "7.0",
"scale": "2x",
"size": "2048x1536",
"idiom": "ipad"
}
],
"properties": {},
"info": {
"version": 1,
"author": ""
}
}
Loading

0 comments on commit eb194e9

Please sign in to comment.