зеркало из https://github.com/DeGsoft/maui-linux.git
Merge branch '4.2.0'
This commit is contained in:
Коммит
bb8d19aa7e
|
@ -43,6 +43,7 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
[Test]
|
||||
public void Bugzilla27731Test()
|
||||
{
|
||||
RunningApp.WaitForElement("Click");
|
||||
RunningApp.WaitForNoElement(_pageTitle);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 7111, "[Bug] [WPF] Label with a predefined FontSize value throws an exception", PlatformAffected.WPF)]
|
||||
public class Issue7111 : TestContentPage
|
||||
{
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
var stack = new StackLayout
|
||||
{
|
||||
VerticalOptions = LayoutOptions.Center,
|
||||
HorizontalOptions = LayoutOptions.Center
|
||||
};
|
||||
|
||||
var labelBody = new Label
|
||||
{
|
||||
Text = "If you see this, things didn't crash and it worked",
|
||||
FontSize = Device.GetNamedSize(NamedSize.Body, typeof(Label))
|
||||
};
|
||||
|
||||
var labelCaption = new Label
|
||||
{
|
||||
Text = "If you see this, things didn't crash and it worked",
|
||||
FontSize = Device.GetNamedSize(NamedSize.Caption, typeof(Label))
|
||||
};
|
||||
|
||||
var labelHeader = new Label
|
||||
{
|
||||
Text = "If you see this, things didn't crash and it worked",
|
||||
FontSize = Device.GetNamedSize(NamedSize.Header, typeof(Label))
|
||||
};
|
||||
|
||||
var labelSubtitle = new Label
|
||||
{
|
||||
Text = "If you see this, things didn't crash and it worked",
|
||||
FontSize = Device.GetNamedSize(NamedSize.Subtitle, typeof(Label))
|
||||
};
|
||||
|
||||
var labelTitle = new Label
|
||||
{
|
||||
Text = "If you see this, things didn't crash and it worked",
|
||||
FontSize = Device.GetNamedSize(NamedSize.Title, typeof(Label))
|
||||
};
|
||||
|
||||
stack.Children.Add(labelBody);
|
||||
stack.Children.Add(labelCaption);
|
||||
stack.Children.Add(labelHeader);
|
||||
stack.Children.Add(labelSubtitle);
|
||||
stack.Children.Add(labelTitle);
|
||||
|
||||
Content = stack;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@
|
|||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue7049.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue7061.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue7111.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ShellGestures.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ShellInsets.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)CollectionViewGrouping.cs" />
|
||||
|
|
|
@ -9,7 +9,8 @@ namespace Xamarin.Forms.Platform.Android
|
|||
internal class AndroidTicker : Ticker, IDisposable
|
||||
{
|
||||
ValueAnimator _val;
|
||||
bool _systemEnabled;
|
||||
bool _energySaveModeDisabled;
|
||||
readonly bool _animatorEnabled;
|
||||
|
||||
public AndroidTicker()
|
||||
{
|
||||
|
@ -17,10 +18,11 @@ namespace Xamarin.Forms.Platform.Android
|
|||
_val.SetIntValues(0, 100); // avoid crash
|
||||
_val.RepeatCount = ValueAnimator.Infinite;
|
||||
_val.Update += OnValOnUpdate;
|
||||
_animatorEnabled = IsAnimatorEnabled();
|
||||
CheckPowerSaveModeStatus();
|
||||
}
|
||||
|
||||
public override bool SystemEnabled => _systemEnabled;
|
||||
public override bool SystemEnabled => _energySaveModeDisabled && _animatorEnabled;
|
||||
|
||||
internal void CheckPowerSaveModeStatus()
|
||||
{
|
||||
|
@ -31,7 +33,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
if (!Forms.IsLollipopOrNewer)
|
||||
{
|
||||
_systemEnabled = true;
|
||||
_energySaveModeDisabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -40,12 +42,24 @@ namespace Xamarin.Forms.Platform.Android
|
|||
var powerSaveOn = powerManager.IsPowerSaveMode;
|
||||
|
||||
// If power saver is active, then animations will not run
|
||||
_systemEnabled = !powerSaveOn;
|
||||
_energySaveModeDisabled = !powerSaveOn;
|
||||
|
||||
// Notify the ticker that this value has changed, so it can manage animations in progress
|
||||
OnSystemEnabledChanged();
|
||||
}
|
||||
|
||||
static bool IsAnimatorEnabled()
|
||||
{
|
||||
var resolver = global::Android.App.Application.Context?.ContentResolver;
|
||||
if (resolver == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var scale = global::Android.Provider.Settings.Global.GetFloat(resolver, global::Android.Provider.Settings.Global.AnimatorDurationScale, 0);
|
||||
return scale > 0;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_val != null)
|
||||
|
|
|
@ -85,6 +85,16 @@ namespace Xamarin.Forms.Platform.WPF
|
|||
return (double)System.Windows.Application.Current.Resources["FontSizeMedium"];
|
||||
case NamedSize.Large:
|
||||
return (double)System.Windows.Application.Current.Resources["FontSizeLarge"];
|
||||
case NamedSize.Body:
|
||||
return (double)System.Windows.Application.Current.Resources["FontSizeBody"];
|
||||
case NamedSize.Caption:
|
||||
return (double)System.Windows.Application.Current.Resources["FontSizeCaption"];
|
||||
case NamedSize.Header:
|
||||
return (double)System.Windows.Application.Current.Resources["FontSizeHeader"];
|
||||
case NamedSize.Subtitle:
|
||||
return (double)System.Windows.Application.Current.Resources["FontSizeSubtitle"];
|
||||
case NamedSize.Title:
|
||||
return (double)System.Windows.Application.Current.Resources["FontSizeTitle"];
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException("size");
|
||||
}
|
||||
|
|
|
@ -29,9 +29,14 @@
|
|||
<system:Double x:Key="FontSizeLarge">32</system:Double>
|
||||
<system:Double x:Key="FontSizeExtraLarge">42</system:Double>
|
||||
<system:Double x:Key="FontSizeExtraExtraLarge">72</system:Double>
|
||||
<system:Double x:Key="FontSizeHuge">186</system:Double>
|
||||
<system:Double x:Key="FontSizeHuge">186</system:Double>
|
||||
<system:Double x:Key="FontSizeBody">14</system:Double>
|
||||
<system:Double x:Key="FontSizeCaption">12</system:Double>
|
||||
<system:Double x:Key="FontSizeHeader">46</system:Double>
|
||||
<system:Double x:Key="FontSizeSubtitle">20</system:Double>
|
||||
<system:Double x:Key="FontSizeTitle">24</system:Double>
|
||||
|
||||
<FontFamily x:Key="FontFamilyNormal">Segoe UI</FontFamily>
|
||||
<FontFamily x:Key="FontFamilyNormal">Segoe UI</FontFamily>
|
||||
<FontFamily x:Key="FontFamilySemiBold">Segoe UI</FontFamily>
|
||||
|
||||
<wpf:HeightConverter x:Key="HeightConverter" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче