-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add Mobile Samples Heads (post update to Uno 5.X and net7.0 bump) (
#1046) * fix: Add Mobile Samples Heads (post update to Uno 5.X and net7.0 bump) * chore: wip * chore: test * chore: update packages --------- Co-authored-by: Steve Bilogan <[email protected]>
- Loading branch information
1 parent
e21b814
commit 59e0371
Showing
24 changed files
with
556 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -340,3 +340,4 @@ src/library/Uno.Material/Generated/mergedpages.v2.xaml | |
|
||
crosstargeting_override.props | ||
|
||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/samples/UWP/Uno.Themes.Samples.Mobile/Android/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
22 changes: 22 additions & 0 deletions
22
src/samples/UWP/Uno.Themes.Samples.Mobile/Android/Assets/AboutAssets.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
42
src/samples/UWP/Uno.Themes.Samples.Mobile/Android/Main.Android.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/samples/UWP/Uno.Themes.Samples.Mobile/Android/MainActivity.Android.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/samples/UWP/Uno.Themes.Samples.Mobile/Android/Resources/AboutResources.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
5 changes: 5 additions & 0 deletions
5
src/samples/UWP/Uno.Themes.Samples.Mobile/Android/Resources/values/Strings.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
18 changes: 18 additions & 0 deletions
18
src/samples/UWP/Uno.Themes.Samples.Mobile/Android/Resources/values/Styles.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
2 changes: 2 additions & 0 deletions
2
src/samples/UWP/Uno.Themes.Samples.Mobile/Android/environment.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
6 changes: 6 additions & 0 deletions
6
src/samples/UWP/Uno.Themes.Samples.Mobile/MacCatalyst/Entitlements.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
26
src/samples/UWP/Uno.Themes.Samples.Mobile/MacCatalyst/Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
15 changes: 15 additions & 0 deletions
15
src/samples/UWP/Uno.Themes.Samples.Mobile/MacCatalyst/Main.maccatalyst.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} | ||
} |
Oops, something went wrong.