1
0
Форкнуть 0

[WindowManager] update to 1.0.0 stable release (#34)

* [WindowManager] update to rc01

test NuGets from CI https://github.com/xamarin/AndroidX/pull/449

* [all] update Jetpack Window Manager (rc01)

* [all] update Jetpack Window Manager (1.0.0 stable)

* tweaks

* add comments re 1.0.0.7 stable version update

* [windowmanager] config tweaks

* update README for Jetpack Window Manager support
This commit is contained in:
Craig Dunn 2022-02-23 10:47:46 -08:00 коммит произвёл GitHub
Родитель 884a903c3c
Коммит d5fce5d26e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
20 изменённых файлов: 66 добавлений и 34 удалений

Просмотреть файл

@ -135,19 +135,19 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.2.0.5</Version>
<Version>1.3.1.4</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.CardView">
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.ConstraintLayout">
<Version>2.0.4.2</Version>
<Version>2.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.RecyclerView">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Window.WindowJava">
<Version>1.0.0.5-beta04</Version>
<Version>1.0.0.7</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />

Просмотреть файл

@ -20,6 +20,9 @@ using System.Linq;
02-Nov-21 Updated to AndroidX.Window-1.0.0-beta03 (note: beta03 was never deployed to NuGet.org)
02-Dec-21 Updated to AndroidX.Window-1.0.0-beta04
Renamed WindowInfoRepository to WindowInfoTracker, added Activity context parameter
16-Dec-21 Updated to AndroidX.Window-1.0.0-rc01
27-Jan-22 Updated to AndroidX.Window-1.0.0 stable release!
09-Feb-22 Updated to AndroidX.Window-1.0.0 stable
*/
namespace CompanionPane
{

Просмотреть файл

@ -18,7 +18,7 @@
<AndroidResgenClass>Resource</AndroidResgenClass>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v12.0</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>

Просмотреть файл

@ -121,13 +121,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.2.0.5</Version>
<Version>1.3.1.4</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.ConstraintLayout">
<Version>2.0.4.2</Version>
<Version>2.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Window.WindowJava">
<Version>1.0.0.5-beta04</Version>
<Version>1.0.0.7</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />

Просмотреть файл

@ -19,6 +19,9 @@ using Android.Util;
02-Nov-21 Updated to AndroidX.Window-1.0.0-beta03 (note: beta03 was never deployed to NuGet.org)
02-Dec-21 Updated to AndroidX.Window-1.0.0-beta04
Renamed WindowInfoRepository to WindowInfoTracker, added Activity context parameter
16-Dec-21 Updated to AndroidX.Window-1.0.0-rc01
27-Jan-22 Updated to AndroidX.Window-1.0.0 stable release!
09-Feb-22 Updated to AndroidX.Window-1.0.0 stable
*/
namespace DualView
{

Просмотреть файл

@ -17,7 +17,7 @@
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v12.0</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
@ -92,10 +92,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.2.0.5</Version>
<Version>1.3.1.4</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.ConstraintLayout">
<Version>2.0.4.2</Version>
<Version>2.1.1.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -9,7 +9,10 @@ using Android.Webkit;
using Android.Widget;
using AndroidX.AppCompat.App;
using Java.Interop;
/*
16-Dec-21 Updated to AndroidX.Window-1.0.0-rc01
09-Feb-22 Updated to AndroidX.Window-1.0.0 stable
*/
namespace ExtendCanvas
{
[Activity(

Просмотреть файл

@ -18,7 +18,7 @@
<AndroidResgenClass>Resource</AndroidResgenClass>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v12.0</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>

Просмотреть файл

@ -98,16 +98,16 @@
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.2.0.5</Version>
<Version>1.3.1.4</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.CardView">
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.ConstraintLayout">
<Version>2.0.4.2</Version>
<Version>2.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Window.WindowJava">
<Version>1.0.0.5-beta04</Version>
<Version>1.0.0.7</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -19,6 +19,9 @@ using Android.Util;
02-Nov-21 Updated to AndroidX.Window-1.0.0-beta03 (note: beta03 was never deployed to NuGet.org)
02-Dec-21 Updated to AndroidX.Window-1.0.0-beta04
Renamed WindowInfoRepository to WindowInfoTracker, added Activity context parameter
16-Dec-21 Updated to AndroidX.Window-1.0.0-rc01
27-Jan-22 Updated to AndroidX.Window-1.0.0 stable release!
09-Feb-22 Updated to AndroidX.Window-1.0.0 stable
*/
namespace ListDetail
{

Просмотреть файл

@ -26,6 +26,7 @@ Before running the samples, be sure that you have the following items installed
- Installed [Surface Duo emulator](https://www.microsoft.com/download/details.aspx?id=100847) or connected device
## Contents
This repository features native Xamarin.Android and Xamarin.Forms samples for [different approaches how to work with two screens](https://docs.microsoft.com/dual-screen/introduction).
Be sure the Surface Duo emulator is already running or your device is attached to your computer. Select the target of your choicet from the Visual Studio device list before running the sample.
@ -33,17 +34,22 @@ Be sure the Surface Duo emulator is already running or your device is attached t
The Surface Duo 2 emulator will appear as `<build> (Android 11.0 - API 30)`.
### Xamarin.Android
Every sample of Xamarin.Android is a runable project. To start for example the `CampanionPane` sample, expand the `Xamarin.Android Native` folder and set the related sample as *Startup project*.
The Xamarin.Android samples all use the [Xamarin.AndroidX.Window.WindowJava](https://www.nuget.org/packages/Xamarin.AndroidX.Window.WindowJava/) NuGet, which exposes the Jetpack Window Manager package for dual-screen and foldable support on Surface Duo and other devices.
Every sample of Xamarin.Android is a runnable project. To start for example the `CampanionPane` sample, expand the `Xamarin.Android Native` folder and set the related sample as *Startup project*.
![Xamarin.Android Surface Duo Companion view sample screenshot](Screenshots/xamarin-companion-shrinked.png)
#### CompanionPane
The `companion pane` pattern is a great opportunity to take advantage of added screen real-estate by taking second-level surfaces that are otherwise hidden and exposing them when the app is spanned.
- [Code sample](https://github.com/microsoft/surface-duo-sdk-xamarin-samples/tree/main/CompanionPane) in repository
- [Microsoft docs](https://docs.microsoft.com/dual-screen/introduction#companion-pane) page
#### DragAndDrop
Support for drag-and-drop ensures a great user experience using all the different input types supported by the Surface Duo.
This sample demonstrates how to implement drag-and drop in your Android app, following the [Android drag and drop guidance](https://developer.android.com/guide/topics/ui/drag-drop).
@ -52,6 +58,7 @@ This sample demonstrates how to implement drag-and drop in your Android app, fol
- [Microsoft docs](https://docs.microsoft.com/dual-screen/xamarin/drag-drop) page
#### DualView
Having two screens provides a natural affordance to compare and contrast two versions of the same type of content side-by-side, like two images, lists, or documents.
It can also be used to show the same information in two different ways at the same time, with each screen working seamlessly to provide more information to the user. For example, a list of restaurants on one screen, and a map with locations on the other.
@ -68,12 +75,14 @@ This pattern only applies to the canvas portion of the UI. You may still need to
- [Microsoft docs](https://docs.microsoft.com/dual-screen/introduction#extended-canvas) page
#### IntentToSecondScreen
This sample demonstrates how to cause an activity to open on the second screen (as long as it's empty, otherwise the activity will launch over the current one).
In the main activity, choose an option to start: another activity from the current app or a URL in a browser window:
- [Code sample](https://github.com/microsoft/surface-duo-sdk-xamarin-samples/tree/main/IntentToSecondScreen) in repository
#### ListDetail
The *list-detail* pattern has a main pane (usually with a list view) and a details pane for content. When an item in the list is selected, the details pane is updated. This pattern is naturally good for when you have a wider viewing area. It is frequently used for email and address books.
Taking advantage of the two distinct screens and snapping to the natural boundary, you could use one screen to show the "items" list and the other to show details of the selected item.
@ -82,22 +91,27 @@ Taking advantage of the two distinct screens and snapping to the natural boundar
- [Microsoft docs](https://docs.microsoft.com/dual-screen/introduction#list-detail) page
#### TwoPage
Some apps naturally tend to a book-like paging experience. You can use the natural boundary to show several items from a collection -like pages or pictures - which otherwise might have required the user to view one at a time.
Depending on your app, you could decide to paginate per 2 pages or advance one page at a time.
- [Code sample](https://github.com/microsoft/surface-duo-sdk-xamarin-samples/tree/main/TwoPage) in repository
- [Microsoft docs](https://docs.microsoft.com/dual-screen/introduction#two-page) page
#### WindowManager
Visit the [Window Manager for Xamarin docs](https://docs.microsoft.com/dual-screen/xamarin/) for more information on using Window Manager in your apps.
Visit the [Jetpack Window Manager for Xamarin docs](https://docs.microsoft.com/dual-screen/xamarin/jetpack-window-manager/) for more information on using Jetpack Window Manager in your apps.
### Xamarin.Forms
The Xamarin.Forms samples all use the [Xamarin.Forms.DualScreen](https://www.nuget.org/packages/Xamarin.Forms.DualScreen/) NuGet, which exposes the underlying [Xamarin.DuoSDK](https://www.nuget.org/packages/Xamarin.DuoSDK) NuGet that only works on Surface Duo devices.
All samples on how to use the SDK using Xamarin.Forms are in one sample app. Expand the solution's `Xamarin.Forms` folder and ensure the `DualScreenDemos.Android` project is the *startup project*.
![Xamarin.Forms Surface Duo Sample App Screenshot with list of all included examples](Screenshots/xamarin-forms-menu-shrinked.png)
#### TwoPane
The `TwoPaneView playground` lets you experiment with the different layout options it supports. [Read the TwoPaneView docs](https://docs.microsoft.com/dual-screen/xamarin/twopaneview) for details on how to control the layout.
#### CompanionPane
@ -107,6 +121,7 @@ The `companion pane` pattern is a great opportunity to take advantage of added s
- [Microsoft docs](https://docs.microsoft.com/dual-screen/introduction#companion-pane) page
#### DualView
Having two screens provides a natural affordance to compare and contrast two versions of the same type of content side-by-side, like two images, lists, or documents.
It can also be used to show the same information in two different ways at the same time, with each screen working seamlessly to provide more information to the user. For example, a list of restaurants on one screen, and a map with locations on the other.
@ -114,10 +129,9 @@ It can also be used to show the same information in two different ways at the sa
- [Microsoft docs](https://docs.microsoft.com/dual-screen/introduction#dual-view) page
#### and many more
The sample itself uses diffrent controls itself that brings the unique features of dual screen devices to life. Other examples are focuses on diffrent APIs like the `Xamarin.Forms DualScreenInfo API`. [Read the Microsoft docs article](https://docs.microsoft.com/dual-screen/xamarin/dualscreeninfo) for further information.
### (Optional) Add API keys
To use the **DualView** and **ExtendCanvas** samples, you will first need to create an Google Map API key. Follow the instructions outlined [here](https://developers.google.com/maps/documentation/javascript/get-api-key) to create an API key.
@ -131,7 +145,6 @@ After you have an API key, put it in the following files:
By replacing `YOUR_API_KEY` string with your actual key the map views will be displayed.
## Related links
- [App samples](https://github.com/microsoft/surface-duo-app-samples)

Двоичные данные
Screenshots/xamarin-window-manager.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 47 KiB

После

Ширина:  |  Высота:  |  Размер: 145 KiB

Просмотреть файл

@ -34,6 +34,9 @@ using Android.Util;
02-Nov-21 Updated to AndroidX.Window-1.0.0-beta03 (note: beta03 was never deployed to NuGet.org)
02-Dec-21 Updated to AndroidX.Window-1.0.0-beta04
Renamed WindowInfoRepository to WindowInfoTracker, added Activity context parameter
16-Dec-21 Updated to AndroidX.Window-1.0.0-rc01
27-Jan-22 Updated to AndroidX.Window-1.0.0 stable release!
09-Feb-22 Updated to AndroidX.Window-1.0.0 stable
*/
namespace TwoPage
{

Просмотреть файл

@ -93,13 +93,13 @@
<ItemGroup />
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.2.0.5</Version>
<Version>1.3.1.4</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.ConstraintLayout">
<Version>2.0.4.2</Version>
<Version>2.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Window.WindowJava">
<Version>1.0.0.5-beta04</Version>
<Version>1.0.0.7</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -18,7 +18,7 @@ using Java.Interop;
https://github.com/googlecodelabs/android-foldable-codelab/tree/main/window-manager
which is part of a Google Codelab that explains how to use Window Manager
19-Jul-21 Update to androidx.window-1.0.0-apha09
19-Jul-21 Update to androidx.window-1.0.0-alpha09
FoldingFeature API changes - some properties became methods (GetOrientation, GetState, GetOcclusionType) and their types became "enums" (static class fields)
Use OnStart/Stop instead of OnAttachedToWindow/OnDetached
17-Aug-21 Updated to AndroidX.Window-1.0.0-alpha10 with
@ -30,6 +30,9 @@ using Java.Interop;
02-Nov-21 Updated to AndroidX.Window-1.0.0-beta03 (note: beta03 was never deployed to NuGet.org)
02-Dec-21 Updated to AndroidX.Window-1.0.0-beta04
Renamed WindowInfoRepository to WindowInfoTracker, added Activity context parameter
16-Dec-21 Updated to AndroidX.Window-1.0.0-rc01
27-Jan-22 Updated to AndroidX.Window-1.0.0 stable release!
09-Feb-22 Updated to AndroidX.Window-1.0.0 stable
*/
namespace WindowManagerDemo
{

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.windowmanager" android:installLocation="auto">
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="31" />
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="24" />
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

Просмотреть файл

@ -2,7 +2,7 @@
Visit the [Window Manager for Xamarin docs](https://docs.microsoft.com/dual-screen/xamarin/) for more information on using Window Manager in your apps.
> NOTE: uses Xamarin.Android.Window.WindowJava-1.0.0.5-beta04, based on Jetpack Window Manager beta04 packages
> NOTE: uses Xamarin.Android.Window.WindowJava-1.0.0.7, based on Jetpack Window Manager 1.0.0 stable packages
![Window Manager example spanned across two screens](../Screenshots/xamarin-window-manager.png)

Просмотреть файл

@ -1,5 +1,5 @@
<resources>
<string name="app_name">Xamarin WindowInfoRepository beta04</string>
<string name="app_name">Xamarin WindowInfoTracker 1.0.0.7</string>
<string name="window_metrics">window metrics</string>
<string name="layout_change_text">layout change text</string>
<string name="configuration_changed">Using one logic/physical display - unspanned</string>

Просмотреть файл

@ -51,6 +51,7 @@
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
<AndroidSupportedAbis>x86;x86_64;arm64-v8a</AndroidSupportedAbis>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -98,14 +99,14 @@
</ItemGroup>
<ItemGroup />
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.2.0.5" />
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.3.1.5" />
<PackageReference Include="Xamarin.AndroidX.ConstraintLayout">
<Version>2.0.4.2</Version>
<Version>2.1.2.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Window.WindowJava">
<Version>1.0.0.5-beta04</Version>
<Version>1.0.0.7</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.6" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ic_launcher_background.xml">

Просмотреть файл

@ -16,7 +16,7 @@
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v12.0</TargetFrameworkVersion>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>