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 += new EventHandler<TextView.EditorActionEventArgs>(_entry_EditorAction);
_entry.ImeOptions = ImeAction.Unspecified;
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;
}
if (Lines > 1)
{
_entry.InputType |= InputTypes.TextFlagMultiLine;
_entry.SetLines(Lines);
}
else if (Send != null)
{
_entry.ImeOptions = ImeAction.Go;
_entry.SetImeActionLabel("Go", ImeAction.Go);
_entry.EditorAction += new EventHandler <TextView.EditorActionEventArgs>(_entry_EditorAction);
}
// 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);
}