LoadStringEntryLayout() публичный статический Метод

public static LoadStringEntryLayout ( Android.Content.Context context, Android.Views.View convertView, Android.Views.ViewGroup parent, int layoutId, Android.Widget.TextView &label, EditText &value ) : Android.Views.View
context Android.Content.Context
convertView Android.Views.View
parent Android.Views.ViewGroup
layoutId int
label Android.Widget.TextView
value EditText
Результат Android.Views.View
Пример #1
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            Log.Debug("MDD", "EntryElement: GetView: ConvertView: " + ((convertView == null) ? "false" : "true") +
                      " Value: " + Value + " Hint: " + Hint + " Password: "******"true" : "false"));


            TextView label;
            var      view = DroidResources.LoadStringEntryLayout(context, convertView, parent, LayoutId, out label, out _entry);

            if (view != null)
            {
                // Warning! Crazy ass hack ahead!
                // since we can't know when out convertedView was was swapped from inside us, we store the
                // old textwatcher in the tag element so it can be removed!!!! (barf, rech, yucky!)
                if (_entry.Tag != null)
                {
                    _entry.RemoveTextChangedListener((ITextWatcher)_entry.Tag);
                }

                _entry.Text = this.Value;
                _entry.Hint = this.Hint;
                _entry.LayoutParameters.Width = this.Width;

                if (this.Password)
                {
                    _entry.InputType = (InputTypes.ClassText | InputTypes.TextVariationPassword);
                }
                else if (this.Numeric)
                {
                    _entry.InputType = (InputTypes.ClassNumber | InputTypes.NumberFlagDecimal | InputTypes.NumberFlagSigned);
                }
                else
                {
                    _entry.InputType = InputTypes.ClassText;
                }

                _entry.Enabled = this.Enabled;

                // continuation of crazy ass hack, stash away the listener value so we can look it up later
                _entry.Tag = this;
                _entry.AddTextChangedListener(this);

                label.Text = (label != null) ? Caption: string.Empty;
            }
            return(view);
        }
Пример #2
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            TextView label;
            var      view = DroidResources.LoadStringEntryLayout(context, convertView, parent, LayoutId, out label, out _entry);

            if (view != null)
            {
                // Warning! Crazy ass hack ahead!
                // since we can't know when out convertedView was was swapped from inside us, we store the
                // old textwatcher in the tag element so it can be removed!!!! (barf, rech, yucky!)
                if (_entry.Tag != null)
                {
                    _entry.RemoveTextChangedListener((ITextWatcher)_entry.Tag);
                }

                _entry.Text         = this.Value;
                _entry.Hint         = this.Hint;
                _entry.EditorAction = null;
                _entry.ImeOptions   = (int)ImeAction.Unspecified;

                if (this.Password)
                {
                    _entry.InputType = (int)(InputTypes.ClassText | InputTypes.TextVariationPassword);
                }
                else if (this.Numeric)
                {
                    _entry.InputType = (int)(InputTypes.ClassNumber | InputTypes.NumberFlagDecimal | InputTypes.NumberFlagSigned);
                }
                else
                {
                    _entry.InputType = (int)InputTypes.ClassText;
                }

                if (Lines > 1)
                {
                    _entry.InputType |= (int)InputTypes.TextFlagMultiLine;
                    _entry.SetLines(Lines);
                }
                else if (Send != null)
                {
                    _entry.ImeOptions = ImeAction.Go;
                    _entry.SetImeActionLabel("Go", ImeAction.Go);
                    _entry.EditorAction = (o, actionId, e) =>
                    {
                        if (actionId == ImeAction.Go)
                        {
                            Send();
                            return(true);
                        }
                        return(false);
                    };
                }

                // continuation of crazy ass hack, stash away the listener value so we can look it up later
                _entry.Tag = this;
                _entry.AddTextChangedListener(this);
                if (label == null)
                {
                    _entry.Hint = Caption;
                }
                else
                {
                    label.Text = Caption;
                }
            }

            return(view);
        }