public void OnTouch(CustomPageView page, TouchData data) { if (transition != null) { transition.OnTouch(page, data); } }
protected override bool OnBackButtonPressed() { if (this.lastView != null) { SwitchCurrent(lastView, true); lastView = null; } return(true); }
public void SwitchCurrent(CustomPageView view, bool returning) { lastView = currentView; currentView = view; if (transition != null) { transition.Switch(currentView, lastView, returning); } }
public override bool OnTouchEvent(Android.Views.MotionEvent e) { if (this.Element is CustomPageView) { var view = this.Control; TouchData data = TouchData.FromAndroid(e); CustomPageView custom = (CustomPageView)this.Element; custom.OnTouch(data); } return(true); }
public void AddView(CustomPageView view, int x) { if (currentView == null) { currentView = view; } views.Add(view); abs.Children.Add(view); if (transition != null) { transition.Add(view); } view.SetParent(this); }
public void Update() { double width = Core.Instance.PlatformManager.GetScreenWidth(); double height = Core.Instance.PlatformManager.GetScreenHeight(); List <CustomPageView> views = page.Views; for (int i = 0; i < views.Count; i++) { CustomPageView v = views[i]; TransitionSlideData data = (TransitionSlideData)v.TransData; if (v.IsEnabled) { data.CurrentPosition = DoubleUtil.Lerp(data.CurrentPosition, data.TargetPosition, data.Speed); AbsoluteLayout.SetLayoutBounds(v, new Rectangle(data.CurrentPosition, 0, width, height)); } } }
public void Add(CustomPageView view) { if (currentView == null) { currentView = view; } double width = Core.Instance.PlatformManager.GetScreenWidth(); double height = Core.Instance.PlatformManager.GetScreenHeight(); TransitionSlideData data = new TransitionSlideData(); if (view != page.CurrentView) { data.CurrentPosition = width; data.TargetPosition = width; } data.Speed = 0.2; view.TransData = data; AbsoluteLayout.SetLayoutBounds(view, new Rectangle(data.CurrentPosition, 0, width, height)); }
public void Switch(CustomPageView current, CustomPageView last, bool returning) { this.currentView = current; this.lastView = last; double width = Core.Instance.PlatformManager.GetScreenWidth(); List <CustomPageView> views = page.Views; for (int i = 0; i < views.Count; i++) { CustomPageView v = views[i]; v.IsEnabled = false; v.IsVisible = false; // disable everything } current.IsEnabled = true; current.IsVisible = true; TransitionSlideData curData = (TransitionSlideData)current.TransData; curData.TargetPosition = 0; if (last != null) { last.IsEnabled = true; last.IsVisible = true; TransitionSlideData lastData = (TransitionSlideData)last.TransData; if (returning) { lastData.TargetPosition = width; } else { lastData.TargetPosition = -width; } } }
public CustomPage(CustomPageView view) : this() { AddView(view, 0); }
public void OnTouch(CustomPageView view, TouchData touch) { }