Merge branch '3.6.0' into 4.0.0

This commit is contained in:
Samantha Houts 2019-08-16 17:41:04 -07:00
Родитель ddddd19e19 8317fcd9a4
Коммит 1e68249a0d
7 изменённых файлов: 80 добавлений и 16 удалений

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

@ -381,6 +381,10 @@ namespace Xamarin.Forms.Platform.Android
while (IsLayoutRequested) while (IsLayoutRequested)
{ {
await Task.Delay(TimeSpan.FromMilliseconds(1)); await Task.Delay(TimeSpan.FromMilliseconds(1));
if (_disposed)
return;
cycle++; cycle++;
if (cycle >= 10) if (cycle >= 10)
@ -541,4 +545,4 @@ namespace Xamarin.Forms.Platform.Android
bool IScrollView.ScrollBarsInitialized { get; set; } = false; bool IScrollView.ScrollBarsInitialized { get; set; } = false;
} }
} }

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

@ -146,7 +146,6 @@ namespace Xamarin.Forms.Platform.iOS
var handler = new PropertyChangedEventHandler(OnMenuItemPropertyChanged); var handler = new PropertyChangedEventHandler(OnMenuItemPropertyChanged);
_tableView = tableView; _tableView = tableView;
SetupSelection(tableView);
if (_cell != null) if (_cell != null)
{ {
@ -641,7 +640,7 @@ namespace Xamarin.Forms.Platform.iOS
return null; return null;
} }
static void SetupSelection(UITableView table) internal static void SetupSelection(UITableView table)
{ {
if (table.GestureRecognizers == null) if (table.GestureRecognizers == null)
return; return;
@ -722,4 +721,4 @@ namespace Xamarin.Forms.Platform.iOS
} }
} }
} }
} }

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

@ -1,3 +1,4 @@
using System;
using UIKit; using UIKit;
using Xamarin.Forms.Internals; using Xamarin.Forms.Internals;
@ -74,6 +75,19 @@ namespace Xamarin.Forms.Platform.iOS
} }
} }
internal static UIModalPresentationStyle ToNativeModalPresentationStyle(this PlatformConfiguration.iOSSpecific.UIModalPresentationStyle style)
{
switch (style)
{
case PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.FormSheet:
return UIModalPresentationStyle.FormSheet;
case PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.FullScreen:
return UIModalPresentationStyle.FullScreen;
default:
throw new ArgumentOutOfRangeException(nameof(style));
}
}
internal static UIReturnKeyType ToUIReturnKeyType(this ReturnType returnType) internal static UIReturnKeyType ToUIReturnKeyType(this ReturnType returnType)
{ {
switch (returnType) switch (returnType)

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

@ -34,6 +34,7 @@ namespace Xamarin.Forms
static bool? s_isiOS9OrNewer; static bool? s_isiOS9OrNewer;
static bool? s_isiOS10OrNewer; static bool? s_isiOS10OrNewer;
static bool? s_isiOS11OrNewer; static bool? s_isiOS11OrNewer;
static bool? s_isiOS13OrNewer;
static bool? s_respondsTosetNeedsUpdateOfHomeIndicatorAutoHidden; static bool? s_respondsTosetNeedsUpdateOfHomeIndicatorAutoHidden;
#endif #endif
@ -69,6 +70,16 @@ namespace Xamarin.Forms
} }
} }
internal static bool IsiOS13OrNewer
{
get
{
if (!s_isiOS13OrNewer.HasValue)
s_isiOS13OrNewer = UIDevice.CurrentDevice.CheckSystemVersion(13, 0);
return s_isiOS13OrNewer.Value;
}
}
internal static bool RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden internal static bool RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden
{ {
get get
@ -341,4 +352,4 @@ namespace Xamarin.Forms
} }
} }
} }
} }

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

@ -14,8 +14,8 @@ namespace Xamarin.Forms.Platform.iOS
_modal = modal; _modal = modal;
var elementConfiguration = modal.Element as IElementConfiguration<Page>; var elementConfiguration = modal.Element as IElementConfiguration<Page>;
if (elementConfiguration?.On<PlatformConfiguration.iOS>().ModalPresentationStyle() == PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.FormSheet) var modalPresentationStyle = elementConfiguration?.On<PlatformConfiguration.iOS>()?.ModalPresentationStyle() ?? PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.FullScreen;
ModalPresentationStyle = UIKit.UIModalPresentationStyle.FormSheet; ModalPresentationStyle = modalPresentationStyle.ToNativeModalPresentationStyle();
View.BackgroundColor = UIColor.White; View.BackgroundColor = UIColor.White;
View.AddSubview(modal.ViewController.View); View.AddSubview(modal.ViewController.View);

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

@ -944,6 +944,7 @@ namespace Xamarin.Forms.Platform.iOS
protected ListView List; protected ListView List;
protected ITemplatedItemsView<Cell> TemplatedItemsView => List; protected ITemplatedItemsView<Cell> TemplatedItemsView => List;
bool _isDragging; bool _isDragging;
bool _setupSelection;
bool _selectionFromNative; bool _selectionFromNative;
bool _disposed; bool _disposed;
bool _wasEmpty; bool _wasEmpty;
@ -999,6 +1000,19 @@ namespace Xamarin.Forms.Platform.iOS
_isDragging = true; _isDragging = true;
} }
void SetupSelection(UITableViewCell nativeCell, UITableView tableView)
{
if (!(nativeCell is ContextActionsCell))
return;
if (_setupSelection)
return;
ContextActionsCell.SetupSelection(tableView);
_setupSelection = true;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{ {
Cell cell; Cell cell;
@ -1036,6 +1050,8 @@ namespace Xamarin.Forms.Platform.iOS
else else
throw new NotSupportedException(); throw new NotSupportedException();
SetupSelection(nativeCell, tableView);
if (List.IsSet(Specifics.SeparatorStyleProperty)) if (List.IsSet(Specifics.SeparatorStyleProperty))
{ {
if (List.OnThisPlatform().GetSeparatorStyle() == SeparatorStyle.FullWidth) if (List.OnThisPlatform().GetSeparatorStyle() == SeparatorStyle.FullWidth)

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

@ -174,19 +174,39 @@ namespace Xamarin.Forms.Platform.iOS
{ {
base.ViewDidLayoutSubviews(); base.ViewDidLayoutSubviews();
if (View.Subviews.Length < 2) bool layoutMaster = false;
bool layoutDetails = false;
if (Forms.IsiOS13OrNewer)
{
layoutMaster = _masterController?.View?.Superview != null;
layoutDetails = _detailController?.View?.Superview != null;
}
else if (View.Subviews.Length < 2)
{
return; return;
}
else
{
layoutMaster = true;
layoutDetails = true;
}
var detailsBounds = _detailController.View.Frame; if (layoutMaster)
var masterBounds = _masterController.View.Frame; {
var masterBounds = _masterController.View.Frame;
_masterWidth = (nfloat)Math.Max(_masterWidth, masterBounds.Width);
_masterWidth = (nfloat)Math.Max(_masterWidth, masterBounds.Width); if (!masterBounds.IsEmpty)
MasterDetailPage.MasterBounds = new Rectangle(0, 0, _masterWidth, masterBounds.Height);
}
if (!masterBounds.IsEmpty) if (layoutDetails)
MasterDetailPage.MasterBounds = new Rectangle(0, 0, _masterWidth, masterBounds.Height); {
var detailsBounds = _detailController.View.Frame;
if (!detailsBounds.IsEmpty) if (!detailsBounds.IsEmpty)
MasterDetailPage.DetailBounds = new Rectangle(0, 0, detailsBounds.Width, detailsBounds.Height); MasterDetailPage.DetailBounds = new Rectangle(0, 0, detailsBounds.Width, detailsBounds.Height);
}
} }
public override void ViewDidLoad() public override void ViewDidLoad()