public bool OnTouch(Android.Views.View v, MotionEvent e) { if (v is EditText && e.Action == MotionEventActions.Up) { EditText editText = (EditText)v; if (e.RawX >= (editText.Right - editText.GetCompoundDrawables()[2].Bounds.Width())) { if (editText.TransformationMethod == null) { editText.TransformationMethod = PasswordTransformationMethod.Instance; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.avd_hide_password, 0); editText.SetSelection(editText.Length()); } else { editText.TransformationMethod = null; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.avd_show_password, 0); editText.SetSelection(editText.Length()); } foreach (Drawable drawable in editText.GetCompoundDrawables()) { var color = new Android.Graphics.Color(editText.CurrentTextColor); if (drawable != null) { drawable.SetColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SrcIn)); } } return(true); } } return(false); }
public bool OnTouch(Android.Views.View v, MotionEvent e) { if (v is EditText && e.Action == MotionEventActions.Up) { EditText editText = (EditText)v; if (e.RawX >= (editText.Right - editText.GetCompoundDrawables()[2].Bounds.Width())) { if (editText.TransformationMethod == null) { editText.TransformationMethod = PasswordTransformationMethod.Instance; var name = editText.Hint; if (name.Trim().Contains("password")) { editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(Resource.Drawable.style_PasswordIcon, 0, Resource.Drawable.style_ForgetShowPass, 0); editText.SetOnTouchListener(new OnDrawableTouchListener()); } } else { editText.TransformationMethod = null; var name = editText.Hint; if (name.Trim().Contains("password")) { editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(Resource.Drawable.style_PasswordIcon, 0, Resource.Drawable.style_ForgetHidePass, 0); editText.SetOnTouchListener(new OnDrawableTouchListener()); } } return(true); } } return(false); }
public bool OnTouch(Android.Views.View v, MotionEvent e) { try { if (v is EditText && e.Action == MotionEventActions.Up) { EditText editText = (EditText)v; if (e.RawX >= (editText.Right - editText.GetCompoundDrawables()[2].Bounds.Width())) { if (editText.TransformationMethod == null) { editText.TransformationMethod = PasswordTransformationMethod.Instance; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.ShowPass, 0); } else { editText.TransformationMethod = null; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.HidePass, 0); } return(true); } } return(false); } catch (Exception ex) { return(false); } }
private void configureControl() { EditText editText = ((EditText)Control); editText.SetCompoundDrawablesWithIntrinsicBounds(editText.GetCompoundDrawables()[0] ?? null, null, ContextCompat.GetDrawable(Android.App.Application.Context, Resource.Drawable.show_password), null); editText.SetOnTouchListener(new OnDrawableTouchListener()); }
public bool OnTouch(Android.Views.View v, MotionEvent e) { if (v is EditText && e.Action == MotionEventActions.Up) { EditText editText = (EditText)v; if (e.RawX >= (editText.Right - editText.GetCompoundDrawables()[2].Bounds.Width())) { if (editText.TransformationMethod == null) { editText.TransformationMethod = PasswordTransformationMethod.Instance; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.baseline_visibility_black_36, 0); } else { editText.TransformationMethod = null; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.baseline_visibility_off_black_36, 0); } return(true); } } return(false); }
public bool OnTouch(View v, MotionEvent e) { if (v is EditText && e.Action == MotionEventActions.Up) { EditText editText = (EditText)v; Drawable drawableRight = editText?.GetCompoundDrawables()[2]; if (drawableRight != null && e.Action == MotionEventActions.Up) { int iconIntrinsicWidth = editText.GetCompoundDrawables()[2].IntrinsicWidth; if (e.RawX >= (editText.Right - iconIntrinsicWidth)) { if (editText.TransformationMethod == null) { editText.TransformationMethod = PasswordTransformationMethod.Instance; editText.SetCompoundDrawablesWithIntrinsicBounds(null, null, visibilityOffDrawable, null); } else { editText.TransformationMethod = null; editText.SetCompoundDrawablesWithIntrinsicBounds(null, null, visibilityDrawable, null); } return(true); } } } return(false); }
public bool OnTouch(Android.Views.View v, MotionEvent e) { context = Android.App.Application.Context; if (v is EditText && e.Action == MotionEventActions.Up) { EditText editText = (EditText)v; if (e.RawX >= (editText.Right - editText.GetCompoundDrawables()[2].Bounds.Width())) { Drawable img = ContextCompat.GetDrawable(context, Resource.Drawable.Group_23); var sd = new ScaleDrawable(img, 0, 35, 20); if (editText.TransformationMethod == null) { editText.TransformationMethod = PasswordTransformationMethod.Instance; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(null, null, sd.Drawable, null); } else { editText.TransformationMethod = null; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(null, null, sd.Drawable, null); } return(true); } } return(false); }
public bool OnTouch(Android.Views.View v, MotionEvent e) { if (v is EditText && e.Action == MotionEventActions.Up) { EditText editText = (EditText)v; var drawablesArray = editText.GetCompoundDrawables(); //only continue if image exists if (drawablesArray[2] == null) { return(false); } // Check to see if the clear button was clicked if (e.RawX >= (editText.Right - editText.PaddingRight - drawablesArray[2].Bounds.Width())) { var ultimateEntryRenderer = (UltimateEntryRenderer)editText.Parent; if (ultimateEntryRenderer != null) { var ultimateEntry = (UltimateEntry)ultimateEntryRenderer.Element; if (ultimateEntry != null) { switch (ultimateEntry.ImageButtonType) { case UltimateEntryImageButton.ClearContents: ultimateEntry.Text = string.Empty; break; //toggle transformation and image on every click case UltimateEntryImageButton.Password: if (ultimateEntry.IsPassword) { ultimateEntryRenderer.SetImage(ultimateEntry.HidePasswordImageSource); ultimateEntry.IsPassword = false; } else { ultimateEntryRenderer.SetImage(ultimateEntry.RightImageSource); ultimateEntry.IsPassword = true; } break; } ultimateEntryRenderer.UpdateControlUI(); ultimateEntry.RightImageTouchedDelegate(ultimateEntry, new EventArgs()); } } return(true); } } return(false); }
public bool OnTouch(Android.Views.View v, MotionEvent e) { if (v is EditText && e.Action == MotionEventActions.Up) { EditText editText = (EditText)v; if (e.RawX >= (editText.Right - editText.GetCompoundDrawables()[2].Bounds.Width())) { editText.Text = string.Empty; return true; } } return false; }
public bool OnTouch(Android.Views.View v, MotionEvent e) { if (v is EditText && e.Action == MotionEventActions.Up) { EditText editText = (EditText)v; if (editText.Text != null) { editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.ic_clear_icon, 0); } if (editText.GetCompoundDrawables()[2] != null) { //If the region on which i tapped is the region with the X the text will be cleaned if (e.RawX >= (editText.Right - editText.GetCompoundDrawables()[2].Bounds.Width())) { editText.Text = string.Empty; return(true); } } } return(false); }
private void ConfigureControl() { EditText editText = ((EditText)Control); editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.avd_hide_password, 0); editText.SetOnTouchListener(new OnDrawableTouchListener()); foreach (Drawable drawable in editText.GetCompoundDrawables()) { var color = new Android.Graphics.Color(editText.CurrentTextColor); if (drawable != null) { drawable.SetColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SrcIn)); } } }
public bool OnTouch(View v, MotionEvent e) { EditText editText = (EditText)v; Drawable drawableRight = editText?.GetCompoundDrawables()[2]; if (drawableRight != null && e.Action == MotionEventActions.Up) { int iconIntrinsicWidth = editText.GetCompoundDrawables()[2].IntrinsicWidth; if (e.RawX >= (editText.Right - iconIntrinsicWidth)) { editText.Text = string.Empty; return(true); } } return(false); }
private void ConfigureControl() { EditText editText = ((EditText)Control); editText.SetCompoundDrawablesWithIntrinsicBounds(0, 0, getShowDrawable(), 0); if (editText.Gravity == GravityFlags.Center) { editText.CompoundDrawablePadding = -editText.CompoundPaddingRight; } editText.Touch += (s, e) => { var handled = false; if (s is EditText && e.Event.Action == MotionEventActions.Up) { EditText sEditText = (EditText)s; if (e.Event.RawX >= (sEditText.Right - sEditText.GetCompoundDrawables()[2].Bounds.Width())) { if (sEditText.TransformationMethod == null) { editText.TransformationMethod = PasswordTransformationMethod.Instance; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, getShowDrawable(), 0); } else { editText.TransformationMethod = null; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, getHideDrawable(), 0); } handled = true; } } e.Handled = handled; }; }
/// <summary> /// /// </summary> public bool OnTouch(View v, MotionEvent e) { if (v is EditText && e.Action == MotionEventActions.Up) { EditText editText = (EditText)v; if (e.RawX >= (editText.Right - editText.GetCompoundDrawables()[2].Bounds.Width())) { if (editText.TransformationMethod == null) { editText.TransformationMethod = PasswordTransformationMethod.Instance; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.esconderojo, 0); } else { editText.TransformationMethod = null; editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.ojover, 0); } return(true); } } return(false); }