/// <summary> /// Transform the title to placeholder /// </summary> /// <returns></returns> async Task TitleToPlaceholder() { if (Animated) { await Task.WhenAll( PlaceholderLabel.TranslateTo( x: LabelStartX, y: 0, length: 100), PlaceholderLabel.SizeTo( startSize: PlaceholderLabel.FontSize, endSize: PLACEHOLDER_FONT_SIZE, callback: (t) => PlaceholderLabel.FontSize = t, length: 100, easing: Easing.BounceIn), PlaceholderLabel.ColorTo( startColor: TitleColor, endColor: PlaceholderColor, callback: (c) => PlaceholderLabel.TextColor = c, length: 100), (TitleToPlaceholderAsync?.InvokeAsync(this, new EventArgs())) ?? Task.CompletedTask); } else { PlaceholderLabel.TranslationX = 10; PlaceholderLabel.TranslationY = 0; PlaceholderLabel.FontSize = PLACEHOLDER_FONT_SIZE; Grid.Margin = new Thickness(0, 0, 0, 0); } }
/// <summary> /// Transform the placeholder to title /// </summary> /// <returns></returns> async Task PlaceholderToTitle() { if (Animated) { await Task.WhenAll( PlaceholderLabel.TranslateTo( x: 0, y: BorderlessEntry.Y - PlaceholderLabel.Height, length: 100), PlaceholderLabel.SizeTo( startSize: PlaceholderLabel.FontSize, endSize: TITLE_FONT_SIZE, callback: (t) => PlaceholderLabel.FontSize = t, length: 100, easing: Easing.BounceIn), PlaceholderLabel.ColorTo( startColor: PlaceholderColor, endColor: TitleColor, callback: (c) => PlaceholderLabel.TextColor = c, length: 100), (PlaceholderToTitleAsync?.InvokeAsync(this, new EventArgs())) ?? Task.CompletedTask); } else { PlaceholderLabel.TranslationX = 0; PlaceholderLabel.TranslationY = BorderlessEntry.Y - PlaceholderLabel.Height; PlaceholderLabel.FontSize = TITLE_FONT_SIZE; } }
public KTextBox() { _placeHolderLabel = new PlaceholderLabel(); _placeHolderLabel.Visible = false; _placeHolderLabel.Margin = new Padding(0); _placeHolderLabel.Padding = new Padding(0); Controls.Add(_placeHolderLabel); PlaceholderColor = Color.Gray; CheckPlaceholder(); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (AlwaysShow != null) { hashCode = hashCode * 59 + AlwaysShow.GetHashCode(); } if (DisplayOrder != null) { hashCode = hashCode * 59 + DisplayOrder.GetHashCode(); } if (FormElement != null) { hashCode = hashCode * 59 + FormElement.GetHashCode(); } if (Label != null) { hashCode = hashCode * 59 + Label.GetHashCode(); } if (Link != null) { hashCode = hashCode * 59 + Link.GetHashCode(); } if (Mask != null) { hashCode = hashCode * 59 + Mask.GetHashCode(); } if (Obfuscate != null) { hashCode = hashCode * 59 + Obfuscate.GetHashCode(); } if (PlaceholderLabel != null) { hashCode = hashCode * 59 + PlaceholderLabel.GetHashCode(); } if (PreferredInputType != null) { hashCode = hashCode * 59 + PreferredInputType.GetHashCode(); } if (Tooltip != null) { hashCode = hashCode * 59 + Tooltip.GetHashCode(); } return(hashCode); } }
async Task TitleToPlaceholder() { if (Animated) { await Task.WhenAll( PlaceholderLabel.TranslateTo(10, 0, 100), PlaceholderLabel.SizeTo(PlaceholderLabel.FontSize, PLACEHOLDER_FONT_SIZE, (t) => PlaceholderLabel.FontSize = t, 100, Easing.BounceIn), HiddenBottomBorder.LayoutTo(new Rectangle(BottomBorder.X, BottomBorder.Y, 0, BottomBorder.Height), 200), PlaceholderLabel.ColorTo(ActiveTextColor, DefaultTextColor, (c) => PlaceholderLabel.TextColor = c, 100), Grid.MarginTo(Grid.Margin, new Thickness(0, 0, 0, 0), (m) => Grid.Margin = m, 100)); } else { PlaceholderLabel.TranslationX = 10; PlaceholderLabel.TranslationY = 0; PlaceholderLabel.FontSize = PLACEHOLDER_FONT_SIZE; HiddenBottomBorder.WidthRequest = 0; Grid.Margin = new Thickness(0, 0, 0, 0); } }
async Task PlaceholderToTitle() { if (Animated) { await Task.WhenAll( PlaceholderLabel.TranslateTo(0, BorderlessEntry.Y - PlaceholderLabel.Height, 100), PlaceholderLabel.SizeTo(PlaceholderLabel.FontSize, TITLE_FONT_SIZE, (t) => PlaceholderLabel.FontSize = t, 100, Easing.BounceIn), HiddenBottomBorder.LayoutTo(new Rectangle(BottomBorder.X, BottomBorder.Y, BottomBorder.Width, BottomBorder.Height), 200), PlaceholderLabel.ColorTo(DefaultTextColor, ActiveTextColor, (c) => PlaceholderLabel.TextColor = c, 100), Grid.MarginTo(Grid.Margin, new Thickness(0, 15, 0, 0), (m) => Grid.Margin = m, 100)); } else { PlaceholderLabel.TranslationX = 0; PlaceholderLabel.TranslationY = BorderlessEntry.Y - PlaceholderLabel.Height; PlaceholderLabel.FontSize = TITLE_FONT_SIZE; HiddenBottomBorder.WidthRequest = BottomBorder.Width; Grid.Margin = new Thickness(0, 15, 0, 0); } }
public void LayoutPlaceholderLabel() { var w = LeftViewWidth; var h = this.Height() == 0 ? IntrinsicContentSize.Height : this.Height(); if (IsEditing || !IsEmpty || !IsPlaceholderAnimated) { PlaceholderLabel.Transform = CGAffineTransform.MakeIdentity(); PlaceholderLabel.Frame = new CGRect(w, 0, this.Width() - w, h); PlaceholderLabel.Transform = CGAffineTransform.MakeScale(0.75f, 0.75f); switch (TextAlignment) { case UITextAlignment.Left: case UITextAlignment.Natural: { PlaceholderLabel.SetX(w); } break; case UITextAlignment.Right: { PlaceholderLabel.SetX(this.Width() - PlaceholderLabel.Width()); } break; default: break; } PlaceholderLabel.SetY(-PlaceholderLabel.Height() + PlaceholderVerticalOffset); } else { PlaceholderLabel.Frame = new CGRect(w, 0, this.Width() - w, h); return; } }
public override void LayoutSubviews() { base.LayoutSubviews(); PlaceholderLabel.Frame = new RectangleF(8, 8, this.Bounds.Size.Width - 16, 0); PlaceholderLabel.SizeToFit(); }
/// <summary> /// Returns true if PaymentProductFieldDisplayHints instances are equal /// </summary> /// <param name="other">Instance of PaymentProductFieldDisplayHints to be compared</param> /// <returns>Boolean</returns> public bool Equals(PaymentProductFieldDisplayHints other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( AlwaysShow == other.AlwaysShow || AlwaysShow != null && AlwaysShow.Equals(other.AlwaysShow) ) && ( DisplayOrder == other.DisplayOrder || DisplayOrder != null && DisplayOrder.Equals(other.DisplayOrder) ) && ( FormElement == other.FormElement || FormElement != null && FormElement.Equals(other.FormElement) ) && ( Label == other.Label || Label != null && Label.Equals(other.Label) ) && ( Link == other.Link || Link != null && Link.Equals(other.Link) ) && ( Mask == other.Mask || Mask != null && Mask.Equals(other.Mask) ) && ( Obfuscate == other.Obfuscate || Obfuscate != null && Obfuscate.Equals(other.Obfuscate) ) && ( PlaceholderLabel == other.PlaceholderLabel || PlaceholderLabel != null && PlaceholderLabel.Equals(other.PlaceholderLabel) ) && ( PreferredInputType == other.PreferredInputType || PreferredInputType != null && PreferredInputType.Equals(other.PreferredInputType) ) && ( Tooltip == other.Tooltip || Tooltip != null && Tooltip.Equals(other.Tooltip) )); }
public override void Tick() { base.Tick(); PlaceholderLabel?.SetClass("hidden", !string.IsNullOrEmpty(Text)); }
void ReleaseDesignerOutlets() { if (AttachmentContainer != null) { AttachmentContainer.Dispose(); AttachmentContainer = null; } if (AttachmentImage != null) { AttachmentImage.Dispose(); AttachmentImage = null; } if (BottomConstraint != null) { BottomConstraint.Dispose(); BottomConstraint = null; } if (DeleteButton != null) { DeleteButton.Dispose(); DeleteButton = null; } if (EditContainer != null) { EditContainer.Dispose(); EditContainer = null; } if (EditingBodyLabel != null) { EditingBodyLabel.Dispose(); EditingBodyLabel = null; } if (EditingCloseButton != null) { EditingCloseButton.Dispose(); EditingCloseButton = null; } if (EditingTitleLabel != null) { EditingTitleLabel.Dispose(); EditingTitleLabel = null; } if (ImageLoader != null) { ImageLoader.Dispose(); ImageLoader = null; } if (OpenCameraButton != null) { OpenCameraButton.Dispose(); OpenCameraButton = null; } if (OpenGalleryButton != null) { OpenGalleryButton.Dispose(); OpenGalleryButton = null; } if (PlaceholderLabel != null) { PlaceholderLabel.Dispose(); PlaceholderLabel = null; } if (SendButton != null) { SendButton.Dispose(); SendButton = null; } if (TextMaxHeightConstraint != null) { TextMaxHeightConstraint.Dispose(); TextMaxHeightConstraint = null; } if (TextView != null) { TextView.Dispose(); TextView = null; } }