From 69b527c39d82546f053d7ef2b9a1f094f1b4a94e Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Fri, 17 May 2013 14:33:31 +0200 Subject: [PATCH] Visibility icon in password field is toggled according to the visibility state; better touch detection of visibility and refresh buttons --- res/layout-land/account_setup.xml | 28 ++---- res/layout/account_setup.xml | 32 ++----- .../authentication/AuthenticatorActivity.java | 103 +++++++++++++-------- 3 files changed, 84 insertions(+), 79 deletions(-) diff --git a/res/layout-land/account_setup.xml b/res/layout-land/account_setup.xml index a4b5a5e4..52f53925 100644 --- a/res/layout-land/account_setup.xml +++ b/res/layout-land/account_setup.xml @@ -122,28 +122,16 @@ android:hint="@string/auth_username" android:inputType="textNoSuggestions" /> - - - - - - + android:ems="10" + android:hint="@string/auth_password" + android:inputType="textPassword" + android:drawablePadding="5dp" + /> + - - - - - - - + + 2) { - rightDrawable = drawables[2]; - } + Drawable rightDrawable = null; + if (view instanceof TextView) { + Drawable[] drawables = ((TextView)view).getCompoundDrawables(); + if (drawables.length > 2) { + rightDrawable = drawables[2]; } - if (rightDrawable != null) { - final int x = (int) event.getX(); - final int y = (int) event.getY(); - final Rect bounds = rightDrawable.getBounds(); - if (x >= (view.getRight() - bounds.width() - fuzz) && x <= (view.getRight() - view.getPaddingRight() + fuzz) - && y >= (view.getPaddingTop() - fuzz) && y <= (view.getHeight() - view.getPaddingBottom()) + fuzz) { - - return onDrawableTouch(event); - } + } + if (rightDrawable != null) { + final int x = (int) event.getX(); + final int y = (int) event.getY(); + final Rect bounds = rightDrawable.getBounds(); + if (x >= (view.getRight() - bounds.width() - fuzz) && x <= (view.getRight() - view.getPaddingRight() + fuzz) + && y >= (view.getPaddingTop() - fuzz) && y <= (view.getHeight() - view.getPaddingBottom()) + fuzz) { + + return onDrawableTouch(event); } } return false; -- 2.11.0