Skip to content

Commit

Permalink
Merge pull request #10 from muak/survey/measureAndroid
Browse files Browse the repository at this point in the history
iOS Fast Scroll Crash
  • Loading branch information
muak committed Apr 3, 2023
2 parents d27546c + 297523a commit e4d68fe
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 11 deletions.
6 changes: 4 additions & 2 deletions SettingsView/Handlers/ButtonCell/ButtonCellHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ public partial class ButtonCellHandler : CellBaseHandler<ButtonCell, ButtonCellV

private static void MapTitleAlignment(ButtonCellHandler handler, ButtonCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateTitleAlignment();
}

private static void MapCommand(ButtonCellHandler handoer, ButtonCell arg2)
private static void MapCommand(ButtonCellHandler handler, ButtonCell arg2)
{
handoer.PlatformView.UpdateCommand();
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateCommand();
}
}

40 changes: 33 additions & 7 deletions SettingsView/Handlers/CellBase/CellBaseHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,17 @@ protected override TnativeCell CreatePlatformElement()
protected override void DisconnectHandler(TnativeCell platformView)
{
base.DisconnectHandler(platformView);
IsDisconnect = true;
}

protected override void ConnectHandler(TnativeCell platformView)
{
base.ConnectHandler(platformView);
IsDisconnect = false;
}

public bool IsDisconnect { get; private set; }

/// <summary>
/// Gets the cell.
/// </summary>
Expand Down Expand Up @@ -104,92 +108,114 @@ public virtual TnativeCell GetCell(CellBase item, UITableViewCell reusableCell,

private static void MapTitleText(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
((CellBaseView?)handler.PlatformView)?.UpdateTitleText();
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateTitleText();
}

private static void MapTitleColor(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
((CellBaseView?)handler.PlatformView)?.UpdateTitleColor();
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateTitleColor();
}

private static void MapTitleFont(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateTitleFont();
nativeView?.UpdateLayout();
}

private static void MapDescriptionText(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateDescriptionText();
nativeView?.UpdateLayout();
}

private static void MapDescriptionColor(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
((CellBaseView?)handler.PlatformView)?.UpdateDescriptionColor();
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateDescriptionColor();
}

private static void MapDescriptionFont(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateDescriptionFont();
nativeView?.UpdateLayout();
}

private static void MapHintText(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
if (handler.IsDisconnect) return;
var nativeCell = handler.PlatformView as CellBaseView;
nativeCell?.UpdateHintText();
nativeCell?.UpdateLayout();
}

private static void MapHintTextColor(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
((CellBaseView?)handler.PlatformView)?.UpdateHintTextColor();
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateHintTextColor();
}

private static void MapHintFont(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateHintFont();
nativeView?.UpdateLayout();
}

private static void MapIconRadius(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateIconRadius();
nativeView?.UpdateLayout();
}

private static void MapIconSize(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateIconSize();
nativeView?.UpdateLayout();
}

private static void MapIconSource(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateIcon();
}

private static void MapIsVisible(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
((CellBaseView?)handler.PlatformView)?.UpdateIsVisible();
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateIsVisible();
}

private static void MapIsEnabled(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
((CellBaseView?)handler.PlatformView)?.UpdateIsEnabled();
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateIsEnabled();
}

private static void MapBackgroundColor(CellBaseHandler<TvirtualCell, TnativeCell> handler, CellBase cell)
{
((CellBaseView?)handler.PlatformView)?.UpdateBackgroundColor();
if (handler.IsDisconnect) return;
var nativeView = handler.PlatformView as CellBaseView;
nativeView?.UpdateBackgroundColor();
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions SettingsView/Handlers/CheckboxCell/CheckboxCellHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ public partial class CheckboxCellHandler : CellBaseHandler<CheckboxCell, Checkbo

private static void MapAccentColor(CheckboxCellHandler handler, CheckboxCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateAccentColor();
}

private static void MapChecked(CheckboxCellHandler handler, CheckboxCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateChecked();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public partial class CommandCellHandler: LabelCellBaseHandler<CommandCell, Comma

private static void MapCommand(CommandCellHandler handler, CommandCell cell)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateCommand();
}
}
Expand Down
1 change: 1 addition & 0 deletions SettingsView/Handlers/CustomCell/CustomCellHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public partial class CustomCellHandler : CellBaseHandler<CustomCell, CustomCellV

private static void MapCommand(CustomCellHandler handler, CustomCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateCommand();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,25 @@ public partial class DatePickerCellHandler : LabelCellBaseHandler<DatePickerCell

private static void MapDate(DatePickerCellHandler handler, DatePickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateDate();
}

private static void MapMaximumDate(DatePickerCellHandler handler, DatePickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateMaximumDate();
}

private static void MapMinimumDate(DatePickerCellHandler handler, DatePickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateMinimumDate();
}

private static void MapTodayText(DatePickerCellHandler handler, DatePickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateTodayText();
}
}
Expand Down
7 changes: 7 additions & 0 deletions SettingsView/Handlers/EntryCell/EntryCellHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,44 @@ public partial class EntryCellHandler : CellBaseHandler<EntryCell, EntryCellView

private static void MapValueText(EntryCellHandler handler, EntryCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateValueText();
}

private static void MapValueTextFont(EntryCellHandler handler, EntryCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateValueTextFont();
handler.PlatformView.UpdateLayout();
}

private static void MapValueTextColor(EntryCellHandler handler, EntryCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateValueTextColor();
}

private static void MapKeyboard(EntryCellHandler handler, EntryCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateKeyboard();
}

private static void MapPlaceholder(EntryCellHandler handler, EntryCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdatePlaceholder();
}

private static void MapTextAlignment(EntryCellHandler handler, EntryCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateTextAlignment();
}

private static void MapIsPassword(EntryCellHandler handler, EntryCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateIsPassword();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ public partial class LabelCellBaseHandler<TvirtualCell, TnativeCell>

private static void MapValueTextColor(LabelCellBaseHandler<TvirtualCell, TnativeCell> handler, LabelCell cell)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateValueTextColor();
}

private static void MapValueText(LabelCellBaseHandler<TvirtualCell, TnativeCell> handler, LabelCell cell)
{
if (handler.IsDisconnect) return;
switch (cell)
{
// disabled ValueTextMapper if cell is PickerCell.
Expand All @@ -38,6 +40,7 @@ private static void MapValueText(LabelCellBaseHandler<TvirtualCell, TnativeCell>

private static void MapValueTextFont(LabelCellBaseHandler<TvirtualCell, TnativeCell> handler, LabelCell cell)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateValueTextFont();
handler.PlatformView.UpdateLayout();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,25 @@ public partial class NumberPickerCellHandler : LabelCellBaseHandler<NumberPicker

private static void MapNumberList(NumberPickerCellHandler handler, NumberPickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateNumberList();
}

private static void MapNumber(NumberPickerCellHandler handler, NumberPickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateNumber();
}

private static void MapPickerTitle(NumberPickerCellHandler handler, NumberPickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateTitle();
}

private static void MapSelectedCommand(NumberPickerCellHandler handler, NumberPickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateCommand();
}
}
Expand Down
1 change: 1 addition & 0 deletions SettingsView/Handlers/RadioCell/RadioCellHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public partial class RadioCellHandler : CellBaseHandler<RadioCell, RadioCellView

private static void MapAccentColor(RadioCellHandler handler, RadioCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateAccentColor();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ private static void MapAccentColor(SimpleCheckCellHandler handler, SimpleCheckCe

private static void MapChecked(SimpleCheckCellHandler handler, SimpleCheckCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateChecked();
}
}
Expand Down
2 changes: 2 additions & 0 deletions SettingsView/Handlers/SwitchCell/SwitchCellHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ public partial class SwitchCellHandler : CellBaseHandler<SwitchCell, SwitchCellV

private static void MapAccentColor(SwitchCellHandler handler, SwitchCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateAccentColor();
}

private static void MapOn(SwitchCellHandler handler, SwitchCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateOn();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,25 @@ public partial class TextPickerCellHandler : LabelCellBaseHandler<TextPickerCell

private static void MapItems(TextPickerCellHandler handler, TextPickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateItems();
}

private static void MapSelectedItem(TextPickerCellHandler handler, TextPickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateSelectedItem();
}

private static void MapPickerTitle(TextPickerCellHandler handler, TextPickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateTitle();
}

private static void MapSelectedCommand(TextPickerCellHandler handler, TextPickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateCommand();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ public partial class TimePickerCellHandler : LabelCellBaseHandler<TimePickerCell

private static void MapTime(TimePickerCellHandler handler, TimePickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdateTime();
}

private static void MapPickerTitle(TimePickerCellHandler handler, TimePickerCell arg2)
{
if (handler.IsDisconnect) return;
handler.PlatformView.UpdatePickerTitle();
}
}
Expand Down
2 changes: 1 addition & 1 deletion SettingsView/Platforms/iOS/AiTableView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected override void Dispose(bool disposing)
_settingsView = null;
}
base.Dispose(disposing);
}
}

void DisposeSubviews(UIView view)
{
Expand Down
6 changes: 6 additions & 0 deletions SettingsView/Platforms/iOS/Cells/CustomCellView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ protected override void SetUpContentView()
internal virtual void UpdateContent(UITableView tableView)
{
if (_coreView is null)
{
return; // for HotReload;
}
if(tableView is null)
{
return;
}

_coreView.CustomCell = CustomCell;
_coreView.UpdateCell(CustomCell.Content, tableView);
Expand Down

0 comments on commit e4d68fe

Please sign in to comment.