import android.os.Handler;\r
import android.preference.PreferenceManager;\r
import android.text.InputType;\r
+import android.view.KeyEvent;\r
import android.view.View;\r
import android.view.View.OnFocusChangeListener;\r
import android.view.Window;\r
+import android.view.inputmethod.EditorInfo;\r
import android.widget.CheckBox;\r
import android.widget.EditText;\r
import android.widget.Button;\r
import android.widget.ImageView;\r
import android.widget.TextView;\r
import android.widget.Toast;\r
+import android.widget.TextView.OnEditorActionListener;\r
\r
import com.owncloud.android.R;\r
\r
* @author David A. Velasco\r
*/\r
public class AuthenticatorActivity extends AccountAuthenticatorActivity\r
- implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeListener {\r
+ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeListener, OnEditorActionListener {\r
\r
private static final String TAG = AuthenticatorActivity.class.getSimpleName();\r
\r
/// bind view elements to listeners\r
mHostUrlInput.setOnFocusChangeListener(this);\r
mPasswordInput.setOnFocusChangeListener(this);\r
+ mPasswordInput.setImeOptions(EditorInfo.IME_ACTION_DONE);\r
+ mPasswordInput.setOnEditorActionListener(this);\r
\r
/// initialization\r
mAccountMgr = AccountManager.get(this);\r
showDialog(DIALOG_CERT_NOT_SAVED);\r
}\r
\r
+\r
+ /**\r
+ * Called when the 'action' button in an IME is pressed ('enter' in software keyboard).\r
+ * \r
+ * Used to trigger the authorization check when the user presses 'enter' after writing the password.\r
+ */\r
+ @Override\r
+ public boolean onEditorAction(TextView inputField, int actionId, KeyEvent event) {\r
+ if (inputField != null && inputField.equals(mPasswordInput) && \r
+ actionId == EditorInfo.IME_ACTION_DONE) {\r
+ if (mOkButton.isEnabled()) {\r
+ mOkButton.performClick();\r
+ }\r
+ }\r
+ return false; // always return false to grant that the software keyboard is hidden anyway\r
+ }\r
+\r
}\r