From 69b527c39d82546f053d7ef2b9a1f094f1b4a94e Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Fri, 17 May 2013 14:33:31 +0200 Subject: [PATCH 1/4] 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 a4b5a5e41a..52f5392570 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; From 0e133233f3e8a775058ddd9b447eb5e6ed7f9091 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Fri, 24 May 2013 12:47:39 +0200 Subject: [PATCH 2/4] Placeholder drawable for 'hide password' button replace with the final icon --- res/drawable/ic_hide.png | Bin 0 -> 1511 bytes res/drawable/ic_view.png | Bin 0 -> 1431 bytes .../authentication/AuthenticatorActivity.java | 6 ++++-- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 res/drawable/ic_hide.png create mode 100644 res/drawable/ic_view.png diff --git a/res/drawable/ic_hide.png b/res/drawable/ic_hide.png new file mode 100644 index 0000000000000000000000000000000000000000..8a8144b5b858342d52bf2f509145af70d26cf24b GIT binary patch literal 1511 zcmah}4NMbf7(PIdiEfCA6CK&DZ0d&ByIyTe4=R)%g^DGl6j#G^9Csh|QrbJNS6Vu^ z1s%qb%q<$GBr+XKCTYN_WR=aqesECZG;WJxfFRkH5tl`>WQ&Vqao_RNxdgIH?!KQq z@AE$I-@RE;Ub1G@##IP{tg)5S4!EMqo0ulY@)|5Hly#0@UVZ z>VX3=Tyx_UkdGiq)4bCqyX?CtR`9AB1)~mmMQDv6`2``7VLd=bYe7BlGpS}SeXc@z z&ZK%#XD95U1-SXrummc@@ss*VY*BFgPg@Yt9h`{{KKA8z&K7aNi0}cGF#EUX7 z_)vwBsTBgUNd=Y8hu{_Cv_Ahrnqb245F_FmHKBww2jti|P7Fv5bIv&y2Mxdre6k;6 zHE}G=lHDGMFG=h5#?gM+0sf6`NwnYDECSpC{6autVUg>y6kpLqLl2Z^G7BgPq z7G%Ni7DUuisYC4y%lnk`BX~eFGBBxN_O%$H!${Ie7%76JNFoP*31S{<7dXDIc`2xl zpftJvfx^;rjLiHmm}99rLGm&%|Gd(zxag~&^JceGHlJT+d@QihCKU`#&GQ^()zU_@ z!E7xu>vbAUF=;lCI*ZY$)x*Zo>Wzj)TUuZPN);Auxwvf+v8=7q&q|#r8c2K-;H;A1 zMdxZk@k?mYAy|qJm2Qap2YsUKiVKJk7 zs;u~jzYMSrnTd7!0SM zZcm^mU->!oef5nq2?JG=nVWPEPxh|QV`jOD(vJ~7>y4iV9*gDwGJWynDKq zP9q_6VUWdzWgA)I2WCwCuz+quV_<^#61S-XP250DmOz}ww?vl^=NF$VwBy5wm)t!s z`Tc(X_dD6#w14x)?HdV#*c@pPVt6I3x4aa8&208QUMf+z4Yj~dloky@1ZCI($cQQ? zKn#d-&&$_A4M7y&Q{ru?EqZ{Lpz07Uj3cA!m`xBh`!c#Hbpb?nfP|v?sXr&CC{mIA z)IoQYiRvMcR2s4dXvsFkrEHhvlc{~RWKD+00xCcvnNhnnlh636oGy>|)-_F$ISA_V zQ!7rjMVrYGGyv&#Fm{RYFr)lIo49n0AN3)!r_3}=RXBcwzp|CYW?&M=a z{i-c|@>5BKbe^Wu>9iy5bU-6Pvp%2C(%?8dM%c|B4T%}MW>)1D1Yk;rq9X-rq@^f! zz!dUR*wd8|RJ|apnX75S38OQjPO}ci3MmJar2ijPp^7;Fiq);Ot|fBTqESAgnMl+m5E1+o4$Yw`GViLd?^Wu9~7SC3E^W=mi zb^LT;lDYi-ueT4S@16(0q$>Smi#oAo+E(5Bwe7)Q&pmPC{qd?~(W#ML70Kntf8GL4 zHx4bmP&R#jYC|c}Sbgu-?jXqqF281bXXfdHKkkk_Q`9h5(z|f&yM+U1+viVzxo!5+ z%-=J&-WdOVzL*+w9?u$$lhU)Ex2l7!|JDR9E%IyBJr>d{(T|M0b?_Db6*^&vM5N2*+IbhqmzVx;8LuSx?~ z%RPwo78 r!;rW3?N^pR_`z09l+C)QTY7Co;C5<9@3%Ky)~_-WZW2c8j`aNpe1+q7 literal 0 HcmV?d00001 diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 7a48232071..5ec4ccbafe 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -476,9 +476,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity private void showViewPasswordButton() { - int drawable = android.R.drawable.ic_menu_view; + //int drawable = android.R.drawable.ic_menu_view; + int drawable = R.drawable.ic_view; if (isPasswordVisible()) { - drawable = android.R.drawable.ic_secure; + //drawable = android.R.drawable.ic_secure; + drawable = R.drawable.ic_hide; } mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, drawable, 0); } From 9dc5a62e44952bdfb972bd46ff4b92ed2cba3d74 Mon Sep 17 00:00:00 2001 From: masensio Date: Tue, 4 Jun 2013 10:45:24 +0200 Subject: [PATCH 3/4] OC-247: Resize active area for the eye icon --- .classpath | 3 ++- .settings/org.eclipse.jdt.core.prefs | 3 +++ oc_jb_workaround/.classpath | 1 + res/layout/account_setup.xml | 13 ++++++------- .../authentication/AuthenticatorActivity.java | 2 +- tests/.classpath | 5 +++-- tests/.settings/org.eclipse.jdt.core.prefs | 4 ++++ 7 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 tests/.settings/org.eclipse.jdt.core.prefs diff --git a/.classpath b/.classpath index 3f9691c5dd..d57ec02513 100644 --- a/.classpath +++ b/.classpath @@ -1,8 +1,9 @@ - + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 0ff9ee10f6..81acefee4a 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,7 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 diff --git a/oc_jb_workaround/.classpath b/oc_jb_workaround/.classpath index 3f9691c5dd..0b08408342 100644 --- a/oc_jb_workaround/.classpath +++ b/oc_jb_workaround/.classpath @@ -4,5 +4,6 @@ + diff --git a/res/layout/account_setup.xml b/res/layout/account_setup.xml index 688e525bed..a218fa972b 100644 --- a/res/layout/account_setup.xml +++ b/res/layout/account_setup.xml @@ -103,13 +103,12 @@ + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:drawablePadding="5dp" + android:ems="10" + android:hint="@string/auth_password" + android:inputType="textPassword" /> - - + + + diff --git a/tests/.settings/org.eclipse.jdt.core.prefs b/tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..b080d2ddc8 --- /dev/null +++ b/tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.source=1.6 From 9f20cc45ccbbfd73bc51e16bd8abab3be856fcac Mon Sep 17 00:00:00 2001 From: masensio Date: Mon, 10 Jun 2013 13:06:46 +0200 Subject: [PATCH 4/4] OC-297: Refresh button in changing orientation. OC-65 --- .../authentication/AuthenticatorActivity.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 13ffd2a9e5..e92554ba81 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -97,6 +97,7 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList private static final String KEY_IS_SSL_CONN = "IS_SSL_CONN"; private static final String KEY_AUTH_STATUS_TEXT = "AUTH_STATUS_TEXT"; private static final String KEY_AUTH_STATUS_ICON = "AUTH_STATUS_ICON"; + private static final String KEY_REFRESH_BUTTON_ENABLED = "KEY_REFRESH_BUTTON_ENABLED"; private static final String OAUTH_MODE_ON = "on"; private static final String OAUTH_MODE_OFF = "off"; @@ -142,6 +143,8 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList private TextView mOAuthAuthEndpointText; private TextView mOAuthTokenEndpointText; + + private boolean mRefreshButtonEnabled; /** @@ -230,13 +233,16 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList // check if server check was interrupted by a configuration change if (savedInstanceState.getBoolean(KEY_SERVER_CHECK_IN_PROGRESS, false)) { checkOcServer(); - } + } + + // refresh button enabled + mRefreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED); } showServerStatus(); showAuthStatus(); - if (mServerIsChecked && !mServerIsValid) showRefreshButton(); + if (mServerIsChecked && !mServerIsValid && mRefreshButtonEnabled) showRefreshButton(); mOkButton.setEnabled(mServerIsValid); // state not automatically recovered in configuration changes if (!OAUTH_MODE_OPTIONAL.equals(getString(R.string.oauth2_mode))) { @@ -284,6 +290,7 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList mPasswordInput.setOnFocusChangeListener(this); mPasswordInput.setImeOptions(EditorInfo.IME_ACTION_DONE); mPasswordInput.setOnEditorActionListener(this); + } /** @@ -318,6 +325,9 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList if (mAccount != null) { outState.putParcelable(KEY_ACCOUNT, mAccount); } + + // refresh button enabled + outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, mRefreshButtonEnabled); } @@ -394,6 +404,9 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList if (view.getId() == R.id.hostUrlInput) { if (!hasFocus) { onUrlInputFocusLost((TextView) view); + if (!mServerIsValid) { + showRefreshButton(); + } } else { hideRefreshButton(); @@ -1100,10 +1113,12 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList private void showRefreshButton() { mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0); + mRefreshButtonEnabled = true; } private void hideRefreshButton() { mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); + mRefreshButtonEnabled = false; } /**