We are going to create one that runs on the UI thread, you can create a different one that doesn’t run on the UI thread if required. Now create function that returns an IExecutor implementation so we provide it to the callback as the first parameter and it will be invoked using it. Wit = new WindowInfoTrackerCallbackAdapter((this)) Initialize the window manager in your activity's OnCreate: protected override void OnCreate(Bundle savedInstanceState) The activity also implements IConsumer, see step 4 below for the code for the Accept method required by this interface. In the MainActivity class, declare a variable for the window information tracker: public class MainActivity : AppCompatActivity, IConsumerĮnsure that the correct using and using statements are added to the top of the file. Search for .Ĭhoose the highest version number to add to your project ( 1.0.0.7 is the first stable version of the API). Right-click on your Xamarin.Android project and choose Manage NuGet Packages. To add the NuGet that provides Jetpack Window Manager features: To use WindowInfoTracker in your code, follow the instructions below (from the Xamarin.Android Window Manager sample app): Add dependency Instead of using the ScreenHelper class to determine IsDualMode or to GetHingeBoundsDip(), you can use the methods and properties on WindowInfoTracker and related classes directly. The NuGet is intended to replace the need to add the Xamarin.DuoSDK NuGet to Xamarin.Android apps. Samples using Jetpack Window Manager are available in the surface-duo-sdk-xamarin-samples repo. The FoldingFeature class provides information about the state of that part of the device, with properties for Bounds and IsSeparating, and methods for OcclusionType, Orientation, and State. FoldingFeature - Provides information about a specific feature of the device - while the Surface Duo only has one folding feature, it's possible that other devices might have more.Window Manager will return a collection of display features from a layout change callback. DisplayFeature - Identifies disruptions in the continuous flat screen surface such as hinges or folds.Jetpack Window Manager provides a standard API for working with all foldable devices. Jetpack Window Manager is intended for developers working with Xamarin.Android projects. Xamarin.Forms users should reference the NuGet for Surface Duo support, with its DualScreenInfo and TwoPaneView classes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |