public void ResetBounds( ) { // reset our dimensions and call sizeToFit, which will // fully recalculate our bounds assuming this should all fit on a single line PlatformLabel.Bounds = new RectangleF(0, 0, 0, 0); PlatformLabel.SizeToFit( ); }
public object GetStyleValue(EditStyling.Style style) { switch (style) { case EditStyling.Style.FontName: { return(PlatformLabel.Editable_GetFontName( )); } case EditStyling.Style.FontSize: { return(PlatformLabel.Editable_GetFontSize( )); } //case EditStyling.Style.Underline: //{ // return PlatformLabel.Editable_HasUnderline( ); //} case EditStyling.Style.RevealBox: { // here, we're basically saying "YES, we ARE a reveal box" so the system // knows to downgrade us. return(true); } case EditStyling.Style.BoldParagraph: { // for bolding the paragraph, forward this to the parent to see if it supports it return(ParentControl.GetStyleValue(style)); } case EditStyling.Style.UnderlineParagraph: { // for underlining the paragraph, forward this to the parent to see if it supports it return(ParentControl.GetStyleValue(style)); } case EditStyling.Style.BulletParagraph: { return(ParentControl.GetStyleValue(style)); } case EditStyling.Style.BoldItalicizeParagraph: { return(ParentControl.GetStyleValue(style)); } case EditStyling.Style.ItalicizeParagraph: { return(ParentControl.GetStyleValue(style)); } } return(null); }
public UIResultView(object parentView, RectangleF frame, DoneClickDelegate onClick) { View = PlatformView.Create( ); View.AddAsSubview(parentView); View.UserInteractionEnabled = false; StatusLabel = PlatformLabel.Create( ); //StatusBackground = PlatformView.Create( ); ResultSymbol = PlatformLabel.Create( ); ResultLabel = PlatformLabel.Create( ); //ResultBackground = PlatformView.Create( ); ResultCircle = PlatformCircleView.Create( ); ResultCircle.AddAsSubview(parentView); // setup our UI hierarchy //StatusBackground.AddAsSubview( parentView ); //StatusBackground.UserInteractionEnabled = false; //StatusBackground.BorderWidth = .5f; StatusLabel.AddAsSubview(parentView); StatusLabel.UserInteractionEnabled = false; //ResultBackground.AddAsSubview( parentView ); //ResultBackground.UserInteractionEnabled = false; //ResultBackground.BorderWidth = .5f; ResultSymbol.AddAsSubview(parentView); ResultSymbol.UserInteractionEnabled = false; ResultLabel.AddAsSubview(parentView); ResultLabel.UserInteractionEnabled = false; DoneButton = PlatformButton.Create( ); DoneButton.AddAsSubview(parentView); DoneButton.ClickEvent = ( PlatformButton button ) => { if (onClick != null) { onClick( ); } }; // default the view size and opacity SetOpacity(0.00f); SetBounds(frame); // give it a default style SetStyle( ); }
private void DrawElementCallback(Rect rect, int index, bool isActive, bool isFocused) { rect.width = EditorGUIUtility.currentViewWidth - GUI.skin.verticalScrollbar.fixedWidth - 32; float oldY = rect.y; rect.y += EditorGUIUtility.standardVerticalSpacing * 2; SerializedProperty element = reorderableList.serializedProperty.GetArrayElementAtIndex(index); SerializedProperty elementTarget = element.FindPropertyRelative("Target"); EditorGUI.BeginChangeCheck(); EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width + 4, EditorGUIUtility.singleLineHeight), elementTarget, GUIContent.none); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); data.ValidateData(index); } UnityEngine.Object elementTypeObj = element.FindPropertyRelative("Type").objectReferenceValue; if (elementTypeObj != null) { // Create foldout SerializedProperty showFoldout = element.FindPropertyRelative("Foldout"); rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing * 4; showFoldout.boolValue = EditorGUI.Foldout(new Rect(rect.x, rect.y, EditorGUIUtility.currentViewWidth - GUI.skin.verticalScrollbar.fixedWidth, EditorGUIUtility.singleLineHeight), showFoldout.boolValue, ""); if (showFoldout.boolValue) { PlatformLabel platformLabel = new PlatformLabel(); platformLabel.OnGUI(rect, null, null); SerializedObject elementType = new SerializedObject(elementTypeObj); SerializedProperty elementTypeIterator = elementType.GetIterator(); elementTypeIterator.NextVisible(true); while (elementTypeIterator.NextVisible(false)) { elementTypeIterator.serializedObject.Update(); rect.y += EditorGUI.GetPropertyHeight(elementTypeIterator, false) * 1.5f; EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), elementTypeIterator, true); if (elementTypeIterator.isArray && elementTypeIterator.isExpanded && elementTypeIterator.arraySize != 0) { for (int i = 0; i < elementTypeIterator.arraySize; i++) { rect.y += EditorGUI.GetPropertyHeight(elementTypeIterator.GetArrayElementAtIndex(i), true) * 1.5f; } } elementTypeIterator.serializedObject.ApplyModifiedProperties(); } } } rect.x = 0; rect.y = oldY + ElementHeightCallback(index) - EditorGUIUtility.standardVerticalSpacing; rect.width = EditorGUIUtility.currentViewWidth; rect.height = 1; EditorGUI.DrawRect(rect, Color.grey); }
protected override void Initialize( ) { base.Initialize( ); mTitle = null; mDate = null; mSpeaker = null; BorderView = PlatformView.Create( ); }
protected override void Initialize( ) { base.Initialize( ); QuoteLabel = PlatformLabel.Create( ); Citation = PlatformLabel.Create( ); UrlGlyph = PlatformLabel.Create( ); BorderView = PlatformView.Create( ); ActiveUrl = string.Empty; }
protected override void Initialize( ) { base.Initialize( ); TextView = PlatformTextView.Create( ); Anchor = PlatformCircleView.Create( ); NoteIcon = PlatformLabel.Create( ); UtilityLayer = PlatformView.Create( ); DeleteButton = PlatformLabel.Create( ); CloseButton = PlatformLabel.Create( ); }
public NoteText( CreateParams parentParams, string text ) { base.Initialize( ); PlatformLabel = PlatformLabel.Create( ); // check for attributes we support RectangleF bounds = new RectangleF( ); // take our parent's style, and for anything not set by them use the default. mStyle = parentParams.Style; Styles.Style.MergeStyleAttributesWithDefaults( ref mStyle, ref ControlStyles.mText ); PlatformLabel.SetFont( mStyle.mFont.mName, mStyle.mFont.mSize.Value ); PlatformLabel.TextColor = mStyle.mFont.mColor.Value; // check for border styling if ( mStyle.mBorderColor.HasValue ) { PlatformLabel.BorderColor = mStyle.mBorderColor.Value; } if( mStyle.mBorderRadius.HasValue ) { PlatformLabel.CornerRadius = mStyle.mBorderRadius.Value; } if( mStyle.mBorderWidth.HasValue ) { PlatformLabel.BorderWidth = mStyle.mBorderWidth.Value; } if( mStyle.mBackgroundColor.HasValue ) { PlatformLabel.BackgroundColor = mStyle.mBackgroundColor.Value; } // set the dimensions and position if( bounds.Width == 0 ) { // always take the available width, in case this control // is specified to be offset relative to its parent bounds.Width = parentParams.Width - bounds.X; } PlatformLabel.Bounds = bounds; // get text SetText( text ); // position ourselves in absolute coordinates, and trust our parent to offset us to be relative to them. PlatformLabel.Position = new PointF( bounds.X, bounds.Y ); }
public NoteText(CreateParams parentParams, string text) { base.Initialize( ); PlatformLabel = PlatformLabel.Create( ); // take our parent's style, and for anything not set by them use the default. mStyle = parentParams.Style; Styles.Style.MergeStyleAttributesWithDefaults(ref mStyle, ref ControlStyles.mText); PlatformLabel.SetFont(mStyle.mFont.mName, mStyle.mFont.mSize.Value); PlatformLabel.TextColor = mStyle.mFont.mColor.Value; // check for border styling if (mStyle.mBorderColor.HasValue) { PlatformLabel.BorderColor = mStyle.mBorderColor.Value; } if (mStyle.mBorderRadius.HasValue) { PlatformLabel.CornerRadius = mStyle.mBorderRadius.Value; } if (mStyle.mBorderWidth.HasValue) { PlatformLabel.BorderWidth = mStyle.mBorderWidth.Value; } if (mStyle.mBackgroundColor.HasValue) { PlatformLabel.BackgroundColor = mStyle.mBackgroundColor.Value; } // set the dimensions and position RectangleF bounds = new RectangleF( ); if (bounds.Width == 0) { // always take the available width, in case this control // is specified to be offset relative to its parent bounds.Width = parentParams.Width - bounds.X; } PlatformLabel.Bounds = bounds; // get text SetText(text); // position ourselves in absolute coordinates, and trust our parent to offset us to be relative to them. PlatformLabel.Position = new PointF(bounds.X, bounds.Y); SetDebugFrame(PlatformLabel.Frame); }
public override IUIControl TouchesEnded(PointF touch) { RectangleF boundingBox = GetHitTarget( ); if (boundingBox.Contains(touch)) { Revealed = !Revealed; float targetFade = 1.0f - PlatformLabel.GetFade( ); PlatformLabel.AnimateToFade(targetFade); return(this); } return(null); }
public UINoteDiscGuideView(object parentView, RectangleF frame, DoneClickDelegate onClick) { View = PlatformView.Create( ); View.AddAsSubview(parentView); View.BackgroundColor = ControlStylingConfig.BackgroundColor; View.UserInteractionEnabled = false; // Guide Desc Header GuideDescHeader = PlatformLabel.Create( ); GuideDescHeader.AddAsSubview(parentView); GuideDescHeader.TextAlignment = TextAlignment.Center; GuideDescHeader.SetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Large_FontSize); GuideDescHeader.TextColor = ControlStylingConfig.TextField_ActiveTextColor; GuideDescHeader.Text = Strings.MessagesStrings.DiscussionGuide_Header; // Guide Desc GuideDescLayer = PlatformView.Create( ); GuideDescLayer.AddAsSubview(parentView); GuideDescLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; GuideDescLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; GuideDescLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; GuideDesc = PlatformLabel.Create( ); GuideDesc.AddAsSubview(parentView); GuideDesc.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize); GuideDesc.TextColor = ControlStylingConfig.TextField_ActiveTextColor; GuideDesc.TextAlignment = TextAlignment.Center; GuideDesc.Text = Strings.MessagesStrings.DiscussionGuide_Desc; // View Guide Button ViewGuideButton = PlatformButton.Create( ); ViewGuideButton.CornerRadius = 4; ViewGuideButton.BackgroundColor = ControlStylingConfig.Button_BGColor; ViewGuideButton.TextColor = ControlStylingConfig.Button_TextColor; ViewGuideButton.UserInteractionEnabled = true; ViewGuideButton.AddAsSubview(parentView); ViewGuideButton.ClickEvent = ( PlatformButton button ) => { if (onClick != null) { onClick( ); } }; ViewGuideButton.Text = "View Guide"; SetBounds(frame); }
public Credit(string message, string image, bool scaleImage, RectangleF frame, PlatformView parent) { MemoryStream logoStream = Rock.Mobile.IO.AssetConvert.AssetToStream(image); logoStream.Position = 0; Image = PlatformImageView.Create( ); Image.AddAsSubview(parent.PlatformNativeObject); Image.Image = logoStream; Image.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFit; logoStream.Dispose( ); Label = PlatformLabel.Create( ); Label.Text = message; Label.BackgroundColor = ControlStylingConfig.BG_Layer_Color; Label.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; Label.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; Label.TextColor = ControlStylingConfig.Label_TextColor; Label.Bounds = new RectangleF(0, 0, frame.Width * .75f, 0); Label.SizeToFit( ); Label.AddAsSubview(parent.PlatformNativeObject); }
public string Export(RectangleF parentPadding, float currYPos) { // only export if there's valid text. If we're simply a blank space, or a URL glyph, we don't need to be saved. if (string.IsNullOrWhiteSpace(PlatformLabel.Text) == false && PlatformLabel.Text != PrivateNoteConfig.CitationUrl_Icon) { // first get the text itself string encodedText = HttpUtility.HtmlEncode(PlatformLabel.Text).Trim(new char[] { ' ' }); // setup note attributes string attributeStrings = string.Format("FontName=\"{0}\" FontSize=\"{1}\"", PlatformLabel.Editable_GetFontName( ), PlatformLabel.Editable_GetFontSize( )); if (PlatformLabel.Editable_HasUnderline( )) { attributeStrings += " Underlined=\"True\""; } // build the final string return("<NT " + attributeStrings + ">" + encodedText + "</NT>"); } else { return(string.Empty); } }
public void SetRevealed(bool revealed) { Revealed = revealed; PlatformLabel.SetFade(revealed == true ? 1.0f : 0.0f); }
public void SetStyleValue(EditStyling.Style style, object value) { switch (style) { case EditStyling.Style.FontName: { string fontName = value as string; PlatformLabel.Editable_SetFontName(fontName); break; } case EditStyling.Style.FontSize: { float fontSize = (float)value; PlatformLabel.Editable_SetFontSize(fontSize); break; } case EditStyling.Style.Underline: { bool enableUnderline = (bool)value; if (enableUnderline) { PlatformLabel.Editable_AddUnderline( ); } else { PlatformLabel.Editable_RemoveUnderline( ); } break; } case EditStyling.Style.BoldParagraph: { // for bolding the paragraph, forward this to the parent ParentControl.SetStyleValue(style, value); break; } case EditStyling.Style.UnderlineParagraph: { // for underlining the paragraph, forward this to the parent ParentControl.SetStyleValue(style, value); break; } case EditStyling.Style.BulletParagraph: { ParentControl.SetStyleValue(style, value); break; } case EditStyling.Style.BoldItalicizeParagraph: { ParentControl.SetStyleValue(style, value); break; } case EditStyling.Style.ItalicizeParagraph: { ParentControl.SetStyleValue(style, value); break; } } // first, reset our dimensions and call sizeToFit, which will // fully recalculate our bounds (since our font name / size may have changed.) PlatformLabel.Bounds = new RectangleF(0, 0, 0, 0); PlatformLabel.SizeToFit( ); // now notify our parent so it can update its layout with our new size ParentControl.HandleChildStyleChanged(style, this); }
public void Create(object masterView, RectangleF frame) { View = PlatformView.Create( ); View.BackgroundColor = ControlStylingConfig.BackgroundColor; View.AddAsSubview(masterView); GroupTitle = PlatformLabel.Create( ); GroupTitle.AddAsSubview(masterView); GroupTitle.SetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Large_FontSize); GroupTitle.TextColor = ControlStylingConfig.TextField_ActiveTextColor; GroupTitle.TextAlignment = TextAlignment.Center; /*GroupDetailsLayer = PlatformView.Create( ); * GroupDetailsLayer.AddAsSubview( masterView ); * GroupDetailsLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; * GroupDetailsLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; * GroupDetailsLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth;*/ GroupDetails = PlatformLabel.Create( ); GroupDetails.AddAsSubview(masterView); GroupDetails.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize); GroupDetails.TextColor = ControlStylingConfig.TextField_ActiveTextColor; // Name Info FirstNameLayer = PlatformView.Create( ); FirstNameLayer.AddAsSubview(masterView); FirstNameLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; FirstNameLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; FirstNameLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; FirstName = PlatformTextField.Create( ); FirstName.AddAsSubview(masterView); FirstName.SetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); FirstName.PlaceholderTextColor = ControlStylingConfig.TextField_PlaceholderTextColor; FirstName.Placeholder = ConnectStrings.JoinGroup_FirstNamePlaceholder; FirstName.TextColor = ControlStylingConfig.TextField_ActiveTextColor; FirstName.KeyboardAppearance = KeyboardAppearanceStyle.Dark; FirstName.AutoCapitalizationType = AutoCapitalizationType.Words; FirstName.AutoCorrectionType = AutoCorrectionType.No; LastNameLayer = PlatformView.Create( ); LastNameLayer.AddAsSubview(masterView); LastNameLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; LastNameLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; LastNameLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; LastName = PlatformTextField.Create( ); LastName.AddAsSubview(masterView); LastName.SetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); LastName.PlaceholderTextColor = ControlStylingConfig.TextField_PlaceholderTextColor; LastName.Placeholder = ConnectStrings.JoinGroup_LastNamePlaceholder; LastName.TextColor = ControlStylingConfig.TextField_ActiveTextColor; LastName.KeyboardAppearance = KeyboardAppearanceStyle.Dark; LastName.AutoCapitalizationType = AutoCapitalizationType.Words; LastName.AutoCorrectionType = AutoCorrectionType.No; SpouseNameLayer = PlatformView.Create( ); SpouseNameLayer.AddAsSubview(masterView); SpouseNameLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; SpouseNameLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; SpouseNameLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; SpouseName = PlatformTextField.Create( ); SpouseName.AddAsSubview(masterView); SpouseName.SetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); SpouseName.PlaceholderTextColor = ControlStylingConfig.TextField_PlaceholderTextColor; SpouseName.Placeholder = ConnectStrings.JoinGroup_SpouseNamePlaceholder; SpouseName.TextColor = ControlStylingConfig.TextField_ActiveTextColor; SpouseName.KeyboardAppearance = KeyboardAppearanceStyle.Dark; SpouseName.AutoCapitalizationType = AutoCapitalizationType.Words; SpouseName.AutoCorrectionType = AutoCorrectionType.No; // Contact Info EmailLayer = PlatformView.Create( ); EmailLayer.AddAsSubview(masterView); EmailLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; EmailLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; EmailLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; Email = PlatformTextField.Create( ); Email.AddAsSubview(masterView); Email.SetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); Email.PlaceholderTextColor = ControlStylingConfig.TextField_PlaceholderTextColor; Email.Placeholder = ConnectStrings.JoinGroup_EmailPlaceholder; Email.TextColor = ControlStylingConfig.TextField_ActiveTextColor; Email.KeyboardAppearance = KeyboardAppearanceStyle.Dark; Email.AutoCapitalizationType = AutoCapitalizationType.None; Email.AutoCorrectionType = AutoCorrectionType.No; CellPhoneLayer = PlatformView.Create( ); CellPhoneLayer.AddAsSubview(masterView); CellPhoneLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; CellPhoneLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; CellPhoneLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; CellPhone = PlatformTextField.Create( ); CellPhone.AddAsSubview(masterView); CellPhone.SetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); CellPhone.PlaceholderTextColor = ControlStylingConfig.TextField_PlaceholderTextColor; CellPhone.Placeholder = ConnectStrings.JoinGroup_CellPhonePlaceholder; CellPhone.TextColor = ControlStylingConfig.TextField_ActiveTextColor; CellPhone.KeyboardAppearance = KeyboardAppearanceStyle.Dark; CellPhone.AutoCapitalizationType = AutoCapitalizationType.None; CellPhone.AutoCorrectionType = AutoCorrectionType.No; // Join Button JoinButton = PlatformButton.Create( ); JoinButton.AddAsSubview(masterView); JoinButton.ClickEvent = JoinClicked; JoinButton.BackgroundColor = ControlStylingConfig.Button_BGColor; JoinButton.TextColor = ControlStylingConfig.Button_TextColor; JoinButton.CornerRadius = ControlStylingConfig.Button_CornerRadius; JoinButton.Text = ConnectStrings.JoinGroup_JoinButtonLabel; JoinButton.SizeToFit( ); JoinButton.UserInteractionEnabled = true; // Create our results view overlay ResultView = new UIResultView(masterView, View.Frame, OnResultViewDone); // Create our blocker view BlockerView = new UIBlockerView(masterView, View.Frame); }
public RevealBox(CreateParams parentParams, string revealText) : base( ) { // don't call the base constructor that reads. we'll do the reading here. base.Initialize( ); Revealed = false; PlatformLabel = PlatformLabel.CreateRevealLabel( ); PlatformLabel.SetFade(0.0f); // take our parent's style, and for anything not set by them use the default. mStyle = parentParams.Style; Styles.Style.MergeStyleAttributesWithDefaults(ref mStyle, ref ControlStyles.mText); // create the font that either we or our parent defined PlatformLabel.SetFont(mStyle.mFont.mName, mStyle.mFont.mSize.Value); PlatformLabel.TextColor = mStyle.mFont.mColor.Value; // check for border styling if (mStyle.mBorderColor.HasValue) { PlatformLabel.BorderColor = mStyle.mBorderColor.Value; } if (mStyle.mBorderRadius.HasValue) { PlatformLabel.CornerRadius = mStyle.mBorderRadius.Value; } if (mStyle.mBorderWidth.HasValue) { PlatformLabel.BorderWidth = mStyle.mBorderWidth.Value; } if (mStyle.mBackgroundColor.HasValue) { PlatformLabel.BackgroundColor = mStyle.mBackgroundColor.Value; } // set the dimensions and position RectangleF bounds = new RectangleF( ); if (bounds.Width == 0) { // always take the available width, in case this control // is specified to be offset relative to its parent bounds.Width = parentParams.Width - bounds.X; } PlatformLabel.Bounds = bounds; // ensure that there's something IN the reveal text. We cannot render blank, because the bitmap mask can't be 0 width / height if (string.IsNullOrWhiteSpace(revealText)) { throw new Exception("RevealBox text cannot be blank."); } // adjust the text switch (mStyle.mTextCase) { case Styles.TextCase.Upper: { revealText = revealText.ToUpper( ); break; } case Styles.TextCase.Lower: { revealText = revealText.ToLower( ); break; } } SetText(revealText); PlatformLabel.Position = new PointF(bounds.X, bounds.Y); }
void ParseHeaderElement( XmlReader reader, float parentWidth, float parentHeight, uint? parentBGColor, out PlatformLabel element, ref RectangleF elementBounds, ref Styles.Style defaultStyle ) { element = PlatformLabel.Create( ); // header elements are weird with styles. We don't want any of our parent's styles, // so we create our own and mix that with our defaults Styles.Style elementStyle = new Styles.Style( ); elementStyle.Initialize( ); elementStyle.mBackgroundColor = parentBGColor.HasValue ? parentBGColor.Value : 0; //one exception is background color. We do want to inherit that. Styles.Style.ParseStyleAttributesWithDefaults( reader, ref elementStyle, ref defaultStyle ); // Note: Margins and padding are not supported by the individual elements of the header. element.SetFont( elementStyle.mFont.mName, elementStyle.mFont.mSize.Value ); element.TextColor = elementStyle.mFont.mColor.Value; if( elementStyle.mBackgroundColor.HasValue ) { element.BackgroundColor = elementStyle.mBackgroundColor.Value; } element.Bounds = elementBounds; // get text switch( elementStyle.mTextCase ) { case Styles.TextCase.Upper: { element.Text = reader.ReadElementContentAsString( ).ToUpper( ); break; } case Styles.TextCase.Lower: { element.Text = reader.ReadElementContentAsString( ).ToLower( ); break; } case Styles.TextCase.Normal: { element.Text = reader.ReadElementContentAsString( ); break; } } element.SizeToFit( ); // horizontally position the controls according to their // requested alignment Styles.Alignment controlAlignment = elementStyle.mAlignment.Value; // adjust by our position float xAdjust = 0; switch( controlAlignment ) { case Styles.Alignment.Center: { xAdjust = elementBounds.X + ( ( parentWidth / 2 ) - ( element.Bounds.Width / 2 ) ); element.TextAlignment = TextAlignment.Center; break; } case Styles.Alignment.Right: { xAdjust = elementBounds.X + ( parentWidth - element.Bounds.Width ); element.TextAlignment = TextAlignment.Right; break; } case Styles.Alignment.Left: { xAdjust = elementBounds.X; element.TextAlignment = TextAlignment.Left; break; } } // adjust position element.Position = new PointF( elementBounds.X + xAdjust, elementBounds.Y ); }
public NoteText( CreateParams parentParams, XmlReader reader ) { base.Initialize( ); PlatformLabel = PlatformLabel.Create( ); PlatformLabel.SetFade( 0.0f ); // Always get our style first mStyle = parentParams.Style; Styles.Style.ParseStyleAttributesWithDefaults( reader, ref mStyle, ref ControlStyles.mText ); // check for attributes we support RectangleF bounds = new RectangleF( ); SizeF parentSize = new SizeF( parentParams.Width, parentParams.Height ); ParseCommonAttribs( reader, ref parentSize, ref bounds ); // Get margins and padding RectangleF padding; RectangleF margin; GetMarginsAndPadding( ref mStyle, ref parentSize, ref bounds, out margin, out padding ); // apply margins to as much of the bounds as we can (bottom must be done by our parent container) ApplyImmediateMargins( ref bounds, ref margin, ref parentSize ); Margin = margin; // create the font that either we or our parent defined PlatformLabel.SetFont( mStyle.mFont.mName, mStyle.mFont.mSize.Value ); PlatformLabel.TextColor = mStyle.mFont.mColor.Value; // check for border styling if ( mStyle.mBorderColor.HasValue ) { PlatformLabel.BorderColor = mStyle.mBorderColor.Value; } if( mStyle.mBorderRadius.HasValue ) { PlatformLabel.CornerRadius = mStyle.mBorderRadius.Value; } if( mStyle.mBorderWidth.HasValue ) { PlatformLabel.BorderWidth = mStyle.mBorderWidth.Value; } if( mStyle.mBackgroundColor.HasValue ) { PlatformLabel.BackgroundColor = mStyle.mBackgroundColor.Value; } // parse the stream string noteText = ""; if( reader.IsEmptyElement == false ) { bool finishedLabel = false; while( finishedLabel == false && reader.Read( ) ) { switch( reader.NodeType ) { case XmlNodeType.Text: { // support text as embedded in the element noteText = reader.Value.Replace( System.Environment.NewLine, "" ); break; } case XmlNodeType.EndElement: { // if we hit the end of our label, we're done. //if( reader.Name == "NoteText" || reader.Name == "NT" ) if( ElementTagMatches( reader.Name ) ) { finishedLabel = true; } break; } } } } // adjust the text switch( mStyle.mTextCase ) { case Styles.TextCase.Upper: { noteText = noteText.ToUpper( ); break; } case Styles.TextCase.Lower: { noteText = noteText.ToLower( ); break; } } SetText( noteText ); PlatformLabel.Position = new PointF( bounds.X, bounds.Y ); }
public void Create(object masterView, RectangleF frame, OnButtonClick onJoinClicked) { OnButtonClicked = onJoinClicked; View = PlatformView.Create( ); View.BackgroundColor = ControlStylingConfig.BackgroundColor; View.AddAsSubview(masterView); // Group Title GroupTitle = PlatformLabel.Create( ); GroupTitle.AddAsSubview(masterView); GroupTitle.SetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Large_FontSize); GroupTitle.TextColor = ControlStylingConfig.TextField_ActiveTextColor; GroupTitle.TextAlignment = TextAlignment.Center; // Meeting Time MeetingTime = PlatformLabel.Create( ); MeetingTime.AddAsSubview(masterView); MeetingTime.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize); MeetingTime.TextColor = ControlStylingConfig.TextField_ActiveTextColor; MeetingTime.TextAlignment = TextAlignment.Center; // Childcare Provided ChildcareProvided = PlatformLabel.Create( ); ChildcareProvided.AddAsSubview(masterView); ChildcareProvided.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize); ChildcareProvided.TextColor = ControlStylingConfig.TextField_ActiveTextColor; ChildcareProvided.TextAlignment = TextAlignment.Center; // Young Adults YoungAdults = PlatformLabel.Create( ); YoungAdults.AddAsSubview(masterView); YoungAdults.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize); YoungAdults.TextColor = ControlStylingConfig.TextField_ActiveTextColor; YoungAdults.TextAlignment = TextAlignment.Center; // Family Image and Layer FamilyImageLayer = PlatformView.Create( ); FamilyImageLayer.AddAsSubview(masterView); FamilyImageLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; FamilyImageLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; FamilyImageLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; FamilyImage = PlatformImageView.Create( ); FamilyImage.AddAsSubview(masterView); FamilyImage.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFit; FamilyImage.BackgroundColor = 0; // Group Desc GroupDescLayer = PlatformView.Create( ); GroupDescLayer.AddAsSubview(masterView); GroupDescLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; GroupDescLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; GroupDescLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; GroupDesc = PlatformLabel.Create( ); GroupDesc.AddAsSubview(masterView); GroupDesc.TextAlignment = TextAlignment.Center; GroupDesc.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize); GroupDesc.TextColor = ControlStylingConfig.TextField_ActiveTextColor; // Group Desc Header GroupDescHeader = PlatformLabel.Create( ); GroupDescHeader.AddAsSubview(masterView); GroupDescHeader.TextAlignment = TextAlignment.Center; GroupDescHeader.SetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Medium_FontSize); GroupDescHeader.TextColor = ControlStylingConfig.TextField_ActiveTextColor; GroupDescHeader.Text = ConnectStrings.GroupInfo_AboutGroup; // Childcare Desc ChildDescLayer = PlatformView.Create( ); ChildDescLayer.AddAsSubview(masterView); ChildDescLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; ChildDescLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; ChildDescLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; ChildDesc = PlatformLabel.Create( ); ChildDesc.AddAsSubview(masterView); ChildDesc.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize); ChildDesc.TextColor = ControlStylingConfig.TextField_ActiveTextColor; ChildDesc.TextAlignment = TextAlignment.Center; // Child Desc Header ChildDescHeader = PlatformLabel.Create( ); ChildDescHeader.AddAsSubview(masterView); ChildDescHeader.TextAlignment = TextAlignment.Center; ChildDescHeader.SetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Medium_FontSize); ChildDescHeader.TextColor = ControlStylingConfig.TextField_ActiveTextColor; ChildDescHeader.Text = ConnectStrings.GroupInfo_AboutChildcare; // Group Image and Layer GroupImageLayer = PlatformView.Create( ); GroupImageLayer.AddAsSubview(masterView); GroupImageLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; GroupImageLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; GroupImageLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; GroupImage = PlatformImageView.Create( ); GroupImage.AddAsSubview(masterView); GroupImage.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFit; GroupImage.BackgroundColor = 0; // Join Button JoinButton = PlatformButton.Create( ); JoinButton.AddAsSubview(masterView); JoinButton.ClickEvent = JoinClicked; JoinButton.BackgroundColor = ControlStylingConfig.Button_BGColor; JoinButton.TextColor = ControlStylingConfig.Button_TextColor; JoinButton.CornerRadius = ControlStylingConfig.Button_CornerRadius; JoinButton.Text = ConnectStrings.JoinGroup_JoinButtonLabel; JoinButton.SizeToFit( ); JoinButton.UserInteractionEnabled = true; // Create our results view overlay ResultView = new UIResultView(masterView, View.Frame, OnResultViewDone); // Create our blocker view BlockerView = new UIBlockerView(masterView, View.Frame); }
public string Export(RectangleF parentPadding, float currYPos) { // only export if there's valid text. If we're simply a blank space, we don't need to be saved. if (string.IsNullOrWhiteSpace(PlatformLabel.Text) == false) { string encodedText = HttpUtility.HtmlEncode(PlatformLabel.Text); // setup note attributes string attributeStrings = string.Format("FontName=\"{0}\" FontSize=\"{1}\"", PlatformLabel.Editable_GetFontName(), PlatformLabel.Editable_GetFontSize()); return("<RB " + attributeStrings + ">" + encodedText.Trim(new char[] { ' ' }) + "</RB>"); } else { return(string.Empty); } }
void ParseHeaderElement(XmlReader reader, float parentWidth, float parentHeight, uint?parentBGColor, out PlatformLabel element, ref RectangleF elementBounds, ref Styles.Style defaultStyle) { element = PlatformLabel.Create( ); // header elements are weird with styles. We don't want any of our parent's styles, // so we create our own and mix that with our defaults Styles.Style elementStyle = new Styles.Style( ); elementStyle.Initialize( ); elementStyle.mBackgroundColor = parentBGColor.HasValue ? parentBGColor.Value : 0; //one exception is background color. We do want to inherit that. Styles.Style.ParseStyleAttributesWithDefaults(reader, ref elementStyle, ref defaultStyle); // Note: Margins and padding are not supported by the individual elements of the header. element.SetFont(elementStyle.mFont.mName, elementStyle.mFont.mSize.Value); element.TextColor = elementStyle.mFont.mColor.Value; if (elementStyle.mBackgroundColor.HasValue) { element.BackgroundColor = elementStyle.mBackgroundColor.Value; } element.Bounds = elementBounds; // get text switch (elementStyle.mTextCase) { case Styles.TextCase.Upper: { element.Text = reader.ReadElementContentAsString( ).ToUpper( ); break; } case Styles.TextCase.Lower: { element.Text = reader.ReadElementContentAsString( ).ToLower( ); break; } case Styles.TextCase.Normal: { element.Text = reader.ReadElementContentAsString( ); break; } } element.SizeToFit( ); // horizontally position the controls according to their // requested alignment Styles.Alignment controlAlignment = elementStyle.mAlignment.Value; // adjust by our position float xAdjust = 0; switch (controlAlignment) { case Styles.Alignment.Center: { xAdjust = elementBounds.X + ((parentWidth / 2) - (element.Bounds.Width / 2)); element.TextAlignment = TextAlignment.Center; break; } case Styles.Alignment.Right: { xAdjust = elementBounds.X + (parentWidth - element.Bounds.Width); element.TextAlignment = TextAlignment.Right; break; } case Styles.Alignment.Left: { xAdjust = elementBounds.X; element.TextAlignment = TextAlignment.Left; break; } } // adjust position element.Position = new PointF(elementBounds.X + xAdjust, elementBounds.Y); }
public void Create(object masterView, string bgLayerImageName, string logoImageName, RectangleF frame, OnButtonClick onClick) { // take the handler OnClick = onClick; View = PlatformView.Create( ); View.BackgroundColor = ControlStylingConfig.OOBE_Splash_BG_Color; View.AddAsSubview(masterView); ImageBG = PlatformImageView.Create( ); ImageBG.AddAsSubview(View.PlatformNativeObject); MemoryStream stream = Rock.Mobile.IO.AssetConvert.AssetToStream(bgLayerImageName); if (stream != null) { stream.Position = 0; ImageBG.Opacity = 0; ImageBG.Image = stream; ImageBG.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFill; stream.Dispose( ); } NetworkErrorLabel = PlatformLabel.Create( ); NetworkErrorLabel.SetFont(ControlStylingConfig.Font_Light, 18); NetworkErrorLabel.TextColor = 0xCCCCCCFF; NetworkErrorLabel.Text = OOBEStrings.NetworkError; NetworkErrorLabel.TextAlignment = TextAlignment.Center; NetworkErrorLabel.Opacity = 0; NetworkErrorLabel.SizeToFit( ); NetworkErrorLabel.AddAsSubview(View.PlatformNativeObject); NetworkRetryButton = PlatformButton.Create( ); NetworkRetryButton.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize); NetworkRetryButton.TextColor = 0xCCCCCCFF; NetworkRetryButton.Text = OOBEStrings.NetworRetry; NetworkRetryButton.Opacity = 0; NetworkRetryButton.SizeToFit( ); NetworkRetryButton.ClickEvent = (PlatformButton button ) => { OnClick(-1, false); }; NetworkRetryButton.AddAsSubview(View.PlatformNativeObject); WelcomeLabel = PlatformLabel.Create( ); WelcomeLabel.SetFont(ControlStylingConfig.Font_Bold, 85); WelcomeLabel.TextColor = 0xCCCCCCFF; WelcomeLabel.Text = OOBEStrings.Welcome; WelcomeLabel.Opacity = 0; WelcomeLabel.SizeToFit( ); WelcomeLabel.AddAsSubview(View.PlatformNativeObject); CampusHeader = PlatformLabel.Create( ); CampusHeader.SetFont(ControlStylingConfig.Font_Light, 18); CampusHeader.TextColor = 0xCCCCCCFF; CampusHeader.Text = OOBEStrings.CampusIntro; CampusHeader.TextAlignment = TextAlignment.Center; CampusHeader.Opacity = 0; CampusHeader.SizeToFit( ); CampusHeader.AddAsSubview(View.PlatformNativeObject); // we'll wait to setup campuses until after a successful download CampusButtons = new List <PlatformButton>( ); RegisterButton = PlatformButton.Create( ); RegisterButton.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize); RegisterButton.TextColor = 0xCCCCCCFF; RegisterButton.Text = string.Format(OOBEStrings.WantAccount, GeneralConfig.OrganizationShortName); RegisterButton.Opacity = 0; RegisterButton.SizeToFit( ); RegisterButton.ClickEvent = (PlatformButton button ) => { // do not allow multiple register taps if (State == OOBE_State.WaitForAccountChoice) { OnClick(0, false); EnterNextState(OOBE_State.Done); } }; RegisterButton.AddAsSubview(View.PlatformNativeObject); RegisterSeperator = PlatformView.Create( ); RegisterSeperator.BackgroundColor = ControlStylingConfig.BG_Layer_BorderColor; RegisterSeperator.Bounds = new RectangleF(0, 0, 0, 1); RegisterSeperator.AddAsSubview(View.PlatformNativeObject); LoginButton = PlatformButton.Create( ); LoginButton.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize); LoginButton.TextColor = 0xCCCCCCFF; LoginButton.Text = string.Format(OOBEStrings.HaveAccount, GeneralConfig.OrganizationShortName); LoginButton.Opacity = 0; LoginButton.SizeToFit( ); LoginButton.ClickEvent = (PlatformButton button ) => { // do not allow multiple register taps if (State == OOBE_State.WaitForAccountChoice) { OnClick(1, false); EnterNextState(OOBE_State.Done); } }; LoginButton.AddAsSubview(View.PlatformNativeObject); LoginSeperator = PlatformView.Create( ); LoginSeperator.BackgroundColor = ControlStylingConfig.BG_Layer_BorderColor; LoginSeperator.Bounds = new RectangleF(0, 0, 0, 1); LoginSeperator.AddAsSubview(View.PlatformNativeObject); SkipButton = PlatformButton.Create( ); SkipButton.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize); SkipButton.TextColor = 0xCCCCCCFF; SkipButton.Text = OOBEStrings.SkipAccount; SkipButton.Opacity = 0; SkipButton.SizeToFit( ); SkipButton.ClickEvent = (PlatformButton button ) => { // do not allow multiple register taps if (State == OOBE_State.WaitForAccountChoice) { OnClick(2, false); EnterNextState(OOBE_State.Done); } }; SkipButton.AddAsSubview(View.PlatformNativeObject); stream = Rock.Mobile.IO.AssetConvert.AssetToStream(logoImageName); stream.Position = 0; ImageLogo = PlatformImageView.Create( ); ImageLogo.AddAsSubview(View.PlatformNativeObject); ImageLogo.Image = stream; ImageLogo.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFit; stream.Dispose( ); State = OOBE_State.Startup; }
static float sModalOffset = 0;//15; public void Create(object masterView, RectangleF frame, Rock.Mobile.UI.PlatformButton.OnClick searchNeighborhoodsClicked, Rock.Mobile.UI.PlatformButton.OnClick searchShortTermClicked, Rock.Mobile.UI.PlatformButton.OnClick searchYoungAdultsClicked) { Backer = PlatformView.Create( ); Backer.BackgroundColor = 0x000000FF; Backer.Opacity = sBackerOpacity; Backer.AddAsSubview(masterView); Backer.Frame = frame; View = PlatformView.Create( ); View.BackgroundColor = ControlStylingConfig.BackgroundColor; View.AddAsSubview(masterView); View.Frame = frame; Title = PlatformLabel.Create( ); Title.AddAsSubview(View.PlatformNativeObject); Title.SetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Large_FontSize); Title.TextColor = ControlStylingConfig.TextField_ActiveTextColor; Title.TextAlignment = TextAlignment.Center; Details = PlatformLabel.Create( ); Details.AddAsSubview(View.PlatformNativeObject); Details.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Small_FontSize); Details.TextColor = ControlStylingConfig.TextField_ActiveTextColor; // Name Info StreetLayer = PlatformView.Create( ); StreetLayer.AddAsSubview(View.PlatformNativeObject); StreetLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; StreetLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; StreetLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; Street = PlatformTextField.Create( ); Street.AddAsSubview(View.PlatformNativeObject); Street.SetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); Street.PlaceholderTextColor = ControlStylingConfig.TextField_PlaceholderTextColor; Street.Placeholder = ConnectStrings.GroupFinder_StreetPlaceholder; Street.TextColor = ControlStylingConfig.TextField_ActiveTextColor; Street.KeyboardAppearance = KeyboardAppearanceStyle.Dark; Street.AutoCapitalizationType = AutoCapitalizationType.Words; Street.AutoCorrectionType = AutoCorrectionType.No; CityLayer = PlatformView.Create( ); CityLayer.AddAsSubview(View.PlatformNativeObject); CityLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; CityLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; CityLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; City = PlatformTextField.Create( ); City.AddAsSubview(View.PlatformNativeObject); City.SetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); City.PlaceholderTextColor = ControlStylingConfig.TextField_PlaceholderTextColor; City.Placeholder = ConnectStrings.GroupFinder_CityPlaceholder; City.TextColor = ControlStylingConfig.TextField_ActiveTextColor; City.KeyboardAppearance = KeyboardAppearanceStyle.Dark; City.AutoCapitalizationType = AutoCapitalizationType.Words; City.AutoCorrectionType = AutoCorrectionType.No; StateLayer = PlatformView.Create( ); StateLayer.AddAsSubview(View.PlatformNativeObject); StateLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; StateLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; StateLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; State = PlatformTextField.Create( ); State.AddAsSubview(View.PlatformNativeObject); State.SetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); State.PlaceholderTextColor = ControlStylingConfig.TextField_PlaceholderTextColor; State.Placeholder = ConnectStrings.GroupFinder_StatePlaceholder; State.TextColor = ControlStylingConfig.TextField_ActiveTextColor; State.KeyboardAppearance = KeyboardAppearanceStyle.Dark; State.AutoCapitalizationType = AutoCapitalizationType.Words; State.AutoCorrectionType = AutoCorrectionType.No; ZipCodeLayer = PlatformView.Create( ); ZipCodeLayer.AddAsSubview(View.PlatformNativeObject); ZipCodeLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color; ZipCodeLayer.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; ZipCodeLayer.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; ZipCode = PlatformTextField.Create( ); ZipCode.AddAsSubview(View.PlatformNativeObject); ZipCode.SetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ZipCode.PlaceholderTextColor = ControlStylingConfig.TextField_PlaceholderTextColor; ZipCode.Placeholder = ConnectStrings.GroupFinder_ZipPlaceholder; ZipCode.TextColor = ControlStylingConfig.TextField_ActiveTextColor; ZipCode.KeyboardAppearance = KeyboardAppearanceStyle.Dark; ZipCode.AutoCapitalizationType = AutoCapitalizationType.None; ZipCode.AutoCorrectionType = AutoCorrectionType.No; // Search Neighborhoods Button SearchNeighborhoodsClicked = searchNeighborhoodsClicked; SearchNeighborhoodsButton = PlatformButton.Create( ); SearchNeighborhoodsButton.AddAsSubview(View.PlatformNativeObject); SearchNeighborhoodsButton.BackgroundColor = ControlStylingConfig.Button_BGColor; SearchNeighborhoodsButton.TextColor = ControlStylingConfig.Button_TextColor; SearchNeighborhoodsButton.CornerRadius = ControlStylingConfig.Button_CornerRadius; SearchNeighborhoodsButton.Text = ConnectStrings.GroupFinder_Search_NeighborhoodGroups; SearchNeighborhoodsButton.SetFont(ControlStylingConfig.Font_Regular, 14); SearchNeighborhoodsButton.SizeToFit( ); SearchNeighborhoodsButton.ClickEvent = ( PlatformButton b ) => { // treat the search button as if Return was pressed if (ShouldReturn( )) { SearchNeighborhoodsClicked(null); } }; // Search ShortTerm Button SearchShortTermClicked = searchShortTermClicked; SearchShortTermButton = PlatformButton.Create( ); SearchShortTermButton.AddAsSubview(View.PlatformNativeObject); SearchShortTermButton.BackgroundColor = ControlStylingConfig.Button_BGColor; SearchShortTermButton.TextColor = ControlStylingConfig.Button_TextColor; SearchShortTermButton.CornerRadius = ControlStylingConfig.Button_CornerRadius; SearchShortTermButton.Text = ConnectStrings.GroupFinder_Search_ShortTermGroups; SearchShortTermButton.SetFont(ControlStylingConfig.Font_Regular, 14); SearchShortTermButton.SizeToFit( ); SearchShortTermButton.ClickEvent = ( PlatformButton b ) => { // treat the search button as if Return was pressed if (ShouldReturn( )) { SearchShortTermClicked(null); } }; // Search Young Adults Button SearchYoungAdultsClicked = searchYoungAdultsClicked; SearchYoungAdultsButton = PlatformButton.Create( ); SearchYoungAdultsButton.AddAsSubview(View.PlatformNativeObject); SearchYoungAdultsButton.BackgroundColor = ControlStylingConfig.Button_BGColor; SearchYoungAdultsButton.TextColor = ControlStylingConfig.Button_TextColor; SearchYoungAdultsButton.CornerRadius = ControlStylingConfig.Button_CornerRadius; SearchYoungAdultsButton.Text = ConnectStrings.GroupFinder_Search_YoungAdultGroups; SearchYoungAdultsButton.SetFont(ControlStylingConfig.Font_Regular, 14); SearchYoungAdultsButton.SizeToFit( ); SearchYoungAdultsButton.ClickEvent = ( PlatformButton b ) => { // treat the search button as if Return was pressed if (ShouldReturn( )) { SearchYoungAdultsClicked(null); } }; SearchShortTermButton.Hidden = true; SearchYoungAdultsButton.Hidden = true; LayoutChanged(frame); }
// This constructor is called when explicit Note Text is being declared. // This means the XML has "<NoteText>Something</NoteText>. Its used when // the user wants to alter a particular piece of text within a paragraph. public NoteText(CreateParams parentParams, XmlReader reader) { base.Initialize( ); PlatformLabel = PlatformLabel.Create( ); PlatformLabel.SetFade(0.0f); // Always get our style first mStyle = parentParams.Style; Styles.Style.ParseStyleAttributesWithDefaults(reader, ref mStyle, ref ControlStyles.mText); // check for attributes we support RectangleF bounds = new RectangleF( ); SizeF parentSize = new SizeF(parentParams.Width, parentParams.Height); ParseCommonAttribs(reader, ref parentSize, ref bounds); // Get margins and padding RectangleF padding; RectangleF margin; GetMarginsAndPadding(ref mStyle, ref parentSize, ref bounds, out margin, out padding); // apply margins to as much of the bounds as we can (bottom must be done by our parent container) ApplyImmediateMargins(ref bounds, ref margin, ref parentSize); Margin = margin; // create the font that either we or our parent defined PlatformLabel.SetFont(mStyle.mFont.mName, mStyle.mFont.mSize.Value); PlatformLabel.TextColor = mStyle.mFont.mColor.Value; // check for border styling if (mStyle.mBorderColor.HasValue) { PlatformLabel.BorderColor = mStyle.mBorderColor.Value; } if (mStyle.mBorderRadius.HasValue) { PlatformLabel.CornerRadius = mStyle.mBorderRadius.Value; } if (mStyle.mBorderWidth.HasValue) { PlatformLabel.BorderWidth = mStyle.mBorderWidth.Value; } if (mStyle.mBackgroundColor.HasValue) { PlatformLabel.BackgroundColor = mStyle.mBackgroundColor.Value; } // see if the user wants this text underlined string underlined = reader.GetAttribute("Underlined"); if (string.IsNullOrWhiteSpace(underlined) == false) { bool addUnderline = bool.Parse(underlined); if (addUnderline) { PlatformLabel.AddUnderline( ); } } // parse the stream string noteText = ""; if (reader.IsEmptyElement == false) { bool finishedLabel = false; while (finishedLabel == false && reader.Read( )) { switch (reader.NodeType) { case XmlNodeType.Text: { // support text as embedded in the element noteText = reader.Value.Replace(System.Environment.NewLine, ""); break; } case XmlNodeType.EndElement: { // if we hit the end of our label, we're done. //if( reader.Name == "NoteText" || reader.Name == "NT" ) if (ElementTagMatches(reader.Name)) { finishedLabel = true; } break; } } } } // adjust the text switch (mStyle.mTextCase) { case Styles.TextCase.Upper: { noteText = noteText.ToUpper( ); break; } case Styles.TextCase.Lower: { noteText = noteText.ToLower( ); break; } } SetText(noteText); PlatformLabel.Position = new PointF(bounds.X, bounds.Y); SetDebugFrame(PlatformLabel.Frame); }
public RevealBox(CreateParams parentParams, XmlReader reader) : base( ) { // don't call the base constructor that reads. we'll do the reading here. base.Initialize( ); Revealed = false; PlatformLabel = PlatformLabel.CreateRevealLabel( ); PlatformLabel.SetFade(0.0f); // Always get our style first mStyle = parentParams.Style; Styles.Style.ParseStyleAttributesWithDefaults(reader, ref mStyle, ref ControlStyles.mRevealBox); // check for attributes we support RectangleF bounds = new RectangleF( ); SizeF parentSize = new SizeF(parentParams.Width, parentParams.Height); ParseCommonAttribs(reader, ref parentSize, ref bounds); // Get margins and padding RectangleF padding; RectangleF margin; GetMarginsAndPadding(ref mStyle, ref parentSize, ref bounds, out margin, out padding); // apply margins to as much of the bounds as we can (bottom must be done by our parent container) ApplyImmediateMargins(ref bounds, ref margin, ref parentSize); Margin = margin; // create the font that either we or our parent defined PlatformLabel.SetFont(mStyle.mFont.mName, mStyle.mFont.mSize.Value); PlatformLabel.TextColor = mStyle.mFont.mColor.Value; // check for border styling if (mStyle.mBorderColor.HasValue) { PlatformLabel.BorderColor = mStyle.mBorderColor.Value; } if (mStyle.mBorderRadius.HasValue) { PlatformLabel.CornerRadius = mStyle.mBorderRadius.Value; } if (mStyle.mBorderWidth.HasValue) { PlatformLabel.BorderWidth = mStyle.mBorderWidth.Value; } if (mStyle.mBackgroundColor.HasValue) { PlatformLabel.BackgroundColor = mStyle.mBackgroundColor.Value; } // parse the stream string revealText = ""; if (reader.IsEmptyElement == false) { bool finishedLabel = false; while (finishedLabel == false && reader.Read( )) { switch (reader.NodeType) { case XmlNodeType.Text: { // support text as embedded in the element revealText = reader.Value.Replace(System.Environment.NewLine, ""); break; } case XmlNodeType.EndElement: { // if we hit the end of our label, we're done. //if( reader.Name == "RevealBox" || reader.Name == "RB" ) if (ElementTagMatches(reader.Name)) { finishedLabel = true; } break; } } } } // ensure that there's something IN the reveal text. We cannot render blank, because the bitmap mask can't be 0 width / height if (string.IsNullOrWhiteSpace(revealText)) { throw new Exception("RevealBox text cannot be blank."); } // adjust the text switch (mStyle.mTextCase) { case Styles.TextCase.Upper: { revealText = revealText.ToUpper( ); break; } case Styles.TextCase.Lower: { revealText = revealText.ToLower( ); break; } } SetText(revealText); PlatformLabel.Position = new PointF(bounds.X, bounds.Y); }