This commit is contained in:
Shane Neuville 2020-02-11 09:05:12 -07:00
Родитель ddf3fbc06d
Коммит 668516548d
4 изменённых файлов: 20 добавлений и 5 удалений

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

@ -27,7 +27,6 @@ namespace XamarinTV.Droid
base.OnCreate(savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
Forms.SetFlags("IndicatorView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental");
Forms.Init(this, savedInstanceState);
CachedImageRenderer.Init(true);
SharpnadoInitializer.Initialize();

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

@ -39,7 +39,6 @@ namespace XamarinTV.UWP
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
Xamarin.Forms.Forms.SetFlags("IndicatorView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental");
Xamarin.Forms.Forms.Init(e); // requires the `e` parameter
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)

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

@ -2,6 +2,7 @@
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.WindowsSpecific;
using FormsApplication = Xamarin.Forms.Application;
using System.Collections.Generic;
namespace XamarinTV
{
@ -20,8 +21,10 @@ namespace XamarinTV
}
_mainPage = new MainPage();
MainPage = _mainPage;
MainPage = _mainPage;
Xamarin.Forms.Device.SetFlags(new List<string>() { "StateTriggers_Experimental", "IndicatorView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental" });
On<Windows>().SetImageDirectory("Assets");
}

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

@ -44,11 +44,25 @@ namespace XamarinTV.Views
}
}
bool IsLandscape
{
get
{
if (DualScreenInfo.Current.SpanMode == TwoPaneViewMode.SinglePane &&
DualScreenInfo.Current.HingeBounds == Rectangle.Zero)
return Device.info.CurrentOrientation == Xamarin.Forms.Internals.DeviceOrientation.Landscape ||
Device.info.CurrentOrientation == Xamarin.Forms.Internals.DeviceOrientation.LandscapeRight ||
Device.info.CurrentOrientation == Xamarin.Forms.Internals.DeviceOrientation.LandscapeLeft;
return DualScreenInfo.Current.IsLandscape;
}
}
void UpdateAspectRatio()
{
Device.BeginInvokeOnMainThread(() =>
{
if (DualScreenInfo.Current.IsLandscape)
if (IsLandscape)
{
VideoPlayer.Aspect = Aspect.AspectFill;
VideoPlayer.HeightRequest = -1;