public void Show(string statusLabel, string resultSymbol, string resultLabel, string buttonLabel) { SetHidden(false); // set and position the status label /*if ( string.IsNullOrEmpty( statusLabel ) == false ) * { * StatusBackground.Hidden = false; * } * else * { * StatusBackground.Hidden = true; * }*/ StatusLabel.Text = statusLabel; StatusLabel.SizeToFit( ); // set the result symbol ResultSymbol.Text = resultSymbol; ResultSymbol.SizeToFit( ); // set the result text /*if ( string.IsNullOrEmpty( resultLabel ) == false ) * { * ResultBackground.Hidden = false; * } * else * { * ResultBackground.Hidden = true; * }*/ ResultLabel.Text = resultLabel; // set the done button if (string.IsNullOrEmpty(buttonLabel) == false) { DoneButton.Hidden = false; } else { DoneButton.Hidden = true; } DoneButton.Text = buttonLabel; DoneButton.SizeToFit( ); SetOpacity(1.00f); SetBounds(View.Bounds); }
public void SetBounds(RectangleF containerBounds) { View.Bounds = containerBounds; // setup the background layers /*StatusBackground.Frame = new RectangleF( View.Frame.X, * View.Frame.Top + Rock.Mobile.Graphics.Util.UnitToPx( 10 ), * View.Frame.Width, * Rock.Mobile.Graphics.Util.UnitToPx( 44 ) );*/ /*ResultBackground.Frame = new RectangleF( View.Frame.X, * View.Frame.Height / 3, * View.Frame.Width, * Rock.Mobile.Graphics.Util.UnitToPx( 150 ) );*/ // and the labels StatusLabel.Frame = new RectangleF(0, 0, View.Frame.Width - Rock.Mobile.Graphics.Util.UnitToPx(40), 0); StatusLabel.SizeToFit( ); StatusLabel.Frame = new RectangleF((View.Frame.Width - StatusLabel.Frame.Width) / 2, View.Frame.Top + Rock.Mobile.Graphics.Util.UnitToPx(10), StatusLabel.Frame.Width, StatusLabel.Frame.Height); ResultSymbol.Frame = new RectangleF(0, 0, View.Frame.Width - Rock.Mobile.Graphics.Util.UnitToPx(40), 0); ResultSymbol.SizeToFit( ); float circleWidth = ResultSymbol.Frame.Width * 1.25f; ResultCircle.Frame = new RectangleF((View.Frame.Width - circleWidth) / 2, Rock.Mobile.Graphics.Util.UnitToPx(140), circleWidth, circleWidth); ResultSymbol.Frame = new RectangleF(ResultCircle.Frame.X + (ResultCircle.Frame.Width - ResultSymbol.Frame.Width) / 2, ResultCircle.Frame.Y + (ResultCircle.Frame.Height - ResultSymbol.Frame.Height) / 2, ResultSymbol.Frame.Width, ResultSymbol.Frame.Height); ResultLabel.Frame = new RectangleF(0, 0, View.Frame.Width - Rock.Mobile.Graphics.Util.UnitToPx(40), 0); ResultLabel.SizeToFit( ); ResultLabel.Frame = new RectangleF((View.Frame.Width - ResultLabel.Frame.Width) / 2, ResultCircle.Frame.Bottom + Rock.Mobile.Graphics.Util.UnitToPx(5), ResultLabel.Frame.Width, ResultLabel.Frame.Height); // lastly the button float doneWidth = Rock.Mobile.Graphics.Util.UnitToPx(122); DoneButton.Frame = new RectangleF((View.Frame.Width - doneWidth) / 2, ResultLabel.Frame.Bottom + Rock.Mobile.Graphics.Util.UnitToPx(10), doneWidth, DoneButton.Frame.Height); }
public override void LayoutSubviews() { base.LayoutSubviews(); var bounds = Bounds; if (_remoteVideoSize.Width > 0 && _remoteVideoSize.Height > 0) { // Aspect fill remote video into bounds. var remoteVideoFrame = bounds.WithAspectRatio(_remoteVideoSize); nfloat scale = 1f; if (remoteVideoFrame.Size.Width > remoteVideoFrame.Size.Height) { // Scale by height. scale = bounds.Size.Height / remoteVideoFrame.Size.Height; } else { // Scale by width. scale = bounds.Size.Width / remoteVideoFrame.Size.Width; } remoteVideoFrame.Size = new CGSize(remoteVideoFrame.Size.Width * scale, remoteVideoFrame.Size.Height * scale); RemoteView.Frame = remoteVideoFrame; RemoteView.Center = new CGPoint(bounds.GetMidX(), bounds.GetMidY()); } else { RemoteView.Frame = bounds; } // Aspect fit local video view into a square box. var localVideoFrame = new CGRect(0, 0, kLocalVideoViewSize, kLocalVideoViewSize); // Place the view in the bottom right. localVideoFrame.Location = new CGPoint( bounds.GetMaxX() - localVideoFrame.Size.Width - kLocalVideoViewPadding, bounds.GetMaxY() - localVideoFrame.Size.Height - kLocalVideoViewPadding - AppDelegate.SafeAreaInsets.Top); LocalVideoView.Frame = localVideoFrame; // Place stats at the top. var statsSize = StatsView.SizeThatFits(bounds.Size); StatsView.Frame = new CGRect(bounds.GetMinX(), bounds.GetMinY() + kStatusBarHeight + AppDelegate.SafeAreaInsets.Top, statsSize.Width, statsSize.Height); // Place hangup button in the bottom left. _hangupButton.Frame = new CGRect(bounds.GetMinX() + kButtonPadding, bounds.GetMaxY() - kButtonPadding - kButtonSize - AppDelegate.SafeAreaInsets.Bottom, kButtonSize, kButtonSize); // Place button to the right of hangup button. var cameraSwitchFrame = _hangupButton.Frame; cameraSwitchFrame.Location = new CGPoint(cameraSwitchFrame.GetMaxX() + kButtonPadding, cameraSwitchFrame.Location.Y); _cameraSwitchButton.Frame = cameraSwitchFrame; // Place route button to the right of camera button. var routeChangeFrame = _cameraSwitchButton.Frame; routeChangeFrame.Location = new CGPoint(routeChangeFrame.GetMaxX() + kButtonPadding, routeChangeFrame.Location.Y); _routeChangeButton.Frame = routeChangeFrame; StatusLabel.SizeToFit(); StatusLabel.Center = new CGPoint(bounds.GetMidX(), bounds.GetMidY()); }