private TextLabel agreeLabel;
private Switch agreeSwitch;
private TapGestureDetector tapGestureDetector;
+ private ScrollableBase scroller;
+ private TextLabel content;
private bool agreementCheckable;
private bool nextEnabled;
bounding.Position2D = new Position2D(56 - 6, 112 - 6);
bounding.Size2D = new Size2D(1086, 331);
- ScrollableBase scroller = new ScrollableBase{
+ scroller = new ScrollableBase{
Position2D = new Position2D(56, 136),
Size2D = new Size2D(1072, 264),
Scrollbar = new Scrollbar(ScrollbarStyles.Default),
HideScrollBar = false,
};
- // workaround crash issue in ScrollableBase
- var scrollerContent = new View
- {
- Padding = new Extents(64, 67, 0, 0),
- WidthResizePolicy = ResizePolicyType.FillToParent,
- HeightResizePolicy = ResizePolicyType.FitToChildren,
- Layout = new LinearLayout(),
- };
-
// Do not use style on content as it seriously impacts scrolling
// performance on ScrollableBase
- TextLabel content = new TextLabel();
+ content = new TextLabel();
content.TextColor = new Color(0, 12.0f / 255.0f, 43.0f / 255.0f, 1.0f);
content.PixelSize = 18.0f;
content.FontFamily = "BreezeSans";
content.MultiLine = true;
content.WidthResizePolicy = ResizePolicyType.FillToParent;
- scrollerContent.Add(content);
- scroller.Add(scrollerContent);
- scroller.ScrollEvent += (object sender, ScrollableBase.ScrollEventArgs args) =>
+ scroller.Add(content);
+ scroller.Scrolling += (object sender, ScrollEventArgs args) =>
{
- if (IsScrolledToLastPage(sender as ScrollableBase))
+ if (IsScrolledToLastPage(args.Position))
{
AgreementCheckable = true;
}
// have to delay check to get proper measurements
Timer timer = new Timer(1000);
timer.Tick += (sender, args) => {
- if (IsScrolledToLastPage(scroller))
+ if (IsScrolledToLastPage(new Position()))
{
AgreementCheckable = true;
}
}
}
- private bool IsScrolledToLastPage(ScrollableBase scroller)
+ private bool IsScrolledToLastPage(Position currentPos)
{
- if (scroller != null && scroller.ChildCount > 0)
+ if (scroller != null && content != null)
{
- var content = scroller.Children[0];
- var diff = content.Position.Y + content.Size2D.Height - scroller.CurrentSize.Height;
-
- if ((content.Position.Y + content.Size2D.Height - scroller.CurrentSize.Height) < 1.0f)
+ if ((content.Position.Y + content.Size2D.Height - scroller.CurrentSize.Height) + currentPos.Y < 1.0f)
{
return true;
}