void OnLayout() { if (Geometry.Width == 0 || Geometry.Height == 0) { return; } var bound = Geometry; int navBarHeight; if (NavBarIsVisible) { var navBound = bound; navBarHeight = DPExtensions.ConvertToScaledPixel(_navBar.GetDefaultNavBarHeight()); navBound.Height = navBarHeight; if (_navBar != null) { _navBar.Show(); _navBar.Geometry = navBound; _navBar.RaiseTop(); } } else { navBarHeight = 0; _navBar?.Hide(); } bound.Y += navBarHeight; bound.Height -= navBarHeight; _viewStack.Geometry = bound; }
protected override void OnCompleted(View sender, object data) { if (Recognizer is SwipeGestureRecognizer swipeGesture) { var lineData = (GestureLayer.LineData)data; (swipeGesture as ISwipeGestureController)?.SendSwipe(sender, DPExtensions.ConvertToScaledDP(lineData.X2 - lineData.X1), DPExtensions.ConvertToScaledDP(lineData.Y2 - lineData.Y1)); (swipeGesture as ISwipeGestureController)?.DetectSwipe(sender, swipeGesture.Direction); } }
EvasObject GetContent(object data, string part) { ShellSection section = data as ShellSection; var box = new EBox(NativeParent); box.Show(); EImage icon = null; if (section.Icon != null) { icon = new TImage(NativeParent); icon.Show(); box.PackEnd(icon); } var title = new TLabel(NativeParent) { Text = section.Title, FontSize = DPExtensions.ConvertToEflFontPoint(14), HorizontalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Start, VerticalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Center, }; title.Show(); box.PackEnd(title); int iconPadding = DPExtensions.ConvertToScaledPixel(this.GetDefaultIconPadding()); int iconSize = DPExtensions.ConvertToScaledPixel(this.GetDefaultIconSize()); int cellHeight = iconPadding * 2 + iconSize; box.SetLayoutCallback(() => { var bound = box.Geometry; int leftMargin = iconPadding; if (icon != null) { var iconBound = bound; iconBound.X += iconPadding; iconBound.Y += iconPadding; iconBound.Width = iconSize; iconBound.Height = iconSize; icon.Geometry = iconBound; leftMargin = (2 * iconPadding + iconSize); } bound.X += leftMargin; bound.Width -= leftMargin; title.Geometry = bound; }); box.MinimumHeight = cellHeight; return(box); }
public double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes) { int pt; // Actual font size depends on the target idiom. switch (size) { case NamedSize.Micro: pt = DeviceInfo.Idiom == DeviceIdiom.TV || DeviceInfo.Idiom == DeviceIdiom.Watch ? 24 : 19; break; case NamedSize.Small: pt = DeviceInfo.Idiom == DeviceIdiom.TV ? 26 : (DeviceInfo.Idiom == DeviceIdiom.Watch ? 30 : 22); break; case NamedSize.Default: case NamedSize.Medium: pt = DeviceInfo.Idiom == DeviceIdiom.TV ? 28 : (DeviceInfo.Idiom == DeviceIdiom.Watch ? 32 : 25); break; case NamedSize.Large: pt = DeviceInfo.Idiom == DeviceIdiom.TV ? 32 : (DeviceInfo.Idiom == DeviceIdiom.Watch ? 36 : 31); break; case NamedSize.Body: pt = DeviceInfo.Idiom == DeviceIdiom.TV ? 30 : (DeviceInfo.Idiom == DeviceIdiom.Watch ? 32 : 28); break; case NamedSize.Caption: pt = DeviceInfo.Idiom == DeviceIdiom.TV ? 26 : (DeviceInfo.Idiom == DeviceIdiom.Watch ? 24 : 22); break; case NamedSize.Header: pt = DeviceInfo.Idiom == DeviceIdiom.TV ? 84 : (DeviceInfo.Idiom == DeviceIdiom.Watch ? 36 : 138); break; case NamedSize.Subtitle: pt = DeviceInfo.Idiom == DeviceIdiom.TV ? 30 : (DeviceInfo.Idiom == DeviceIdiom.Watch ? 30 : 28); break; case NamedSize.Title: pt = DeviceInfo.Idiom == DeviceIdiom.TV ? 42 : (DeviceInfo.Idiom == DeviceIdiom.Watch ? 36 : 40); break; default: throw new ArgumentOutOfRangeException(nameof(size)); } return(DPExtensions.ConvertToDPFont(pt)); }
public virtual bool Initialize() { if (IsPlatformViewInitialized) { return(true); } if (Window == null) { return(false); } var platformWindow = Window.Content?.ToPlatform() as Window; if (platformWindow == null) { return(false); } var handler = Window.Handler as WindowHandler; if (handler?.MauiContext == null) { return(false); } _graphicsView = new SkiaGraphicsView(platformWindow); _graphicsView.Drawable = this; _graphicsView.RepeatEvents = !DisableUITouchEventPassthrough; _touchLayer = new GestureLayer(platformWindow); _touchLayer.Attach(_graphicsView); _touchLayer.SetTapCallback(GestureLayer.GestureType.Tap, GestureLayer.GestureState.Start, (data) => { var x = _touchLayer.EvasCanvas.Pointer.X; var y = _touchLayer.EvasCanvas.Pointer.Y; OnTappedInternal(new Point(DPExtensions.ConvertToScaledDP(x), DPExtensions.ConvertToScaledDP(y))); }); platformWindow.SetOverlay(_graphicsView); IsPlatformViewInitialized = true; return(IsPlatformViewInitialized); }
protected override void OnMoved(View sender, object data) { var lineData = (GestureLayer.MomentumData)data; (Recognizer as IPanGestureController)?.SendPan(sender, DPExtensions.ConvertToScaledDP(lineData.X2 - lineData.X1), DPExtensions.ConvertToScaledDP(lineData.Y2 - lineData.Y1), _currentPanGestureId); }