Exemplo n.º 1
0
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                TextView label = Control;
                int      size  = ((CustomLabel)e.NewElement).Size;

                if (size > 0) // is valid
                {
                    switch (size)
                    {
                    case CustomLabel.SIZE_SPEEDO:      label.TextSize = 80;                                                          break;

                    case CustomLabel.SIZE_SPEEDO_UNIT: label.TextSize = 30;                                                          break;

                    case CustomLabel.SIZE_BIG:         label.TextSize = 80;                                                          break;

                    case CustomLabel.SIZE_LARGE:       label.TextSize = (float)Device.GetNamedSize(NamedSize.Large, typeof(Label)); break;

                    case CustomLabel.SIZE_CAPTION:     label.TextSize = 40;                                                          break;

                    case CustomLabel.SIZE_CAPTION_DE:  label.TextSize = 30;                                                          break;

                    case CustomLabel.SIZE_MEDIUM:      label.TextSize = (float)Device.GetNamedSize(NamedSize.Medium, typeof(Label)); break;

                    default:                           label.TextSize = (float)Device.GetNamedSize(NamedSize.Small, typeof(Label)); break;
                    }
                }

                if (isMailSupported)
                {
                    // make mail/url addresses clickable

                    // set the auto link mask to capture link-able data
                    // info: make sure to set text after setting the mask
                    label.AutoLinkMask = MatchOptions.EmailAddresses | MatchOptions.WebUrls;
                }

                label.Typeface = font;

                // hyperlinks shall be readable on light and dark background
                label.SetLinkTextColor(Android.Graphics.Color.Rgb(100, 100, 255));

                // ensure a blank space at the end of each label.text
                // because the italic font is cut off at the right border
                label.Append(" ");

                label.AddTextChangedListener(new TextWatcher());
            }
        }
Exemplo n.º 2
0
        public CellViewText(Activity context, CellControllerText controller)
        {
            numberView = new EditText(context);

            numberView.SetMaxLines(1);
            numberView.SetLines(1);
            numberView.SetSingleLine(true);

            numberView.AddTextChangedListener(this);



            cell_controller = controller;
            cell_controller.HookView(this);
        }
Exemplo n.º 3
0
        /// Method Name     : SetFinalPaymentControl
        /// Author          : Sanket Prajapati
        /// Creation Date   : 28 feb 2018
        /// Purpose         : Use for find finalpayment layout control
        /// Revision        :
        /// </summary>
        public void SetFinalPaymentControl(ViewGroup layout)
        {
            RelativeLayoutFianlPaymentControl = layout.FindViewById <RelativeLayout>(Resource.Id.RelativeLayoutFianlPaymentControl);

            txtAmount           = layout.FindViewById <EditText>(Resource.Id.txtAmount);
            txtNameofCardHolder = layout.FindViewById <EditText>(Resource.Id.txtNameofCardHolder);
            txtCVV = layout.FindViewById <EditText>(Resource.Id.txtCVV);

            textViewMakePayment = layout.FindViewById <TextView>(Resource.Id.textViewMakePayment);
            textViewCardNumber  = layout.FindViewById <EditText>(Resource.Id.txtCardNumber);
            spinnerExpMonth     = layout.FindViewById <Spinner>(Resource.Id.spinnerExpMonth);
            spinnerExpYear      = layout.FindViewById <Spinner>(Resource.Id.spinnerExpYear);
            textViewMakePayment.SetOnClickListener(this);
            textViewCardNumber.AddTextChangedListener(this);
            textViewCardNumber.SetOnKeyListener(this);

            Paymentlayout = layout;
        }
        public CellViewNumber(Activity context, CellControllerNumber controller)
        {
            numberView = new EditText(context)
            {
                InputType = InputTypes.ClassNumber |
                            InputTypes.NumberFlagDecimal |
                            InputTypes.NumberFlagSigned
            };
            numberView.SetMaxLines(1);
            numberView.SetLines(1);
            numberView.SetSingleLine(true);
            numberView.AddTextChangedListener(this);

            cell_controller = controller;



            controller.HookView(this);
        }
        /// <summary>
        /// Applies a Typeface to a TextView, if deferred,its recommend you don't call this multiple
        /// times, as this adds a TextWatcher.
        /// Deferring should really only be used on tricky views which get Typeface set by the system at
        /// weird times.
        /// </summary>
        /// <param name="textView">Not null, TextView or child of.</param>
        /// <param name="typeface">Not null, Typeface to apply to the TextView.</param>
        /// <param name="deferred">if set to <c>true</c> [deferred].
        /// If true we use Typefaces and TextChange listener to make sure font is always
        /// applied, but this sometimes conflicts with other <see cref="Android.Text.ISpannable"/>.
        /// </param>
        /// <returns>true if applied otherwise false.</returns>
        /// <see cref="ApplyFontToTextView(Android.Widget.TextView,Android.Graphics.Typeface)"/>
        internal static bool ApplyFontToTextView(TextView textView, Typeface typeface, bool deferred)
        {
            if (textView == null || typeface == null)
            {
                return(false);
            }

            textView.PaintFlags = textView.PaintFlags | PaintFlags.SubpixelText | PaintFlags.AntiAlias;
            textView.Typeface   = typeface;
            if (!deferred)
            {
                return(true);
            }

            textView.SetText(ApplyTypefaceSpan(new String(textView.Text), typeface), TextView.BufferType.Spannable);

            textView.AddTextChangedListener(new TextWatcher(typeface));
            return(true);
        }