private static final String KEY_SERVER_STATUS_TEXT = "SERVER_STATUS_TEXT";\r
private static final String KEY_SERVER_STATUS_ICON = "SERVER_STATUS_ICON";\r
private static final String KEY_IS_SSL_CONN = "IS_SSL_CONN";\r
+ private static final String KEY_PASSWORD_VISIBLE = "PASSWORD_VISIBLE";\r
private static final String KEY_AUTH_STATUS_TEXT = "AUTH_STATUS_TEXT";\r
private static final String KEY_AUTH_STATUS_ICON = "AUTH_STATUS_ICON";\r
- \r
+ \r
private static final String OAUTH_MODE_ON = "on";\r
private static final String OAUTH_MODE_OFF = "off";\r
private static final String OAUTH_MODE_OPTIONAL = "optional";\r
private boolean mJustCreated;\r
private byte mAction;\r
private Account mAccount;\r
- \r
+ \r
- private ImageView mViewPasswordButton;\r
private EditText mHostUrlInput;\r
private EditText mUsernameInput;\r
private EditText mPasswordInput;\r
protected void onCreate(Bundle savedInstanceState) {\r
super.onCreate(savedInstanceState);\r
getWindow().requestFeature(Window.FEATURE_NO_TITLE);\r
- \r
+ \r
/// set view and get references to view elements\r
setContentView(R.layout.account_setup);\r
- mViewPasswordButton = (ImageView) findViewById(R.id.viewPasswordButton);\r
mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput);\r
mUsernameInput = (EditText) findViewById(R.id.account_username);\r
mPasswordInput = (EditText) findViewById(R.id.account_password);\r
mPasswordInput.setOnFocusChangeListener(this);\r
mPasswordInput.setImeOptions(EditorInfo.IME_ACTION_DONE);\r
mPasswordInput.setOnEditorActionListener(this);\r
+ mPasswordInput.setOnTouchListener(new RightDrawableOnTouchListener() {\r
+ @Override\r
+ public boolean onDrawableTouch(final MotionEvent event) {\r
+ if (event.getAction() == MotionEvent.ACTION_UP) {\r
+ AuthenticatorActivity.this.onViewPasswordClick();\r
+ }\r
+ return true;\r
+ }\r
+ });\r
}\r
- \r
+ \r
/**\r
* Saves relevant state before {@link #onPause()}\r
* \r
outState.putBoolean(KEY_SERVER_CHECKED, mServerIsChecked);\r
outState.putBoolean(KEY_SERVER_CHECK_IN_PROGRESS, (!mServerIsValid && mOcServerChkOperation != null));\r
outState.putBoolean(KEY_IS_SSL_CONN, mIsSslConn);\r
+ outState.putBoolean(KEY_PASSWORD_VISIBLE, isPasswordVisible());\r
outState.putInt(KEY_AUTH_STATUS_ICON, mAuthStatusIcon);\r
outState.putInt(KEY_AUTH_STATUS_TEXT, mAuthStatusText);\r
- \r
+ \r
/// server data\r
if (mDiscoveredVersion != null) {\r
outState.putString(KEY_OC_VERSION, mDiscoveredVersion.toString());\r
* \r
* @param view Refresh 'button'\r
*/\r
- public void onRefreshClick(View view) {\r
+ public void onRefreshClick() {\r
checkOcServer();\r
}\r
-\r
-\r
+ \r
+ \r
- \r
/**\r
* Called when the eye icon in the password field is clicked.\r
* \r
* Toggles the visibility of the password in the field. \r
- * \r
- * @param view 'View password' 'button'\r
*/\r
- public void onViewPasswordClick(View view) {\r
+ public void onViewPasswordClick() {\r
int selectionStart = mPasswordInput.getSelectionStart();\r
int selectionEnd = mPasswordInput.getSelectionEnd();\r
- int input_type = mPasswordInput.getInputType();\r
- if ((input_type & InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {\r
- input_type = InputType.TYPE_CLASS_TEXT\r
- | InputType.TYPE_TEXT_VARIATION_PASSWORD;\r
+ if (isPasswordVisible()) {\r
+ hidePassword();\r
} else {\r
- input_type = InputType.TYPE_CLASS_TEXT\r
- | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;\r
+ showPassword();\r
}\r
- mPasswordInput.setInputType(input_type);\r
mPasswordInput.setSelection(selectionStart, selectionEnd);\r
} \r
- \r
- \r
+ \r
+ \r
/**\r
* Called when the checkbox for OAuth authorization is clicked.\r
* \r
return false; // always return false to grant that the software keyboard is hidden anyway\r
}\r
\r
- \r
+ \r
private abstract static class RightDrawableOnTouchListener implements OnTouchListener {\r
\r
- private int fuzz = 10;\r
-\r
+ private int fuzz = 75;\r
+ \r
/**\r
* {@inheritDoc}\r
*/\r